summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2004-11-15 17:20:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:16 -0500
commitb87a0af812442385111bfca2055a65fc12027e58 (patch)
tree29311076fb6738cdb214293393b8f2c124195337 /source3
parentfc7302b09e9a62c3758f9239c6040ce60eb15bdb (diff)
downloadsamba-b87a0af812442385111bfca2055a65fc12027e58.tar.gz
samba-b87a0af812442385111bfca2055a65fc12027e58.tar.bz2
samba-b87a0af812442385111bfca2055a65fc12027e58.zip
r3761: Fix bug #1932: crash when non-root invokes net getlocalsid
First check to see if we can open secrets.tdb. (This used to be commit 81e3c78d056c0a7499b8f27dcd37a13e725053ee)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 2fe15c2b8e..784612fc71 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -479,11 +479,19 @@ static int net_getlocalsid(int argc, const char **argv)
"backend knowlege (such as the sid stored in LDAP)\n"));
}
+ /* first check to see if we can even access secrets, so we don't
+ panic when we can't. */
+
+ if (!secrets_init()) {
+ d_printf("Unable to open secrets.tdb. Can't fetch domain SID for name: %s\n", name);
+ return 1;
+ }
+
/* Generate one, if it doesn't exist */
get_global_sam_sid();
if (!secrets_fetch_domain_sid(name, &sid)) {
- DEBUG(0, ("Can't fetch domain SID for name: %s\n", name));
+ DEBUG(0, ("Can't fetch domain SID for name: %s\n", name));
return 1;
}
sid_to_string(sid_str, &sid);