On Sun, 4 Feb 2007 21:19:49 +0100 manu@... wrote:
> Ok, so let's add an additionnal argument for the mode
> socket "/var/run/milter-greylist.sock" 660
>
> Possible values: 666, 660 or 600, which turn into umask 000, 007 or 077.
> Other values cause an error.
How do I deal with config file parsing? I tried the following:
diff -u -r1.45 conf.c
--- conf.c 26 Dec 2006 21:21:52 -0000 1.45
+++ conf.c 4 Feb 2007 23:06:01 -0000
@@ -425,6 +425,7 @@
c->c_syncsrcaddr = NULL;
c->c_syncsrcport = NULL;
c->c_socket = NULL;
+ c->c_socket_mode = 0;
c->c_user = NULL;
c->c_nodetach = 0;
c->c_report = C_ALL;
diff -u -r1.39 conf.h
--- conf.h 26 Dec 2006 21:21:52 -0000 1.39
+++ conf.h 4 Feb 2007 23:06:01 -0000
@@ -79,6 +79,7 @@
struct in6_addr c_match_mask6;
#endif
char *c_socket;
+ int c_socket_mode;
char *c_user;
char *c_syncaddr;
char *c_syncport;
diff -u -r1.73 conf_yacc.y
--- conf_yacc.y 2 Feb 2007 07:00:06 -0000 1.73
+++ conf_yacc.y 4 Feb 2007 23:06:02 -0000
@@ -312,9 +312,11 @@
#endif
}
;
-socket: SOCKET QSTRING { if (C_NOTFORCED(C_SOCKET))
+socket: SOCKET QSTRING { if (C_NOTFORCED(C_SOCKET)) {
conf.c_socket =
quotepath(conf.c_socket_storage, $2, QSTRLEN);
+ strncpy(conf.c_socket_mode, $3, NUMLEN);
+ }
}
;
user: USER QSTRING { if (C_NOTFORCED(C_USER))
but it fails when making:
bison -y -p`echo conf_yacc.c|sed 's/^\([^_]\{1,\}_\).*$/\1/'` conf_yacc.y
conf_yacc.y:318.69-70: integer out of range: `$3'
make: *** [conf_yacc.c] Error 1
Regards,
Nerijus