Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Using SIA calls, modifying INN's nnrpd
@ 1998-09-23  4:00 Paul Coen
  1998-09-23  4:00 ` John Ferlan
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Coen @ 1998-09-23  4:00 UTC (permalink / raw)


I'm trying to hack the INN 1.7.2 nnrpd program to use the sia* calls
for user authentication.  Am I reading the (dripping sarcasm) wonderfully
thorough documentation correctly, and I have to use sia_ses_init, and
then somehow call the sia version of getpwnam -- some stuff in the
security manual makes it sound like you can just use sia_getpasswd.
The table on page 20-3 lists sia_getpwnam(), though.  Or is there another
function that then passes the call based on matrix.conf?

Anyway, I'd love to see just one *good* example before I try to hack
this in. I want to do user based security on a 4.0b Digital Unix system
with the enhanced security package installed.  Any tips would be
appreciated.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using SIA calls, modifying INN's nnrpd
  1998-09-23  4:00 Using SIA calls, modifying INN's nnrpd Paul Coen
@ 1998-09-23  4:00 ` John Ferlan
  1998-09-29  4:00   ` Paul Coen
  0 siblings, 1 reply; 4+ messages in thread
From: John Ferlan @ 1998-09-23  4:00 UTC (permalink / raw)




Paul Coen wrote:

> I'm trying to hack the INN 1.7.2 nnrpd program to use the sia* calls
> for user authentication.  Am I reading the (dripping sarcasm) wonderfully
> thorough documentation correctly, and I have to use sia_ses_init, and
> then somehow call the sia version of getpwnam -- some stuff in the
> security manual makes it sound like you can just use sia_getpasswd.
> The table on page 20-3 lists sia_getpwnam(), though.  Or is there another
> function that then passes the call based on matrix.conf?
>

Don't try and mimic what someone else does - that is find out what the
username is, get an entry from the password database, ask for the password,
compare the result in the password db with a self crypt()'d change of the
user's input password.

SIA will do what you want it to do very simply if you don't try to follow
other examples...  The question you should be asking is why do you need to
get a passwd pointer?  What are you doing with it - and of course will what
you're doing work in an Enhanced Security environment (or shadow password db
for other unixes).

>
> Anyway, I'd love to see just one *good* example before I try to hack
> this in. I want to do user based security on a 4.0b Digital Unix system
> with the enhanced security package installed.  Any tips would be
> appreciated.

See the example in Chapter 20 "Using the SIA Interface" Example 20-3 -
"Session Processing Code"... It's basically what login.c does (more or
less)...

See appendix D for examples of reauthentication and su authentication

If you already have a username/password and all you're trying to do is
validate if they are correct, then why not use sia_validate_user().

I guess if I knew what it was you were trying to do more exactly, then I
could provide a more direct answer...


--

John Ferlan                             | DTN: 264-0854  Office: ZKO3-3/Y26
ferlan aT zk3 dOt dec dOt com           | Compaq Computer Corp
To reply read above and figure it out@  | 110 Spit Brook Rd.
                                        | M/S: ZKO3-3/W20
Spammers can cheerfully send mail to:   | Nashua, NH 03062-2698
 uce@ftc.gov                     | (603)884-0854
 root@localhost
 webmaster@localhost
 postmaster@localhost





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using SIA calls, modifying INN's nnrpd
  1998-09-23  4:00 ` John Ferlan
@ 1998-09-29  4:00   ` Paul Coen
  1998-09-30  4:00     ` John Ferlan
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Coen @ 1998-09-29  4:00 UTC (permalink / raw)


In article <36095BCE.109F6475@zk3.dec.com>, John Ferlan <ferlan@zk3.dec.com> writes:
> other examples...  The question you should be asking is why do you need to
> get a passwd pointer?  What are you doing with it - and of course will what
> you're doing work in an Enhanced Security environment (or shadow password db
> for other unixes).

All I'm trying to do is say have the nnrpd server say "yup, this user
exists and that's the right password." It's not logging in as the
user, not accessing files as the user, etc.

> If you already have a username/password and all you're trying to do is
> validate if they are correct, then why not use sia_validate_user().
> 

That sounds good -- I've been looking at it, but it's hard to tell
what it's doing, and I'm not sure I'm testing for success correctly.
In fact, I'm fairly sure I'm not doing it correctly.

The original routine in INN's nnrpd (1.7.*) is:

         /* 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;
        }

I've tried changing by adding:

int auth_stat;
char *argv[] = {"NNRPD",NULL};


and using:

         /* See if we should lookup a specific user in the passwd file */
         if (user && pass && EQ(fields[2], "+")) {
            auth_stat=sia_validate_user(NULL,1,argv,NULL,user,NULL,
             	0,NULL,pwd->pw_passwd);
            if (!EQ(auth_stat, "SIACORRECT"))
                continue;
         }

It's not working so far -- I'm pretty sure I'm really just not 
understanding something about the call -- or how to check for 
success/failure.  Of course, I'm still noticing things about the
logic in nnrpd.c, which is making this even more complicated -- I
can't eliminate either a sia_* call error on my part or a logic
error on my part yet :)  Thanks in advance for any advice.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using SIA calls, modifying INN's nnrpd
  1998-09-29  4:00   ` Paul Coen
@ 1998-09-30  4:00     ` John Ferlan
  0 siblings, 0 replies; 4+ messages in thread
From: John Ferlan @ 1998-09-30  4:00 UTC (permalink / raw)
  To: Paul Coen

SNIP SNIP...

> The original routine in INN's nnrpd (1.7.*) is:
>
>          /* 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;
>         }
>
> I've tried changing by adding:
>
> int auth_stat;
> char *argv[] = {"NNRPD",NULL};
>
> and using:
>
>          /* See if we should lookup a specific user in the passwd file */
>          if (user && pass && EQ(fields[2], "+")) {
>             auth_stat=sia_validate_user(NULL,1,argv,NULL,user,NULL,
>                 0,NULL,pwd->pw_passwd);

Don't pass pwd->pw_passwd - pass the argument 'pass' - it's the user's pass phrase
correct?  What you're passing is the password taken from the password database - if from
/etc/passwd and if user is in the Enhanced Database (auth.db), then what's in that field
could be "*".  In my previous entry you will note I said other UNIX's use getpwnam() and
crypt() themselves - with SIA and Enhanced Security the crypt() routine may not have
encrypted your password, so you cannot do this.  With SIA no matter what security
mechanism you've installed (Base, Enhanced, DCE, ASDU, etc.) use of the sia_*() routines
will guarantee you won't have to change your code depending on your user's
authentication model.


>             if (!EQ(auth_stat, "SIACORRECT"))

That's SIASUCCESS not SIACORRECT.  (see /usr/include/sia.h)

>
>                 continue;
>          }
>
> Snip.. .Snip...

--

John Ferlan   DTN: 264-0854  Office: ZKO3-3/Y26
Compaq Computer Corporation
110 Spit Brook Rd.
M/S: ZKO3-3/W20
Nashua, NH 03062-2698

Phone: (603)884-0854

John.Ferlan aT digital dOt com
ferlan aT zk3 dOt dec dOt com
johnferlan aT iname dOt com

Any of the above will get mail to me.
To reply read above and figure it out@

Spammers can cheerfully send mail to:
 uce@ftc.gov
 root@localhost
 webmaster@localhost
 postmaster@localhost





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-09-30  4:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-09-23  4:00 Using SIA calls, modifying INN's nnrpd Paul Coen
1998-09-23  4:00 ` John Ferlan
1998-09-29  4:00   ` Paul Coen
1998-09-30  4:00     ` John Ferlan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox