mirror of
https://github.com/samba-team/samba.git
synced 2025-01-05 09:18:06 +03:00
netlogon_creds_cli: Simplify netlogon_creds_cli_context_common
printf knows to only print part of a string. No need to talloc_strdup. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
2591e320c0
commit
f08a04c184
@ -113,7 +113,7 @@ static NTSTATUS netlogon_creds_cli_context_common(
|
|||||||
struct netlogon_creds_cli_context *context = NULL;
|
struct netlogon_creds_cli_context *context = NULL;
|
||||||
TALLOC_CTX *frame = talloc_stackframe();
|
TALLOC_CTX *frame = talloc_stackframe();
|
||||||
char *_key_name = NULL;
|
char *_key_name = NULL;
|
||||||
char *server_netbios_name = NULL;
|
size_t server_netbios_name_len;
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
|
||||||
*_context = NULL;
|
*_context = NULL;
|
||||||
@ -172,22 +172,19 @@ static NTSTATUS netlogon_creds_cli_context_common(
|
|||||||
* For now we have to deal with
|
* For now we have to deal with
|
||||||
* "HOSTNAME" vs. "hostname.example.com".
|
* "HOSTNAME" vs. "hostname.example.com".
|
||||||
*/
|
*/
|
||||||
server_netbios_name = talloc_strdup(frame, server_computer);
|
|
||||||
if (server_netbios_name == NULL) {
|
|
||||||
TALLOC_FREE(context);
|
|
||||||
TALLOC_FREE(frame);
|
|
||||||
return NT_STATUS_NO_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = strchr(server_netbios_name, '.');
|
p = strchr(server_computer, '.');
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
p[0] = '\0';
|
server_netbios_name_len = p-server_computer;
|
||||||
|
} else {
|
||||||
|
server_netbios_name_len = strlen(server_computer);
|
||||||
}
|
}
|
||||||
|
|
||||||
_key_name = talloc_asprintf(frame, "CLI[%s/%s]/SRV[%s/%s]",
|
_key_name = talloc_asprintf(frame, "CLI[%s/%s]/SRV[%.*s/%s]",
|
||||||
client_computer,
|
client_computer,
|
||||||
client_account,
|
client_account,
|
||||||
server_netbios_name,
|
(int)server_netbios_name_len,
|
||||||
|
server_computer,
|
||||||
server_netbios_domain);
|
server_netbios_domain);
|
||||||
if (_key_name == NULL) {
|
if (_key_name == NULL) {
|
||||||
TALLOC_FREE(context);
|
TALLOC_FREE(context);
|
||||||
|
Loading…
Reference in New Issue
Block a user