From: Paul L. <pdo...@us...> - 2005-06-17 07:29:55
|
Update of /cvsroot/serverfilters/serversidefilter/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12559/script Modified Files: filtercmd.c Log Message: Adding delrc command to filtercmd script Index: filtercmd.c =================================================================== RCS file: /cvsroot/serverfilters/serversidefilter/script/filtercmd.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filtercmd.c 17 Jun 2005 04:43:52 -0000 1.3 --- filtercmd.c 17 Jun 2005 07:29:46 -0000 1.4 *************** *** 7,10 **** --- 7,11 ---- * filtercmd getrc rctype > temprcfile < credentials * filtercmd putrc rctype < credentials < temprcfile + * filtercmd delrc rctype < credentials * filtercmd rcexists rctype < credentials * *************** *** 12,16 **** * * The filtercmd program allows an unpriviledged program ! * (squirrelmail) to work with users' mail filtering configuration * files. The format of the mail filtering configuration files is not * parsed in any way. This program only handles reading and writing --- 13,17 ---- * * The filtercmd program allows an unpriviledged program ! * (SquirrelMail) to work with users' mail filtering configuration * files. The format of the mail filtering configuration files is not * parsed in any way. This program only handles reading and writing *************** *** 26,29 **** --- 27,32 ---- * reading the credentials, and replace the existing rcfile. * + * The delrc command will remove the rc file if it exists. + * * The rcexists command will return a zero exit status if the rc file exists, * non-zero otherwise. *************** *** 109,113 **** #define STR_MAX 1024 #define MAXLEN 1024 ! #define VERSION "filtercmd 1.41, part of serversidefilter for squirrelmail" /* define this in filtercmd.opts */ --- 112,116 ---- #define STR_MAX 1024 #define MAXLEN 1024 ! #define VERSION "filtercmd 1.5, part of serversidefilter for squirrelmail" /* define this in filtercmd.opts */ *************** *** 273,276 **** --- 276,288 ---- return putrc(filter_file, UID, GID); + } else if (!strcmp("delrc", cmd)) { + if (argc < 3) { + printf("Usage: filtercmd delrc filter_file\n"); + return ERR_USAGE; + } + err = findfilterfile(argv[2], filter_file, STR_MAX); + if (err) return inerror(err); + + return delrc(filter_file); } else if (!strcmp("rcexists", cmd)) { if (argc < 3) { *************** *** 285,289 **** return inerror(ERR_INVALID_COMMAND); } else { ! printf("Usage: filtercmd [getrc|putrc|rcexists]\n"); return ERR_USAGE; } --- 297,301 ---- return inerror(ERR_INVALID_COMMAND); } else { ! printf("Usage: filtercmd [getrc|putrc|delrc|rcexists]\n"); return ERR_USAGE; } *************** *** 546,549 **** --- 558,569 ---- + int delrc(char* filter_file) + { + int result; + + result = unlink(filter_file); + return result; + } + int getrc(char* filter_file) { |