mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s3/lib: use talloc_alpha_strcpy() in set_remote_machine_name()
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
1a8e6271c6
commit
e3cd8e46b3
@ -94,7 +94,6 @@ bool set_remote_machine_name(const char *remote_name, bool perm)
|
|||||||
{
|
{
|
||||||
static bool already_perm = False;
|
static bool already_perm = False;
|
||||||
char *tmp_remote_machine;
|
char *tmp_remote_machine;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
if (already_perm) {
|
if (already_perm) {
|
||||||
return true;
|
return true;
|
||||||
@ -107,16 +106,12 @@ bool set_remote_machine_name(const char *remote_name, bool perm)
|
|||||||
trim_char(tmp_remote_machine,' ',' ');
|
trim_char(tmp_remote_machine,' ',' ');
|
||||||
|
|
||||||
TALLOC_FREE(remote_machine);
|
TALLOC_FREE(remote_machine);
|
||||||
len = strlen(tmp_remote_machine);
|
remote_machine = talloc_alpha_strcpy(NULL,
|
||||||
remote_machine = (char *)TALLOC_ZERO(NULL, len+1);
|
tmp_remote_machine,
|
||||||
if (!remote_machine) {
|
SAFE_NETBIOS_CHARS);
|
||||||
TALLOC_FREE(tmp_remote_machine);
|
if (remote_machine == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* alpha_strcpy includes the space for the terminating nul. */
|
|
||||||
alpha_strcpy(remote_machine,tmp_remote_machine,
|
|
||||||
SAFE_NETBIOS_CHARS,len+1);
|
|
||||||
if (!strlower_m(remote_machine)) {
|
if (!strlower_m(remote_machine)) {
|
||||||
TALLOC_FREE(tmp_remote_machine);
|
TALLOC_FREE(tmp_remote_machine);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user