Browse code

fixed problem with cli_rmdirs() and some small cleanups

git-svn: trunk@315

Tomasz Kojm authored on 2004/02/21 00:49:29
Showing 16 changed files
... ...
@@ -1,3 +1,11 @@
1
+Fri Feb 20 16:49:05 CET 2004 (tk)
2
+---------------------------------
3
+  * clamscan, freshclam: removed --log-verbose (but it's still accepted by the
4
+    option parser)
5
+  * libclamav: cli_rmdirs() fixed directory permission problem (reported by
6
+	       Brian J. France <list*firehawksystems.com> and Nigel)
7
+  * doc: clamscan, clamdscan and freshclam manual pages updated
8
+
1 9
 Fri Feb 20 14:55:32 GMT 2004 (trog)
2 10
 -----------------------------------
3 11
   * libclamav/vba_extract.c: vba_decompress returns explicit data length
... ...
@@ -22,6 +22,7 @@
22 22
 
23 23
 #include <stdio.h>
24 24
 #include <stdlib.h>
25
+#include <string.h>
25 26
 #include <unistd.h>
26 27
 #include <sys/time.h>
27 28
 #include <sys/types.h>
... ...
@@ -186,7 +186,7 @@ int scan(const char *filename, unsigned long int *scanned, const struct cl_node
186 186
 
187 187
 int scanstream(int odesc, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, const struct cfgstruct *copt)
188 188
 {
189
-	int ret, flags, portscan = CL_DEFAULT_MAXPORTSCAN, sockfd, port, acceptd, tmpd, bread, count;
189
+	int ret, portscan = CL_DEFAULT_MAXPORTSCAN, sockfd, port, acceptd, tmpd, bread, count;
190 190
 	long int size = 0, maxsize = 0;
191 191
 	short bound = 0;
192 192
 	char *virname, buff[32768];
... ...
@@ -21,7 +21,10 @@
21 21
 #include <errno.h>
22 22
 #include <signal.h>
23 23
 #include <stdio.h>
24
+#include <string.h>
24 25
 #include <time.h>
26
+#include <sys/types.h>
27
+#include <sys/socket.h>
25 28
 
26 29
 #include "server.h"
27 30
 #include "thrmgr.h"
... ...
@@ -83,8 +86,6 @@ void scanner_thread(void *arg)
83 83
 void sighandler_th(int sig)
84 84
 {
85 85
 	time_t currtime;
86
-	int maxwait = CL_DEFAULT_MAXWHILEWAIT * 5;
87
-	int i;
88 86
 
89 87
     switch(sig) {
90 88
 	case SIGINT:
... ...
@@ -183,7 +184,7 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
183 183
 	sigset_t sigset;
184 184
 	client_conn_t *client_conn;
185 185
 	struct cfgstruct *cpt;
186
-	char *buff[BUFFSIZE+1];
186
+	/* char *buff[BUFFSIZE+1]; */
187 187
 	unsigned int selfchk;
188 188
 	time_t start_time, current_time;
189 189
 	
... ...
@@ -47,6 +47,7 @@
47 47
 #include <errno.h>
48 48
 
49 49
 #include "thrmgr.h"
50
+#include "others.h"
50 51
 
51 52
 /*
52 53
  * Thread start routine to serve the work queue.
... ...
@@ -80,9 +80,6 @@ void clamscan(struct optstruct *opt)
80 80
 
81 81
     /* initialize logger */
82 82
 
83
-    if(optl(opt, "log-verbose")) logverbose = 1;
84
-    else logverbose = 0;
85
-
86 83
     if(optc(opt, 'l')) {
87 84
 	logfile = getargc(opt, 'l');
88 85
 	if(logg("--------------------------------------\n")) {
... ...
@@ -104,9 +104,6 @@ void clamscan(struct optstruct *opt)
104 104
 
105 105
     /* initialize logger */
106 106
 
107
-    if(optl(opt, "log-verbose")) logverbose = 1;
108
-    else logverbose = 0;
109
-
110 107
     if(optc(opt, 'l')) {
111 108
 	logfile = getargc(opt, 'l');
112 109
 	if(logg("--------------------------------------\n")) {
... ...
@@ -203,8 +200,7 @@ void help(void)
203 203
     mprintf("    --tempdir=DIRECTORY                  create temporary files in DIRECTORY\n");
204 204
     mprintf("    --database=FILE/DIR   -d FILE/DIR    Load virus database from FILE or load\n");
205 205
     mprintf("                                         all .db and .db2 files from DIR\n");
206
-    mprintf("    --log=FILE            -l FILE        Save scan report in FILE\n");
207
-    mprintf("    --log-verbose                        Save additional informations\n");
206
+    mprintf("    --log=FILE            -l FILE        Save scan report to FILE\n");
208 207
     mprintf("    --recursive           -r             Scan directories recursively\n");
209 208
     mprintf("    --infected            -i             Print infected files only\n");
210 209
     mprintf("    --remove                             Remove infected files. Be careful.\n");
... ...
@@ -45,6 +45,10 @@ int main(int argc, char **argv)
45 45
 	const char *getopt_parameters = "hvd:wriVl:m";
46 46
 
47 47
 	static struct option long_options[] = {
48
+	    /* 
49
+	     * WARNING: For compatibility reasons options marked as "not used"
50
+	     *		must still be accepted !
51
+	     */
48 52
 	    {"help", 0, 0, 'h'},
49 53
 	    {"quiet", 0, 0, 0},
50 54
 	    {"verbose", 0, 0, 'v'},
... ...
@@ -61,7 +65,7 @@ int main(int argc, char **argv)
61 61
 	    {"no-summary", 0, 0, 0},
62 62
 	    {"infected", 0, 0, 'i'},
63 63
 	    {"log", 1, 0, 'l'},
64
-	    {"log-verbose", 0, 0, 0},
64
+	    {"log-verbose", 0, 0, 0}, /* not used */
65 65
 	    {"threads", 1, 0, 0}, /* not used */
66 66
 	    {"one-virus", 0, 0, 0}, /* not used */
67 67
 	    {"move", 1, 0, 0},
... ...
@@ -154,8 +154,7 @@ int logg(const char *str, ...)
154 154
 	    fprintf(fd, "WARNING: ");
155 155
 	    vfprintf(fd, ++str, args);
156 156
 	} else if(*str == '*') {
157
-	    if(logverbose)
158
-		vfprintf(fd, ++str, args);
157
+	    vfprintf(fd, ++str, args);
159 158
 	} else vfprintf(fd, str, args);
160 159
 
161 160
 	va_end(args);
... ...
@@ -32,7 +32,7 @@ struct s_info {
32 32
     long int blocks; /* number of read 16kb blocks */
33 33
 } claminfo;
34 34
 
35
-short int mprintf_disabled, mprintf_verbose, mprintf_quiet, mprintf_stdout, logverbose, recursion, printinfected, bell;
35
+short int mprintf_disabled, mprintf_verbose, mprintf_quiet, mprintf_stdout, recursion, printinfected, bell;
36 36
 const char *logfile;
37 37
 
38 38
 #endif
... ...
@@ -1,14 +1,14 @@
1 1
 .\" Manual page created by Tomasz Kojm, 20021121
2
-.TH "Clamd client" "1" "November 11, 2003" "Tomasz Kojm" "Clam AntiVirus"
2
+.TH "Clamd client" "1" "February 20, 2004" "Tomasz Kojm" "Clam AntiVirus"
3 3
 .SH "NAME"
4 4
 .LP 
5 5
 clamdscan \- scan files and directories against viruses using Clam AntiVirus Daemon
6 6
 .SH "SYNOPSIS"
7 7
 .LP 
8
-clamscan [options] [file/directory]
8
+clamdscan [options] [file/directory]
9 9
 .SH "DESCRIPTION"
10 10
 .LP 
11
-clamdscan is a simple clamd client, which may be used as a clamscan replacement. clamdscan accepts all the options implemented in clamscan. It's a part of the Clam AntiVirus package.
11
+clamdscan is a simple clamd client which may be used as a clamscan replacement. clamdscan accepts all the options implemented in clamscan but most of them will be ignored because its scanning abilities only depend on clamd. clamdscan is a part of the Clam AntiVirus package.
12 12
 .SH "OPTIONS"
13 13
 .LP 
14 14
 
... ...
@@ -28,6 +28,9 @@ Be quiet \- only output error messages.
28 28
 \fB\-\-stdout\fR
29 29
 Write all messages to the standard output (stdout) instead of the standard error output (stderr).
30 30
 .TP 
31
+\fB\-\-config\-file=FILE\fR
32
+Read clamd settings from FILE.
33
+.TP 
31 34
 \fB\-l FILE, \-\-log=FILE\fR
32 35
 Save the scan report to FILE.
33 36
 .TP 
... ...
@@ -64,4 +67,4 @@ Please check the full documentation for credits.
64 64
 Tomasz Kojm <tkojm@clamav.net>
65 65
 .SH "SEE ALSO"
66 66
 .LP 
67
-clamscan(1), clamd(8), freshclam(1), sigtool(1), clamav.conf(5), clamav\-milter(8)
67
+clamscan(1), clamd(8), freshclam(1), clamav.conf(5)
... ...
@@ -1,5 +1,5 @@
1 1
 .\" Manual page created by Tomasz Kojm, 14/15 IV 2002
2
-.TH "clamscan" "1" "January 13, 2004" "Tomasz Kojm" "Clam AntiVirus"
2
+.TH "clamscan" "1" "February 20, 2004" "Tomasz Kojm" "Clam AntiVirus"
3 3
 .SH "NAME"
4 4
 .LP 
5 5
 clamscan \- scan files and directories against viruses
... ...
@@ -8,43 +8,40 @@ clamscan \- scan files and directories against viruses
8 8
 clamscan [options] [file/directory/\-]
9 9
 .SH "DESCRIPTION"
10 10
 .LP 
11
-clamscan is a console anti\-virus scanner. It's a part of the Clam AntiVirus package.
11
+clamscan is a command line anti\-virus scanner. It's a part of the Clam AntiVirus package.
12 12
 .SH "OPTIONS"
13 13
 .LP 
14 14
 
15 15
 .TP 
16 16
 \fB\-h, \-\-help\fR
17
-Output help information and exit.
17
+Print help information and exit.
18 18
 .TP 
19 19
 \fB\-V, \-\-version\fR
20
-Print the version number and exit.
20
+Print version number and exit.
21 21
 .TP 
22 22
 \fB\-v, \-\-verbose\fR
23 23
 Be verbose.
24 24
 .TP 
25 25
 \fB\-\-debug\fR
26
-Enable debug messages (mainly from libclamav).
26
+Enable debug messages (from libclamav).
27 27
 .TP 
28 28
 \fB\-\-quiet\fR
29
-Be quiet \- output error messages only.
29
+Be quiet (only print error messages).
30 30
 .TP 
31 31
 \fB\-\-stdout\fR
32
-Write all messages to the standard output (stdout), instead of the standard error output (stderr). The buffer is automatically flushed (stdout unlike stderr is buffered), to avoid race conditions on output.
32
+Write all messages to the standard output (stdout) instead of the standard error output (stderr).
33 33
 .TP 
34 34
 \fB\-d FILE/DIR, \-\-database=FILE/DIR\fR
35
-Load the virus database from FILE or load all .db and .db2 files from DIR.
35
+Load virus database from FILE or load all virus database files from DIR.
36 36
 .TP 
37 37
 \fB\-l FILE, \-\-log=FILE\fR
38
-Save the scan report to FILE. By default the log isn't saved.
39
-.TP 
40
-\fB\-\-log\-verbose\fR
41
-Save an additional information (mostly needless) to the report file.
38
+Save scan report to FILE.
42 39
 .TP 
43 40
 \fB\-\-tempdir=DIRECTORY\fR
44 41
 Create temporary files in DIRECTORY. Directory must be writeable for the 'clamav' user or unprivileged user running clamscan.
45 42
 .TP 
46 43
 \fB\-r, \-\-recursive\fR
47
-Scan directories recursively. All the files in the given directory will be scanned. \fBThis option affects scanning subdirectories in archives, if you are using unpackers just turn it on.\fR
44
+Scan directories recursively. All the subdirectories in the given directory will be scanned.
48 45
 .TP 
49 46
 \fB\-\-bell\fR
50 47
 Sound bell on virus detection.
... ...
@@ -59,7 +56,7 @@ Don't scan file names containing PATT. It may be used multiple times.
59 59
 Only scan file names containing PATT. It may be used multiple times.
60 60
 .TP 
61 61
 \fB\-\-mbox\fR
62
-Enable scanning of Mbox, Maildir and raw mail files. (also treat stdin as a mailbox, for backward compatibility).
62
+Enable scanning of various mail file types (also treat stdin as a mailbox \- for backward compatibility).
63 63
 .TP 
64 64
 \fB\-i, \-\-infected\fR
65 65
 Only print infected files.
... ...
@@ -76,34 +73,34 @@ EXTRACTION OPTIONS:
76 76
 Disable archive support built in libclamav.
77 77
 .TP 
78 78
 \fB\-\-max\-files=#n\fR
79
-Extract first #n files from each archive. This option protects your system against DoS attacks.
79
+Extract first #n files from each archive. This option protects your system against DoS attacks (default: 500)
80 80
 .TP 
81 81
 \fB\-\-max\-space=#n\fR
82
-Extract first #n kilobytes from each archive. You may give the number in megabytes in format xM or xm, where x is a number.
82
+Extract first #n kilobytes from each archive. You may give the number in megabytes in format xM or xm, where x is a number. This option protects your system against DoS attacks (default: 10 MB)
83 83
 .TP 
84 84
 \fB\-\-max\-recursion=#n\fR
85
-Set archive recursion level limit.
85
+Set archive recursion level limit. This option protects your system against DoS attacks (default: 5).
86 86
 .TP 
87 87
 \fB\-\-unzip[=FULLPATH]\fR
88
-In most cases you don't need this option \- the built\-in unarchiver will do the work. This option however may be used as a backup for internal unpacker \- see clamdoc.pdf. When enabled without the argument, unzip program will be searched in $PATH. If unzip cannot be found in $PATH, you must supply it with =pathname. Remember about '=' between the option and the argument.
88
+In most cases you don't need this option \- the built\-in unarchiver will do extract Zip archives. This option however may be used as a backup for internal unpacker \- see the full documentation for more information. When enabled without an argument, unzip program will be searched in $PATH. If unzip cannot be found in $PATH, you must force it with =pathname. Remember about '=' between the option and an argument.
89 89
 .TP 
90 90
 \fB\-\-unrar[=FULLPATH]\fR
91
-Supports .rar files.
91
+Scan .rar files.
92 92
 .TP 
93 93
 \fB\-\-unace[=FULLPATH]\fR
94
-Supports .ace files.
94
+Scan .ace files.
95 95
 .TP 
96 96
 \fB\-\-unarj[=FULLPATH]\fR
97
-Supports .arj files.
97
+Scan .arj files.
98 98
 .TP 
99 99
 \fB\-\-unzoo[=FULLPATH]\fR
100
-Supports .zoo files.
100
+Scan .zoo files.
101 101
 .TP 
102 102
 \fB\-\-lha[=FULLPATH]\fR
103
-Supports .lzh files.
103
+Scan .lzh files.
104 104
 .TP 
105 105
 \fB\-\-jar[=FULLPATH]\fR
106
-clamscan uses unzip for .jar files, so optionally give a full path to unzip.
106
+clamscan uses unzip for .jar files, so optionally eventually you will need to pass a full path to unzip.
107 107
 .TP 
108 108
 \fB\-\-deb[=FULLPATH]\fR
109 109
 This option supports debian binary packages. Implies \-\-tgz, but doesn't conflict with \-\-tgz=FULLPATH. It requires ar utility.
... ...
@@ -112,15 +109,15 @@ This option supports debian binary packages. Implies \-\-tgz, but doesn't confli
112 112
 This option supports non\-compressed archives.
113 113
 .TP 
114 114
 \fB\-\-tgz[=FULLPATH]\fR
115
-This option supports tar.gz and .tgz files. You need GNU tar, on non\-Linux system you probably have it installed as gtar. If it's in $PATH, please use \-\-tgz=gtar in other case please use a full pathname.
115
+This option supports tar.gz and .tgz files. You need GNU tar, on non\-Linux system you probably have it installed as gtar. If it's in $PATH, please use \-\-tgz=gtar in other case please pass a full path.
116 116
 .SH "EXAMPLES"
117 117
 .LP 
118 118
 .TP 
119
-(0) Scan a selected file:
119
+(0) Scan selected file:
120 120
 
121 121
 \fBclamscan file\fR
122 122
 .TP 
123
-(1) Scan a current working directory:
123
+(1) Scan current working directory:
124 124
 
125 125
 \fBclamscan\fR
126 126
 .TP 
... ...
@@ -128,20 +125,20 @@ This option supports tar.gz and .tgz files. You need GNU tar, on non\-Linux syst
128 128
 
129 129
 \fBclamscan \-r /home\fR
130 130
 .TP 
131
-(3) Load the database from selected file and limit a disk usage to 50 Mb:
131
+(3) Load database from selected file and limit disk usage to 50 Mb:
132 132
 
133 133
 \fBclamscan \-d /tmp/newclamdb \-\-max\-space=50m \-r /tmp\fR
134 134
 .TP 
135
-(4) Scan a data stream:
135
+(4) Scan data stream:
136 136
 
137 137
 \fBcat testfile | clamscan \-\fR
138 138
 .TP 
139
-(5) Scan a mail spool directory:
139
+(5) Scan mail spool directory:
140 140
 
141 141
 \fBclamscan \-r \-\-mbox /var/spool/mail\fR
142 142
 .SH "RETURN CODES"
143 143
 .LP 
144
-Note: some return codes may only appear in a one file mode (clamscan is started with file argument). These ones are marked with \fB(ofm)\fR.
144
+Note: some return codes may only appear in a one file mode (clamscan is started with file argument). Those are marked with \fB(ofm)\fR.
145 145
 
146 146
 0 : No virus found.
147 147
 .TP 
... ...
@@ -151,8 +148,6 @@ Note: some return codes may only appear in a one file mode (clamscan is started
151 151
 .TP 
152 152
 50: Database initialization error.
153 153
 .TP 
154
-51: Wrong number of threads given.
155
-.TP 
156 154
 52: Not supported file type.
157 155
 .TP 
158 156
 53: Can't open directory.
... ...
@@ -163,9 +158,9 @@ Note: some return codes may only appear in a one file mode (clamscan is started
163 163
 .TP 
164 164
 56: Can't stat input file / directory.
165 165
 .TP 
166
-57: Can't get absolute pathname of current working directory.
166
+57: Can't get absolute path name of current working directory.
167 167
 .TP 
168
-58: I/O error, check your filesystem.
168
+58: I/O error, please check your filesystem.
169 169
 .TP 
170 170
 59: Can't get information about current user from /etc/passwd.
171 171
 .TP 
... ...
@@ -175,7 +170,7 @@ Note: some return codes may only appear in a one file mode (clamscan is started
175 175
 .TP 
176 176
 63: Can't create temporary files/directories (check permissions).
177 177
 .TP 
178
-64: Can't write to temporary directory, please specify another one.
178
+64: Can't write to temporary directory (please specify another one).
179 179
 .TP 
180 180
 70: Can't allocate and clear memory (calloc).
181 181
 .TP 
... ...
@@ -187,4 +182,4 @@ Please check the full documentation for credits.
187 187
 Tomasz Kojm <tkojm@clamav.net>
188 188
 .SH "SEE ALSO"
189 189
 .LP 
190
-clamd(8), clamdscan(1), freshclam(1), sigtool(1), clamav.conf(5), clamav\-milter(8)
190
+clamdscan(1), freshclam(1)
... ...
@@ -1,5 +1,5 @@
1 1
 .\" Manual page created by Tomasz Kojm, 20020415
2
-.TH "freshclam" "1" "November 11, 2003" "Tomasz Kojm" "Clam AntiVirus"
2
+.TH "freshclam" "1" "February 20, 2004" "Tomasz Kojm" "Clam AntiVirus"
3 3
 .SH "NAME"
4 4
 .LP 
5 5
 freshclam \- update virus databases
... ...
@@ -11,7 +11,7 @@ freshclam [options]
11 11
 freshclam updates the virus database. It's a part of the Clam AntiVirus package. It requires an Internet connection.
12 12
 .SH "OPTIONS"
13 13
 .LP 
14
-
14
+Freshclam reads its configuration from freshclam.conf. The settings will be overwritten with command line options.
15 15
 .TP 
16 16
 \fB\-h, \-\-help\fR
17 17
 Output help information and exit.
... ...
@@ -31,11 +31,8 @@ Write all messages to the standard output (stdout), instead of the standard erro
31 31
 \fB\-l FILE, \-\-log=FILE\fR
32 32
 Save download report in FILE.
33 33
 .TP 
34
-\fB\-\-log\-verbose\fR
35
-Save additional information (mostly needless) to the report file.
36
-.TP 
37 34
 \fB\-\-datadir=DIRECTORY\fR
38
-Install downloaded database in DIRECTORY. The directory must be writeable for the 'clamav' user or unprivileged user running freshclam.
35
+Install new database in DIRECTORY. The directory must be writeable for the 'clamav' user or unprivileged user running freshclam.
39 36
 .TP 
40 37
 \fB\-u USER, \-\-user USER\fR
41 38
 Run as USER. By default (when started by root) freshclam drops privileges and works as the 'clamav' user.
... ...
@@ -44,13 +41,7 @@ Run as USER. By default (when started by root) freshclam drops privileges and wo
44 44
 Run in a daemon mode. This option requires \-\-checks.
45 45
 .TP 
46 46
 \fB\-c #n, \-\-checks=#n\fR
47
-Check #n times pet day for new database. #n must be between 1 and 50.
48
-.TP 
49
-\fB\-\-http\-proxy=hostname[:port]\fR
50
-Connect via a proxy server.
51
-.TP 
52
-\fB\-\-proxy\-user=user:password\fR
53
-Do proxy authorization for user. Password is required.
47
+Check #n times day for new database. #n must be between 1 and 50.
54 48
 .TP 
55 49
 \fB\-\-daemon\-notify=/path/to/clamav.conf\fR
56 50
 Notify the daemon about the new database. By default it reads a hardcoded config file but you can use an another one. Both local and TCP sockets are supported.
... ...
@@ -101,4 +92,4 @@ Please check the full documentation for credits.
101 101
 Tomasz Kojm <tk@clamav.net>
102 102
 .SH "SEE ALSO"
103 103
 .LP 
104
-clamd(8), clamdscan(1), clamscan(1), sigtool(1), clamav.conf(5), clamav\-milter(8)
104
+clamd(8), clamdscan(1), clamscan(1), sigtool(1), clamav.conf(5)
... ...
@@ -169,11 +169,6 @@ int freshclam(struct optstruct *opt)
169 169
 
170 170
     /* initialize logger */
171 171
 
172
-    if(optl(opt, "log-verbose") || cfgopt(copt, "LogVerbose"))
173
-	logverbose = 1;
174
-    else
175
-	logverbose = 0;
176
-
177 172
     if(optc(opt, 'l')) {
178 173
 	logfile = getargc(opt, 'l');
179 174
 	if(logg("--------------------------------------\n")) {
... ...
@@ -369,7 +364,6 @@ void help(void)
369 369
     mprintf("\n");
370 370
     mprintf("    --config-file=FILE                   read configuration from FILE.\n");
371 371
     mprintf("    --log=FILE           -l FILE         log into FILE\n");
372
-    mprintf("    --log-verbose                        log additional information\n");
373 372
     mprintf("    --daemon             -d              run in daemon mode\n");
374 373
     mprintf("    --pid                -p FILE         save daemon's pid in FILE\n");
375 374
     mprintf("    --user=USER          -u USER         run as USER\n");
... ...
@@ -37,6 +37,10 @@ int main(int argc, char **argv)
37 37
 	const char *getopt_parameters = "hvdp:Vl:c:u:";
38 38
 
39 39
 	static struct option long_options[] = {
40
+	    /* 
41
+	     * WARNING: For compatibility reasons options marked as "not used"
42
+	     *		must still be accepted !
43
+	     */
40 44
 	    {"help", 0, 0, 'h'},
41 45
 	    {"quiet", 0, 0, 0},
42 46
 	    {"verbose", 0, 0, 'v'},
... ...
@@ -44,7 +48,7 @@ int main(int argc, char **argv)
44 44
 	    {"version", 0, 0, 'V'},
45 45
 	    {"datadir", 1, 0, 0},
46 46
 	    {"log", 1, 0, 'l'},
47
-	    {"log-verbose", 0, 0, 0},
47
+	    {"log-verbose", 0, 0, 0}, /* not used */
48 48
 	    {"stdout", 0, 0, 0},
49 49
 	    {"daemon", 0, 0, 'd'},
50 50
 	    {"pid", 1, 0, 'p'},
... ...
@@ -327,6 +327,8 @@ int cli_rmdirs(const char *dirname)
327 327
 	struct stat maind, statbuf;
328 328
 	char *fname;
329 329
 
330
+
331
+    chmod(dirname, 0700);
330 332
     if((dd = opendir(dirname)) != NULL) {
331 333
 	while(stat(dirname, &maind) != -1) {
332 334
 	    if(!rmdir(dirname)) break;