
connection should be refused or allowed. Unfortunately, I couldn't find much information about the way of doing this. The man page of "request_init" did help but was not enough.
A search with Google didn't help me so now I'm hoping someone on this list could give me a hint where to find more information about the tcp_wrapper library. Any links, docs ?
Hope I'm not out of place (I'm not a programmer) in suggesting that you try:
rpm -qd tcpd man 3 hosts_access emacs /usr/include/tcpd.h
for more starting places.
have fun ... dproc
Install the latest lprng source rpm from 8.0 and see the patch that comes with it. I have appended it below: Thanks, Roman. diff -ruN LPRng-3.8.5.orig/src/Makefile.in LPRng-3.8.5/src/Makefile.in --- LPRng-3.8.5.orig/src/Makefile.in Wed Jan 23 01:04:35 2002 +++ LPRng-3.8.5/src/Makefile.in Mon Jan 28 22:58:45 2002 @@ -253,7 +253,7 @@ $(LINK) $(LIBLPR_OBJS) -rpath ${libdir} lpd: $(LPD_OBJS) liblpr.la - $(LINK) ${LPD_OBJS} liblpr.la $(LIBS) + $(LINK) ${LPD_OBJS} liblpr.la $(LIBS) -lwrap lpr: $(LPR_OBJS) liblpr.la $(LINK) ${LPR_OBJS} liblpr.la $(LIBS) lpq: $(LPQ_OBJS) liblpr.la diff -ruN LPRng-3.8.5.orig/src/common/lpd.c LPRng-3.8.5/src/common/lpd.c --- LPRng-3.8.5.orig/src/common/lpd.c Wed Jan 23 02:01:17 2002 +++ LPRng-3.8.5/src/common/lpd.c Tue Jan 29 14:28:13 2002 @@ -44,6 +44,10 @@ #include "lpd.h" +#include <tcpd.h> +int allow_severity = LOG_INFO; +int deny_severity = LOG_WARNING; + /**** ENDINCLUDE ****/ /*************************************************************************** @@ -490,6 +494,20 @@ err = errno; DEBUG1("lpd: connection fd %d", newsock ); if( newsock > 0 ){ +/* + * libwrap/tcp_wrappers: + * draht@suse.de, Mon Jan 28 2002 + */ + + struct request_info wrap_req; + + request_init(&wrap_req, RQ_DAEMON, "lpd" , RQ_FILE, newsock, NULL); + fromhost(&wrap_req); + openlog("lpd", LOG_PID, LOG_LPR); /* we syslog(3) initialized, no closelog(). */ + if (hosts_access(&wrap_req)) { + /* We accept. */ + syslog(LOG_INFO, "connection from %s", eval_client(&wrap_req)); + pid = Start_worker( "server", &args, newsock ); if( pid < 0 ){ LOGERR(LOG_INFO) _("lpd: fork() failed") ); @@ -497,6 +515,13 @@ } else { DEBUG1( "lpd: listener pid %d running", pid ); } + } else { /* we do not accept the connection: */ + syslog(LOG_WARNING, "connection refused from %s", eval_client(&wrap_req)); + } +/* + * end libwrap + */ + close( newsock ); Free_line_list(&args); } else {