Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
drac
drac.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File drac.dif of Package drac
--- drac/Makefile +++ drac/Makefile @@ -5,9 +5,9 @@ # Paths -INSTALL = /usr/ucb/install -EBIN = /usr/local/sbin -MAN = /usr/local/man/man +INSTALL = /usr/bin/install +EBIN = /usr/sbin +MAN = /usr/share/man/man # OS-Dependant settings @@ -33,26 +33,27 @@ # -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 +CC = gcc RANLIB = : -CFLAGS = $(DEFS) -g -I/usr/local/src/db/db-4.1.25/build_unix +OPTFLAGS = -O2 -Wall +CFLAGS = $(DEFS) $(OPTFLAGS) #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 = -lnsl -ldb -lpthread #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 +#RPCGENFLAGS = +RPCGENFLAGS = -C # Man sections MANLIB = 3 -MANADM = 1m +MANADM = 8 ## Nothing to change after this point @@ -110,7 +111,7 @@ $(CC) -o $(CLIENT) $(TST_OBJ) $(TSTLIBS) $(SERVER): $(S_OBJS) - $(CC) -o $(SERVER) $(S_OBJS) $(LDLIBS) + $(CC) -o $(SERVER) $(S_OBJS) $(LDLIBS) -pie clean: rm -f core $(RPC_ALL) $(H_OBJS) $(TST_OBJ) $(CLIENT) \ @@ -120,7 +121,7 @@ tar cf drac.tar $(PACKAGE) install: $(SERVER) - $(INSTALL) -c -o bin -g bin -m 0755 $(SERVER) $(EBIN) + $(INSTALL) -c -m 0755 $(SERVER) $(EBIN) install-man: $(SERVER).1m dracauth.3 $(INSTALL) -c -m 0444 $(SERVER).1m $(MAN)$(MANADM)/$(SERVER).$(MANADM) --- drac/rc.dracd +++ drac/rc.dracd @@ -0,0 +1,149 @@ +#! /bin/sh +# Copyright (c) 2000 SuSE GmbH Nuernberg, Germany. +# Copyright (c) 2002 SuSE Linux Ag Nuernberg, Germany. +# +# Author: Carsten Hoeger, Ralf Haferkamp +# +# /sbin/init.d/dracd +# +# and symbolic its link +# +# /sbin/rcdracd +# +### BEGIN INIT INFO +# Provides: drac +# Required-Start: $remote_fs portmap +# Required-Stop: $remote_fs portmap +# Default-Start: 3 5 +# Description: start the DRAC Daemon +### END INIT INFO + +test -f /etc/sysconfig/dracd && . /etc/sysconfig/dracd + +# Determine the base and follow a runlevel link name. +base=${0##*/} +link=${base#*[SK][0-9][0-9]} + +DRAC_BIN=/usr/sbin/rpc.dracd +test -x $DRAC_BIN || exit 5 + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v ditto but be verbose in local rc status +# rc_status -v -r ditto and clear the local rc status +# rc_failed set local and overall rc status to failed +# rc_failed <num> set local and overall rc status to <num><num> +# rc_reset clear local rc status (overall remains) +# rc_exit exit appropriate to overall rc status +. /etc/rc.status + +# First reset status of this service +rc_reset + +# Return values acc. to LSB for all commands but status: +# 0 - success +# 1 - generic or unspecified error +# 2 - invalid or excess argument(s) +# 3 - unimplemented feature (e.g. "reload") +# 4 - insufficient privilege +# 5 - program is not installed +# 6 - program is not configured +# 7 - program is not running +# +# Note that starting an already running service, stopping +# or restarting a not-running service as well as the restart +# with force-reload (in case signalling is not supported) are +# considered a success. + +case "$1" in + start) + echo -n "Starting service DRAC" + ## Start daemon with startproc(8). If this fails + ## the echo return value is set appropriate. + + # NOTE: startproc return 0, even if service is + # already running to match LSB spec. + startproc $DRAC_BIN -i -e $DRACD_RELAYTIME $DRACD_DRACDB + + # Remember status and be verbose + rc_status -v + ;; + stop) + echo -n "Shutting down service DRAC" + ## Stop daemon with killproc(8) and if this fails + ## set echo the echo return value. + + killproc -TERM $DRAC_BIN + + # Remember status and be verbose + rc_status -v + ;; + try-restart) + ## Stop the service and if this succeeds (i.e. the + ## service was running before), start it again. + ## Note: try-restart is not (yet) part of LSB (as of 0.7.5) + $0 status >/dev/null && $0 restart + + # Remember status and be quiet + rc_status + ;; + restart) + ## Stop the service and regardless of whether it was + ## running or not, start it again. + $0 stop + $0 start + + # Remember status and be quiet + rc_status + ;; + force-reload) + ## Signal the daemon to reload its config. Most daemons + ## do this on signal 1 (SIGHUP). + ## If it does not support it, restart. + + echo -n "Reload service DRAC" + ## if it supports it: + #killproc -HUP $CYRUS_BIN + #touch /var/run/FOO.pid + #rc_status -v + + # Otherwise: + $0 stop && $0 start + rc_status + ;; + reload) + ## Like force-reload, but if daemon does not support + ## signalling, do nothing (!) + + echo -n "Reload service DRAC" + # If it supports signalling: + #killproc -HUP $CYRUS_BIN + #touch /var/run/FOO.pid + #rc_status -v + + # Otherwise if it does not support reload: + rc_failed 3 + rc_status -v + ;; + status) + echo -n "Checking for service DRAC: " + ## Check status with checkproc(8), if process is running + ## checkproc will return with exit status 0. + + # Status has a slightly different for the status command: + # 0 - service running + # 1 - service dead, but /var/run/ pid file exists + # 2 - service dead, but /var/lock/ lock file exists + # 3 - service not running + + # NOTE: checkproc returns LSB compliant status values. + checkproc $DRAC_BIN + rc_status -v + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" + exit 1 + ;; +esac +rc_exit --- drac/README +++ drac/README @@ -18,7 +18,7 @@ periodically expires old entries. o Only trusted mail servers are permitted to communicate with rpc.dracd, - as controlled by /etc/mail/dracd.allow . + as controlled by /etc/dracd.allow . o The daemon can optionally re-create the database on startup. --- drac/rpc.dracd.1m +++ drac/rpc.dracd.1m @@ -22,7 +22,7 @@ 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/etc/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: @@ -61,7 +61,7 @@ .B /etc/mail/dracd.db default database file .TP -.B /etc/mail/dracd.allow +.B /etc/dracd.allow default allow file. .PD .SH SEE ALSO --- drac/rpc.dracd.c +++ drac/rpc.dracd.c @@ -37,7 +37,7 @@ #include "drac.h" #define DBFILE "/etc/mail/dracd.db" -#define ALFILE "/etc/mail/dracd.allow" +#define ALFILE "/etc/dracd.allow" struct net_def { struct net_def *nd_next; @@ -62,12 +62,17 @@ FILE *debugf; #endif +static void expire(); +static int lockdb(); +static int unlockdb(); +static void iniclist(); /* On SIGTERM, must close db */ void catcher(n) int n; { terminate = 1; } /* Parse command-line options */ +int main(argc, argv) int argc; char **argv; { int c; extern char *optarg; @@ -93,6 +98,7 @@ } /* Called once after fork */ +void drac_run() { int sel; time_t nexte, now; @@ -176,7 +182,11 @@ (initdb) ? DB_TRUNCATE|DB_CREATE : DB_CREATE, 0644); #else +#if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1) + errno = dbp->open(dbp, NULL, dbfile, NULL, DB_BTREE, +#else errno = dbp->open(dbp, dbfile, NULL, DB_BTREE, +#endif (initdb) ? DB_TRUNCATE|DB_CREATE : DB_CREATE, 0644); #endif @@ -357,6 +367,7 @@ } /* Expire old entries from the database */ +static void expire() { #if DB_VERSION_MAJOR < 2 int seqerr, flags; @@ -386,7 +397,7 @@ #endif if ( errno != 0 ) { syslog(LOG_ERR, "expire cursor failed: %m"); - return 0; + return; } #endif @@ -440,6 +451,7 @@ } /* Lock the database */ +static int lockdb() { #ifdef FCNTL_LOCK struct flock lfd; @@ -454,6 +466,7 @@ } /* Unlock the database */ +static int unlockdb() { #ifdef FCNTL_LOCK struct flock lfd; @@ -469,6 +482,7 @@ /* Initialize the trusted client table */ /* All in network byte order */ +static void iniclist() { FILE *alfp; char buf[128], mask[32], addr[32], hname[128]; --- drac/sysconfig.dracd +++ drac/sysconfig.dracd @@ -0,0 +1,17 @@ +## Path: Network/Mail/Drac +## Description: Dynamic Relay Authorization Control (POP-before-SMTP) +## Type: integer +## Default: 5 +## ServiceRestart: dracd +# +# The TTL of a per IP open relay in minutes +# +DRACD_RELAYTIME="5" + +## Type: string +## Default: /etc/postfix/dracd.db +## ServiceRestart: dracd +# +# The name of the (btree) dracdb. +# +DRACD_DRACDB="/etc/postfix/dracd.db" --- drac/testing.c +++ drac/testing.c @@ -3,6 +3,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -24,4 +25,5 @@ ip = inet_addr(argv[2]); rc = dracauth(host, ip, &err); if (rc != 0) printf("%s: %s\n", argv[0], err); + return 0; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor