Update of /cvsroot/fink/dists/10.4/stable/main/finkinfo/net
In directory vz-cvs-3.sog:/tmp/cvs-serv18226/stable/main/finkinfo/net

Added Files:
        drac1.info drac1.patch 
Log Message:
drac: upgrade to db48, sync to stable


--- NEW FILE: drac1.info ---
Package: drac1
Version: 1.12
Revision: 1012
###
Depends: db48-aes-shlibs | db48-shlibs, daemonic
BuildDepends: db48-aes | db48
###
Source: ftp://ftp.cc.umanitoba.ca/src/drac.tar.Z
Source-MD5: fadaee589bf1dd9067222d58637d5fe4
NoSourceDirectory: true
###
PatchFile: %n.patch
PatchFile-MD5: 2eadf86e776dc57f0b8942d67ee780df
PatchScript: <<
  sed -e 's,@FINKPREFIX@,%p,g' %{PatchFile} | patch -p1
<<
###
DocFiles: COPYRIGHT Changes INSTALL PORTING README
ConfFiles: <<
  %p/etc/drac/dracd.allow
  %p/var/lib/drac/dracd.db
<<
###
UseMaxBuildJobs: false
CompileScript: <<
  make
<<
###
InstallScript: <<
  mkdir -p %i/sbin
  mkdir -p %i/share/man/man3
  mkdir -p %i/share/man/man1
  mkdir -p %i/lib
  mkdir -p %i/include
  mkdir -p %i/etc/drac
  mkdir -p %i/var/lib/drac
  make install DESTDIR=%d
  touch %i/var/lib/drac/dracd.db
  install -m 664 dracd.allow-sample %i/etc/drac/dracd.allow
  install -m 644 libdrac.a %i/lib
  install -m 644 drac.h %i/include
  install -m 644 libdrac.1.12.0.dylib %i/lib
  ln -s %p/lib/libdrac.1.12.0.dylib %i/lib/libdrac.1.dylib
  ln -s %p/lib/libdrac.1.12.0.dylib %i/lib/libdrac.dylib
  ln -s %p/sbin/rpc.dracd %i/sbin/dracd
  install -m 644 rpc.dracd.1m %i/share/man/man1/rpc.dracd.1
  install -m 644 dracauth.3 %i/share/man/man3
  ln -s %p/share/man/man1/rpc.dracd.1 %i/share/man/man1/dracd.1
<<
###
SplitOff: <<
  Package: %N-dev
  Depends: %N-shlibs (= %v-%r)
  BuildDependsOnly: true
  Files: <<
    lib/libdrac.a
    lib/libdrac.dylib
    include
    share/man/man3
  <<
  Description: Dynamic Relay Authorization Control (develpement files)
<<
SplitOff2: <<
  Package: %N-shlibs
  Files: <<
    lib/libdrac.*.dylib
  <<
  Shlibs: <<
    %p/lib/libdrac.1.dylib 1.0.0 %n (>= 1.12-1)
  <<
  Description: Dynamic Relay Authorization Control (shared libraries)
<<
###
PostInstScript: <<
  # update init script if necessary
  daemonic update drac
<<
PreRmScript: <<
  # clean up
  [ -f %p/var/run/drac.pid ] && kill `cat %p/var/run/drac.pid`
  if [ $1 != "upgrade" ]; then
    daemonic remove drac
  fi
<<
###
DaemonicName: drac
DaemonicFile: <<
  <service>
   <description>Dynamic Relay Authorization Control</description>
   <message>Dynamic Relay Authorization Control</message>

   <daemon name="drac">
    <executable background="yes">%p/sbin/rpc.dracd</executable>
    <parameters> -i -e 30 %p/var/lib/drac/dracd.db</parameters>
    <configfile>%p/etc/ffserver.conf</configfile>
    <pidfile>%p/var/run/drac.pid</pidfile>
   </daemon>
  </service>
<<
###
Description: Dynamic Relay Authorization Control
DescDetail: <<
  DRAC is a daemon that dynamically updates a relay authorization map for
  sendmail. It provides a way to allow legitimate users to relay mail through
  an SMTP server, while still preventing others from using it as a spam relay.
  User's IP addresses are added to the map immediately after they have
  authenticated to the POP or IMAP server. By default, map entries expire
  after 30 minutes, but can be renewed by additional authentication.
  Periodically checking mail on a POP server is sufficient to do this. The
  POP and SMTP servers can be on different hosts.
<<
###
License: GPL
Maintainer: Justin F. Hallett <the...@users.sourceforge.net>
Homepage: http://mail.cc.umanitoba.ca/drac

--- NEW FILE: drac1.patch ---
diff -Nurd -x'*~' drac.orig/Makefile drac/Makefile
--- drac.orig/Makefile  2003-01-12 15:45:12.000000000 -0500
+++ drac/Makefile       2012-01-18 12:07:31.000000000 -0500
@@ -5,9 +5,10 @@
 
 # Paths
 
-INSTALL = /usr/ucb/install
-EBIN = /usr/local/sbin
-MAN = /usr/local/man/man
+DESTDIR =
+INSTALL = /usr/bin/install
+EBIN = @FINKPREFIX@/sbin
+MAN = @FINKPREFIX@/share/man/man
 
 # OS-Dependant settings
 
@@ -33,26 +34,26 @@
 # -DCIDR_KEY   # keys in CIDR format
 # -DTERM_KD    # keys and data nul-terminated
 
-DEFS = -DTI_RPC -DFCNTL_LOCK -DSYSINFO
+DEFS = -DSOCK_RPC -DFCNTL_LOCK -DGETHOST -DDASH_C
 
 # Compiler flags 
 CC = cc
-RANLIB = :
-CFLAGS = $(DEFS) -g -I/usr/local/src/db/db-4.1.25/build_unix
+RANLIB = /usr/bin/ranlib
+CFLAGS = $(DEFS) -g -fno-common -I@FINKPREFIX@/include/db4
 #CFLAGS = $(DEFS) -g -I/usr/local/src/db/db-3.1.17/build_unix
 #CFLAGS = $(DEFS) -g -I/usr/local/src/db/db-2.4.14/Unix
 #CFLAGS = $(DEFS) -g -I/usr/local/src/db/db.1.85/PORT/sunos.5.2/include
-LDLIBS = -L/usr/local/src/db/db-4.1.25/build_unix -lnsl -ldb-4.1
+LDLIBS = -L@FINKPREFIX@/lib -ldb-4.8
 #LDLIBS = -L/usr/local/src/db/db-3.1.17/build_unix -lnsl -ldb
 #LDLIBS = -L/usr/local/src/db/db-2.4.14/Unix -lnsl -ldb
 #LDLIBS = -L/usr/local/src/db/db.1.85/PORT/sunos.5.2 -lnsl -ldb
-TSTLIBS = -L. -ldrac -lnsl
-RPCGENFLAGS = 
-#RPCGENFLAGS = -C
+TSTLIBS = libdrac.1.12.0.dylib
+#RPCGENFLAGS = 
+RPCGENFLAGS = -C
 
 # Man sections
 MANLIB = 3
-MANADM = 1m
+MANADM = 8
 
 ## Nothing to change after this point
 
@@ -70,6 +71,7 @@
 # Final targets
 
 CLIENT = testing
+CLIENT6 = testing6
 SERVER = rpc.dracd
 LIBRAR = libdrac.a
 
@@ -86,13 +88,14 @@
 LIB_OBJ = dracauth.o
 SVC_OBJ = rpc.dracd.o
 TST_OBJ = testing.o
+TST6_OBJ = testing6.o
 H_OBJS = drac_xdr.o drac_svc.o drac_clnt.o $(SVC_OBJ) $(LIB_OBJ)
 L_OBJS = $(LIB_OBJ) drac_xdr.o drac_clnt.o
 S_OBJS = $(SVC_OBJ) drac_xdr.o drac_svc.o
 
 # Rules
 
-all: $(CLIENT) $(SERVER)
+all: $(CLIENT) $(CLIENT6) $(SERVER)
 
 $(RPC_ALL): $(RPC_SRC) 
        rpcgen $(RPCGENFLAGS) $(RPC_SRC)
@@ -103,12 +106,18 @@
 
 $(LIBRAR): $(L_OBJS)
        rm -f $@
+       $(CC) -dynamiclib -install_name @FINKPREFIX@/lib/libdrac.1.dylib \
+       -compatibility_version 1.0 -current_version 1.12.0 \
+       -o libdrac.1.12.0.dylib $(L_OBJS)
        ar cq $@ $(L_OBJS)
        $(RANLIB) $@
 
 $(CLIENT): $(TST_OBJ) $(LIBRAR)
        $(CC) -o $(CLIENT) $(TST_OBJ) $(TSTLIBS)
 
+$(CLIENT6): $(TST6_OBJ) $(LIBRAR)
+       $(CC) -o $(CLIENT6) $(TST6_OBJ) $(TSTLIBS)
+
 $(SERVER): $(S_OBJS) 
        $(CC) -o $(SERVER) $(S_OBJS) $(LDLIBS)
 
@@ -120,9 +129,9 @@
        tar cf drac.tar $(PACKAGE)
 
 install: $(SERVER)
-       $(INSTALL) -c -o bin -g bin -m 0755 $(SERVER) $(EBIN)
+       $(INSTALL) -c -m 0755 $(SERVER) $(DESTDIR)$(EBIN)
 
 install-man: $(SERVER).1m dracauth.3
-       $(INSTALL) -c -m 0444 $(SERVER).1m $(MAN)$(MANADM)/$(SERVER).$(MANADM)
-       $(INSTALL) -c -m 0444 dracauth.3 $(MAN)$(MANLIB)/dracauth.$(MANLIB)
+       $(INSTALL) -c -m 0444 $(SERVER).1m 
$(DESTDIR)$(MAN)$(MANADM)/$(SERVER).$(MANADM)
+       $(INSTALL) -c -m 0444 dracauth.3 
$(DESTDIR)$(MAN)$(MANLIB)/dracauth.$(MANLIB)
 
diff -Nurd -x'*~' drac.orig/drac.x drac/drac.x
--- drac.orig/drac.x    1998-08-10 22:01:18.000000000 -0400
+++ drac/drac.x 2012-01-18 11:57:49.000000000 -0500
@@ -17,6 +17,10 @@
        unsigned long ip_addr;  /* In network order */
 };
 
+struct drac_add_parm6 {
+       char ip_addr6[16];      /* In network order */
+};
+
 enum addstat {
        ADD_SUCCESS,    /* Succeeded */
        ADD_PERM,       /* Permission denied */
@@ -32,4 +36,11 @@
                addstat
                DRACPROC_ADD(drac_add_parm) = 1;
        } = 1;
+       version DRACVERS6 {
+               /*
+               * Update my passwd entry
+               */
+               addstat
+               DRACPROC_ADD(drac_add_parm6) = 1;
+       } = 2;
 } = 900101;
diff -Nurd -x'*~' drac.orig/dracauth.c drac/dracauth.c
--- drac.orig/dracauth.c        1999-06-24 22:15:12.000000000 -0400
+++ drac/dracauth.c     2012-01-18 11:57:49.000000000 -0500
@@ -135,4 +135,121 @@
        return 0;
 }
 
+int
+dracauth6(server, userip6, errmsg)
+       char *server; unsigned char userip6[16]; char **errmsg; {
+
+       CLIENT *clnt6;
+       addstat  *result;
+       drac_add_parm6  dracproc_add_2_arg;
+
+#ifdef TI_RPC
+       clnt6 = clnt_create(server, DRACPROG, DRACVERS6, "datagram_v");
+#endif
+#ifdef SOCK_RPC
+       clnt6 = clnt_create(server, DRACPROG, DRACVERS6, "udp");
+#endif
+       if (clnt6 == (CLIENT *) NULL) {
+               if ( errmsg ) *errmsg = clnt_spcreateerror(server);
+               return (-1);
+       }
+       memcpy(dracproc_add_2_arg.ip_addr6, userip6,
+               sizeof(dracproc_add_2_arg.ip_addr6));
+       result = dracproc_add_2(&dracproc_add_2_arg, clnt6);
+       if (result == (addstat *) NULL) {
+               if ( errmsg ) *errmsg = clnt_sperror(clnt, "call failed");
+               clnt_destroy(clnt6);
+               return (-2);
+       }
+       clnt_destroy(clnt6);
+       if ( errmsg ) {
+           switch (*result) {
+             case ADD_SUCCESS:
+               *errmsg = "Server reports add succeeded";
+               break;
+             case ADD_PERM:
+               *errmsg = "Server reports permission denied";
+               break;
+             case ADD_SYSERR:
+               *errmsg = "Server reports system error";
+               break;
+             default:
+               *errmsg = "Server reports unknown error";
+           }
+       }
+       return *result;
+}
+
+static CLIENT *clnt6;
+
+int
+dracconn6(server, errmsg)
+       char *server; char **errmsg; {
+
+#ifdef TI_RPC
+       clnt6 = clnt_create(server, DRACPROG, DRACVERS6, "datagram_v");
+#endif
+#ifdef SOCK_RPC
+       clnt6 = clnt_create(server, DRACPROG, DRACVERS6, "udp");
+#endif
+       if (clnt6 == (CLIENT *) NULL) {
+               if ( errmsg ) *errmsg = clnt_spcreateerror(server);
+               return (-1);
+       }
+       if ( errmsg ) *errmsg = "Connect succeeded";
+       return 0;
+}
+
+
+int
+dracsend6(userip6, errmsg)
+       unsigned char userip6[16]; char **errmsg; {
+
+       addstat  *result;
+       drac_add_parm6  dracproc_add_2_arg;
+
+       if (clnt6 == (CLIENT *) NULL) {
+               if ( errmsg ) *errmsg = "Not connected";
+               return (-1);
+       }
+       memcpy(dracproc_add_2_arg.ip_addr6, userip6,
+               sizeof(dracproc_add_2_arg.ip_addr6));
+       result = dracproc_add_2(&dracproc_add_2_arg, clnt6);
+       if (result == (addstat *) NULL) {
+               if ( errmsg ) *errmsg = clnt_sperror(clnt6, "call failed");
+               return (-2);
+       }
+       if ( errmsg ) {
+           switch (*result) {
+             case ADD_SUCCESS:
+               *errmsg = "Server reports add succeeded";
+               break;
+             case ADD_PERM:
+               *errmsg = "Server reports permission denied";
+               break;
+             case ADD_SYSERR:
+               *errmsg = "Server reports system error";
+               break;
+             default:
+               *errmsg = "Server reports unknown error";
+           }
+       }
+       return *result;
+}
+
+
+int
+dracdisc6(errmsg)
+       char **errmsg; {
+
+       if (clnt6 == (CLIENT *) NULL) {
+               if ( errmsg ) *errmsg = "Not connected";
+               return (-1);
+       }
+       clnt_destroy(clnt6);
+       clnt6 = (CLIENT *) NULL;
+       if ( errmsg ) *errmsg = "Disconnect succeeded";
+       return 0;
+}
+
 /**/
diff -Nurd -x'*~' drac.orig/rpc.dracd.1m drac/rpc.dracd.1m
--- drac.orig/rpc.dracd.1m      1998-07-23 11:13:59.000000000 -0400
+++ drac/rpc.dracd.1m   2012-01-18 11:57:49.000000000 -0500
@@ -2,7 +2,7 @@
 '\"macro stdmacro
 .\" Copyright University of Manitoba 1998.
 .nr X
-.TH rpc.dracd 1M "22 Jul 1998"
+.TH rpc.dracd 8 "22 Jul 1998"
 .SH NAME
 rpc.dracd \- Dynamic Relay Authorization Control server
 .SH SYNOPSIS
@@ -16,13 +16,13 @@
 \f4rpc.dracd\f1
 is the Dynamic Relay Authorization Control server.
 It uses the Berkeley db package to maintain a relay authorization
-map for sendmail, by default \f4/etc/mail/dracd.db\f1.
+map for sendmail, by default \f4@FINKPREFIX@/var/lib/drac/dracd.db\f1.
 POP and IMAP mail servers make an RPC call to add an entry to the
 authorization cache after they have authenticated each user.
 The daemon, rpc.dracd, adds or updates entries in the cache, and
 periodically expires old entries.
 Only trusted mail servers are permitted to communicate with rpc.dracd,
-as controlled by \f4/etc/mail/dracd.allow\f1.
+as controlled by \f4@FINKPREFIX@/var/lib/drac/dracd.allow\f1.
 If this file does not exist, all local IP addresses are permitted.
 .SS Allow File Format
 The Allow File file consists of entries of the form:
@@ -58,10 +58,10 @@
 .SH FILES
 .PD 0
 .TP 30
-.B /etc/mail/dracd.db
+.B @FINKPREFIX@/var/lib/drac/dracd.db
 default database file
 .TP
-.B /etc/mail/dracd.allow
+.B @FINKPREFIX@/etc/drac/dracd.allow
 default allow file.
 .PD
 .SH SEE ALSO
diff -Nurd -x'*~' drac.orig/rpc.dracd.c drac/rpc.dracd.c
--- drac.orig/rpc.dracd.c       2003-01-12 15:22:22.000000000 -0500
+++ drac/rpc.dracd.c    2012-01-18 11:57:49.000000000 -0500
@@ -36,8 +36,8 @@
 #endif
 #include "drac.h"
 
-#define DBFILE "/etc/mail/dracd.db"
-#define ALFILE "/etc/mail/dracd.allow"
+#define DBFILE "@FINKPREFIX@/var/lib/drac/dracd.db"
+#define ALFILE "@FINKPREFIX@/etc/drac/dracd.allow"
 
 struct net_def {
     struct net_def *nd_next;
@@ -356,6 +356,128 @@
        return (&result);
 }
 
+/* Add an entry to the database */
+addstat *
+#ifdef DASH_C
+dracproc_add_2_svc(argp, rqstp)
+#else
+dracproc_add_2(argp, rqstp)
+#endif
+       drac_add_parm6 *argp;
+       struct svc_req *rqstp; {
+
+       static addstat  result;
+       char buf[INET6_ADDRSTRLEN];
+#ifdef TI_RPC
+       struct netbuf *nb;
+       struct netconfig *nc;
+       char *cad, *pt;
+#endif
+#ifdef SOCK_RPC
+       struct sockaddr_in *si;
+#endif
+      struct in_addr client_ip;
+       struct in6_addr requ_ip;
+       DBT key, data;
+       char akey[INET6_ADDRSTRLEN+4], alimit[32];
+       struct net_def *nd;
+
+       result = ADD_SUCCESS;
+
+       /* Get the IP address of the client */
+#ifdef TI_RPC
+       if ( (nc = getnetconfigent(rqstp->rq_xprt->xp_netid)) == NULL
+           || (nb = svc_getrpccaller(rqstp->rq_xprt)) == NULL
+           || (cad = taddr2uaddr(nc, nb)) == NULL ) {
+           if (nc) freenetconfigent(nc);
+           result = ADD_SYSERR;
+           return (&result);
+       }
+       if ( (pt = strrchr(cad, '.')) != NULL ) *pt = '\0';
+       if ( (pt = strrchr(cad, '.')) != NULL ) *pt = '\0';
+       client_ip.s_addr = inet_addr(cad);
+       freenetconfigent(nc);
+       free(cad);
+#endif
+#ifdef SOCK_RPC
+       if ( (si = svc_getcaller(rqstp->rq_xprt)) == NULL ) {
+           result = ADD_SYSERR;
+           return (&result);
+       }
+       client_ip.s_addr = si->sin_addr.s_addr;
+#endif
+#ifdef DEBUG
+       fprintf(debugf, "Client Address: %s\n", inet_ntoa(client_ip));
+       fflush(debugf);
+#endif
+
+       /* Check agains the table of trusted clients */
+       for ( nd = net_tbl; nd != NULL; nd = nd->nd_next ) {
+           if ( (client_ip.s_addr & nd->nd_mask.s_addr)
+               == nd->nd_addr.s_addr ) break;
+       }
+       if ( nd == NULL ) {
+           result = ADD_PERM;
+           return (&result);
+       }
+
+       /* Set up for the add */
+       memcpy(requ_ip.s6_addr, argp->ip_addr6,
+               sizeof(requ_ip.s6_addr));
+#ifdef DEBUG
+       fprintf(debugf, "Requested IP Address: %s\n",
+               inet_ntop(AF_INET6, requ_ip.s6_addr, buf, sizeof(buf)));
+       fflush(debugf);
+#endif
+       memset(&key, 0, sizeof(DBT));
+       memset(&data, 0, sizeof(DBT));
+       inet_ntop(AF_INET6, requ_ip.s6_addr, akey, sizeof(akey)-4);
+#ifdef CIDR_KEY
+       strcat(akey, "/128");
+#endif
+       key.data = akey;
+#ifdef TERM_KD
+       key.size = strlen(akey) + 1;
+#else
+       key.size = strlen(akey);
+#endif
+       sprintf(alimit, "%lu", time((time_t *)NULL) + explimit);
+       data.data = alimit;
+#ifdef TERM_KD
+       data.size = strlen(alimit) + 1;
+#else
+       data.size = strlen(alimit);
+#endif
+
+       /* Do the add and sync, with locking */
+       if ( lockdb() == (-1) ) {
+           syslog(LOG_ERR, "dracproc_add_1 lockdb failed: %m");
+       }
+#if DB_VERSION_MAJOR < 2
+       errno = 0;
+       dbp->put(dbp, &key, &data, 0);
+#else
+       errno = dbp->put(dbp, NULL, &key, &data, 0);
+#endif
+       if ( errno != 0 ) {
+           syslog(LOG_ERR, "dracproc_add_1 put failed: %m");
+           result = ADD_SYSERR;
+       }
+#if DB_VERSION_MAJOR < 2
+       errno = 0;
+       dbp->sync(dbp, 0);
+#else
+       errno = dbp->sync(dbp, 0);
+#endif
+       if ( errno != 0 ) {
+           syslog(LOG_ERR, "dracproc_add_1 sync failed: %m");
+       }
+       (void)unlockdb();
+
+       /* Send result code back to client */
+       return (&result);
+}
+
 /* Expire old entries from the database */
 expire() {
 #if DB_VERSION_MAJOR < 2
diff -Nurd -x'*~' drac.orig/testing6.c drac/testing6.c
--- drac.orig/testing6.c        1969-12-31 19:00:00.000000000 -0500
+++ drac/testing6.c     2012-01-18 11:57:49.000000000 -0500
@@ -0,0 +1,28 @@
+/*
+ * Test client for dracauth
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+main(argc, argv)
+       int argc;
+       char *argv[];
+{
+        int rc;
+       char *host;
+       unsigned char ip6[16];
+       char *err;
+
+       if (argc < 3) {
+               printf("usage:  %s server_host client_addr\n", argv[0]);
+               exit(1);
+       }
+       host = argv[1];
+       inet_pton(AF_INET6, argv[2], ip6);
+       rc = dracauth6(host, ip6, &err);
+       if (rc != 0) printf("%s: %s\n", argv[0], err);
+}


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
http://news.gmane.org/gmane.os.apple.fink.cvs

Reply via email to