diff options
Diffstat (limited to 'daemon/ntlm.c')
-rw-r--r-- | daemon/ntlm.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/daemon/ntlm.c b/daemon/ntlm.c index bb08995..2cd20db 100644 --- a/daemon/ntlm.c +++ b/daemon/ntlm.c @@ -103,13 +103,18 @@ static ntlm_connection_t* makeconnection(ha_request_t* rq, ntlm_context_t* ctx) memset(conn, 0, sizeof(*conn)); - /* - * Open a connection to to the domain controller. I don't think - * we can cache these connections or use them again as opening - * a connection here results in an nonce being generated. - */ - conn->handle = ntlmssp_connect(ctx->server, ctx->backup, - ctx->domain, (char*)conn->nonce); + ha_lock(&g_smblib_mutex); + + /* + * Open a connection to to the domain controller. I don't think + * we can cache these connections or use them again as opening + * a connection here results in an nonce being generated. + */ + conn->handle = ntlmssp_connect(ctx->server, ctx->backup, + ctx->domain, (char*)conn->nonce); + + ha_unlock(&g_smblib_mutex); + if(!conn->handle) { ha_messagex(rq, LOG_ERR, "couldn't connect to the domain server %s (backup: %s)", @@ -128,9 +133,14 @@ static void freeconnection(ha_request_t* rq, ntlm_connection_t* conn) if(conn->handle) { + ha_lock(&g_smblib_mutex); + + ntlmssp_disconnect(conn->handle); + conn->handle = NULL; + + ha_unlock(&g_smblib_mutex); + ha_messagex(rq, LOG_DEBUG, "disconnected from server"); - ntlmssp_disconnect(conn->handle); - conn->handle = NULL; } free(conn); |