mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s3-lsa-server: fix _lsa_GetUserName.
Guenther
This commit is contained in:
parent
f0b1a1bc9b
commit
b11f3a60fd
@ -1462,6 +1462,16 @@ NTSTATUS _lsa_GetUserName(pipes_struct *p,
|
||||
struct lsa_String *account_name = NULL;
|
||||
struct lsa_String *authority_name = NULL;
|
||||
|
||||
if (r->in.account_name &&
|
||||
*r->in.account_name) {
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (r->in.authority_name &&
|
||||
*r->in.authority_name) {
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (p->server_info->guest) {
|
||||
/*
|
||||
* I'm 99% sure this is not the right place to do this,
|
||||
@ -1477,21 +1487,24 @@ NTSTATUS _lsa_GetUserName(pipes_struct *p,
|
||||
domname = pdb_get_domain(p->server_info->sam_account);
|
||||
}
|
||||
|
||||
account_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
|
||||
account_name = TALLOC(p->mem_ctx, struct lsa_String);
|
||||
if (!account_name) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
init_lsa_String(account_name, username);
|
||||
|
||||
authority_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
|
||||
if (!authority_name) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
if (r->out.authority_name) {
|
||||
authority_name = TALLOC(p->mem_ctx, struct lsa_String);
|
||||
if (!authority_name) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
init_lsa_String(authority_name, domname);
|
||||
}
|
||||
|
||||
init_lsa_String(account_name, username);
|
||||
init_lsa_String(authority_name, domname);
|
||||
|
||||
*r->out.account_name = account_name;
|
||||
*r->out.authority_name = authority_name;
|
||||
if (r->out.authority_name) {
|
||||
*r->out.authority_name = authority_name;
|
||||
}
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
@ -1182,7 +1182,8 @@ static NTSTATUS cmd_lsa_get_username(struct rpc_pipe_client *cli,
|
||||
/* Print results */
|
||||
|
||||
printf("Account Name: %s, Authority Name: %s\n",
|
||||
account_name->string, authority_name->string);
|
||||
account_name->string, authority_name ? authority_name->string :
|
||||
"");
|
||||
|
||||
rpccli_lsa_Close(cli, mem_ctx, &pol);
|
||||
done:
|
||||
|
Loading…
Reference in New Issue
Block a user