Finish adding strings to all talloc_init() calls.
authorJeremy Allison <jra@samba.org>
Mon, 23 Dec 2002 23:53:56 +0000 (23:53 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 23 Dec 2002 23:53:56 +0000 (23:53 +0000)
Jeremy.
(This used to be commit 784d15761c3271bfd602866f8f9f880dac77671c)

14 files changed:
source3/auth/auth_winbind.c
source3/lib/talloc.c
source3/libsmb/netlogon_unigrp.c
source3/modules/mysql.c
source3/python/py_lsa.c
source3/python/py_samr.c
source3/python/py_smb.c
source3/python/py_spoolss_drivers.c
source3/python/py_spoolss_ports.c
source3/python/py_spoolss_printers.c
source3/rpcclient/samsync.c
source3/sam/gums_api.c
source3/torture/samtest.c
source3/utils/rpccheck.c

index c6a1727ebeaf90e69c4a4be6c9ac997d56053d5b..e45e2c879f3d86140b6e8f6831e2f29c78b4d68d 100644 (file)
@@ -127,9 +127,8 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
 /* module initialisation */
 NTSTATUS auth_init_winbind(struct auth_context *auth_context, const char *param, auth_methods **auth_method) 
 {
-       if (!make_auth_methods(auth_context, auth_method)) {
+       if (!make_auth_methods(auth_context, auth_method))
                return NT_STATUS_NO_MEMORY;
-       }
 
        (*auth_method)->name = "winbind";
        (*auth_method)->auth = check_winbind_security;
index f0c13753b51062fdb7a504bf270e665ffa02265b..b6c8b2efdf09a80fe9f53c696762382b54b1c33a 100644 (file)
@@ -136,7 +136,6 @@ static TALLOC_CTX *talloc_init_internal(void)
 
 /**
  * Create a new talloc context, with a name specifying its purpose.
- * Please call this in preference to talloc_init().
  **/
 
  TALLOC_CTX *talloc_init(char const *fmt, ...) 
index ea9e790b7da7ddd853521c1a93db15bd72425a81..fa2fe32f35f7691f05e53215ea615f1790f8c27b 100644 (file)
@@ -47,7 +47,7 @@ BOOL uni_group_cache_init(void)
        return (netlogon_unigrp_tdb != NULL);
 }
 
-void uni_group_cache_store_netlogon(TALLOC_CTX *mem_ctx, NET_USER_INFO_3 *user)
+BOOL  uni_group_cache_store_netlogon(TALLOC_CTX *mem_ctx, NET_USER_INFO_3 *user)
 {
        TDB_DATA key,data;
         fstring keystr;
@@ -55,7 +55,7 @@ void uni_group_cache_store_netlogon(TALLOC_CTX *mem_ctx, NET_USER_INFO_3 *user)
 
        if (!uni_group_cache_init()) {
                DEBUG(0,("uni_group_cache_store_netlogon: cannot open netlogon_unigrp.tdb for write!\n"));
-               return;
+               return False;
        }
 
        /* Prepare key as DOMAIN-SID/USER-RID string */
@@ -70,7 +70,7 @@ void uni_group_cache_store_netlogon(TALLOC_CTX *mem_ctx, NET_USER_INFO_3 *user)
        if(!data.dptr) {
                DEBUG(0,("uni_group_cache_store_netlogon: cannot allocate memory!\n"));
                talloc_destroy(mem_ctx);
-               return;
+               return False;
        }
        
        /* Store data in byteorder-independent format */
@@ -78,7 +78,9 @@ void uni_group_cache_store_netlogon(TALLOC_CTX *mem_ctx, NET_USER_INFO_3 *user)
        for(i=1; i<=user->num_groups2; i++) {
                SIVAL(&((uint32*)data.dptr)[i],0,user->gids[i-1].g_rid);
        }
-       tdb_store(netlogon_unigrp_tdb, key, data, TDB_REPLACE); 
+       if (tdb_store(netlogon_unigrp_tdb, key, data, TDB_REPLACE) == -1)
+               return False;
+       return True;
 }
 
 /*
@@ -149,10 +151,9 @@ uint32* uni_group_cache_fetch(DOM_SID *domain, uint32 user_rid,
 }
 
 /* Shutdown netlogon_unigrp database */
-void uni_group_cache_shutdown(void)
+BOOL uni_group_cache_shutdown(void)
 {
-       if(netlogon_unigrp_tdb) {
-               tdb_close(netlogon_unigrp_tdb);
-       }
+       if(netlogon_unigrp_tdb)
+               return (tdb_close(netlogon_unigrp_tdb) == 0);
+       return True;
 }
-
index 5516befc08c7aa522a6dd5cc0d7db9f82664db0a..1d5819295b034ce737b3d27a0a0fd8e59d9c5f2e 100644 (file)
@@ -676,7 +676,7 @@ static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods,
        /* I know this is somewhat overkill but only the talloc 
         * functions have asprint_append and the 'normal' asprintf 
         * is a GNU extension */
-       query.mem_ctx = talloc_init();
+       query.mem_ctx = talloc_init("mysqlsam_replace_sam_account");
        query.part2 = talloc_asprintf(query.mem_ctx, "%s", "");
        if (query.update) {
                query.part1 =
index d54a2289ef48a48d93e618e92e4ae144b6217234..31706af684064653cb8b0a2b07e5b6684b251bd7 100644 (file)
@@ -84,7 +84,7 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args,
                return NULL;
        }
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("lsa_open_policy"))) {
                PyErr_SetString(lsa_error, "unable to init talloc context\n");
                goto done;
        }
index 92a2eaf063735d3f546410fc2697d52e9c0a0d06..208274d9b5fb2b2132dfca08df710c60e211cb39 100644 (file)
@@ -73,7 +73,7 @@ static PyObject *samr_open_domain(PyObject *self, PyObject *args, PyObject *kw)
                return NULL;
        }
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("samr_open_domain"))) {
                PyErr_SetString(samr_error, "unable to init talloc context");
                return NULL;
        }
@@ -167,7 +167,7 @@ static PyObject *samr_enum_dom_groups(PyObject *self, PyObject *args,
                    args, kw, "", kwlist))
                return NULL;
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("samr_enum_dom_groups"))) {
                PyErr_SetString(samr_error, "unable to init talloc context");
                return NULL;
        }
@@ -399,7 +399,7 @@ static PyObject *samr_connect(PyObject *self, PyObject *args, PyObject *kw)
                return NULL;
        }
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("samr_connect"))) {
                PyErr_SetString(samr_ntstatus,
                                "unable to init talloc context\n");
                goto done;
index efb7d0a5fdd77e03d8fc012b80cfc4cd8db1c71b..8d81176e4dd3459ba87de413042debd013e4a2d1 100644 (file)
@@ -232,7 +232,7 @@ static PyObject *py_smb_query_secdesc(PyObject *self, PyObject *args,
                    args, kw, "i", kwlist, &fnum))
                return NULL;
 
-       mem_ctx = talloc_init();
+       mem_ctx = talloc_init("py_smb_query_secdesc");
 
        secdesc = cli_query_secdesc(cli->cli, fnum, mem_ctx);
 
@@ -269,7 +269,7 @@ static PyObject *py_smb_set_secdesc(PyObject *self, PyObject *args,
        static char *kwlist[] = { "fnum", "security_descriptor", NULL };
        PyObject *py_secdesc;
        SEC_DESC *secdesc;
-       TALLOC_CTX *mem_ctx = talloc_init();
+       TALLOC_CTX *mem_ctx = talloc_init("py_smb_set_secdesc");
        int fnum;
        BOOL result;
 
index 6daa32d0f41e568ff8ac1ebf4f2ff423864dbeff..a072ac0d5c0afc94edfe3903dca45e07e7e53c7a 100644 (file)
@@ -63,7 +63,7 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
                goto done;
        }
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("spoolss_enumprinterdrivers"))) {
                PyErr_SetString(
                        spoolss_error, "unable to init talloc context\n");
                goto done;
@@ -267,7 +267,7 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
                goto done;
        }
        
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("spoolss_getprinterdriverdir"))) {
                PyErr_SetString(
                        spoolss_error, "unable to init talloc context\n");
                goto done;
@@ -335,7 +335,7 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
                return NULL;
        }
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("spoolss_addprinterdriver"))) {
                PyErr_SetString(
                        spoolss_error, "unable to init talloc context\n");
                return NULL;
index 55716aca6ec45b2f8efa7c817b1145d4acc8fefa..ddc8868f0f5567c9bfd705305927849c4b877496 100644 (file)
@@ -59,7 +59,7 @@ PyObject *spoolss_enumports(PyObject *self, PyObject *args, PyObject *kw)
                goto done;
        }
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("spoolss_enumports"))) {
                PyErr_SetString(
                        spoolss_error, "unable to init talloc context\n");
                goto done;
index a96498dddc7127a184875c511a4867c596198440..2076bd76cf135d64a19d526db67186a7c226f7c5 100644 (file)
@@ -62,7 +62,7 @@ PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
                goto done;
        }
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("spoolss_openprinter"))) {
                PyErr_SetString(spoolss_error, 
                                "unable to init talloc context\n");
                goto done;
@@ -310,7 +310,7 @@ PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw)
                goto done;
        }
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("spoolss_enumprinters"))) {
                PyErr_SetString(
                        spoolss_error, "unable to init talloc context\n");
                goto done;
@@ -445,7 +445,7 @@ PyObject *spoolss_addprinterex(PyObject *self, PyObject *args, PyObject *kw)
                goto done;
        }
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("spoolss_addprinterex"))) {
                PyErr_SetString(
                        spoolss_error, "unable to init talloc context\n");
                goto done;
index cbc3601812421cfcedaf4b7b533e58817a72514f..f941d70e5ee7a9182c0dc52a006039ef83e6ed93 100644 (file)
@@ -373,7 +373,7 @@ static NTSTATUS sam_sync(struct cli_state *cli, unsigned char trust_passwd[16],
                      return result;
        }
 
-       if (!(mem_ctx = talloc_init())) {
+       if (!(mem_ctx = talloc_init("sam_sync"))) {
                DEBUG(0,("talloc_init failed\n"));
                return result;
        }
index 0061988eea9a708c77b2504ad0703c6834513aa6..df5faa42c1f7d7d9cd893f75cd8370d4e574e4a7 100644 (file)
@@ -35,7 +35,7 @@ NTSTATUS gums_get_object_type(uint32 *type, const GUMS_OBJECT *obj)
 
 NTSTATUS gums_create_object(GUMS_OBJECT **obj, uint32 type)
 {
-       TALLOC_CTX *mem_ctx = talloc_init();
+       TALLOC_CTX *mem_ctx = talloc_init("gums_create_object");
        GUMS_OBJECT *go;
        NT_STATUS ret;
        
index d3268d8b5b25b243157d730ce09621178ff54abf..17444c0757bb60eb33e6e181bbccae80fa4ab5dc 100644 (file)
@@ -249,7 +249,7 @@ static NTSTATUS do_cmd(struct samtest_state *st, struct cmd_set *cmd_entry, char
 
                if (mem_ctx == NULL) {
                        /* Create mem_ctx */
-                       if (!(mem_ctx = talloc_init())) {
+                       if (!(mem_ctx = talloc_init("do_cmd"))) {
                                DEBUG(0, ("talloc_init() failed\n"));
                                goto done;
                        }
index ab7286f8be56c2047d76d17710ad0b81690736a2..ae109f69b65c36e5bab997dae8c9c1b2bcd0fcef 100644 (file)
@@ -38,7 +38,7 @@ main()
        setup_logging("", True);
        DEBUGLEVEL=10;
 
-       ctx=talloc_init();
+       ctx=talloc_init("main");
        if (!ctx) exit(1);
 
        prs_init(&ps, 1600, 4, ctx, MARSHALL);