svn commit: samba r16846 - in branches/SAMBA_4_0/source/passdb: .
abartlet at samba.org
abartlet at samba.org
Fri Jul 7 01:59:45 GMT 2006
Author: abartlet
Date: 2006-07-07 01:59:43 +0000 (Fri, 07 Jul 2006)
New Revision: 16846
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16846
Log:
Try not to segfault if the domain SID isn't there, or the search
failed.
Andrew Bartlett
Modified:
branches/SAMBA_4_0/source/passdb/secrets.c
Changeset:
Modified: branches/SAMBA_4_0/source/passdb/secrets.c
===================================================================
--- branches/SAMBA_4_0/source/passdb/secrets.c 2006-07-07 00:20:55 UTC (rev 16845)
+++ branches/SAMBA_4_0/source/passdb/secrets.c 2006-07-07 01:59:43 UTC (rev 16846)
@@ -136,7 +136,7 @@
ldb = secrets_db_connect(mem_ctx);
if (ldb == NULL) {
DEBUG(5, ("secrets_db_connect failed\n"));
- goto done;
+ return NULL;
}
ldb_ret = gendb_search(ldb, ldb,
@@ -144,25 +144,33 @@
&msgs, attrs,
SECRETS_PRIMARY_DOMAIN_FILTER, domain);
+ if (ldb_ret == -1) {
+ DEBUG(5, ("Error searching for domain SID for %s: %s",
+ domain, ldb_errstring(ldb)));
+ talloc_free(ldb);
+ return NULL;
+ }
+
if (ldb_ret == 0) {
DEBUG(5, ("Did not find domain record for %s\n", domain));
- goto done;
+ talloc_free(ldb);
+ return NULL;
}
if (ldb_ret > 1) {
DEBUG(5, ("Found more than one (%d) domain records for %s\n",
ldb_ret, domain));
- goto done;
+ talloc_free(ldb);
+ return NULL;
}
result = samdb_result_dom_sid(mem_ctx, msgs[0], "objectSid");
if (result == NULL) {
DEBUG(0, ("Domain object for %s does not contain a SID!\n",
domain));
- goto done;
+ talloc_free(ldb);
+ return NULL;
}
- done:
- talloc_free(ldb);
return result;
}
More information about the samba-cvs
mailing list