Author: jmcd
Date: 2004-11-15 17:20:58 +0000 (Mon, 15 Nov 2004)
New Revision: 3761

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3761

Log:
Fix bug #1932: crash when non-root invokes net getlocalsid

First check to see if we can open secrets.tdb.

Modified:
   branches/SAMBA_3_0/source/utils/net.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net.c       2004-11-15 14:16:10 UTC (rev 
3760)
+++ branches/SAMBA_3_0/source/utils/net.c       2004-11-15 17:20:58 UTC (rev 
3761)
@@ -479,11 +479,19 @@
                          "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);

Reply via email to