diff options
Diffstat (limited to 'source3/smbd/negprot.c')
-rw-r--r-- | source3/smbd/negprot.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 6877ccc861..a6d7cc0ab3 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -224,7 +224,7 @@ DATA_BLOB negprot_spnego(TALLOC_CTX *ctx, struct smbd_server_connection *sconn) } else { fstring myname; char *host_princ_s = NULL; - name_to_fqdn(myname, global_myname()); + name_to_fqdn(myname, lp_netbios_name()); strlower_m(myname); if (asprintf(&host_princ_s, "cifs/%s@%s", myname, lp_realm()) == -1) { @@ -234,6 +234,10 @@ DATA_BLOB negprot_spnego(TALLOC_CTX *ctx, struct smbd_server_connection *sconn) SAFE_FREE(host_princ_s); } + if (blob.length == 0 || blob.data == NULL) { + return data_blob_null; + } + blob_out = data_blob_talloc(ctx, NULL, 16 + blob.length); if (blob_out.data == NULL) { data_blob_free(&blob); @@ -242,10 +246,10 @@ DATA_BLOB negprot_spnego(TALLOC_CTX *ctx, struct smbd_server_connection *sconn) memset(blob_out.data, '\0', 16); - checked_strlcpy(unix_name, global_myname(), sizeof(unix_name)); + checked_strlcpy(unix_name, lp_netbios_name(), sizeof(unix_name)); strlower_m(unix_name); push_ascii_nstring(dos_name, unix_name); - safe_strcpy((char *)blob_out.data, dos_name, 16); + strlcpy((char *)blob_out.data, dos_name, 17); #ifdef DEVELOPER /* Fix valgrind 'uninitialized bytes' issue. */ @@ -569,7 +573,7 @@ void reply_negprot(struct smb_request *req) char **tmp; - tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), cliprotos, char *, + tmp = talloc_realloc(talloc_tos(), cliprotos, char *, num_cliprotos+1); if (tmp == NULL) { DEBUG(0, ("talloc failed\n")); @@ -712,6 +716,11 @@ void reply_negprot(struct smb_request *req) } TALLOC_FREE(cliprotos); + + if (lp_async_smb_echo_handler() && !fork_echo_handler(sconn)) { + exit_server("Failed to fork echo handler"); + } + END_PROFILE(SMBnegprot); return; } |