return nt_status_string_to_code(user);
}
- strlower_m(user);
+ if (!strlower_m(user)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
error_num = strtoul(user, NULL, 16);
DEBUG(5,("check_name_to_ntstatus_security: Error for user %s was %lx\n", user, error_num));
if (!lower_username) {
return NT_STATUS_NO_MEMORY;
}
- strlower_m( lower_username );
+ if (!strlower_m( lower_username )) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
orig_dom_user = talloc_asprintf(mem_ctx,
"%s%c%s",
special_char_sub(prompt);
fstrcpy(t->prompt, prompt);
- strlower_m(t->prompt);
+ (void)strlower_m(t->prompt);
trim_char(t->prompt, ' ', ' ');
if (!next_token_talloc(frame, &p, &reply, NULL)) {
special_char_sub(reply);
fstrcpy(t->reply, reply);
- strlower_m(t->reply);
+ (void)strlower_m(t->reply);
trim_char(t->reply, ' ', ' ');
}
/* try all lowercase if it's currently all uppercase */
if (strhasupper(pass2)) {
- strlower_m(pass2);
+ if (!strlower_m(pass2)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
nt_status = password_check(pass2, (const void *)rhost);
if (NT_STATUS_IS_OK(nt_status)) {
return (nt_status);
}
/* last chance - all combinations of up to level chars upper! */
- strlower_m(pass2);
+ if (!strlower_m(pass2)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
nt_status = string_combinations(pass2, password_check, level,
(const void *)rhost);
if (!lowercase_user) {
return false;
}
- strlower_m(lowercase_user);
+ if (!strlower_m(lowercase_user)) {
+ return false;
+ }
if (strcmp(user,lowercase_user) == 0) {
/* user name was already lower case! */
}
if (lowercase) {
- strlower_m(lname);
+ if (!strlower_m(lname)) {
+ d_printf("strlower_m %s failed\n", lname);
+ return 1;
+ }
}
status = cli_resolve_path(ctx, "", auth_info, cli, rname, &targetcli,
string_replace(finfo->name,'\\','/');
if (lowercase) {
- strlower_m(finfo->name);
+ if (!strlower_m(finfo->name)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
}
if (!directory_exist(finfo->name) &&
fixtarname(hb.dbuf.name, aname, (l+2 >= NAMSIZ) ? NAMSIZ : l + 2);
if (lowercase)
- strlower_m(hb.dbuf.name);
+ (void)strlower_m(hb.dbuf.name);
/* write out a "standard" tar format header */
/* The pts command always generates completely lower-case user
* names. */
- strlower_m(afs_username);
+ if (!strlower_m(afs_username)) {
+ return false;
+ }
cell = strchr(afs_username, '@');
/* alpha_strcpy includes the space for the terminating nul. */
alpha_strcpy(local_machine,tmp_local_machine,
SAFE_NETBIOS_CHARS,len+1);
- strlower_m(local_machine);
+ if (!strlower_m(local_machine)) {
+ TALLOC_FREE(tmp_local_machine);
+ return false;
+ }
TALLOC_FREE(tmp_local_machine);
already_perm = perm;
/* alpha_strcpy includes the space for the terminating nul. */
alpha_strcpy(remote_machine,tmp_remote_machine,
SAFE_NETBIOS_CHARS,len+1);
- strlower_m(remote_machine);
+ if (!strlower_m(remote_machine)) {
+ TALLOC_FREE(tmp_remote_machine);
+ return false;
+ }
TALLOC_FREE(tmp_remote_machine);
already_perm = perm;
return;
}
trim_char(tmp, ' ', ' ');
- strlower_m(tmp);
+ if (!strlower_m(tmp)) {
+ TALLOC_FREE(tmp);
+ return;
+ }
len = strlen(tmp);
/* Try in all lower case first as this is the most
common case on UNIX systems */
- strlower_m(user2);
+ if (!strlower_m(user2)) {
+ DEBUG(5,("strlower_m %s failed\n", user2));
+ goto done;
+ }
+
DEBUG(5,("Trying _Get_Pwnam(), username as lowercase is %s\n",user2));
ret = getpwnam_alloc_cached(mem_ctx, user2);
if(ret)
}
/* Try all combinations up to usernamelevel */
- strlower_m(user2);
+ if (!strlower_m(user2)) {
+ DEBUG(5,("strlower_m %s failed\n", user2));
+ goto done;
+ }
DEBUG(5,("Checking combinations of %d uppercase letters in %s\n",
lp_usernamelevel(), user2));
ret = uname_string_combinations(user2, mem_ctx, getpwnam_alloc_cached,
TALLOC_FREE(ctx);
return false;
}
- strlower_m(p2);
- strlower_m(s2);
+ if (!strlower_m(p2)) {
+ TALLOC_FREE(ctx);
+ return false;
+ }
+ if (!strlower_m(s2)) {
+ TALLOC_FREE(ctx);
+ return false;
+ }
/* Remove any *? and ** from the pattern as they are meaningless */
for(p = p2; *p; p++) {
if (case_default == CASE_UPPER)
return strupper_m(s);
else
- strlower_m(s);
- return true; /* FIXME - return strlower_m value later. */
+ return strlower_m(s);
}
/**
/* Catch mb conversion errors that may not terminate. */
if (errno) {
s[len-1] = '\0';
- ret = false;
}
errno = errno_save;
return ret;
if (ret == NULL) {
return NULL;
}
- strlower_m(ret);
+ if (!strlower_m(ret)) {
+ TALLOC_FREE(ret);
+ return NULL;
+ }
return ret;
}
return NULL;
}
- strlower_m( dnsdomain );
+ if (!strlower_m( dnsdomain )) {
+ SAFE_FREE(dnsdomain);
+ return NULL;
+ }
+
all_string_sub( dnsdomain, "dc=", "", 0);
all_string_sub( dnsdomain, ",", ".", 0 );
fstring salt;
fstr_sprintf( salt, "host/%s.%s@", lp_netbios_name(), lp_realm() );
- strlower_m( salt );
+ (void)strlower_m( salt );
fstrcat( salt, lp_realm() );
return SMB_STRDUP( salt );
goto out;
}
- strlower_m(&psp1[strlen(spn)]);
+ if (!strlower_m(&psp1[strlen(spn)])) {
+ ret = ADS_ERROR(LDAP_NO_MEMORY);
+ goto out;
+ }
servicePrincipalName[0] = psp1;
DEBUG(5,("ads_add_service_principal_name: INFO: Adding %s to host %s\n",
goto out;
}
- strlower_m(&psp2[strlen(spn)]);
+ if (!strlower_m(&psp2[strlen(spn)])) {
+ ret = ADS_ERROR(LDAP_NO_MEMORY);
+ goto out;
+ }
servicePrincipalName[1] = psp2;
DEBUG(5,("ads_add_service_principal_name: INFO: Adding %s to host %s\n",
/* hostname must be lowercase */
host = SMB_STRDUP(hostname);
- strlower_m(host);
+ if (!strlower_m(host)) {
+ SAFE_FREE(host);
+ return ADS_ERROR_SYSTEM(EINVAL);
+ }
status = ads_find_machine_acct(ads, &res, host);
if (!ADS_ERR_OK(status)) {
return ADS_ERROR(LDAP_NO_MEMORY);
}
- strlower_m(server);
+ if (!strlower_m(server)) {
+ SAFE_FREE(server);
+ SAFE_FREE(server_realm);
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
+
if (!strupper_m(server_realm)) {
SAFE_FREE(server);
SAFE_FREE(server_realm);
return ADS_ERROR(LDAP_NO_MEMORY);
}
- strlower_m(server);
+ if (!strlower_m(server)) {
+ SAFE_FREE(server);
+ SAFE_FREE(server_realm);
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
+
if (!strupper_m(server_realm)) {
SAFE_FREE(server);
SAFE_FREE(server_realm);
r->out.dns_domain_name);
}
- strlower_m(my_fqdn);
+ if (!strlower_m(my_fqdn)) {
+ return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+ }
if (!strequal(my_fqdn, r->in.machine_name)) {
spn = talloc_asprintf(mem_ctx, "HOST/%s", my_fqdn);
/* according to WKSSVC_JOIN_FLAGS_MACHINE_PWD_PASSED */
fstrcpy(trust_passwd, r->in.admin_password);
- strlower_m(trust_passwd);
+ if (!strlower_m(trust_passwd)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
/*
* Machine names can be 15 characters, but the max length on
/* Create domain user */
acct_name = talloc_asprintf(mem_ctx, "%s$", r->in.machine_name);
- strlower_m(acct_name);
+ if (!strlower_m(acct_name)) {
+ status = NT_STATUS_INVALID_PARAMETER;
+ goto done;
+ }
init_lsa_String(&lsa_acct_name, acct_name);
/* Create domain user */
acct_name = talloc_asprintf(mem_ctx, "%s$", r->in.machine_name);
- strlower_m(acct_name);
+ if (!strlower_m(acct_name)) {
+ status = NT_STATUS_INVALID_PARAMETER;
+ goto done;
+ }
init_lsa_String(&lsa_acct_name, acct_name);
return -1;
}
- strlower_m(host_princ_s);
+ if (!strlower_m(host_princ_s)) {
+ SAFE_FREE(host_princ_s);
+ return -1;
+ }
ret = smb_krb5_parse_name(krbctx, host_princ_s, host_princ);
if (ret) {
DEBUG(1, (__location__ ": smb_krb5_parse_name(%s) "
if (tmp == NULL) {
return false;
}
- strlower_m(tmp);
+ if (!strlower_m(tmp)) {
+ return false;
+ }
name = tmp;
}
result = talloc_strdup(ctx, src);
SMB_ASSERT(result != NULL);
- strlower_m(result);
+ if (!strlower_m(result)) {
+ TALLOC_FREE(result);
+ return NULL;
+ }
return result;
}
/* Is it a usershare service ? */
if (iService < 0 && *lp_usershare_path(talloc_tos())) {
/* Ensure the name is canonicalized. */
- strlower_m(*p_service_out);
+ if (!strlower_m(*p_service_out)) {
+ goto fail;
+ }
iService = load_usershare_service(*p_service_out);
}
/* lowercase the username before creating the Unix account for
compatibility with previous Samba releases */
fstrcpy( name2, name );
- strlower_m( name2 );
+ if (!strlower_m( name2 )) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
add_script = talloc_all_string_sub(tmp_ctx,
add_script,
"%u",
external scripts */
fstrcpy( username, pdb_get_username(sam_acct) );
- strlower_m( username );
+ if (!strlower_m( username )) {
+ return status;
+ }
smb_delete_user( username );
if (info->dns_domain == NULL) {
goto fail;
}
- strlower_m(info->dns_domain);
+ if (!strlower_m(info->dns_domain)) {
+ goto fail;
+ }
info->dns_forest = talloc_strdup(info, info->dns_domain);
/* we expect a domain SID to have 4 sub IDs */
posix name but preserve the case in passdb */
fstrcpy( oldname_lower, oldname );
- strlower_m( oldname_lower );
+ if (!strlower_m( oldname_lower )) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
fstrcpy( newname_lower, newname );
- strlower_m( newname_lower );
+ if (!strlower_m( newname_lower )) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
rename_script = realloc_string_sub2(rename_script,
"%unew",
newname_lower,
/* Data is stored in all lower-case */
fstrcpy(name, sname);
- strlower_m(name);
+ if (!strlower_m(name)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
/* set search key */
slprintf(keystr, sizeof(keystr)-1, "%s%s", USERPREFIX, name);
NTSTATUS status;
fstrcpy(name, pdb_get_username(sam_pass));
- strlower_m(name);
+ if (!strlower_m(name)) {
+ return false;
+ }
/* set the search key */
}
fstrcpy(name, pdb_get_username(sam_pass));
- strlower_m(name);
+ if (!strlower_m(name)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
/* set the search key */
data.dptr = buf;
fstrcpy(name, pdb_get_username(newpwd));
- strlower_m(name);
+ if (!strlower_m(name)) {
+ goto done;
+ }
DEBUG(5, ("Storing %saccount %s with RID %d\n",
flag == TDB_INSERT ? "(new) " : "", name,
NTSTATUS status;
fstrcpy(name, pdb_get_username(newpwd));
- strlower_m(name);
+ if (!strlower_m(name)) {
+ return false;
+ }
/* setup RID data */
data = string_term_tdb_data(name);
so that we lower case the posix name but preserve the case in passdb */
fstrcpy( oldname_lower, pdb_get_username(old_acct) );
- strlower_m( oldname_lower );
+ if (!strlower_m( oldname_lower )) {
+ goto cancel;
+ }
fstrcpy( newname_lower, newname );
- strlower_m( newname_lower );
+ if (!strlower_m( newname_lower )) {
+ goto cancel;
+ }
rename_script = talloc_string_sub2(new_acct,
rename_script,
printer status line:
handle them so that most severe condition is shown */
int i;
- strlower_m(line);
+ if (!strlower_m(line)) {
+ return false;
+ }
switch (status->status) {
case LPSTAT_OK:
TDB_DATA key;
fstrcpy(share, sharename);
- strlower_m(share);
+ (void)strlower_m(share);
keystr = talloc_asprintf(ctx, "%s%s", PRINTERS_PREFIX, share);
key = string_term_tdb_data(keystr ? keystr : "");
TDB_DATA key;
fstrcpy(share, sharename );
- strlower_m(share);
+ (void)strlower_m(share);
keystr = talloc_asprintf(ctx, "%s%s", SECDESC_PREFIX, share);
key = string_term_tdb_data(keystr ? keystr : "");
if (!altpath) {
return WERR_NOMEM;
}
- strlower_m(altpath);
+ if (!strlower_m(altpath)) {
+ return WERR_INVALID_PARAM;
+ }
DEBUG(5,("init_reply_dfs_remove: Request to remove %s -> %s\\%s.\n",
r->in.dfs_entry_path, r->in.servername, r->in.sharename));
}
if (!dnsdomain) {
return WERR_NOMEM;
}
- strlower_m(dnsdomain);
+ if (!strlower_m(dnsdomain)) {
+ return WERR_INVALID_PARAM;
+ }
basic->dns_domain = dnsdomain;
/* FIXME!! We really should fill in the correct forest
memset(blob_out.data, '\0', 16);
checked_strlcpy(unix_name, lp_netbios_name(), sizeof(unix_name));
- strlower_m(unix_name);
+ (void)strlower_m(unix_name);
push_ascii_nstring(dos_name, unix_name);
strlcpy((char *)blob_out.data, dos_name, 17);
return NULL;
}
- strlower_m(service);
+ if (!strlower_m(service)) {
+ DEBUG(2, ("strlower_m %s failed\n", service));
+ *status = NT_STATUS_INVALID_PARAMETER;
+ return NULL;
+ }
snum = find_service(talloc_tos(), service, &service);
if (!service) {
return NT_STATUS_NO_MEMORY;
}
- strlower_m(service);
+ if (!strlower_m(service)) {
+ DEBUG(2, ("strlower_m %s failed\n", service));
+ return NT_STATUS_INVALID_PARAMETER;
+ }
/* TODO: do more things... */
if (strequal(service,HOMES_NAME)) {
fstrcpy(state->short_name, f->short_name ? f->short_name : "");
- strlower_m(state->short_name);
+ (void)strlower_m(state->short_name);
*state->pp_long_name = SMB_STRDUP(f->name);
if (!*state->pp_long_name) {
return NT_STATUS_NO_MEMORY;
}
- strlower_m(*state->pp_long_name);
+ (void)strlower_m(*state->pp_long_name);
return NT_STATUS_OK;
}
} else {
name_to_fqdn( machine_name, lp_netbios_name() );
}
- strlower_m( machine_name );
+ if (!strlower_m( machine_name )) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
if (num_addrs == 0 || iplist == NULL) {
/*
}
fstrcpy(my_name, lp_netbios_name());
- strlower_m(my_name);
+ if (!strlower_m(my_name)) {
+ ads_destroy(&ads);
+ return -1;
+ }
+
if (asprintf(&host_principal, "%s$@%s", my_name, ads->config.realm) == -1) {
ads_destroy(&ads);
return -1;
status = NT_STATUS_NO_MEMORY;
goto done;
}
- strlower_m(acct_name);
+ if (!strlower_m(acct_name)) {
+ status = NT_STATUS_INVALID_PARAMETER;
+ goto done;
+ }
init_lsa_String(&lsa_acct_name, acct_name);
return net_usershare_info_usage(c, argc, argv);
}
- strlower_m(wcard);
+ if (!strlower_m(wcard)) {
+ return -1;
+ }
ctx = talloc_init("share_info");
ret = get_share_list(ctx, wcard, only_ours);
return net_usershare_list_usage(c, argc, argv);
}
- strlower_m(wcard);
+ if (!strlower_m(wcard)) {
+ return -1;
+ }
ctx = talloc_init("share_list");
ret = get_share_list(ctx, wcard, only_ours);
return -1;
}
- strlower_m(name);
+ if (!strlower_m(name)) {
+ fprintf(stderr, "strlower_m %s failed\n", name);
+ TALLOC_FREE(sam_pwent);
+ return -1;
+ }
ret = pdb_getsampwnam(sam_pwent, name);
if (!ret) {
return -1;
}
- strlower_m(name);
+ if (!strlower_m(name)) {
+ fprintf(stderr, "strlower_m %s failed\n", name);
+ return -1;
+ }
flags = LOCAL_ADD_USER | LOCAL_TRUST_ACCOUNT | LOCAL_SET_PASSWORD;
if (local_flags & LOCAL_ADD_USER) {
SAFE_FREE(new_passwd);
new_passwd = smb_xstrdup(user_name);
- strlower_m(new_passwd);
+ if (!strlower_m(new_passwd)) {
+ fprintf(stderr, "strlower_m %s failed\n",
+ new_passwd);
+ exit(1);
+ }
}
/*
/* Username */
fstrcpy(user_name, state->info->acct_name);
- strlower_m(user_name);
+ if (!strlower_m(user_name)) {
+ tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
+ }
status = normalize_name_map(state, domain, user_name, &mapped_name);
/* Basic removal of whitespace */
if (!strupper_m(discard_const_p(char, domain_name))) {
return NT_STATUS_INVALID_PARAMETER;
}
- strlower_m(discard_const_p(char, name));
+ (void)strlower_m(discard_const_p(char, name));
wcache_save_sid_to_name(domain, status, sid, domain_name, name, *type);
}
}
return NT_STATUS_NO_MEMORY;
}
- strlower_m(afsname);
+ if (!strlower_m(afsname)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
DEBUG(10, ("Generating token for user %s\n", afsname));
fstring tmp_user;
fstrcpy(tmp_user, user);
- strlower_m(tmp_user);
+ (void)strlower_m(tmp_user);
if (can_assume && assume_domain(domain)) {
strlcpy(name, tmp_user, sizeof(fstring));
char *tmp_user, *name;
tmp_user = talloc_strdup(mem_ctx, user);
- strlower_m(tmp_user);
+ if (!strlower_m(tmp_user)) {
+ TALLOC_FREE(tmp_user);
+ return NULL;
+ }
if (can_assume && assume_domain(domain)) {
name = tmp_user;