version 1.237, 2023/08/16 16:14:11 |
version 1.238, 2024/05/17 00:30:24 |
|
|
fatal_fr(r, "assemble %s", #id); \ |
fatal_fr(r, "assemble %s", #id); \ |
} while (0) |
} while (0) |
|
|
|
void |
|
mm_encode_server_options(struct sshbuf *m) |
|
{ |
|
int r; |
|
u_int i; |
|
|
|
/* XXX this leaks raw pointers to the unpriv child processes */ |
|
if ((r = sshbuf_put_string(m, &options, sizeof(options))) != 0) |
|
fatal_fr(r, "assemble options"); |
|
|
|
#define M_CP_STROPT(x) do { \ |
|
if (options.x != NULL && \ |
|
(r = sshbuf_put_cstring(m, options.x)) != 0) \ |
|
fatal_fr(r, "assemble %s", #x); \ |
|
} while (0) |
|
#define M_CP_STRARRAYOPT(x, nx) do { \ |
|
for (i = 0; i < options.nx; i++) { \ |
|
if ((r = sshbuf_put_cstring(m, options.x[i])) != 0) \ |
|
fatal_fr(r, "assemble %s", #x); \ |
|
} \ |
|
} while (0) |
|
/* See comment in servconf.h */ |
|
COPY_MATCH_STRING_OPTS(); |
|
#undef M_CP_STROPT |
|
#undef M_CP_STRARRAYOPT |
|
} |
|
|
/* Retrieves the password entry and also checks if the user is permitted */ |
/* Retrieves the password entry and also checks if the user is permitted */ |
int |
int |
mm_answer_pwnamallow(struct ssh *ssh, int sock, struct sshbuf *m) |
mm_answer_pwnamallow(struct ssh *ssh, int sock, struct sshbuf *m) |
{ |
{ |
struct passwd *pwent; |
struct passwd *pwent; |
int r, allowed = 0; |
int r, allowed = 0; |
u_int i; |
|
|
|
debug3_f("entering"); |
debug3_f("entering"); |
|
|
|
|
out: |
out: |
ssh_packet_set_log_preamble(ssh, "%suser %s", |
ssh_packet_set_log_preamble(ssh, "%suser %s", |
authctxt->valid ? "authenticating" : "invalid ", authctxt->user); |
authctxt->valid ? "authenticating" : "invalid ", authctxt->user); |
if ((r = sshbuf_put_string(m, &options, sizeof(options))) != 0) |
|
fatal_fr(r, "assemble options"); |
|
|
|
#define M_CP_STROPT(x) do { \ |
/* Send active options to unpriv */ |
if (options.x != NULL && \ |
mm_encode_server_options(m); |
(r = sshbuf_put_cstring(m, options.x)) != 0) \ |
|
fatal_fr(r, "assemble %s", #x); \ |
|
} while (0) |
|
#define M_CP_STRARRAYOPT(x, nx) do { \ |
|
for (i = 0; i < options.nx; i++) { \ |
|
if ((r = sshbuf_put_cstring(m, options.x[i])) != 0) \ |
|
fatal_fr(r, "assemble %s", #x); \ |
|
} \ |
|
} while (0) |
|
/* See comment in servconf.h */ |
|
COPY_MATCH_STRING_OPTS(); |
|
#undef M_CP_STROPT |
|
#undef M_CP_STRARRAYOPT |
|
|
|
/* Create valid auth method lists */ |
/* Create valid auth method lists */ |
if (auth2_setup_methods_lists(authctxt) != 0) { |
if (auth2_setup_methods_lists(authctxt) != 0) { |