summaryrefslogtreecommitdiffstats
path: root/server/nss
diff options
context:
space:
mode:
Diffstat (limited to 'server/nss')
-rw-r--r--server/nss/pamsrv.h2
-rw-r--r--server/nss/pamsrv_cmd.c39
2 files changed, 5 insertions, 36 deletions
diff --git a/server/nss/pamsrv.h b/server/nss/pamsrv.h
index ad1fc0dc5..4dbb942f2 100644
--- a/server/nss/pamsrv.h
+++ b/server/nss/pamsrv.h
@@ -17,8 +17,6 @@ struct pam_data {
char *rhost;
uint8_t *authtok;
uint8_t *newauthtok;
-/* FIXME: delete oldauthtok if everything changed to newauthtok */
- char *oldauthtok;
};
typedef void (*pam_dp_callback_t)(struct cli_ctx *cctx, int pam_status, char *domain);
diff --git a/server/nss/pamsrv_cmd.c b/server/nss/pamsrv_cmd.c
index de8d115b9..6a36bb648 100644
--- a/server/nss/pamsrv_cmd.c
+++ b/server/nss/pamsrv_cmd.c
@@ -22,14 +22,9 @@ static int pam_parse_in_data(uint8_t *body, size_t blen, struct pam_data *pd) {
int last=blen-1;
char *delim;
- if (body[last] != '\0') {
- return EINVAL;
- }
-
start = end = 0;
while ( end < last && body[end++]!='\0');
pd->user = (char *) &body[start];
- DEBUG(4, ("%d %d %d\n", start, end, blen));
delim = strchr(pd->user, SSS_DOMAIN_DELIM);
if (delim != NULL ) {
@@ -42,33 +37,18 @@ static int pam_parse_in_data(uint8_t *body, size_t blen, struct pam_data *pd) {
start = end;
while ( end < last && body[end++]!='\0');
pd->service = (char *) &body[start];
- DEBUG(4, ("%d %d %d\n", start, end, blen));
start = end;
while ( end < last && body[end++]!='\0');
pd->tty = (char *) &body[start];
- DEBUG(4, ("%d %d %d\n", start, end, blen));
start = end;
while ( end < last && body[end++]!='\0');
pd->ruser = (char *) &body[start];
- DEBUG(4, ("%d %d %d\n", start, end, blen));
start = end;
while ( end < last && body[end++]!='\0');
pd->rhost = (char *) &body[start];
- DEBUG(4, ("%d %d %d\n", start, end, blen));
-/*
- start = end;
- while ( end < last && body[end++]!='\0');
- pd->authtok = (char *) &body[start];
- DEBUG(4, ("%d %d %d\n", start, end, blen));
-
- start = end;
- while ( end < last && body[end++]!='\0');
- pd->oldauthtok = (char *) &body[start];
- DEBUG(4, ("%d %d %d\n", start, end, blen));
-*/
start = end;
pd->authtok_type = (int) body[start];
@@ -79,7 +59,6 @@ static int pam_parse_in_data(uint8_t *body, size_t blen, struct pam_data *pd) {
if ( end <= blen ) {
pd->authtok = (uint8_t *) &body[start];
} else {
- DEBUG(4, ("%d %d %d\n", start, end, blen));
DEBUG(1, ("Invalid authtok size: %d\n", pd->authtok_size));
return EINVAL;
}
@@ -94,18 +73,14 @@ static int pam_parse_in_data(uint8_t *body, size_t blen, struct pam_data *pd) {
if ( end <= blen ) {
pd->newauthtok = (uint8_t *) &body[start];
} else {
- DEBUG(4, ("%d %d %d\n", start, end, blen));
DEBUG(1, ("Invalid newauthtok size: %d\n", pd->newauthtok_size));
return EINVAL;
}
- DEBUG(4, ("%d %d %d\n", start, end, blen));
-
-
pam_print_data(pd);
return EOK;
-}
+}
static void pam_reply(struct cli_ctx *cctx, int pam_status, char *domain) {
struct sss_cmd_ctx *nctx;
@@ -158,7 +133,9 @@ static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd)
if (pd == NULL) return ENOMEM;
sss_packet_get_body(cctx->creq->in, &body, &blen);
- if (body[blen -1] != '\0') {
+ fprintf(stderr,"\n");
+ if (blen >= sizeof(uint32_t) &&
+ ((uint32_t *)(&body[blen - sizeof(uint32_t)]))[0] != END_OF_PAM_REQUEST) {
DEBUG(1, ("Received data not terminated.\n"));
talloc_free(pd);
return EINVAL;
@@ -167,13 +144,7 @@ static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd)
i=0;
str=body;
while (i<blen) {
- /*
- if (body[i] == '\0') {
- DEBUG(4, ("Received data: %s\n", str));
- str=&body[i+1];
- }
- */
- DEBUG(4, ("Received data: %x\n", body[i]));
+ DEBUG(4, ("Received data: %x\n", body[i]));
i++;
}