From ac34cdb856bba34262a773d60d10b8c8de90404c Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Sat, 7 Apr 2012 11:24:35 +0200 Subject: [PATCH 1/1] Per volume login message --- NEWS | 5 +++++ etc/afpd/messages.c | 7 ++++--- etc/afpd/volume.c | 8 ++++++++ libatalk/util/netatalk_conf.c | 2 +- man/man5/afp.conf.5.tmpl | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index c6f50991..612d6892 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +Changes in 3.0 alpha3 +===================== + +* NEW: afpd: Per volume "login message", NetAFP bug ID #18 + Changes in 3.0 alpha2 ===================== diff --git a/etc/afpd/messages.c b/etc/afpd/messages.c index e2dd1535..241f0d08 100644 --- a/etc/afpd/messages.c +++ b/etc/afpd/messages.c @@ -133,10 +133,11 @@ int afp_getsrvrmesg(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, siz * it has asked the login msg... * Workaround: concatenate the two if any, ugly. */ - if (*message && *obj->options.loginmesg) { - strlcat(message, " - ", MAXMESGSIZE); + if (obj->options.loginmesg) { + if (*message) + strlcat(message, " - ", MAXMESGSIZE); + strlcat(message, obj->options.loginmesg, MAXMESGSIZE); } - strlcat(message, obj->options.loginmesg, MAXMESGSIZE); break; case AFPMESG_SERVER: /* server */ break; diff --git a/etc/afpd/volume.c b/etc/afpd/volume.c index 61d744ca..56398145 100644 --- a/etc/afpd/volume.c +++ b/etc/afpd/volume.c @@ -871,6 +871,14 @@ int afp_openvol(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t goto openvol_err; } } + + char *msg; + if ((msg = iniparser_getstrdup(obj->iniconfig, volume->v_configname, "login message", NULL)) != NULL) { + if (obj->options.loginmesg) + free(obj->options.loginmesg); + obj->options.loginmesg = msg; + } + return( AFP_OK ); } diff --git a/libatalk/util/netatalk_conf.c b/libatalk/util/netatalk_conf.c index a75ded21..8720ff54 100644 --- a/libatalk/util/netatalk_conf.c +++ b/libatalk/util/netatalk_conf.c @@ -1427,7 +1427,7 @@ int afp_config_parse(AFPObj *AFPObj) options->passwdbits |= PASSWD_SET; /* figure out options w values */ - options->loginmesg = iniparser_getstrdup(config, INISEC_GLOBAL, "login message", ""); + options->loginmesg = iniparser_getstrdup(config, INISEC_GLOBAL, "login message", NULL); options->guest = iniparser_getstrdup(config, INISEC_GLOBAL, "guest account", "nobody"); options->passwdfile = iniparser_getstrdup(config, INISEC_GLOBAL, "passwd file",_PATH_AFPDPWFILE); options->uampath = iniparser_getstrdup(config, INISEC_GLOBAL, "uam path", _PATH_AFPDUAMPATH); diff --git a/man/man5/afp.conf.5.tmpl b/man/man5/afp.conf.5.tmpl index c96eddb8..096cce03 100644 --- a/man/man5/afp.conf.5.tmpl +++ b/man/man5/afp.conf.5.tmpl @@ -624,7 +624,7 @@ guest account = \fIname\fR \fB(G)\fR Specifies the user that guests should use (default is "nobody")\&. The name should be quoted\&. .RE .PP -login message = \fImessage\fR \fB(G)\fR +login message = \fImessage\fR \fB(G)/(V)\fR .RS 4 Sets a message to be displayed when clients logon to the server\&. The message should be in \fBunix charset\fR -- 2.39.2