Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace more SASL calls #4510

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 50 additions & 6 deletions ldap/servers/slapd/saslbind.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,54 @@ ids_sasl_server_new(Connection *conn)
return;
}

/*
* start a sasl server connection
*/
int
ids_sasl_server_start(Connection *conn, const char *mech,
struct berval *cred,
const char **sdata, unsigned int *slen)
{
int rc;
sasl_conn_t *sasl_conn;

slapi_log_err(SLAPI_LOG_TRACE, "ids_sasl_server_start", "=> (mech=%s)\n",
mech);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also log the connection ID in the logging (before and after):

slapi_log_err(SLAPI_LOG_CONNS, "ids_sasl_server_start", "=> (conn=%" PRIu64 " mech=%s)\n",
              conn->c_connid, mech);
...
slapi_log_err(SLAPI_LOG_CONNS, "ids_sasl_server_start", "<= (conn=%" PRIu64 " rc=%s)\n",
              conn->c_connid, sasl_errstring(rc, NULL, NULL));


sasl_conn = (sasl_conn_t *)conn->c_sasl_conn;
rc = sasl_server_start(sasl_conn, mech,
cred->bv_val, cred->bv_len,
sdata, slen);

slapi_log_err(SLAPI_LOG_TRACE, "ids_sasl_server_start", "<= (rc=%s)\n",
sasl_errstring(rc, NULL, NULL));

return rc;
}

/*
* perform a sasl server step
*/
int
ids_sasl_server_step(Connection *conn, struct berval *cred,
const char **sdata, unsigned int *slen)
{
int rc;
sasl_conn_t *sasl_conn;

slapi_log_err(SLAPI_LOG_TRACE, "ids_sasl_server_step", "=>\n");

sasl_conn = (sasl_conn_t *)conn->c_sasl_conn;
rc = sasl_server_step(sasl_conn,
cred->bv_val, cred->bv_len,
sdata, slen);

slapi_log_err(SLAPI_LOG_TRACE, "ids_sasl_server_step", "<= (rc=%s)\n",
sasl_errstring(rc, NULL, NULL));

return rc;
}

/*
* return sasl mechanisms available on this connection.
* caller must free returned charray.
Expand Down Expand Up @@ -945,9 +993,7 @@ ids_sasl_check_bind(Slapi_PBlock *pb)
goto sasl_start;
}

rc = sasl_server_step(sasl_conn,
cred->bv_val, cred->bv_len,
&sdata, &slen);
rc = ids_sasl_server_step(pb_conn, cred, &sdata, &slen);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on what we want to do here, we could add these in #ifdef DEBUG.

goto sasl_check_result;
}

Expand Down Expand Up @@ -984,9 +1030,7 @@ ids_sasl_check_bind(Slapi_PBlock *pb)
}
}

rc = sasl_server_start(sasl_conn, mech,
cred->bv_val, cred->bv_len,
&sdata, &slen);
rc = ids_sasl_server_start(pb_conn, mech, cred, &sdata, &slen);

sasl_check_result:

Expand Down