]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Fix mlmmj-sub to not be able to subscribe twice
authormmj <none@none>
Fri, 9 Sep 2005 10:11:58 +0000 (20:11 +1000)
committermmj <none@none>
Fri, 9 Sep 2005 10:11:58 +0000 (20:11 +1000)
ChangeLog
src/mlmmj-sub.c

index 1ea81cf40474964ecceb4d625d179accc6ede757..427fcf2ae1ec6d910188a6bda217e0e6e0a61251 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index d2656445299897d09e5f608bdeb4d69b28964202..5b1baf8593e02a928f7509a8a503f1ed890e2264 100644 (file)
@@ -277,9 +277,8 @@ int main(int argc, char **argv)
        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 @@ int main(int argc, char **argv)
                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 @@ int main(int argc, char **argv)
        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 @@ int main(int argc, char **argv)
                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);