summaryrefslogtreecommitdiff
path: root/source3/libnet
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-07-18 15:07:23 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-07-18 15:07:23 +0930
commitfe72740e8221575921c22030d6d4fcb19201b03b (patch)
tree0b1bb254e23d6541eede8f2ff4494af477fd5566 /source3/libnet
parentc809eec53fb1d2a36909e4934dff349f91e3359e (diff)
downloadsamba-fe72740e8221575921c22030d6d4fcb19201b03b.tar.gz
samba-fe72740e8221575921c22030d6d4fcb19201b03b.tar.bz2
samba-fe72740e8221575921c22030d6d4fcb19201b03b.zip
loadparm: make the source3/ lp_ functions take an explicit TALLOC_CTX *.
They use talloc_tos() internally: hoist that up to the callers, some of whom don't want to us talloc_tos(). A simple patch, but hits a lot of files. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_dssync_passdb.c4
-rw-r--r--source3/libnet/libnet_samsync_ldif.c40
-rw-r--r--source3/libnet/libnet_samsync_passdb.c4
3 files changed, 24 insertions, 24 deletions
diff --git a/source3/libnet/libnet_dssync_passdb.c b/source3/libnet/libnet_dssync_passdb.c
index b56c2d4451..edadddbb28 100644
--- a/source3/libnet/libnet_dssync_passdb.c
+++ b/source3/libnet/libnet_dssync_passdb.c
@@ -670,11 +670,11 @@ static NTSTATUS smb_create_user(TALLOC_CTX *mem_ctx,
/* Create appropriate user */
if (acct_flags & ACB_NORMAL) {
- add_script = talloc_strdup(mem_ctx, lp_adduser_script());
+ add_script = lp_adduser_script(mem_ctx);
} else if ( (acct_flags & ACB_WSTRUST) ||
(acct_flags & ACB_SVRTRUST) ||
(acct_flags & ACB_DOMTRUST) ) {
- add_script = talloc_strdup(mem_ctx, lp_addmachine_script());
+ add_script = lp_addmachine_script(mem_ctx);
} else {
DEBUG(1, ("Unknown user type: %s\n",
pdb_encode_acct_ctrl(acct_flags, NEW_PW_FORMAT_SPACE_PADDED_LEN)));
diff --git a/source3/libnet/libnet_samsync_ldif.c b/source3/libnet/libnet_samsync_ldif.c
index a46bfca554..c492b9fda5 100644
--- a/source3/libnet/libnet_samsync_ldif.c
+++ b/source3/libnet/libnet_samsync_ldif.c
@@ -130,7 +130,7 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid,
fprintf(add_fd, "\n");
fflush(add_fd);
- user_suffix = lp_ldap_user_suffix();
+ user_suffix = lp_ldap_user_suffix(talloc_tos());
if (user_suffix == NULL) {
SAFE_FREE(suffix_attr);
return NT_STATUS_NO_MEMORY;
@@ -138,7 +138,7 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid,
/* If it exists and is distinct from other containers,
Write the Users entity */
if (*user_suffix && strcmp(user_suffix, suffix)) {
- user_attr = sstring_sub(lp_ldap_user_suffix(), '=', ',');
+ user_attr = sstring_sub(lp_ldap_user_suffix(talloc_tos()), '=', ',');
fprintf(add_fd, "# %s\n", user_suffix);
fprintf(add_fd, "dn: %s\n", user_suffix);
fprintf(add_fd, "objectClass: organizationalUnit\n");
@@ -148,7 +148,7 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid,
}
- group_suffix = lp_ldap_group_suffix();
+ group_suffix = lp_ldap_group_suffix(talloc_tos());
if (group_suffix == NULL) {
SAFE_FREE(suffix_attr);
SAFE_FREE(user_attr);
@@ -157,7 +157,7 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid,
/* If it exists and is distinct from other containers,
Write the Groups entity */
if (*group_suffix && strcmp(group_suffix, suffix)) {
- group_attr = sstring_sub(lp_ldap_group_suffix(), '=', ',');
+ group_attr = sstring_sub(lp_ldap_group_suffix(talloc_tos()), '=', ',');
fprintf(add_fd, "# %s\n", group_suffix);
fprintf(add_fd, "dn: %s\n", group_suffix);
fprintf(add_fd, "objectClass: organizationalUnit\n");
@@ -168,7 +168,7 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid,
/* If it exists and is distinct from other containers,
Write the Computers entity */
- machine_suffix = lp_ldap_machine_suffix();
+ machine_suffix = lp_ldap_machine_suffix(talloc_tos());
if (machine_suffix == NULL) {
SAFE_FREE(suffix_attr);
SAFE_FREE(user_attr);
@@ -183,7 +183,7 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid,
fprintf(add_fd, "objectClass: organizationalUnit\n");
/* this isn't totally correct as it assumes that
there _must_ be an ou. just fixing memleak now. jmcd */
- machine_ou = sstring_sub(lp_ldap_machine_suffix(), '=', ',');
+ machine_ou = sstring_sub(lp_ldap_machine_suffix(talloc_tos()), '=', ',');
fprintf(add_fd, "ou: %s\n", machine_ou);
SAFE_FREE(machine_ou);
fprintf(add_fd, "\n");
@@ -192,7 +192,7 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid,
/* If it exists and is distinct from other containers,
Write the IdMap entity */
- idmap_suffix = lp_ldap_idmap_suffix();
+ idmap_suffix = lp_ldap_idmap_suffix(talloc_tos());
if (idmap_suffix == NULL) {
SAFE_FREE(suffix_attr);
SAFE_FREE(user_attr);
@@ -206,7 +206,7 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid,
fprintf(add_fd, "# %s\n", idmap_suffix);
fprintf(add_fd, "dn: %s\n", idmap_suffix);
fprintf(add_fd, "ObjectClass: organizationalUnit\n");
- s = sstring_sub(lp_ldap_idmap_suffix(), '=', ',');
+ s = sstring_sub(lp_ldap_idmap_suffix(talloc_tos()), '=', ',');
fprintf(add_fd, "ou: %s\n", s);
SAFE_FREE(s);
fprintf(add_fd, "\n");
@@ -370,7 +370,7 @@ static NTSTATUS map_populate_groups(TALLOC_CTX *mem_ctx,
const char *suffix,
const char *builtin_sid)
{
- char *group_attr = sstring_sub(lp_ldap_group_suffix(), '=', ',');
+ char *group_attr = sstring_sub(lp_ldap_group_suffix(talloc_tos()), '=', ',');
/* Map the groups created by populate_ldap_for_ldif */
groupmap[0].rid = 512;
@@ -576,7 +576,7 @@ static NTSTATUS fetch_group_info_to_ldif(TALLOC_CTX *mem_ctx,
{
const char *groupname = r->group_name.string;
uint32 grouptype = 0, g_rid = 0;
- char *group_attr = sstring_sub(lp_ldap_group_suffix(), '=', ',');
+ char *group_attr = sstring_sub(lp_ldap_group_suffix(talloc_tos()), '=', ',');
/* Set up the group type (always 2 for group info) */
grouptype = 2;
@@ -673,9 +673,9 @@ static NTSTATUS fetch_account_info_to_ldif(TALLOC_CTX *mem_ctx,
} else {
snprintf(homedir, sizeof(homedir), "/nobodyshomedir");
}
- ou = lp_ldap_user_suffix();
+ ou = lp_ldap_user_suffix(talloc_tos());
} else {
- ou = lp_ldap_machine_suffix();
+ ou = lp_ldap_machine_suffix(talloc_tos());
snprintf(homedir, sizeof(homedir), "/machinehomedir");
}
@@ -795,7 +795,7 @@ static NTSTATUS fetch_alias_info_to_ldif(TALLOC_CTX *mem_ctx,
{
fstring aliasname, description;
uint32 grouptype = 0, g_rid = 0;
- char *group_attr = sstring_sub(lp_ldap_group_suffix(), '=', ',');
+ char *group_attr = sstring_sub(lp_ldap_group_suffix(talloc_tos()), '=', ',');
/* Get the alias name */
fstrcpy(aliasname, r->alias_name.string);
@@ -930,6 +930,12 @@ static NTSTATUS ldif_init_context(TALLOC_CTX *mem_ctx,
const char *mod_template = "/tmp/mod.ldif.XXXXXX";
const char *builtin_sid = "S-1-5-32";
+ r = talloc_zero(mem_ctx, struct samsync_ldif_context);
+ NT_STATUS_HAVE_NO_MEMORY(r);
+
+ /* Get the ldap suffix */
+ r->suffix = lp_ldap_suffix(talloc_tos());
+
/* Get other smb.conf data */
if (!(lp_workgroup()) || !*(lp_workgroup())) {
DEBUG(0,("workgroup missing from smb.conf--exiting\n"));
@@ -937,7 +943,7 @@ static NTSTATUS ldif_init_context(TALLOC_CTX *mem_ctx,
}
/* Get the ldap suffix */
- if (!(lp_ldap_suffix()) || !*(lp_ldap_suffix())) {
+ if (!r->suffix || !*r->suffix) {
DEBUG(0,("ldap suffix missing from smb.conf--exiting\n"));
exit(1);
}
@@ -946,12 +952,6 @@ static NTSTATUS ldif_init_context(TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
- r = talloc_zero(mem_ctx, struct samsync_ldif_context);
- NT_STATUS_HAVE_NO_MEMORY(r);
-
- /* Get the ldap suffix */
- r->suffix = lp_ldap_suffix();
-
/* Ensure we have an output file */
if (ldif_filename) {
r->ldif_file = fopen(ldif_filename, "a");
diff --git a/source3/libnet/libnet_samsync_passdb.c b/source3/libnet/libnet_samsync_passdb.c
index cf47934475..c09474e9b7 100644
--- a/source3/libnet/libnet_samsync_passdb.c
+++ b/source3/libnet/libnet_samsync_passdb.c
@@ -250,11 +250,11 @@ static NTSTATUS smb_create_user(TALLOC_CTX *mem_ctx,
/* Create appropriate user */
if (acct_flags & ACB_NORMAL) {
- add_script = talloc_strdup(mem_ctx, lp_adduser_script());
+ add_script = lp_adduser_script(mem_ctx);
} else if ( (acct_flags & ACB_WSTRUST) ||
(acct_flags & ACB_SVRTRUST) ||
(acct_flags & ACB_DOMTRUST) ) {
- add_script = talloc_strdup(mem_ctx, lp_addmachine_script());
+ add_script = lp_addmachine_script(mem_ctx);
} else {
DEBUG(1, ("Unknown user type: %s\n",
pdb_encode_acct_ctrl(acct_flags, NEW_PW_FORMAT_SPACE_PADDED_LEN)));