Last modified: Thursday, July 02, 2026

Patch to make qpopper-4.1.0 compatible with youbin-3.5

qpopper, youbin3

qpopper is a POP3 server developed by Qualcomm.

This is a patch to make qpopper-4.1.0 compatible with youbin-3.5. It is simply a modified version of the qpopper4.0.5+youbin3.patch.gz file --- originally released by Mr. Masahiro sakapon Sakamoto for qpopper-4.0.5 --- that has been adapted to work properly with qpopper-4.1.0.

qpopper4.1.0+youbin3.patch (August 4, 2011)



diff -u -r -N qpopper4.1.0/popper/Makefile.in qpopper4.1.0+youbin3/popper/Makefile.in
--- qpopper4.1.0/popper/Makefile.in	2011-05-31 04:13:39.000000000 +0900
+++ qpopper4.1.0+youbin3/popper/Makefile.in	2011-08-04 16:28:29.468236161 +0900
@@ -137,7 +137,7 @@
                     pop_extend.o scram.o hmac.o pop_util.o \
                     get_sub_opt.o msg_ptr.o drac.o pop_config.o pop_tls.o \
                     pop_tls_openssl.o pop_tls_sslplus.o sslplus_utils.o \
-                    main.o pop_cache.o genpath.o pop_sasl.o
+                    main.o pop_cache.o genpath.o pop_sasl.o sendto.o
 
 SRCS            =   pop_dele.c pop_dropcopy.c \
                     pop_get_command.c pop_get_subcommand.c pop_init.c \
@@ -150,7 +150,7 @@
                     pop_extend.c scram.c hmac.c pop_util.c \
                     get_sub_opt.c msg_ptr.c drac.c pop_config.c pop_tls.c \
                     pop_tls_openssl.c pop_tls_sslplus.c sslplus_utils.c \
-                    main.c pop_cache.c genpath.c pop_sasl.c
+                    main.c pop_cache.c genpath.c pop_sasl.c sendto.c
 
 POPAUTHOBJS     =   scram.o hmac.o popauth.o
 
@@ -177,7 +177,7 @@
 CDEFS           =   @CDEFS@
 LDFLAGS         =   @LDFLAGS@
 OS_DEFS         =   @OS_DEFS@
-DEFS            =   @DEFS@
+DEFS            =   @DEFS@ -DYOUBIN
 pop_auth        =   @POPAUTH@
 apop_uid        =   @APOP_UID@
 apop_dir        =   @APOP_DIR@
@@ -289,6 +289,8 @@
 
 
 ${OBJS}:    ${INCLUDES}
+sendto.o: sendto.c
+	${CC} -c -I. -I${srcdir} ${CFLAGS} ${DEFS} ${O_DEFS} -DCALLED_FROM_POPD sendto.c
 pop_ssl.o: pop_ssl.h
 
 test: 
diff -u -r -N qpopper4.1.0/popper/pop_updt.c qpopper4.1.0+youbin3/popper/pop_updt.c
--- qpopper4.1.0/popper/pop_updt.c	2011-05-31 04:13:40.000000000 +0900
+++ qpopper4.1.0+youbin3/popper/pop_updt.c	2011-08-04 16:24:49.432861224 +0900
@@ -339,6 +339,9 @@
                         "truncated temp drop (%d)", fileno(p->drop) );
         unlink_temp_drop ( p,  p->temp_drop, HERE );
         fclose ( p->drop );
+#ifdef YOUBIN
+        sendto_youbin( p->user );
+#endif
 
     if ( p->bDo_timing )
         p->clean_time = time(0) - my_timer;
@@ -373,6 +376,9 @@
         if ( ( mfd = open   ( p->drop_name, O_RDWR | O_CREAT, 0660 ) ) == -1 ||
              ( md  = fdopen ( mfd, "r+" ) ) == NULL ) {
             Qmailunlock ( HERE );
+#ifdef YOUBIN
+            sendto_youbin( p->user );
+#endif
             return pop_msg ( p, POP_FAILURE, HERE, standard_error, 
                              STRERROR(errno), errno );
         }
@@ -393,6 +399,9 @@
     if ( retrycnt == 4 ) {
         fclose ( (p->server_mode) ? p->drop : md );
         Qmailunlock ( HERE );
+#ifdef YOUBIN
+        sendto_youbin( p->user );
+#endif
         return pop_msg ( p, POP_FAILURE, HERE, "flock: '%s': %s (%d)", 
                          p->drop_name,
                          STRERROR(errno), errno );
@@ -427,6 +436,9 @@
             ftruncate ( fileno ( p->drop ), (OFF_T)offset );
             fclose ( p->drop );
             Qmailunlock ( HERE );
+#ifdef YOUBIN
+            sendto_youbin( p->user );
+#endif
             return pop_msg ( p, POP_FAILURE, HERE, 
                              "Error copying new messages: '%s' : %s (%d)",
                              p->drop_name, STRERROR(save_errno), save_errno );
@@ -639,6 +651,9 @@
             fclose ( md );
             Qmailunlock ( HERE );
             fclose ( p->drop );
+#ifdef YOUBIN
+            sendto_youbin( p->user );
+#endif
             if ( save_errno == EDQUOT )
                 return pop_msg ( p, POP_FAILURE, HERE,
                                  "Overquota copying messages to spool."
@@ -658,6 +673,9 @@
             close ( mfd );
             Qmailunlock ( HERE );
             fclose ( p->drop );
+#ifdef YOUBIN
+            sendto_youbin( p->user );
+#endif
 
             if ( save_error == EDQUOT )
                 return pop_msg ( p, POP_FAILURE, HERE,
@@ -852,6 +870,9 @@
             fclose ( md );
             fclose ( p->drop );
             Qmailunlock ( HERE );
+#ifdef YOUBIN
+            sendto_youbin( p->user );
+#endif
 
             if ( save_error == EDQUOT )
                 return pop_msg ( p, POP_FAILURE, HERE,
@@ -873,6 +894,9 @@
         unlink_temp_drop ( p,  p->temp_drop, HERE );
         fclose ( p->drop );
         Qmailunlock ( HERE );
+#ifdef YOUBIN
+        sendto_youbin( p->user );
+#endif
 
     } /* non-server mode */
 
@@ -987,6 +1011,9 @@
                      fileno(p->drop), offset );
         fclose ( p->drop );
         Qmailunlock ( HERE );
+#ifdef YOUBIN
+        sendto_youbin( p->user );
+#endif
 
         if ( save_errno == EDQUOT ) {
             return pop_msg ( p, POP_FAILURE, HERE, 
@@ -1025,6 +1052,9 @@
         fclose ( md );
         fclose ( p->drop );
         Qmailunlock ( HERE );
+#ifdef YOUBIN
+        sendto_youbin( p->user );
+#endif
 
         if ( save_errno == EDQUOT )
             return pop_msg ( p, POP_FAILURE, HERE,
@@ -1044,6 +1074,9 @@
     unlink_temp_drop ( p,  p->temp_drop, HERE );
     fclose ( p->drop );
     Qmailunlock ( HERE );
+#ifdef YOUBIN
+    sendto_youbin( p->user );
+#endif
 
     if ( p->bDo_timing )
         p->clean_time = time(0) - my_timer;
diff -u -r -N qpopper4.1.0/popper/sendto.c qpopper4.1.0+youbin3/popper/sendto.c
--- qpopper4.1.0/popper/sendto.c	1970-01-01 09:00:00.000000000 +0900
+++ qpopper4.1.0+youbin3/popper/sendto.c	2011-08-04 16:56:06.480257838 +0900
@@ -0,0 +1,150 @@
+/*
+ * Program:     $RCSfile: sendto.c,v $  $Revision: 4.4 $
+ *
+ * Purpose:     Send a message with UDP packet.
+ *              Invoked from mh-inc-folder-hook.
+ *
+ * Usage:       sendto <host> <service> <message>
+ *
+ * Author:      K.Agusa     agusa@nuie.nagoya-u.ac.jp
+ *              S.Yamamoto  yamamoto@ist.aichi-pu.ac.jp
+ *              N.Atsumi    atsumi@agusa.nuie.nagoya-u.ac.jp
+ *
+ * Modified:    K.Makimura  macky@agusa.nuie.nagoya-u.ac.jp
+ *
+ * Date:        1993/07/24
+ * Modified:    $Date: 2003/05/07 13:31:09 $
+ *
+ * Copyright:   K.Agusa and S.Yamamoto  1993 - 94
+ *
+ * The X Consortium, and any party obtaining a copy of these files from
+ * the X Consortium, directly or indirectly, is granted, free of charge,
+ * a full and unrestricted irrevocable, world-wide, paid up, royalty-free,
+ * nonexclusive right and license to deal in this software and documentation
+ * files (the "Software"), including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons who receive copies from any such
+ * party to do so. This license includes without limitation a license to do
+ * the foregoing actions under any patents of the party supplying this
+ * software to the X Consortium.
+ */
+/*
+ * modified for "qpopper 4.1.0"
+ * by Atsushi Nunome
+ */
+
+#ifndef lint
+static char rcsid[] =
+    "$Id: sendto.c,v 4.4 2003/05/07 13:31:09 atsumi Exp $";
+#endif /* not lint */
+
+#ifdef YOUBIN
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+static struct sockaddr_in  sa;              /* Server address. */
+static int                 sockid;          /* Socket Id. */
+static char                err_msg[256];
+
+static char *
+udp_init(host, service)
+char    *host;
+char    *service;
+{
+    struct hostent *hp;                     /* Result of host name lookup. */
+    struct servent *sp;                     /* Result of service lookup. */
+    
+    if ((hp = gethostbyname(host)) == NULL) {
+        sprintf(err_msg, "No such host: %s", host);
+        return (err_msg);
+    }
+    if ((sp = getservbyname(service, "udp")) == NULL) {
+        sprintf(err_msg, "No such service: %s", service);
+        return (err_msg);
+    }
+    if ((sockid = socket(hp->h_addrtype, SOCK_DGRAM, 0)) < 0) {
+        sprintf(err_msg, "Error in getting socket");
+        return (err_msg);
+    }
+    
+    memset((char *)&sa, '\0', sizeof(sa));
+    sa.sin_family = hp->h_addrtype;
+    memcpy((char *)&sa.sin_addr, (char *)hp->h_addr, hp->h_length);
+    sa.sin_port = sp->s_port;
+    
+    return ((char *)NULL);
+}
+
+static char *
+udp_send(message)
+char    *message;
+{
+    int   len;
+    
+    len = strlen(message);
+    if (sendto(sockid, message, len, 0, (struct sockaddr *)&sa, sizeof(sa)) != len) {
+        sprintf(err_msg, "Error in sending packet");
+        return (err_msg);
+    }
+    return ((char *)NULL);
+}
+
+#ifndef CALLED_FROM_POPD
+
+void
+main(argc, argv)
+int     argc;
+char    **argv;
+{
+    char    *msg;
+    char    *prog_name;
+    
+    if ((prog_name = strrchr(argv[0], '/')) != NULL) {
+        prog_name++;
+    } else {
+        prog_name = argv[0];
+    }
+
+    if (argc != 4) {
+        fprintf(stderr, "%s: Usage: sendto <host> <service> <message>\n",
+                prog_name);
+        exit(1);
+    }
+    if ((msg = udp_init(argv[1], argv[2])) != NULL) {
+        fprintf(stderr, "%s: %s\n", prog_name, msg);
+        exit(1);
+    }
+    if ((msg = udp_send(argv[3])) != NULL) {
+        fprintf(stderr, "%s: %s\n", prog_name, msg);
+        exit(1);
+    }
+    exit(0);
+}
+
+#else /* CALLED_FROM_POPD */
+
+#ifndef YOUBINSERVICE
+#define YOUBINSERVICE       "biff"          /* For patch to popd. */
+#endif /* not YOUBINSERVICE */
+
+void
+sendto_youbin(username)
+char    *username;
+{
+    char  msg[256];
+    
+    if (udp_init("localhost", YOUBINSERVICE) != NULL) {
+        return;
+    }
+    sprintf(msg, "UPDT 0 %s", username);
+    udp_send(msg);
+}
+
+#endif /* CALLED_FROM_POPD */
+#endif /* YOUBIN */
diff -u -r -N qpopper4.1.0/popper/version.h qpopper4.1.0+youbin3/popper/version.h
--- qpopper4.1.0/popper/version.h	2011-05-31 04:22:52.000000000 +0900
+++ qpopper4.1.0+youbin3/popper/version.h	2011-08-04 16:24:49.452860540 +0900
@@ -18,6 +18,15 @@
 
 
 #ifdef KERBEROS
+#ifdef YOUBIN
+#  ifdef KRB4
+#    define VERS_SUF1     "-krb-IV+youbin"
+#  endif /* KRB4 */
+
+#  ifdef KRB5
+#    define VERS_SUF1     "-krb-V+youbin"
+#  endif /* KRB5 */
+#else
 #  ifdef KRB4
 #    define VERS_SUF1     "-krb-IV"
 #  endif /* KRB4 */
@@ -25,9 +34,14 @@
 #  ifdef KRB5
 #    define VERS_SUF1     "-krb-V"
 #  endif /* KRB5 */
+#endif
 
 #else /* not KERBEROS */
+#ifdef YOUBIN
+#  define VERS_SUF1       "+youbin"
+#else
 #  define VERS_SUF1       ""
+#endif
 #endif /* KERBEROS */
 
 #ifdef _DEBUG

Atsushi NUNOME @ Computer System Laboratory at Kyoto Institute of Technology (nunome@kit.ac.jp)