NIS authentication

Russ Allbery rra at stanford.edu
Tue Apr 11 01:29:12 UTC 2000


Marc Lajeunesse <mlajeune at matrox.com> writes:

> Hi, I'm using inn for internal use and different dept should not access
> every newsgroup.  I found the NIS support quite basic.  I added a
> functionnality in the nnrp.access file.  This allows you to specify a
> NIS user or group in the fourth field when a + is found in the third.  I
> find it quite useful for me, maybe you would like to use the following:

Thanks for your patch!  I'm cc'ing inn-patches on this response so that it
makes it on the mailing list for other folks to see if they're interested.

The process of authenticating users has changed significantly in INN 2.3,
and now this process should really be done as part of ckpasswd.  I'll add
support for checking a NIS group using a varient of this code to the list
of things to look at adding to ckpasswd (with a flag).

> [mgitools-10:43:45] .../nnrpd {82}% rcsdiff nnrpd.c
> ===================================================================
> RCS file: RCS/nnrpd.c,v
> retrieving revision 1.1
> diff -r1.1 nnrpd.c
> 356a357,381
>> /* Checks if the user username with default gid defaultgid is member
>>  * of the group groupname */
>> int
>> IsNisGroupMember(char *username, char *groupname, gid_t defaultgid)
>> {
>> 
>>   char **p;
>>   struct group *groupinfo;
>>  
>>   groupinfo=getgrnam(groupname);
>>   if (groupinfo==NULL){
>>     return 0;
>>   }
>>   if (groupinfo->gr_gid == defaultgid) {
>>     return 1;
>>   }else{
>>     for (p=groupinfo->gr_mem;*p!=NULL;p++){
>>       if (!strcmp(*p,username)){
>> 	return 1;
>>       }
>>     }
>>   }
>>   return 0;
>> }
>> 
> 484a510,517
>> 
>> 	    if (fields[3]){
>> 	      if (!EQ(user, fields[3])){
>> 		if (IsNisGroupMember(user, fields[3], pwd->pw_gid)==0){
>> 		  continue;
>> 		}
>> 	      }
>> 	    }

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>



More information about the inn-patches mailing list