diff options
author | Volker Lendecke <vl@samba.org> | 2011-01-02 12:42:47 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2011-01-07 13:28:05 +0100 |
commit | 0376d03e6db6713285bad9ad27c3b48e8c11b848 (patch) | |
tree | 367cef4ef574a66ba810f03c8d136d267913ec6a | |
parent | 6ba4bddb61cb6033a7937152966a608c1bbced40 (diff) | |
download | samba-0376d03e6db6713285bad9ad27c3b48e8c11b848.tar.gz samba-0376d03e6db6713285bad9ad27c3b48e8c11b848.tar.bz2 samba-0376d03e6db6713285bad9ad27c3b48e8c11b848.zip |
s3: Lift my_mailslot from prep_getdc_request
-rw-r--r-- | source3/libsmb/clidgram.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/source3/libsmb/clidgram.c b/source3/libsmb/clidgram.c index c9592a15ac..734564dcbb 100644 --- a/source3/libsmb/clidgram.c +++ b/source3/libsmb/clidgram.c @@ -117,13 +117,12 @@ static bool prep_getdc_request(const struct sockaddr_storage *dc_ss, const char *domain_name, const struct dom_sid *sid, uint32_t nt_version, + const char *my_mailslot, int dgm_id, struct packet_struct *p) { TALLOC_CTX *frame = talloc_stackframe(); - struct in_addr dc_ip; const char *my_acct_name; - const char *my_mailslot; struct nbt_netlogon_packet packet; struct NETLOGON_SAM_LOGON_REQUEST *s; enum ndr_err_code ndr_err; @@ -131,10 +130,6 @@ static bool prep_getdc_request(const struct sockaddr_storage *dc_ss, struct dom_sid my_sid; bool ret = false; - if (dc_ss->ss_family != AF_INET) { - goto fail; - } - ZERO_STRUCT(packet); ZERO_STRUCT(my_sid); @@ -142,13 +137,6 @@ static bool prep_getdc_request(const struct sockaddr_storage *dc_ss, my_sid = *sid; } - dc_ip = ((struct sockaddr_in *)dc_ss)->sin_addr; - - my_mailslot = mailslot_name(talloc_tos(), dc_ip); - if (my_mailslot == NULL) { - goto fail; - } - my_acct_name = talloc_asprintf(talloc_tos(), "%s$", global_myname()); if (my_acct_name == NULL) { goto fail; @@ -195,21 +183,37 @@ bool send_getdc_request(struct messaging_context *msg_ctx, { struct packet_struct p; pid_t nmbd_pid; + char *my_mailslot; + struct in_addr dc_ip; + NTSTATUS status; if ((nmbd_pid = pidfile_pid("nmbd")) == 0) { DEBUG(3, ("No nmbd found\n")); return False; } + if (dc_ss->ss_family != AF_INET) { + return false; + } + dc_ip = ((struct sockaddr_in *)dc_ss)->sin_addr; + + my_mailslot = mailslot_name(talloc_tos(), dc_ip); + if (my_mailslot == NULL) { + return NULL; + } + if (!prep_getdc_request(dc_ss, domain_name, sid, nt_version, - dgm_id, &p)) { + my_mailslot, dgm_id, &p)) { + TALLOC_FREE(my_mailslot); return false; } - return NT_STATUS_IS_OK(messaging_send_buf(msg_ctx, - pid_to_procid(nmbd_pid), - MSG_SEND_PACKET, - (uint8 *)&p, sizeof(p))); + status = messaging_send_buf(msg_ctx, pid_to_procid(nmbd_pid), + MSG_SEND_PACKET, + (uint8 *)&p, sizeof(p)); + TALLOC_FREE(my_mailslot); + + return NT_STATUS_IS_OK(status); } bool receive_getdc_response(TALLOC_CTX *mem_ctx, |