Author: metze
Date: 2004-08-17 12:05:29 +0000 (Tue, 17 Aug 2004)
New Revision: 1859

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/&rev=1859&nolog=1

Log:
- fix segfault (pass or dereferenz a uninitialized pointer!

- fix declaration after statement

metze

Modified:
   trunk/source/passdb/pdb_tdb.c


Changeset:
Modified: trunk/source/passdb/pdb_tdb.c
===================================================================
--- trunk/source/passdb/pdb_tdb.c       2004-08-17 11:57:31 UTC (rev 1858)
+++ trunk/source/passdb/pdb_tdb.c       2004-08-17 12:05:29 UTC (rev 1859)
@@ -916,7 +916,7 @@
        TDB_DATA key, data;
        
        char* domain = NULL, *tp_key = NULL;
-       char** buffer;
+       char* buffer;
        size_t buffer_len;
 
        secrets_tdb = secrets_open();
@@ -947,11 +947,11 @@
        }
 
        /* prepare storage record */
-       buffer_len = pdb_init_buffer_from_trustpw(mem_ctx, buffer, pass);
+       buffer_len = pdb_init_buffer_from_trustpw(mem_ctx, &buffer, pass);
 
        key.dptr   = tp_key;
        key.dsize  = strlen(tp_key);
-       data.dptr  = *buffer;
+       data.dptr  = buffer;
        data.dsize = buffer_len;
 
        /* write the packed structure in secrets.tdb */
@@ -1491,6 +1491,8 @@
 
        /* check we have a PRIV_+SID entry */
        if (strncmp(key.dptr, PRIVPREFIX, prefixlen) == 0) {
+               /* add the discovered sid */
+               DOM_SID tmpsid;
 
                fstring sid_str;
                /* add to privilege_set if any of the sid in the token
@@ -1498,9 +1500,6 @@
 
                fstrcpy(sid_str, &key.dptr[strlen(PRIVPREFIX)]);
 
-               /* add the discovered sid */
-               DOM_SID tmpsid;
-
                if (!string_to_sid(&tmpsid, sid_str)) {
                        DEBUG(3, ("Could not convert SID\n"));
                        return 0;

Reply via email to