summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-01-27 03:00:56 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-01-27 03:00:56 +0000
commit26073c4aec4a45ae58855dd6eecc20cc376c7e8c (patch)
tree9cd656182636ce444a390f851dae790b02735928 /source3
parent485b4ff5ecf40620a0a6fedc0929dacdb28876a2 (diff)
downloadsamba-26073c4aec4a45ae58855dd6eecc20cc376c7e8c.tar.gz
samba-26073c4aec4a45ae58855dd6eecc20cc376c7e8c.tar.bz2
samba-26073c4aec4a45ae58855dd6eecc20cc376c7e8c.zip
Give pdbedit a -D paramater for setting the DEBUGLEVEL (makes debugging passdb
much saner :-). Change to pdb_init_sam()/pdb_free_sam() loop rather than reset based due to the talloc basis. Andrew Bartlett (This used to be commit e40a0a7f27950bd0484fe7d6b67dce45cd75d25c)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/pdbedit.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 5202d8d3fe..4f3ceaf18f 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -58,6 +58,7 @@ static void usage(void)
printf(" -m it is a machine trust\n");
printf(" -x delete this user\n");
printf(" -i file import account from file (smbpasswd style)\n");
+ printf(" -D debuglevel set DEBUGELEVEL (default = 1)\n");
exit(1);
}
@@ -160,19 +161,20 @@ static int print_users_list (BOOL verbosity, BOOL smbpwdstyle)
ret = pdb_setsampwent(False);
if (ret && errno == ENOENT) {
fprintf (stderr,"Password database not found!\n");
- pdb_free_sam(&sam_pwent);
exit(1);
}
+ pdb_free_sam(&sam_pwent);
- while ((ret = pdb_getsampwent (sam_pwent))) {
+ while ((NT_STATUS_IS_OK(pdb_init_sam(&sam_pwent))
+ && (ret = pdb_getsampwent (sam_pwent)))) {
if (verbosity)
printf ("---------------\n");
print_sam_info (sam_pwent, verbosity, smbpwdstyle);
- pdb_reset_sam(sam_pwent);
+ pdb_free_sam(&sam_pwent);
}
+ pdb_free_sam(&sam_pwent);
pdb_endsampwent ();
- pdb_free_sam(&sam_pwent);
return 0;
}
@@ -572,7 +574,7 @@ int main (int argc, char **argv)
exit(1);
}
- while ((ch = getopt(argc, argv, "ad:f:h:i:lmp:s:u:vwx")) != EOF) {
+ while ((ch = getopt(argc, argv, "ad:f:h:i:lmp:s:u:vwxD:")) != EOF) {
switch(ch) {
case 'a':
add_user = True;
@@ -619,6 +621,9 @@ int main (int argc, char **argv)
import = True;
smbpasswd = optarg;
break;
+ case 'D':
+ DEBUGLEVEL = atoi(optarg);
+ break;
default:
usage();
}