mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
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.
This commit is contained in:
parent
2c5a9f0a57
commit
8b4b5c3a92
@ -469,13 +469,13 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context)
|
|||||||
{
|
{
|
||||||
case SEC_DOMAIN:
|
case SEC_DOMAIN:
|
||||||
DEBUG(5,("Making default auth method list for security=domain\n"));
|
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",
|
talloc_tos(), "guest sam winbind:ntdomain",
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
case SEC_SERVER:
|
case SEC_SERVER:
|
||||||
DEBUG(5,("Making default auth method list for security=server\n"));
|
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",
|
talloc_tos(), "guest sam smbserver",
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
@ -483,36 +483,36 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context)
|
|||||||
if (lp_encrypted_passwords()) {
|
if (lp_encrypted_passwords()) {
|
||||||
if ((lp_server_role() == ROLE_DOMAIN_PDC) || (lp_server_role() == ROLE_DOMAIN_BDC)) {
|
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"));
|
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(),
|
talloc_tos(),
|
||||||
"guest sam winbind:trustdomain",
|
"guest sam winbind:trustdomain",
|
||||||
NULL);
|
NULL);
|
||||||
} else {
|
} else {
|
||||||
DEBUG(5,("Making default auth method list for standalone security=user, encrypt passwords = yes\n"));
|
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",
|
talloc_tos(), "guest sam",
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DEBUG(5,("Making default auth method list for security=user, encrypt passwords = no\n"));
|
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);
|
talloc_tos(), "guest unix", NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEC_SHARE:
|
case SEC_SHARE:
|
||||||
if (lp_encrypted_passwords()) {
|
if (lp_encrypted_passwords()) {
|
||||||
DEBUG(5,("Making default auth method list for security=share, encrypt passwords = yes\n"));
|
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);
|
talloc_tos(), "guest sam", NULL);
|
||||||
} else {
|
} else {
|
||||||
DEBUG(5,("Making default auth method list for security=share, encrypt passwords = no\n"));
|
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);
|
talloc_tos(), "guest unix", NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEC_ADS:
|
case SEC_ADS:
|
||||||
DEBUG(5,("Making default auth method list for security=ADS\n"));
|
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",
|
talloc_tos(), "guest sam winbind:ntdomain",
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
|
@ -1582,6 +1582,7 @@ bool validate_net_name( const char *name,
|
|||||||
const char *invalid_chars,
|
const char *invalid_chars,
|
||||||
int max_len);
|
int max_len);
|
||||||
char *escape_shell_string(const char *src);
|
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 */
|
/* The following definitions come from lib/util_unistr.c */
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ bool debug_parse_levels(const char *params_str)
|
|||||||
if (AllowDebugChange == False)
|
if (AllowDebugChange == False)
|
||||||
return True;
|
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)) {
|
if (debug_parse_params(params)) {
|
||||||
debug_dump_status(5);
|
debug_dump_status(5);
|
||||||
|
@ -2532,3 +2532,19 @@ char *escape_shell_string(const char *src)
|
|||||||
*dest++ = '\0';
|
*dest++ = '\0';
|
||||||
return ret;
|
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);
|
||||||
|
}
|
||||||
|
@ -44,7 +44,7 @@ bool ads_parse_gp_ext(TALLOC_CTX *mem_ctx,
|
|||||||
goto parse_error;
|
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) {
|
if (!ext_list) {
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ bool ads_parse_gp_ext(TALLOC_CTX *mem_ctx,
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ext_strings = str_list_make(mem_ctx, p, "}");
|
ext_strings = str_list_make_v3(mem_ctx, p, "}");
|
||||||
if (ext_strings == NULL) {
|
if (ext_strings == NULL) {
|
||||||
goto parse_error;
|
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));
|
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) {
|
if (!link_list) {
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
}
|
}
|
||||||
|
@ -4899,7 +4899,7 @@ static void init_globals(bool first_time_only)
|
|||||||
Globals.bWinbindTrustedDomainsOnly = False;
|
Globals.bWinbindTrustedDomainsOnly = False;
|
||||||
Globals.bWinbindNestedGroups = True;
|
Globals.bWinbindNestedGroups = True;
|
||||||
Globals.winbind_expand_groups = 1;
|
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.bWinbindRefreshTickets = False;
|
||||||
Globals.bWinbindOfflineLogon = 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;
|
return (const char **)def;
|
||||||
|
|
||||||
if (data->list==NULL) {
|
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;
|
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)
|
static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
|
||||||
{
|
{
|
||||||
TALLOC_FREE(Globals.szNetbiosAliases);
|
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);
|
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:
|
case P_LIST:
|
||||||
TALLOC_FREE(*((char ***)parm_ptr));
|
TALLOC_FREE(*((char ***)parm_ptr));
|
||||||
*(char ***)parm_ptr = str_list_make(
|
*(char ***)parm_ptr = str_list_make_v3(
|
||||||
NULL, pszParmValue, NULL);
|
NULL, pszParmValue, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ bool map_username(fstring user)
|
|||||||
|
|
||||||
/* skip lines like 'user = ' */
|
/* skip lines like 'user = ' */
|
||||||
|
|
||||||
dosuserlist = str_list_make(talloc_tos(), dosname, NULL);
|
dosuserlist = str_list_make_v3(talloc_tos(), dosname, NULL);
|
||||||
if (!dosuserlist) {
|
if (!dosuserlist) {
|
||||||
DEBUG(0,("Bad username map entry. Unable to build user list. Ignoring.\n"));
|
DEBUG(0,("Bad username map entry. Unable to build user list. Ignoring.\n"));
|
||||||
continue;
|
continue;
|
||||||
|
@ -576,7 +576,7 @@ static bool user_ok(const char *user, int snum)
|
|||||||
TALLOC_FREE(valid);
|
TALLOC_FREE(valid);
|
||||||
|
|
||||||
if (ret && lp_onlyuser(snum)) {
|
if (ret && lp_onlyuser(snum)) {
|
||||||
char **user_list = str_list_make(
|
char **user_list = str_list_make_v3(
|
||||||
talloc_tos(), lp_username(snum), NULL);
|
talloc_tos(), lp_username(snum), NULL);
|
||||||
if (user_list &&
|
if (user_list &&
|
||||||
str_list_substitute(user_list, "%S",
|
str_list_substitute(user_list, "%S",
|
||||||
|
@ -74,7 +74,7 @@ void web_set_lang(const char *lang_string)
|
|||||||
int lang_num, i;
|
int lang_num, i;
|
||||||
|
|
||||||
/* build the lang list */
|
/* 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;
|
if (!lang_list) return;
|
||||||
|
|
||||||
/* sort the list by priority */
|
/* sort the list by priority */
|
||||||
|
Loading…
Reference in New Issue
Block a user