Back to index

courier  0.68.2
sqwebpasswd.c
Go to the documentation of this file.
00001 #include "config.h"
00002 /*
00003 ** Copyright 2000-2001 Double Precision, Inc.  See COPYING for
00004 ** distribution information.
00005 */
00006 
00007 #include      "auth.h"
00008 #include      <stdio.h>
00009 #include      <stdlib.h>
00010 #include      <string.h>
00011 #if    HAVE_UNISTD_H
00012 #include      <unistd.h>
00013 #endif
00014 #include      <fcntl.h>
00015 #include        <unistd.h>
00016 #include        <stdlib.h>
00017 #include        <errno.h>
00018 #include      <signal.h>
00019 
00020 
00021 extern int authdaemondopasswd(char *, int);
00022 
00023 int main()
00024 {
00025        char buf[BUFSIZ];
00026        char *p;
00027 
00028        strcpy(buf,"PASSWD ");
00029 
00030        if (fgets(buf+7, sizeof(buf)-10, stdin) == NULL)
00031               exit(1);
00032 
00033        if ((p=strchr(buf, '\n')) != 0)
00034               *p=0;
00035 
00036        strcat(buf, "\n");
00037        signal(SIGPIPE, SIG_IGN);
00038        if (authdaemondopasswd(buf, sizeof(buf)))
00039        {
00040               sleep(5);
00041               exit(1);
00042        }
00043        exit(0);
00044        return (0);
00045 }