summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-11-06 18:53:00 -0800
committerJeremy Allison <jra@samba.org>2008-11-06 18:53:00 -0800
commit8b4b5c3a92be83e99d9177b04f0da56f610025de (patch)
tree7ee4a9729d64a7eb52db84c01b4bb65d7fd4c252 /source3
parent2c5a9f0a57774b861439390ab86b48c3f0475af8 (diff)
downloadsamba-8b4b5c3a92be83e99d9177b04f0da56f610025de.tar.gz
samba-8b4b5c3a92be83e99d9177b04f0da56f610025de.tar.bz2
samba-8b4b5c3a92be83e99d9177b04f0da56f610025de.zip
Add wrapper str_list_make_v3() to replace the old S3 behavior of
str_list_make(). From Dan Sledz <dan.sledz@isilon.com>: In samba 3.2 passing NULL or an empty string returned NULL. In master, it now returns a list of length 1 with the first string set to NULL (an empty list). Jeremy.
Diffstat (limited to 'source3')
-rw-r--r--source3/auth/auth.c16
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/lib/debug.c2
-rw-r--r--source3/lib/util_str.c16
-rw-r--r--source3/libgpo/gpo_ldap.c6
-rw-r--r--source3/param/loadparm.c8
-rw-r--r--source3/smbd/map_username.c2
-rw-r--r--source3/smbd/password.c2
-rw-r--r--source3/web/neg_lang.c2
9 files changed, 36 insertions, 19 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index 7f95656bef..505098c76a 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -469,13 +469,13 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context)
{
case SEC_DOMAIN:
DEBUG(5,("Making default auth method list for security=domain\n"));
- auth_method_list = str_list_make(
+ auth_method_list = str_list_make_v3(
talloc_tos(), "guest sam winbind:ntdomain",
NULL);
break;
case SEC_SERVER:
DEBUG(5,("Making default auth method list for security=server\n"));
- auth_method_list = str_list_make(
+ auth_method_list = str_list_make_v3(
talloc_tos(), "guest sam smbserver",
NULL);
break;
@@ -483,36 +483,36 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context)
if (lp_encrypted_passwords()) {
if ((lp_server_role() == ROLE_DOMAIN_PDC) || (lp_server_role() == ROLE_DOMAIN_BDC)) {
DEBUG(5,("Making default auth method list for DC, security=user, encrypt passwords = yes\n"));
- auth_method_list = str_list_make(
+ auth_method_list = str_list_make_v3(
talloc_tos(),
"guest sam winbind:trustdomain",
NULL);
} else {
DEBUG(5,("Making default auth method list for standalone security=user, encrypt passwords = yes\n"));
- auth_method_list = str_list_make(
+ auth_method_list = str_list_make_v3(
talloc_tos(), "guest sam",
NULL);
}
} else {
DEBUG(5,("Making default auth method list for security=user, encrypt passwords = no\n"));
- auth_method_list = str_list_make(
+ auth_method_list = str_list_make_v3(
talloc_tos(), "guest unix", NULL);
}
break;
case SEC_SHARE:
if (lp_encrypted_passwords()) {
DEBUG(5,("Making default auth method list for security=share, encrypt passwords = yes\n"));
- auth_method_list = str_list_make(
+ auth_method_list = str_list_make_v3(
talloc_tos(), "guest sam", NULL);
} else {
DEBUG(5,("Making default auth method list for security=share, encrypt passwords = no\n"));
- auth_method_list = str_list_make(
+ auth_method_list = str_list_make_v3(
talloc_tos(), "guest unix", NULL);
}
break;
case SEC_ADS:
DEBUG(5,("Making default auth method list for security=ADS\n"));
- auth_method_list = str_list_make(
+ auth_method_list = str_list_make_v3(
talloc_tos(), "guest sam winbind:ntdomain",
NULL);
break;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 49c9aff349..482027e8dc 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1582,6 +1582,7 @@ bool validate_net_name( const char *name,
const char *invalid_chars,
int max_len);
char *escape_shell_string(const char *src);
+char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
/* The following definitions come from lib/util_unistr.c */
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index 986dff48d7..d64fcb66d9 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -472,7 +472,7 @@ bool debug_parse_levels(const char *params_str)
if (AllowDebugChange == False)
return True;
- params = str_list_make(talloc_tos(), params_str, NULL);
+ params = str_list_make_v3(talloc_tos(), params_str, NULL);
if (debug_parse_params(params)) {
debug_dump_status(5);
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 046ce61ea3..fde4f825e8 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -2532,3 +2532,19 @@ char *escape_shell_string(const char *src)
*dest++ = '\0';
return ret;
}
+
+/***************************************************
+ Wrapper for str_list_make() to restore the s3 behavior.
+ In samba 3.2 passing NULL or an empty string returned NULL.
+
+ In master, it now returns a list of length 1 with the first string set
+ to NULL (an empty list)
+***************************************************/
+
+char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep)
+{
+ if (!string || !*string) {
+ return NULL;
+ }
+ return str_list_make(mem_ctx, string, sep);
+}
diff --git a/source3/libgpo/gpo_ldap.c b/source3/libgpo/gpo_ldap.c
index 0e77f0a856..26813864e5 100644
--- a/source3/libgpo/gpo_ldap.c
+++ b/source3/libgpo/gpo_ldap.c
@@ -44,7 +44,7 @@ bool ads_parse_gp_ext(TALLOC_CTX *mem_ctx,
goto parse_error;
}
- ext_list = str_list_make(mem_ctx, extension_raw, "]");
+ ext_list = str_list_make_v3(mem_ctx, extension_raw, "]");
if (!ext_list) {
goto parse_error;
}
@@ -87,7 +87,7 @@ bool ads_parse_gp_ext(TALLOC_CTX *mem_ctx,
p++;
}
- ext_strings = str_list_make(mem_ctx, p, "}");
+ ext_strings = str_list_make_v3(mem_ctx, p, "}");
if (ext_strings == NULL) {
goto parse_error;
}
@@ -162,7 +162,7 @@ static ADS_STATUS gpo_parse_gplink(TALLOC_CTX *mem_ctx,
DEBUG(10,("gpo_parse_gplink: gPLink: %s\n", gp_link_raw));
- link_list = str_list_make(mem_ctx, gp_link_raw, "]");
+ link_list = str_list_make_v3(mem_ctx, gp_link_raw, "]");
if (!link_list) {
goto parse_error;
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 84f6fb907a..fae6cb38dc 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -4899,7 +4899,7 @@ static void init_globals(bool first_time_only)
Globals.bWinbindTrustedDomainsOnly = False;
Globals.bWinbindNestedGroups = True;
Globals.winbind_expand_groups = 1;
- Globals.szWinbindNssInfo = str_list_make(NULL, "template", NULL);
+ Globals.szWinbindNssInfo = str_list_make_v3(NULL, "template", NULL);
Globals.bWinbindRefreshTickets = False;
Globals.bWinbindOfflineLogon = False;
@@ -5615,7 +5615,7 @@ const char **lp_parm_string_list(int snum, const char *type, const char *option,
return (const char **)def;
if (data->list==NULL) {
- data->list = str_list_make(NULL, data->value, NULL);
+ data->list = str_list_make_v3(NULL, data->value, NULL);
}
return (const char **)data->list;
@@ -6859,7 +6859,7 @@ static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
{
TALLOC_FREE(Globals.szNetbiosAliases);
- Globals.szNetbiosAliases = str_list_make(NULL, pszParmValue, NULL);
+ Globals.szNetbiosAliases = str_list_make_v3(NULL, pszParmValue, NULL);
return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
}
@@ -7261,7 +7261,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
case P_LIST:
TALLOC_FREE(*((char ***)parm_ptr));
- *(char ***)parm_ptr = str_list_make(
+ *(char ***)parm_ptr = str_list_make_v3(
NULL, pszParmValue, NULL);
break;
diff --git a/source3/smbd/map_username.c b/source3/smbd/map_username.c
index a8899dd538..f549f0c9f3 100644
--- a/source3/smbd/map_username.c
+++ b/source3/smbd/map_username.c
@@ -178,7 +178,7 @@ bool map_username(fstring user)
/* skip lines like 'user = ' */
- dosuserlist = str_list_make(talloc_tos(), dosname, NULL);
+ dosuserlist = str_list_make_v3(talloc_tos(), dosname, NULL);
if (!dosuserlist) {
DEBUG(0,("Bad username map entry. Unable to build user list. Ignoring.\n"));
continue;
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 88e7b766be..84b40f28cc 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -576,7 +576,7 @@ static bool user_ok(const char *user, int snum)
TALLOC_FREE(valid);
if (ret && lp_onlyuser(snum)) {
- char **user_list = str_list_make(
+ char **user_list = str_list_make_v3(
talloc_tos(), lp_username(snum), NULL);
if (user_list &&
str_list_substitute(user_list, "%S",
diff --git a/source3/web/neg_lang.c b/source3/web/neg_lang.c
index 82411000cd..491ca9eedd 100644
--- a/source3/web/neg_lang.c
+++ b/source3/web/neg_lang.c
@@ -74,7 +74,7 @@ void web_set_lang(const char *lang_string)
int lang_num, i;
/* build the lang list */
- lang_list = str_list_make(talloc_tos(), lang_string, ", \t\r\n");
+ lang_list = str_list_make_v3(talloc_tos(), lang_string, ", \t\r\n");
if (!lang_list) return;
/* sort the list by priority */