made pdb_getsampwuid() into a simple wrapper for pdb_getsampwnam().
[Samba.git] / source / utils / pdbedit.c
blobde3fe0fbecacca2993d56720bf519efb201ad19f
1 /*
2 Unix SMB/Netbios implementation.
3 passdb editing frontend
4 Version 3.0
6 Copyright (C) Simo Sorce 2000
7 Copyright (C) Andrew Bartlett 2001
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /* base uid for trust accounts is set to 60000 !
25 * May be we should add the defines in smb.h to make it possible having
26 * different values on different platforms?
29 #define BASE_MACHINE_UID 60000
30 #define MAX_MACHINE_UID 65500 /* 5500 trust accounts aren't enough? */
32 #include "includes.h"
34 extern pstring global_myname;
37 * Next two lines needed for SunOS and don't
38 * hurt anything else...
40 extern char *optarg;
41 extern int optind;
43 /*********************************************************
44 Print command usage on stderr and die.
45 **********************************************************/
46 static void usage(void)
48 if (getuid() == 0) {
49 printf("pdbedit options\n");
50 } else {
51 printf("You need to be root to use this tool!\n");
53 printf("(actually to add a user you need to use smbpasswd)\n");
54 printf("options:\n");
55 printf(" -l list usernames\n");
56 printf(" -v verbose output\n");
57 printf(" -w smbpasswd file style\n");
58 printf(" -u username print user's info\n");
59 printf(" -f fullname set Full Name\n");
60 printf(" -h homedir set home directory\n");
61 printf(" -d drive set home dir drive\n");
62 printf(" -s script set logon script\n");
63 printf(" -p profile set profile path\n");
64 printf(" -a create new account\n");
65 printf(" -m it is a machine trust\n");
66 printf(" -x delete this user\n");
67 printf(" -i file import account from file (smbpasswd style)\n");
68 exit(1);
71 /*********************************************************
72 Print info from sam structure
73 **********************************************************/
75 static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdstyle)
77 /* TODO: chaeck if entry is a user or a workstation */
78 if (!sam_pwent) return -1;
80 if (verbosity) {
81 printf ("username: %s\n", sam_pwent->username);
82 printf ("user ID/Group: %d/%d\n", sam_pwent->uid,
83 sam_pwent->gid);
84 printf ("user RID/GRID: %d/%d\n", sam_pwent->user_rid,
85 sam_pwent->group_rid);
86 printf ("Full Name: %s\n", sam_pwent->full_name);
87 printf ("Home Directory: %s\n", sam_pwent->home_dir);
88 printf ("HomeDir Drive: %s\n", sam_pwent->dir_drive);
89 printf ("Logon Script: %s\n", sam_pwent->logon_script);
90 printf ("Profile Path: %s\n", sam_pwent->profile_path);
91 } else if (smbpwdstyle) {
92 char lm_passwd[33];
93 char nt_passwd[33];
94 pdb_sethexpwd(lm_passwd,
95 pdb_get_lanman_passwd(sam_pwent),
96 pdb_get_acct_ctrl(sam_pwent));
97 pdb_sethexpwd(nt_passwd,
98 pdb_get_nt_passwd(sam_pwent),
99 pdb_get_acct_ctrl(sam_pwent));
101 printf("%s:%d:%s:%s:%s:LCT-%08X:\n",
102 pdb_get_username(sam_pwent),
103 pdb_get_uid(sam_pwent),
104 lm_passwd,
105 nt_passwd,
106 pdb_encode_acct_ctrl(pdb_get_acct_ctrl(sam_pwent),NEW_PW_FORMAT_SPACE_PADDED_LEN),
107 (uint32)pdb_get_pass_last_set_time(sam_pwent));
108 } else {
109 printf ("%s:%d:%s\n", sam_pwent->username, sam_pwent->uid, sam_pwent->full_name);
112 return 0;
115 /*********************************************************
116 Get an Print User Info
117 **********************************************************/
119 static int print_user_info (char *username, BOOL verbosity, BOOL smbpwdstyle)
121 SAM_ACCOUNT *sam_pwent=NULL;
122 BOOL ret;
124 pdb_init_sam(&sam_pwent);
126 ret = pdb_getsampwnam (sam_pwent, username);
128 if (ret==False) {
129 fprintf (stderr, "Username not found!\n");
130 pdb_free_sam(sam_pwent);
131 return -1;
134 ret=print_sam_info (sam_pwent, verbosity, smbpwdstyle);
135 pdb_free_sam(sam_pwent);
137 return ret;
140 /*********************************************************
141 List Users
142 **********************************************************/
143 static int print_users_list (BOOL verbosity, BOOL smbpwdstyle)
145 SAM_ACCOUNT *sam_pwent=NULL;
146 BOOL ret;
148 pdb_init_sam(&sam_pwent);
150 ret = pdb_setsampwent(False);
151 if (ret && errno == ENOENT) {
152 fprintf (stderr,"Password database not found!\n");
153 pdb_free_sam(sam_pwent);
154 exit(1);
157 while ((ret = pdb_getsampwent (sam_pwent))) {
158 if (verbosity)
159 printf ("---------------\n");
160 print_sam_info (sam_pwent, verbosity, smbpwdstyle);
161 pdb_reset_sam(sam_pwent);
164 pdb_endsampwent ();
165 pdb_free_sam(sam_pwent);
166 return 0;
169 /*********************************************************
170 Set User Info
171 **********************************************************/
173 static int set_user_info (char *username, char *fullname, char *homedir, char *drive, char *script, char *profile)
175 SAM_ACCOUNT *sam_pwent=NULL;
176 BOOL ret;
178 pdb_init_sam(&sam_pwent);
180 ret = pdb_getsampwnam (sam_pwent, username);
181 if (ret==False) {
182 fprintf (stderr, "Username not found!\n");
183 pdb_free_sam(sam_pwent);
184 return -1;
187 if (fullname)
188 pdb_set_fullname(sam_pwent, fullname);
189 if (homedir)
190 pdb_set_homedir(sam_pwent, homedir, True);
191 if (drive)
192 pdb_set_dir_drive(sam_pwent, drive, True);
193 if (script)
194 pdb_set_logon_script(sam_pwent, script, True);
195 if (profile)
196 pdb_set_profile_path (sam_pwent, profile, True);
198 if (pdb_update_sam_account (sam_pwent, True))
199 print_user_info (username, True, False);
200 else {
201 fprintf (stderr, "Unable to modify entry!\n");
202 pdb_free_sam(sam_pwent);
203 return -1;
205 pdb_free_sam(sam_pwent);
206 return 0;
209 /*********************************************************
210 A strdup with exit
211 **********************************************************/
213 static char *strdup_x(const char *s)
215 char *new_s = strdup(s);
216 if (!new_s) {
217 fprintf(stderr,"out of memory\n");
218 exit(1);
220 return new_s;
223 /*************************************************************
224 Utility function to prompt for passwords from stdin. Each
225 password entered must end with a newline.
226 *************************************************************/
227 static char *stdin_new_passwd(void)
229 static fstring new_passwd;
230 size_t len;
232 ZERO_ARRAY(new_passwd);
235 * if no error is reported from fgets() and string at least contains
236 * the newline that ends the password, then replace the newline with
237 * a null terminator.
239 if ( fgets(new_passwd, sizeof(new_passwd), stdin) != NULL) {
240 if ((len = strlen(new_passwd)) > 0) {
241 if(new_passwd[len-1] == '\n')
242 new_passwd[len - 1] = 0;
245 return(new_passwd);
248 /*************************************************************
249 Utility function to get passwords via tty or stdin
250 Used if the '-s' option is set to silently get passwords
251 to enable scripting.
252 _copied_ from smbpasswd
253 *************************************************************/
254 static char *get_pass( char *prompt, BOOL stdin_get)
256 char *p;
257 if (stdin_get) {
258 p = stdin_new_passwd();
259 } else {
260 p = getpass(prompt);
262 return strdup_x(p);
265 /*************************************************************
266 Utility function to prompt for new password.
267 _copied_ from smbpasswd
268 *************************************************************/
269 static char *prompt_for_new_password(BOOL stdin_get)
271 char *p;
272 fstring new_passwd;
274 ZERO_ARRAY(new_passwd);
276 p = get_pass("New SMB password:", stdin_get);
278 fstrcpy(new_passwd, p);
279 safe_free(p);
281 p = get_pass("Retype new SMB password:", stdin_get);
283 if (strcmp(p, new_passwd)) {
284 fprintf(stderr, "Mismatch - password unchanged.\n");
285 ZERO_ARRAY(new_passwd);
286 safe_free(p);
287 return NULL;
290 return p;
294 /*********************************************************
295 Add New User
296 **********************************************************/
297 static int new_user (char *username, char *fullname, char *homedir, char *drive, char *script, char *profile)
299 SAM_ACCOUNT *sam_pwent=NULL;
300 struct passwd *pwd = NULL;
301 char *password;
303 ZERO_STRUCT(sam_pwent);
305 pdb_init_sam (&sam_pwent);
307 if (!(pwd = sys_getpwnam(username))) {
308 fprintf (stderr, "User %s does not exist in system passwd!\n", username);
309 pdb_free_sam (sam_pwent);
310 return -1;
313 password = prompt_for_new_password(0);
314 if (!password) {
315 fprintf (stderr, "Passwords do not match!\n");
316 pdb_free_sam (sam_pwent);
317 return -1;
320 pdb_set_plaintext_passwd(sam_pwent, password);
322 pdb_set_username(sam_pwent, username);
323 if (fullname)
324 pdb_set_fullname(sam_pwent, fullname);
325 if (homedir)
326 pdb_set_homedir (sam_pwent, homedir, True);
327 if (drive)
328 pdb_set_dir_drive (sam_pwent, drive, True);
329 if (script)
330 pdb_set_logon_script(sam_pwent, script, True);
331 if (profile)
332 pdb_set_profile_path (sam_pwent, profile, True);
334 /* TODO: Check uid not being in MACHINE UID range!! */
335 pdb_set_uid (sam_pwent, pwd->pw_uid);
336 pdb_set_gid (sam_pwent, pwd->pw_gid);
337 pdb_set_user_rid (sam_pwent, pdb_uid_to_user_rid (pwd->pw_uid));
338 pdb_set_group_rid (sam_pwent, pdb_gid_to_group_rid (pwd->pw_gid));
340 pdb_set_acct_ctrl (sam_pwent, ACB_NORMAL);
342 if (pdb_add_sam_account (sam_pwent)) {
343 print_user_info (username, True, False);
344 } else {
345 fprintf (stderr, "Unable to add user! (does it alredy exist?)\n");
346 pdb_free_sam (sam_pwent);
347 return -1;
349 pdb_free_sam (sam_pwent);
350 return 0;
353 /*********************************************************
354 Add New Machine
355 **********************************************************/
357 static int new_machine (char *machinename)
359 SAM_ACCOUNT *sam_pwent=NULL;
360 SAM_ACCOUNT *sam_trust=NULL;
361 char name[16];
362 char *password = NULL;
363 uid_t uid;
365 pdb_init_sam (&sam_pwent);
367 if (machinename[strlen (machinename) -1] == '$')
368 machinename[strlen (machinename) -1] = '\0';
370 safe_strcpy (name, machinename, 16);
371 safe_strcat (name, "$", 16);
373 string_set (&password, machinename);
374 strlower(password);
376 pdb_set_plaintext_passwd (sam_pwent, password);
378 pdb_set_username (sam_pwent, name);
380 for (uid=BASE_MACHINE_UID; uid<=MAX_MACHINE_UID; uid++) {
381 pdb_init_sam (&sam_trust);
382 if (pdb_getsampwuid (sam_trust, uid)) {
383 pdb_free_sam (sam_trust);
384 } else {
385 break;
389 if (uid>MAX_MACHINE_UID) {
390 fprintf (stderr, "No more free UIDs available to Machine accounts!\n");
391 pdb_free_sam(sam_pwent);
392 return -1;
395 pdb_set_uid (sam_pwent, uid);
396 pdb_set_gid (sam_pwent, BASE_MACHINE_UID); /* TODO: set there more appropriate value!! */
397 pdb_set_user_rid (sam_pwent,pdb_uid_to_user_rid (uid));
398 pdb_set_group_rid (sam_pwent, pdb_gid_to_group_rid (BASE_MACHINE_UID));
399 pdb_set_acct_ctrl (sam_pwent, ACB_WSTRUST);
401 if (pdb_add_sam_account (sam_pwent)) {
402 print_user_info (name, True, False);
403 } else {
404 fprintf (stderr, "Unable to add machine! (does it already exist?)\n");
405 pdb_free_sam (sam_pwent);
406 return -1;
408 pdb_free_sam (sam_pwent);
409 return 0;
412 /*********************************************************
413 Delete user entry
414 **********************************************************/
416 static int delete_user_entry (char *username)
418 return pdb_delete_sam_account (username);
421 /*********************************************************
422 Delete machine entry
423 **********************************************************/
425 static int delete_machine_entry (char *machinename)
427 char name[16];
429 safe_strcpy (name, machinename, 16);
430 if (name[strlen(name)] != '$')
431 safe_strcat (name, "$", 16);
432 return pdb_delete_sam_account (name);
435 /*********************************************************
436 Import smbpasswd style file
437 **********************************************************/
439 static int import_users (char *filename)
441 FILE *fp = NULL;
442 SAM_ACCOUNT *sam_pwent = NULL;
443 static pstring user_name;
444 static unsigned char smbpwd[16];
445 static unsigned char smbntpwd[16];
446 char linebuf[256];
447 size_t linebuf_len;
448 unsigned char c;
449 unsigned char *p;
450 long uidval;
451 int line = 0;
452 int good = 0;
454 if (!pdb_init_sam (&sam_pwent)) {
455 fprintf (stderr, "pdb_init_sam FAILED!\n");
458 if((fp = sys_fopen(filename, "rb")) == NULL) {
459 fprintf (stderr, "%s\n", strerror (ferror (fp)));
460 return -1;
463 while (!feof(fp)) {
464 /*Get a new line*/
465 linebuf[0] = '\0';
466 fgets(linebuf, 256, fp);
467 if (ferror(fp)) {
468 fprintf (stderr, "%s\n", strerror (ferror (fp)));
469 pdb_free_sam(sam_pwent);
470 return -1;
472 if ((linebuf_len = strlen(linebuf)) == 0) {
473 line++;
474 continue;
476 if (linebuf[linebuf_len - 1] != '\n') {
477 c = '\0';
478 while (!ferror(fp) && !feof(fp)) {
479 c = fgetc(fp);
480 if (c == '\n') break;
482 } else
483 linebuf[linebuf_len - 1] = '\0';
484 linebuf[linebuf_len] = '\0';
485 if ((linebuf[0] == 0) && feof(fp)) {
486 /*end of file!!*/
487 pdb_free_sam(sam_pwent);
488 return 0;
490 line++;
491 if (linebuf[0] == '#' || linebuf[0] == '\0')
492 continue;
494 pdb_set_acct_ctrl (sam_pwent,ACB_NORMAL);
496 /* Get user name */
497 p = (unsigned char *) strchr(linebuf, ':');
498 if (p == NULL) {
499 fprintf (stderr, "Error: malformed password entry at line %d !!\n", line);
500 pdb_reset_sam (sam_pwent);
501 continue;
503 strncpy(user_name, linebuf, PTR_DIFF(p, linebuf));
504 user_name[PTR_DIFF(p, linebuf)] = '\0';
506 /* Get smb uid. */
507 p++;
508 if(*p == '-') {
509 fprintf (stderr, "Error: negative uid at line %d\n", line);
510 pdb_reset_sam (sam_pwent);
511 continue;
513 if (!isdigit(*p)) {
514 fprintf (stderr, "Error: malformed password entry at line %d (uid not number)\n", line);
515 pdb_reset_sam (sam_pwent);
516 continue;
518 uidval = atoi((char *) p);
519 while (*p && isdigit(*p)) p++;
520 if (*p != ':') {
521 fprintf (stderr, "Error: malformed password entry at line %d (no : after uid)\n", line);
522 pdb_reset_sam (sam_pwent);
523 continue;
526 pdb_set_username(sam_pwent, user_name);
527 pdb_set_uid (sam_pwent, uidval);
529 /* Get passwords */
530 p++;
531 if (*p == '*' || *p == 'X') {
532 /* Password deliberately invalid */
533 fprintf (stderr, "Warning: entry invalidated for user %s\n", user_name);
534 pdb_set_lanman_passwd(sam_pwent, NULL);
535 pdb_set_nt_passwd(sam_pwent,NULL);
536 pdb_set_acct_ctrl(sam_pwent, pdb_get_acct_ctrl(sam_pwent) | ACB_DISABLED);
537 } else {
538 if (linebuf_len < (PTR_DIFF(p, linebuf) + 33)) {
539 fprintf (stderr, "Error: malformed password entry at line %d (password too short)\n",line);
540 pdb_reset_sam (sam_pwent);
541 continue;
543 if (p[32] != ':') {
544 fprintf (stderr, "Error: malformed password entry at line %d (no terminating :)\n",line);
545 pdb_reset_sam (sam_pwent);
546 continue;
548 if (!strncasecmp((char *) p, "NO PASSWORD", 11)) {
549 pdb_set_lanman_passwd(sam_pwent, NULL);
550 pdb_set_acct_ctrl(sam_pwent, pdb_get_acct_ctrl(sam_pwent) | ACB_PWNOTREQ);
551 } else {
552 if (!pdb_gethexpwd((char *)p, smbpwd)) {
553 fprintf (stderr, "Error: malformed Lanman password entry at line %d (non hex chars)\n", line);
554 pdb_reset_sam (sam_pwent);
555 continue;
557 pdb_set_lanman_passwd(sam_pwent, smbpwd);
559 /* NT password */
560 pdb_set_nt_passwd(sam_pwent, smbpwd);
561 p += 33;
562 if ((linebuf_len >= (PTR_DIFF(p, linebuf) + 33)) && (p[32] == ':')) {
563 if (*p != '*' && *p != 'X') {
564 if (pdb_gethexpwd((char *)p,smbntpwd)) {
565 pdb_set_nt_passwd(sam_pwent, smbntpwd);
568 p += 33;
572 /* Get ACCT_CTRL field if any */
573 if (*p == '[') {
574 uint16 acct_ctrl;
575 unsigned char *end_p = (unsigned char *)strchr((char *)p, ']');
577 acct_ctrl = pdb_decode_acct_ctrl((char*)p);
578 if (acct_ctrl)
579 acct_ctrl = ACB_NORMAL;
581 pdb_set_acct_ctrl(sam_pwent, acct_ctrl);
583 /* Get last change time */
584 if(end_p)
585 p = end_p + 1;
586 if(*p == ':') {
587 p++;
588 if(*p && (StrnCaseCmp((char *)p, "LCT-", 4)==0)) {
589 int i;
591 p += 4;
592 for(i = 0; i < 8; i++) {
593 if(p[i] == '\0' || !isxdigit(p[i])) break;
595 if(i == 8) {
596 pdb_set_pass_last_set_time (sam_pwent, (time_t)strtol((char *)p, NULL, 16));
602 /* Old-style workstation account code droped. */
604 if (pdb_get_acct_ctrl(sam_pwent) & ACB_WSTRUST) {
605 if ((uidval < BASE_MACHINE_UID) || (uidval > MAX_MACHINE_UID)) {
606 fprintf (stderr, "Warning: Machine UID out of normal range %d-%d\n",
607 BASE_MACHINE_UID,
608 MAX_MACHINE_UID);
610 pdb_set_uid(sam_pwent, BASE_MACHINE_UID);
613 /* Test if user is valid */
614 if (pdb_get_acct_ctrl(sam_pwent) & ACB_NORMAL) {
615 struct passwd *pwd = NULL;
617 if (!(pwd = sys_getpwnam(user_name))) {
618 fprintf (stderr, "Error: User %s does not exist in system passwd!\n", user_name);
619 continue;
621 pdb_set_gid(sam_pwent, pwd->pw_gid);
624 /* Fill in sam_pwent structure */
625 pdb_set_user_rid(sam_pwent, pdb_uid_to_user_rid (pdb_get_uid(sam_pwent)));
626 pdb_set_group_rid(sam_pwent, pdb_gid_to_group_rid (pdb_get_gid(sam_pwent)));
628 /* TODO: set also full_name, home_dir, dir_drive, logon_script, profile_path, ecc...
629 * when defaults will be available (after passdb redesign)
630 * let them blank just now they are not used anyway
633 /* Now ADD the entry */
634 if (!(pdb_add_sam_account (sam_pwent))) {
635 fprintf (stderr, "Unable to add user entry!\n");
636 pdb_reset_sam (sam_pwent);
637 continue;
639 printf ("%s imported!\n", user_name);
640 good++;
641 pdb_reset_sam (sam_pwent);
643 printf ("%d lines read.\n%d entries imported\n", line, good);
644 pdb_free_sam(sam_pwent);
645 return 0;
648 /*********************************************************
649 Start here.
650 **********************************************************/
652 int main (int argc, char **argv)
654 int ch;
655 static pstring servicesf = CONFIGFILE;
656 BOOL list_users = False;
657 BOOL verbose = False;
658 BOOL spstyle = False;
659 BOOL setparms = False;
660 BOOL machine = False;
661 BOOL add_user = False;
662 BOOL delete_user = False;
663 BOOL import = False;
664 char *user_name = NULL;
665 char *full_name = NULL;
666 char *home_dir = NULL;
667 char *home_drive = NULL;
668 char *logon_script = NULL;
669 char *profile_path = NULL;
670 char *smbpasswd = NULL;
672 TimeInit();
674 setup_logging("pdbedit", True);
676 charset_initialise();
678 if (argc < 2) {
679 usage();
680 return 0;
683 if (!lp_load(servicesf,True,False,False)) {
684 fprintf(stderr, "Can't load %s - run testparm to debug it\n",
685 servicesf);
686 exit(1);
689 secrets_init();
691 if(!initialize_password_db(True)) {
692 fprintf(stderr, "Can't setup password database vectors.\n");
693 exit(1);
697 codepage_initialise(lp_client_code_page());
699 while ((ch = getopt(argc, argv, "ad:f:h:i:lmp:s:u:vwxD:")) != EOF) {
700 switch(ch) {
701 case 'a':
702 add_user = True;
703 break;
704 case 'm':
705 machine = True;
706 break;
707 case 'l':
708 list_users = True;
709 break;
710 case 'v':
711 verbose = True;
712 break;
713 case 'w':
714 spstyle = True;
715 break;
716 case 'u':
717 user_name = optarg;
718 break;
719 case 'f':
720 setparms = True;
721 full_name = optarg;
722 break;
723 case 'h':
724 setparms = True;
725 home_dir = optarg;
726 break;
727 case 'd':
728 setparms = True;
729 home_drive = optarg;
730 break;
731 case 's':
732 setparms = True;
733 logon_script = optarg;
734 break;
735 case 'p':
736 setparms = True;
737 profile_path = optarg;
738 break;
739 case 'x':
740 delete_user = True;
741 break;
742 case 'i':
743 import = True;
744 smbpasswd = optarg;
745 break;
746 case 'D':
747 DEBUGLEVEL = atoi(optarg);
748 break;
749 default:
750 usage();
753 if (((add_user?1:0) + (delete_user?1:0) + (list_users?1:0) + (import?1:0) + (setparms?1:0)) > 1) {
754 fprintf (stderr, "Incompatible options on command line!\n");
755 usage();
756 exit(1);
759 if (add_user) {
760 if (!user_name) {
761 fprintf (stderr, "Username not specified! (use -u option)\n");
762 return -1;
764 if (machine)
765 return new_machine (user_name);
766 else
767 return new_user (user_name, full_name, home_dir, home_drive, logon_script, profile_path);
770 if (delete_user) {
771 if (!user_name) {
772 fprintf (stderr, "Username not specified! (use -u option)\n");
773 return -1;
775 if (machine)
776 return delete_machine_entry (user_name);
777 else
778 return delete_user_entry (user_name);
781 if (user_name) {
782 if (setparms)
783 set_user_info ( user_name, full_name,
784 home_dir,
785 home_drive,
786 logon_script,
787 profile_path);
788 else
789 return print_user_info (user_name, verbose, spstyle);
791 return 0;
795 if (list_users)
796 return print_users_list (verbose, spstyle);
798 if (import)
799 return import_users (smbpasswd);
801 usage();
803 return 0;