Mercurial > hg > mlmmj
changeset 517:ad761c84a780
Fix mlmmj-sub to not be able to subscribe twice
author | mmj |
---|---|
date | Fri, 09 Sep 2005 20:11:58 +1000 |
parents | 277b8be14f75 |
children | f745db86c61c |
files | ChangeLog src/mlmmj-sub.c |
diffstat | 2 files changed, 19 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Sep 09 01:07:52 2005 +1000 +++ b/ChangeLog Fri Sep 09 20:11:58 2005 +1000 @@ -1,3 +1,5 @@ + o Use is_subbed_in instead of find_subscriber when subscribing people + (Christian Laursen) o Make it possible to confirm subscription even though it's a closedlist. It makes sense to be able to confirm a request submitted by the sysadmin on the commandline
--- a/src/mlmmj-sub.c Fri Sep 09 01:07:52 2005 +1000 +++ b/src/mlmmj-sub.c Fri Sep 09 20:11:58 2005 +1000 @@ -277,9 +277,8 @@ char *sublockname; int subconfirm = 0, confirmsub = 0, opt, subfilefd, lock, notifysub; int changeuid = 1, status, digest = 0, nomail = 0; - int groupwritable = 0, sublock, sublockfd, nogensubscribed = 0; + int groupwritable = 0, sublock, sublockfd, nogensubscribed = 0, subbed; size_t len; - off_t suboff; struct stat st; pid_t pid, childpid; uid_t uid; @@ -364,7 +363,20 @@ exit(EXIT_SUCCESS); /* XXX is this success? */ } - subddirname = concatstr(2, listdir, "/subscribers.d"); + switch(typesub) { + default: + case SUB_NORMAL: + subdir = "/subscribers.d/"; + break; + case SUB_DIGEST: + subdir = "/digesters.d/"; + break; + case SUB_NOMAIL: + subdir = "/nomailsubs.d/"; + break; + } + + subddirname = concatstr(2, listdir, subdir); if (stat(subddirname, &st) == 0) { if(st.st_mode & S_IWGRP) { groupwritable = S_IRGRP|S_IWGRP; @@ -389,19 +401,6 @@ chstr[0] = address[0]; chstr[1] = '\0'; - switch(typesub) { - default: - case SUB_NORMAL: - subdir = "/subscribers.d/"; - break; - case SUB_DIGEST: - subdir = "/digesters.d/"; - break; - case SUB_NOMAIL: - subdir = "/nomailsubs.d/"; - break; - } - subfilename = concatstr(3, listdir, subdir, chstr); sublockname = concatstr(5, listdir, subdir, ".", chstr, ".lock"); @@ -438,8 +437,8 @@ myfree(sublockname); exit(EXIT_FAILURE); } - suboff = find_subscriber(subfilefd, address); - if(suboff == -1) { + subbed = is_subbed_in(subddirname, address); + if(subbed) { if(subconfirm) { close(subfilefd); close(sublockfd);