summaryrefslogtreecommitdiff
path: root/source3/utils/pdbedit.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2002-03-18 23:57:14 +0000
committerSimo Sorce <idra@samba.org>2002-03-18 23:57:14 +0000
commit32334bc6553c25b706e60a321f9c16f8931f94c1 (patch)
tree4b4a57dc2ccdf262c6a9e463d15c07e7ad9fa08c /source3/utils/pdbedit.c
parent9fffb0859d07a885278c395a366656f05731235c (diff)
downloadsamba-32334bc6553c25b706e60a321f9c16f8931f94c1.tar.gz
samba-32334bc6553c25b706e60a321f9c16f8931f94c1.tar.bz2
samba-32334bc6553c25b706e60a321f9c16f8931f94c1.zip
more verbose checking in talloc and util_pw
fixed tdbsam memory corruption (and segfault) reducing calls to pdb_uid_to_user_rid and countrary to 0 to move to a non alghoritmic rid allocation with some passdb modules. (This used to be commit 9836af7cd623357feaec07bc49cfb78f0aa01fc3)
Diffstat (limited to 'source3/utils/pdbedit.c')
-rw-r--r--source3/utils/pdbedit.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 2ba6de55df..71abcc74ee 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -155,27 +155,28 @@ static int print_user_info (char *username, BOOL verbosity, BOOL smbpwdstyle)
static int print_users_list (BOOL verbosity, BOOL smbpwdstyle)
{
SAM_ACCOUNT *sam_pwent=NULL;
- BOOL ret;
+ BOOL check, ret;
- pdb_init_sam(&sam_pwent);
errno = 0; /* testing --simo */
- ret = pdb_setsampwent(False);
- if (ret && errno == ENOENT) {
+ check = pdb_setsampwent(False);
+ if (check && errno == ENOENT) {
fprintf (stderr,"Password database not found!\n");
exit(1);
}
- pdb_free_sam(&sam_pwent);
- while ((NT_STATUS_IS_OK(pdb_init_sam(&sam_pwent))
- && (ret = pdb_getsampwent (sam_pwent)))) {
+ check = True;
+ if (!(NT_STATUS_IS_OK(pdb_init_sam(&sam_pwent)))) return 1;
+
+ while (check && (ret = pdb_getsampwent (sam_pwent))) {
if (verbosity)
printf ("---------------\n");
print_sam_info (sam_pwent, verbosity, smbpwdstyle);
pdb_free_sam(&sam_pwent);
+ check = NT_STATUS_IS_OK(pdb_init_sam(&sam_pwent));
}
- pdb_free_sam(&sam_pwent);
+ if (check) pdb_free_sam(&sam_pwent);
- pdb_endsampwent ();
+ pdb_endsampwent();
return 0;
}