* When translating the input from a REGI command into a vCard, set the telephone...
[citadel.git] / citadel / chkpwd.c
bloba2235bdfd214978ad42dd45c3de95fdf78a07654
1 /*
2 * $Id$
4 * a setuid helper program for machines which use shadow passwords
5 * by Nathan Bryant, March 1999
7 */
9 #include <pwd.h>
10 #include <stdio.h>
11 #include <limits.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <syslog.h>
15 #include <unistd.h>
16 #include <sys/types.h>
18 #include "auth.h"
19 #include "config.h"
20 #include "citadel_dirs.h"
21 #include "citadel.h"
23 int main(void)
25 uid_t uid;
26 char buf[SIZ];
28 while (1) {
29 buf[0] = '\0';
30 read(0, &uid, sizeof(uid_t)); /* uid */
31 read(0, buf, 256); /* password */
33 if (buf[0] == '\0')
34 return (0);
35 if (validate_password(uid, buf)) {
36 write(1, "PASS", 4);
38 else {
39 write(1, "FAIL", 4);
43 return(0);