From: Jim McDonough Date: Mon, 15 Nov 2004 17:20:58 +0000 (+0000) Subject: r3761: Fix bug #1932: crash when non-root invokes net getlocalsid X-Git-Tag: samba-misc-tags/initial-v3-0-unstable~5594 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=81e3c78d056c0a7499b8f27dcd37a13e725053ee;p=thirdparty%2Fsamba.git r3761: Fix bug #1932: crash when non-root invokes net getlocalsid First check to see if we can open secrets.tdb. --- diff --git a/source/utils/net.c b/source/utils/net.c index 2fe15c2b8ef..784612fc71b 100644 --- a/source/utils/net.c +++ b/source/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);