1 /*
2  * $Id: vmkpasswd.c 1014 2011-02-03 16:04:37Z volz0r $
3  * Copyright (C) 1999-2009 Inter7 Internet Technologies, Inc.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18  */
19 
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <unistd.h>
23 #include <string.h>
24 #include <pwd.h>
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <fcntl.h>
28 #include <signal.h>
29 #include "config.h"
30 #include "vpopmail.h"
31 #include "vauth.h"
32 
33 char Domain[MAX_BUFF];
34 
35 void usage();
36 
main(int argc,char * argv[])37 int main(int argc, char *argv[])
38 {
39 #ifdef USE_CDB
40  int i;
41 
42 	if ( argc != 2 ) {
43 		usage();
44 		vexit(-1);
45 	}
46 
47 	memset(Domain, 0, sizeof(Domain));
48 
49 	for(i=1;i<argc;++i){
50 		if ( Domain[0] == 0 ) {
51 			snprintf(Domain, sizeof(Domain), "%s", argv[i]);
52 		}
53 	}
54 	lowerit(Domain);
55 	return(vmkpasswd( Domain ));
56 #else
57 	usage();
58 	return(vexit(0));
59 #endif
60 
61 }
62 
usage()63 void usage()
64 {
65 #ifdef USE_CDB
66 	printf("vmkpasswd: usage: domain \n");
67 #else
68 	printf("vmkpasswd: is only needed by the cdb authentication module\n");
69 #endif
70 }
71