1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-10 04:23:50 +03:00

Finish adding strings to all talloc_init() calls.

Jeremy.
This commit is contained in:
Jeremy Allison
-
parent d7f18c60f7
commit 784d15761c
14 changed files with 29 additions and 30 deletions

View File

@@ -127,9 +127,8 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
/* module initialisation */ /* module initialisation */
NTSTATUS auth_init_winbind(struct auth_context *auth_context, const char *param, auth_methods **auth_method) 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; return NT_STATUS_NO_MEMORY;
}
(*auth_method)->name = "winbind"; (*auth_method)->name = "winbind";
(*auth_method)->auth = check_winbind_security; (*auth_method)->auth = check_winbind_security;

View File

@@ -136,7 +136,6 @@ static TALLOC_CTX *talloc_init_internal(void)
/** /**
* Create a new talloc context, with a name specifying its purpose. * 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, ...) TALLOC_CTX *talloc_init(char const *fmt, ...)

View File

@@ -47,7 +47,7 @@ BOOL uni_group_cache_init(void)
return (netlogon_unigrp_tdb != NULL); 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; TDB_DATA key,data;
fstring keystr; 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()) { if (!uni_group_cache_init()) {
DEBUG(0,("uni_group_cache_store_netlogon: cannot open netlogon_unigrp.tdb for write!\n")); 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 */ /* 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) { if(!data.dptr) {
DEBUG(0,("uni_group_cache_store_netlogon: cannot allocate memory!\n")); DEBUG(0,("uni_group_cache_store_netlogon: cannot allocate memory!\n"));
talloc_destroy(mem_ctx); talloc_destroy(mem_ctx);
return; return False;
} }
/* Store data in byteorder-independent format */ /* 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++) { for(i=1; i<=user->num_groups2; i++) {
SIVAL(&((uint32*)data.dptr)[i],0,user->gids[i-1].g_rid); 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 */ /* Shutdown netlogon_unigrp database */
void uni_group_cache_shutdown(void) BOOL uni_group_cache_shutdown(void)
{ {
if(netlogon_unigrp_tdb) { if(netlogon_unigrp_tdb)
tdb_close(netlogon_unigrp_tdb); return (tdb_close(netlogon_unigrp_tdb) == 0);
} return True;
} }

View 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 /* I know this is somewhat overkill but only the talloc
* functions have asprint_append and the 'normal' asprintf * functions have asprint_append and the 'normal' asprintf
* is a GNU extension */ * 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", ""); query.part2 = talloc_asprintf(query.mem_ctx, "%s", "");
if (query.update) { if (query.update) {
query.part1 = query.part1 =

View File

@@ -84,7 +84,7 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args,
return NULL; 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"); PyErr_SetString(lsa_error, "unable to init talloc context\n");
goto done; goto done;
} }

View File

@@ -73,7 +73,7 @@ static PyObject *samr_open_domain(PyObject *self, PyObject *args, PyObject *kw)
return NULL; return NULL;
} }
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("samr_open_domain"))) {
PyErr_SetString(samr_error, "unable to init talloc context"); PyErr_SetString(samr_error, "unable to init talloc context");
return NULL; return NULL;
} }
@@ -167,7 +167,7 @@ static PyObject *samr_enum_dom_groups(PyObject *self, PyObject *args,
args, kw, "", kwlist)) args, kw, "", kwlist))
return NULL; 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"); PyErr_SetString(samr_error, "unable to init talloc context");
return NULL; return NULL;
} }
@@ -399,7 +399,7 @@ static PyObject *samr_connect(PyObject *self, PyObject *args, PyObject *kw)
return NULL; return NULL;
} }
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("samr_connect"))) {
PyErr_SetString(samr_ntstatus, PyErr_SetString(samr_ntstatus,
"unable to init talloc context\n"); "unable to init talloc context\n");
goto done; goto done;

View File

@@ -232,7 +232,7 @@ static PyObject *py_smb_query_secdesc(PyObject *self, PyObject *args,
args, kw, "i", kwlist, &fnum)) args, kw, "i", kwlist, &fnum))
return NULL; return NULL;
mem_ctx = talloc_init(); mem_ctx = talloc_init("py_smb_query_secdesc");
secdesc = cli_query_secdesc(cli->cli, fnum, mem_ctx); 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 }; static char *kwlist[] = { "fnum", "security_descriptor", NULL };
PyObject *py_secdesc; PyObject *py_secdesc;
SEC_DESC *secdesc; SEC_DESC *secdesc;
TALLOC_CTX *mem_ctx = talloc_init(); TALLOC_CTX *mem_ctx = talloc_init("py_smb_set_secdesc");
int fnum; int fnum;
BOOL result; BOOL result;

View File

@@ -63,7 +63,7 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
goto done; goto done;
} }
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("spoolss_enumprinterdrivers"))) {
PyErr_SetString( PyErr_SetString(
spoolss_error, "unable to init talloc context\n"); spoolss_error, "unable to init talloc context\n");
goto done; goto done;
@@ -267,7 +267,7 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
goto done; goto done;
} }
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("spoolss_getprinterdriverdir"))) {
PyErr_SetString( PyErr_SetString(
spoolss_error, "unable to init talloc context\n"); spoolss_error, "unable to init talloc context\n");
goto done; goto done;
@@ -335,7 +335,7 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
return NULL; return NULL;
} }
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("spoolss_addprinterdriver"))) {
PyErr_SetString( PyErr_SetString(
spoolss_error, "unable to init talloc context\n"); spoolss_error, "unable to init talloc context\n");
return NULL; return NULL;

View File

@@ -59,7 +59,7 @@ PyObject *spoolss_enumports(PyObject *self, PyObject *args, PyObject *kw)
goto done; goto done;
} }
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("spoolss_enumports"))) {
PyErr_SetString( PyErr_SetString(
spoolss_error, "unable to init talloc context\n"); spoolss_error, "unable to init talloc context\n");
goto done; goto done;

View File

@@ -62,7 +62,7 @@ PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
goto done; goto done;
} }
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("spoolss_openprinter"))) {
PyErr_SetString(spoolss_error, PyErr_SetString(spoolss_error,
"unable to init talloc context\n"); "unable to init talloc context\n");
goto done; goto done;
@@ -310,7 +310,7 @@ PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw)
goto done; goto done;
} }
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("spoolss_enumprinters"))) {
PyErr_SetString( PyErr_SetString(
spoolss_error, "unable to init talloc context\n"); spoolss_error, "unable to init talloc context\n");
goto done; goto done;
@@ -445,7 +445,7 @@ PyObject *spoolss_addprinterex(PyObject *self, PyObject *args, PyObject *kw)
goto done; goto done;
} }
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("spoolss_addprinterex"))) {
PyErr_SetString( PyErr_SetString(
spoolss_error, "unable to init talloc context\n"); spoolss_error, "unable to init talloc context\n");
goto done; goto done;

View File

@@ -373,7 +373,7 @@ static NTSTATUS sam_sync(struct cli_state *cli, unsigned char trust_passwd[16],
return result; return result;
} }
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("sam_sync"))) {
DEBUG(0,("talloc_init failed\n")); DEBUG(0,("talloc_init failed\n"));
return result; return result;
} }

View 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) 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; GUMS_OBJECT *go;
NT_STATUS ret; NT_STATUS ret;

View File

@@ -249,7 +249,7 @@ static NTSTATUS do_cmd(struct samtest_state *st, struct cmd_set *cmd_entry, char
if (mem_ctx == NULL) { if (mem_ctx == NULL) {
/* Create mem_ctx */ /* Create mem_ctx */
if (!(mem_ctx = talloc_init())) { if (!(mem_ctx = talloc_init("do_cmd"))) {
DEBUG(0, ("talloc_init() failed\n")); DEBUG(0, ("talloc_init() failed\n"));
goto done; goto done;
} }

View File

@@ -38,7 +38,7 @@ main()
setup_logging("", True); setup_logging("", True);
DEBUGLEVEL=10; DEBUGLEVEL=10;
ctx=talloc_init(); ctx=talloc_init("main");
if (!ctx) exit(1); if (!ctx) exit(1);
prs_init(&ps, 1600, 4, ctx, MARSHALL); prs_init(&ps, 1600, 4, ctx, MARSHALL);