Article View: news.software.nntp
Article #24469INN Shadow password patch...
From: Nate Shockey
Date: Thu, 18 Dec 1997 00:00
Date: Thu, 18 Dec 1997 00:00
210 lines
6305 bytes
6305 bytes
This is a multi-part message in MIME format.
--------------C7022435F3BE234DDB0479B5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
INN-1.7.2 shadow password file patch for Solaris...
I'm not saying that this patch won't work with other
operating systems, I've just never tried it. Ok, first
thing, copy the patch to your inn-1.X.X/nnrpd directory, and then
apply the patch in the normal way.
Here's where a little explanation is necessary.
In order to read the shadow file, you have to be root, right?
Well, nobody wants to leave nnrpd running as root just so a
few lousy lusers can read their news. The problem also exists
that the "authinfo" command is not required, which means
you can't force a setuid() right after the authinfo, because
not everyone does it. The patch fixes this, but it still
requires nnrpd to be _run_ as root. As soon as any command
other than authinfo is entered it will change itself
to news. (It is up to you, however, to make nnrpd
run originally as root. I run nnrpd from inetd for other
reasons, so this wasn't an issue for me.)
In order to do this, though, you will have to
edit "nnrpd.h" and change the #define NEWS_UID to
the uid of your user "news" _after you have installed
the patch_.
Thanks! If this causes any problems, let me know!
It's been running fine at FlashNet for sometime now, so I don't
anticipate any trouble. :)
Nate Shockey
<underdog@flash.net>
--------------C7022435F3BE234DDB0479B5
Content-Type: text/plain; charset=us-ascii; name="spwdpatch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="spwdpatch"
*** article.c Thu Dec 18 12:58:52 1997
--- article.c.ORIG Mon Dec 8 17:48:50 1997
***************
*** 427,434 ****
register BOOL ok;
ARTNUM art;
- setuid(NEWS_UID);
-
/* Find what to send; get permissions. */
ok = PERMcanread;
switch (*av[0]) {
--- 427,432 ----
***************
*** 997,1004 ****
char buff[SPOOLNAMEBUFF];
ARTNUM art;
- setuid(NEWS_UID);
-
if (!PERMcanread) {
Reply("%s\r\n", NOACCESS);
return;
--- 995,1000 ----
***************
*** 1077,1084 ****
ARTRANGE range;
char buff[SPOOLNAMEBUFF];
- setuid(NEWS_UID);
-
if (!PERMcanread) {
Printf("%s\r\n", NOACCESS);
return;
--- 1073,1078 ----
*** commands.c Thu Dec 18 12:58:46 1997
--- commands.c.ORIG Mon Dec 8 17:48:50 1997
***************
*** 276,283 ****
TIMEINFO t;
struct tm *gmt;
- setuid(NEWS_UID);
-
if (GetTimeInfo(&t) < 0 || (gmt = gmtime(&t.time)) == NULL) {
Reply("%d Can't get time, %s\r\n", NNTP_TEMPERR_VAL, strerror(errno));
return;
--- 276,281 ----
***************
*** 306,313 ****
char *wildarg = NULL;
char savec;
- setuid(NEWS_UID);
-
p = av[1];
if (p == NULL || caseEQ(p, "active")) {
static time_t last_time;
--- 304,309 ----
***************
*** 461,468 ****
long date;
char *grplist[2];
- setuid(NEWS_UID);
-
/* Parse the date. */
date = NNTPtoGMT(av[1], av[2]);
if (date < 0) {
--- 457,462 ----
***************
*** 562,569 ****
STRING response;
char idbuff[SMBUF];
- setuid(NEWS_UID);
-
if (!PERMcanpost) {
syslog(L_NOTICE, "%s noperm post without permission", ClientHost);
Reply("%s\r\n", NNTP_CANTPOST);
--- 556,561 ----
***************
*** 672,679 ****
{
char *p;
- setuid(NEWS_UID);
-
if ((p = HISgetent(av[1], TRUE)) == NULL)
Reply("%d Don't have it\r\n", NNTP_DONTHAVEIT_VAL);
else
--- 664,669 ----
*** nnrpd.c Thu Dec 18 13:01:50 1997
--- nnrpd.c.ORIG Mon Dec 8 17:48:50 1997
***************
*** 11,17 ****
#define MAINLINE
#include "nnrpd.h"
#include <netdb.h>
! #include <shadow.h>
#if defined(HPUX)
#include <sys/pstat.h>
#endif /* defined(HPUX) */
--- 11,17 ----
#define MAINLINE
#include "nnrpd.h"
#include <netdb.h>
! #include <pwd.h>
#if defined(HPUX)
#include <sys/pstat.h>
#endif /* defined(HPUX) */
***************
*** 315,321 ****
register char *p;
register BOOL found;
register int i;
! struct spwd *swd;
char buff[BIG_BUFFER];
char *fields[5];
--- 315,321 ----
register char *p;
register BOOL found;
register int i;
! struct passwd *pwd;
char buff[BIG_BUFFER];
char *fields[5];
***************
*** 354,362 ****
/* See if we should lookup a specific user in the passwd file */
if (user && pass && EQ(fields[2], "+")) {
! if ((swd = getspnam(user)) == NULL)
continue;
! if (!EQ(swd->sp_pwdp, crypt(pass, swd->sp_pwdp)))
continue;
}
/* Matching for a specific user or just the host? */
--- 354,362 ----
/* See if we should lookup a specific user in the passwd file */
if (user && pass && EQ(fields[2], "+")) {
! if ((pwd = getpwnam(user)) == NULL)
continue;
! if (!EQ(pwd->pw_passwd, crypt(pass, pwd->pw_passwd)))
continue;
}
/* Matching for a specific user or just the host? */
*** nnrpd.h Thu Dec 18 12:58:38 1997
--- nnrpd.h.ORIG Mon Dec 8 17:48:50 1997
***************
*** 34,44 ****
#define ART_LINE_LENGTH 1000
#define ART_LINE_MALLOC 1024
- /*
- ** Define this as the uid of user 'news'.
- ** INN-Solaris/shadow patch.
- */
- #define NEWS_UID 104
/*
** Some convenient shorthands.
--- 34,39 ----
--------------C7022435F3BE234DDB0479B5--
Technical Details
Message-ID:
<349982C8.2E3EF51@flash.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <349982C8.2E3EF51@flash.net> Subject: INN Shadow password patch... Date: Thu, 18 Dec 1997 00:00:00 +0000 From: Nate Shockey <underdog@flash.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 299430002 Content-Type: multipart/mixed; boundary="------------C7022435F3BE234DDB0479B5" Organization: FlashNet Communications Mime-Version: 1.0 Reply-To: underdog@flash.net Newsgroups: news.software.nntp