typedef void (*stdio_helper_function)(enum stdio_helper_mode stdio_helper_mode,
+ struct loadparm_context *lp_ctx,
char *buf, int length, void **private,
unsigned int mux_id, void **private2);
static void manage_squid_basic_request (enum stdio_helper_mode stdio_helper_mode,
+ struct loadparm_context *lp_ctx,
char *buf, int length, void **private,
unsigned int mux_id, void **private2);
static void manage_gensec_request (enum stdio_helper_mode stdio_helper_mode,
+ struct loadparm_context *lp_ctx,
char *buf, int length, void **private,
unsigned int mux_id, void **private2);
static void manage_ntlm_server_1_request (enum stdio_helper_mode stdio_helper_mode,
+ struct loadparm_context *lp_ctx,
char *buf, int length, void **private,
unsigned int mux_id, void **private2);
form DOMAIN/user into a domain and a user */
static bool parse_ntlm_auth_domain_user(const char *domuser, fstring domain,
- fstring user)
+ fstring user, char winbind_separator)
{
- char *p = strchr(domuser,*lp_winbind_separator(global_loadparm));
+ char *p = strchr(domuser, winbind_separator);
if (!p) {
return false;
/* authenticate a user with an encrypted username/password */
-static NTSTATUS local_pw_check_specified(const char *username,
+static NTSTATUS local_pw_check_specified(struct loadparm_context *lp_ctx,
+ const char *username,
const char *domain,
const char *workstation,
const DATA_BLOB *challenge,
nt_status = ntlm_password_check(mem_ctx,
+ lp_ctx,
MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT |
MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT,
challenge,
if (unix_name) {
asprintf(unix_name,
"%s%c%s", domain,
- *lp_winbind_separator(global_loadparm),
+ *lp_winbind_separator(lp_ctx),
username);
}
} else {
}
static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode,
+ struct loadparm_context *lp_ctx,
char *buf, int length, void **private,
unsigned int mux_id, void **private2)
{
to the calling application. The callback comes from within gensec */
static void manage_gensec_get_pw_request(enum stdio_helper_mode stdio_helper_mode,
+ struct loadparm_context *lp_ctx,
char *buf, int length, void **private,
unsigned int mux_id, void **password)
{
}
/**
- * Callback for password credentails. This is not async, and when
- * GENSEC and the credentails code is made async, it will look rather
+ * Callback for password credentials. This is not async, and when
+ * GENSEC and the credentials code is made async, it will look rather
* different.
*/
}
static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
+ struct loadparm_context *lp_ctx,
char *buf, int length, void **private,
unsigned int mux_id, void **private2)
{
case NTLMSSP_CLIENT_1:
/* setup the client side */
- nt_status = gensec_client_start(NULL, &state->gensec_state, NULL);
+ nt_status = gensec_client_start(NULL, &state->gensec_state, NULL, lp_ctx);
if (!NT_STATUS_IS_OK(nt_status)) {
exit(1);
}
if (!ev) {
exit(1);
}
- msg = messaging_client_init(state, lp_messaging_path(state, global_loadparm), ev);
+ msg = messaging_client_init(state, lp_messaging_path(state, lp_ctx), ev);
if (!msg) {
exit(1);
}
- if (!NT_STATUS_IS_OK(gensec_server_start(state, ev, msg, &state->gensec_state))) {
+ if (!NT_STATUS_IS_OK(gensec_server_start(state, ev, lp_ctx, msg, &state->gensec_state))) {
exit(1);
}
break;
}
creds = cli_credentials_init(state->gensec_state);
- cli_credentials_set_conf(creds, global_loadparm);
+ cli_credentials_set_conf(creds, lp_ctx);
if (opt_username) {
cli_credentials_set_username(creds, opt_username, CRED_SPECIFIED);
}
reply_code = "AF";
reply_arg = talloc_asprintf(state->gensec_state,
"%s%s%s", session_info->server_info->domain_name,
- lp_winbind_separator(global_loadparm), session_info->server_info->account_name);
+ lp_winbind_separator(lp_ctx), session_info->server_info->account_name);
talloc_free(session_info);
}
} else if (state->gensec_state->gensec_role == GENSEC_CLIENT) {
}
static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mode,
+ struct loadparm_context *lp_ctx,
char *buf, int length, void **private,
unsigned int mux_id, void **private2)
{
} else if (plaintext_password) {
/* handle this request as plaintext */
if (!full_username) {
- if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(global_loadparm), username) == -1) {
+ if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(lp_ctx), username) == -1) {
mux_printf(mux_id, "Error: Out of memory in asprintf!\n.\n");
return;
}
fstring fstr_user;
fstring fstr_domain;
- if (!parse_ntlm_auth_domain_user(full_username, fstr_user, fstr_domain)) {
+ if (!parse_ntlm_auth_domain_user(full_username, fstr_user, fstr_domain,
+ *lp_winbind_separator(lp_ctx))) {
/* username might be 'tainted', don't print into our new-line deleimianted stream */
mux_printf(mux_id, "Error: Could not parse into domain and username\n");
}
}
if (!domain) {
- domain = smb_xstrdup(lp_workgroup(global_loadparm));
+ domain = smb_xstrdup(lp_workgroup(lp_ctx));
}
if (ntlm_server_1_lm_session_key)
flags |= NTLM_AUTH_FLAG_USER_SESSION_KEY;
if (!NT_STATUS_IS_OK(
- local_pw_check_specified(username,
+ local_pw_check_specified(lp_ctx,
+ username,
domain,
- lp_netbios_name(global_loadparm),
+ lp_netbios_name(lp_ctx),
&challenge,
&lm_response,
&nt_response,
private = &normal_private;
}
- fn(helper_mode, c, length, private, mux_id, private2);
+ fn(helper_mode, global_loadparm, c, length, private, mux_id, private2);
talloc_free(buf);
}
return 1;
}
- gensec_init();
+ gensec_init(global_loadparm);
if (opt_domain == NULL) {
opt_domain = lp_workgroup(global_loadparm);