diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 1998-08-04 22:45:21 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 1998-08-04 22:45:21 +0000 |
commit | 693741eef75533f85c1eb99b446270421a6ff867 (patch) | |
tree | 4290834b94e23ed4ad011682915a4876a67645e3 /mail/popper/files | |
parent | 8338cde2ff67c8ba92fc281a99bf0b24e1ab7161 (diff) | |
download | ports-693741eef75533f85c1eb99b446270421a6ff867.tar.gz ports-693741eef75533f85c1eb99b446270421a6ff867.zip |
add optional youbin support
Notes
Notes:
svn path=/head/; revision=12283
Diffstat (limited to 'mail/popper/files')
-rw-r--r-- | mail/popper/files/patch-aa | 6 | ||||
-rw-r--r-- | mail/popper/files/patch-aj | 62 | ||||
-rw-r--r-- | mail/popper/files/sendto.c | 170 |
3 files changed, 235 insertions, 3 deletions
diff --git a/mail/popper/files/patch-aa b/mail/popper/files/patch-aa index f98a3959a450..f0e4359a14dd 100644 --- a/mail/popper/files/patch-aa +++ b/mail/popper/files/patch-aa @@ -1,5 +1,5 @@ *** Makefile.in.orig Fri Jul 10 03:44:06 1998 ---- Makefile.in Sat Jul 18 20:04:20 1998 +--- Makefile.in Wed Aug 5 01:26:01 1998 *************** *** 1,20 **** ! CSRCS = flock.c pop_dele.c pop_dropcopy.c \ @@ -30,7 +30,7 @@ pop_rset.c pop_send.c pop_stat.c pop_updt.c \ pop_user.c pop_xtnd.c pop_xmit.c popper.c \ ! pop_bull.c xtnd_xlst.c pop_uidl.c \ -! pop_rpop.c pop_apop.c pop_auth.c +! pop_rpop.c pop_apop.c pop_auth.c sendto.c ! OBJS = pop_dele.o pop_dropcopy.o \ pop_get_command.o pop_get_subcommand.o pop_init.o \ @@ -39,7 +39,7 @@ pop_rset.o pop_send.o pop_stat.o pop_updt.o \ pop_user.o pop_xtnd.o pop_xmit.o popper.o \ ! pop_bull.o xtnd_xlst.o pop_uidl.o \ -! pop_rpop.o pop_apop.o pop_auth.o +! pop_rpop.o pop_apop.o pop_auth.o sendto.o DOCS = README pop3.rfc1081 pop3e.rfc1082 popper.8 diff --git a/mail/popper/files/patch-aj b/mail/popper/files/patch-aj new file mode 100644 index 000000000000..f7a697027080 --- /dev/null +++ b/mail/popper/files/patch-aj @@ -0,0 +1,62 @@ +*** pop_updt.c.orig Fri Jul 10 03:44:08 1998 +--- pop_updt.c Wed Aug 5 01:14:24 1998 +*************** +*** 126,131 **** +--- 126,134 ---- + mailunlock(); + #endif + } ++ #ifdef YOUBIN ++ sendto_youbin(p->user); ++ #endif + return (POP_SUCCESS); + } + +*************** +*** 328,333 **** +--- 331,339 ---- + mailunlock(); + #endif + (void)fclose(p->drop) ; ++ #ifdef YOUBIN ++ sendto_youbin(p->user); ++ #endif + #ifdef EDQUOT + if (save_errno == EDQUOT) + return pop_msg(p, POP_FAILURE, +*************** +*** 348,353 **** +--- 354,362 ---- + mailunlock(); + #endif + (void)fclose(p->drop); ++ #ifdef YOUBIN ++ sendto_youbin(p->user); ++ #endif + #ifdef EDQUOT + if (save_errno == EDQUOT) + return pop_msg(p, POP_FAILURE, +*************** +*** 452,457 **** +--- 461,469 ---- + mailunlock(); + #endif + (void)fclose(p->drop) ; ++ #ifdef YOUBIN ++ sendto_youbin(p->user); ++ #endif + #ifdef EDQUOT + if (save_errno == EDQUOT) + return pop_msg(p, POP_FAILURE, +*************** +*** 475,480 **** +--- 487,495 ---- + #endif + (void)fclose(p->drop); + } ++ #ifdef YOUBIN ++ sendto_youbin(p->user); ++ #endif + + return(pop_quit(p)); + } diff --git a/mail/popper/files/sendto.c b/mail/popper/files/sendto.c new file mode 100644 index 000000000000..c7783e5df0ae --- /dev/null +++ b/mail/popper/files/sendto.c @@ -0,0 +1,170 @@ +#ifdef YOUBIN +/* + * Program: $RCSfile: sendto.c,v $ $Revision: 4.3 $ + * + * 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@nuie.nagoya-u.ac.jp + * + * Modified: K.Makimura macky@agusa.nuie.nagoya-u.ac.jp + * + * Date: 1993/07/24 + * Modified: $Date: 1994/08/01 12:57:38 $ + * + * 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. + */ + +#ifndef lint +static char rcsid[] = + "$Id: sendto.c,v 4.3 1994/08/01 12:57:38 yamamoto Exp $"; +#endif /* not lint */ + +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/param.h> +#include <netinet/in.h> +#include <netdb.h> +#include <stdio.h> + +/* + * Platform definitions. + */ + +#if defined(SVR4) && !defined(SYSV) +#define SYSV +#endif /* defined(SVR4) && !defined(SYSV) */ + +/* + * For compatibility. + */ + +#ifdef SYSV +#include <string.h> /* For strchr(). */ +#else /* not SYSV */ +#include <strings.h> +#if !defined(strchr) && !defined(strrchr) +#define strchr(str, c) index((str), (c)) +#define strrchr(str, c) rindex((str), (c)) +#endif /* !defined(strchr) && !defined(strrchr) */ +#endif /* not SYSV */ + +#ifdef SYSV +#define bzero(dst, len) memset((dst), '\0', (len)) +#define bcopy(src, dst, len) memcpy((dst), (src), (len)) +#endif + +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); + } + + bzero((char *)&sa, sizeof(sa)); + sa.sin_family = hp->h_addrtype; + bcopy((char *)hp->h_addr, (char *)&sa.sin_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, "U %s", username); + udp_send(msg); +} + +#endif /* CALLED_FROM_POPD */ +#endif /* YOUBIN */ |