Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-19 Thread Matt Brookings
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Manvendra Bhangui wrote:
 How often does the code actually reference the UID/GID?  Could you  
 have a function to look it up and cache it in a static once found?

 A quick check and it looks like it's only referenced when adding a  
 user or updating the tcp.smtp.cdb file.  There are a few other  
 references, but the common things (like vchkpw and vdelivermail)  
 don't appear to make use of it.

 Probably not a big deal to use getpwnam.

You make a good point.

 Not a big deal using getpwnam(). Also if you run nscd daemon,
 password/group file lookups get cached
 http://docs.sun.com/app/docs/doc/816-5166/nscd-1m?a=view

Another good point.

 Also using getpwnam() function allows you to use hooks like NSS (Name
 Service Switch) - http://en.wikipedia.org/wiki/Name_Service_Switch
 
 In Unix-like operating systems, the Name Service Switch (NSS) allows
 Unix configuration databases to be provided by different sources,
 including local files (for
 example: /etc/passwd, /etc/group, /etc/hosts), LDAP, and other sources.

..good points, etc, etc :)

 In case it can be used, attaching a function GetVpopID() which I used
 with vpopmail in my early days of using vpopmail. It uses static
 variables to cache the uid/gid.

I've patched the 5.5 branch in Subversion to dynamically determine the UID/GID
as needed.
- --
/*
Matt Brookings m...@inter7.com   GnuPG Key FAE0672C
Software developer Systems technician
Inter7 Internet Technologies, Inc. (815)776-9465
*/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqMKXQACgkQIwet2/rgZyzyvQCdHUz7P4lDxUIO2g2gDCxujOUy
31kAniHLfpJ6UqgTiBzUKJiE/BpEDGwV
=FnXC
-END PGP SIGNATURE-


Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-18 Thread Tom Collins

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Aug 17, 2009, at 4:03 PM, Matt Brookings wrote:

Itamar Reis Peixoto wrote:

storing uid / gid in a config file will be light


Lighter than accessing an authentication database, agreed.  Like I  
said, I'm hoping
to add configuration API to vpopmail that will replace all the  
configure-time options

and settings.

The vusage client and daemon use some admittedly rather older and  
hastily put together
configuration code, that really isn't as efficient as it should be,  
considering the

vusage client is built for speed.


How often does the code actually reference the UID/GID?  Could you  
have a function to look it up and cache it in a static once found?


A quick check and it looks like it's only referenced when adding a  
user or updating the tcp.smtp.cdb file.  There are a few other  
references, but the common things (like vchkpw and vdelivermail)  
don't appear to make use of it.


Probably not a big deal to use getpwnam.

- -Tom


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFKizqBve7eT9VwhJURAo3GAJ0bvRwBCEINbHu1Aajl4oDNwTjnbACaAtMP
gtLjiLcK09pkh34A6qBFGBI=
=472+
-END PGP SIGNATURE-

!DSPAM:4a8b3a9032712083014635!



Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-18 Thread Itamar Reis Peixoto

 How often does the code actually reference the UID/GID?  Could you have a
 function to look it up and cache it in a static once found?

sounds great, the best solution at this moment.


 A quick check and it looks like it's only referenced when adding a user or
 updating the tcp.smtp.cdb file.  There are a few other references, but the
 common things (like vchkpw and vdelivermail) don't appear to make use of it.

 Probably not a big deal to use getpwnam.

for packaging vpopmail as rpm it is, because no need to use a fixed
uid/gid in all systems.




Itamar Reis Peixoto

e-mail/msn: ita...@ispbrasil.com.br
sip: ita...@ispbrasil.com.br
skype: itamarjp
icq: 81053601
+55 11 4063 5033
+55 34 3221 8599

!DSPAM:4a8b3dae32711327166225!



Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-18 Thread Manvendra Bhangui
On Tue, 2009-08-18 at 18:34 -0500, Tom Collins wrote:

 How often does the code actually reference the UID/GID?  Could you  
 have a function to look it up and cache it in a static once found?
 
 A quick check and it looks like it's only referenced when adding a  
 user or updating the tcp.smtp.cdb file.  There are a few other  
 references, but the common things (like vchkpw and vdelivermail)  
 don't appear to make use of it.
 
 Probably not a big deal to use getpwnam.
 

Not a big deal using getpwnam(). Also if you run nscd daemon,
password/group file lookups get cached
http://docs.sun.com/app/docs/doc/816-5166/nscd-1m?a=view


Also using getpwnam() function allows you to use hooks like NSS (Name
Service Switch) - http://en.wikipedia.org/wiki/Name_Service_Switch

In Unix-like operating systems, the Name Service Switch (NSS) allows
Unix configuration databases to be provided by different sources,
including local files (for
example: /etc/passwd, /etc/group, /etc/hosts), LDAP, and other sources.

In case it can be used, attaching a function GetVpopID() which I used
with vpopmail in my early days of using vpopmail. It uses static
variables to cache the uid/gid.

Regards Manvendra
http://www.indimail.org


!DSPAM:4a8b792832719326514358!
/*
 * $Log: GetVpopID.c,v $
 * Revision 1.3  2001-11-24 12:16:57+05:30  Cprogrammer
 * version information added
 *
 * Revision 1.2  2001-11-20 10:53:16+05:30  Cprogrammer
 * *** empty log message ***
 *
 * Revision 1.1  2001-10-24 18:15:00+05:30  Cprogrammer
 * Initial revision
 *
 */
#include indimail.h
#include pwd.h

#ifndef	lint
static char sccsid[] = $Id: GetVpopID.c,v 1.3 2001-11-24 12:16:57+05:30 Cprogrammer Stab mbhangui $;
#endif

int
GetVpopID(uid_t *uid, gid_t *gid)
{
	struct passwd  *pw;
	static uid_tsuid = -1;
	static gid_tsgid = -1;

	if(suid != -1  sgid != -1)
	{
		*uid = suid;
		*gid = sgid;
		return(0);
	}
	if(!(pw = getpwnam(VPOPUSER)))
	{
		fprintf(stderr, getpwnam failed for user %s\n, VPOPUSER);
		return(-1);
	}
	*uid = suid = pw-pw_uid;
	*gid = sgid = pw-pw_gid;
	return(0);
}

void
getversion_GetVpopID_c()
{
	printf(%s\n, sccsid);
	printf(%s\n, sccsidh);
}


[vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-17 Thread Itamar Reis Peixoto
currently vpopmail user and vchkpw group's need's to be created before
running ./configure.

this is not good for packaging it as rpm, because in rpm the user and
group are created in %post section (after vpopmail installed)


#define VPOPMAILGID 503
#define VPOPMAILUID 507

any chance to improve this with automatic detection uid and gid using
getpwnam function ?

http://publib.boulder.ibm.com/infocenter/zos/v1r10/index.jsp?topic=/com.ibm.zos.r10.bpxbd00/rtgtpn.htm





-- 


Itamar Reis Peixoto

e-mail/msn: ita...@ispbrasil.com.br
sip: ita...@ispbrasil.com.br
skype: itamarjp
icq: 81053601
+55 11 4063 5033
+55 34 3221 8599

!DSPAM:4a89812232716199578350!



Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-17 Thread Matt Brookings
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Itamar Reis Peixoto wrote:
 currently vpopmail user and vchkpw group's need's to be created before
 running ./configure.
 
 this is not good for packaging it as rpm, because in rpm the user and
 group are created in %post section (after vpopmail installed)

I'm pretty sure there are RPMs that handle this situation already.  How
do they do it?

 any chance to improve this with automatic detection uid and gid using
 getpwnam function ?

I'm not sure if this would be considered an improvement.  Parsing /etc/passwd
every time a vpopmail binary is invoked could be expensive on some systems.

I'm looking at adding a configuration file to vpopmail for the 5.5 branch that
will contain all the stuff that usually you have to set at configure time.  The
UID/GID would be contained here as well, but that's not currently available.
Just an OT about the config: It will be compiled so as to be very quick to load.

Thoughts anyone?
- --
/*
Matt Brookings m...@inter7.com   GnuPG Key FAE0672C
Software developer Systems technician
Inter7 Internet Technologies, Inc. (815)776-9465
*/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqJgssACgkQIwet2/rgZyzmXQCeOl04M9MG0QVTyPUpXjxj6AIa
wLUAn0LhtOYsOjPaDYLmm27vpMpWaRMp
=0abu
-END PGP SIGNATURE-


Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-17 Thread Itamar Reis Peixoto
I agree parsing /etc/passwd every time is expensive

a config file file will be welcome.




On Mon, Aug 17, 2009 at 1:18 PM, Matt Brookingsm...@inter7.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Itamar Reis Peixoto wrote:
 currently vpopmail user and vchkpw group's need's to be created before
 running ./configure.

 this is not good for packaging it as rpm, because in rpm the user and
 group are created in %post section (after vpopmail installed)

 I'm pretty sure there are RPMs that handle this situation already.  How
 do they do it?

 any chance to improve this with automatic detection uid and gid using
 getpwnam function ?

 I'm not sure if this would be considered an improvement.  Parsing /etc/passwd
 every time a vpopmail binary is invoked could be expensive on some systems.

 I'm looking at adding a configuration file to vpopmail for the 5.5 branch that
 will contain all the stuff that usually you have to set at configure time.  
 The
 UID/GID would be contained here as well, but that's not currently available.
 Just an OT about the config: It will be compiled so as to be very quick to 
 load.

 Thoughts anyone?
 - --
 /*
    Matt Brookings m...@inter7.com       GnuPG Key FAE0672C
    Software developer                     Systems technician
    Inter7 Internet Technologies, Inc.     (815)776-9465
 */
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iEYEARECAAYFAkqJgssACgkQIwet2/rgZyzmXQCeOl04M9MG0QVTyPUpXjxj6AIa
 wLUAn0LhtOYsOjPaDYLmm27vpMpWaRMp
 =0abu
 -END PGP SIGNATURE-




-- 


Itamar Reis Peixoto

e-mail/msn: ita...@ispbrasil.com.br
sip: ita...@ispbrasil.com.br
skype: itamarjp
icq: 81053601
+55 11 4063 5033
+55 34 3221 8599

!DSPAM:4a8986c832711158417373!



Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-17 Thread T.J. Drennan

Itamar Reis Peixoto wrote:

currently vpopmail user and vchkpw group's need's to be created before
running ./configure.

this is not good for packaging it as rpm, because in rpm the user and
group are created in %post section (after vpopmail installed)


#define VPOPMAILGID 503
#define VPOPMAILUID 507

any chance to improve this with automatic detection uid and gid using
getpwnam function ?

http://publib.boulder.ibm.com/infocenter/zos/v1r10/index.jsp?topic=/com.ibm.zos.r10.bpxbd00/rtgtpn.htm

  
Could the user and group be created in the %pre section so it is done 
before the files are dropped into the system?


-T.J.

!DSPAM:4a89888432712120640251!



Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-17 Thread Tren Blackburn
And since no one else has mentioned this...some of us don't use /etc/passwd for 
authentication. So searching /etc/passwd would not work anyway. Isn't there a C 
function call to check user/group id? Or at least a universal alternative...

t

- Original Message -
From: Matt Brookings m...@inter7.com
To: vchkpw@inter7.com vchkpw@inter7.com
Sent: Mon Aug 17 09:18:19 2009
Subject: Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Itamar Reis Peixoto wrote:
 currently vpopmail user and vchkpw group's need's to be created before
 running ./configure.
 
 this is not good for packaging it as rpm, because in rpm the user and
 group are created in %post section (after vpopmail installed)

I'm pretty sure there are RPMs that handle this situation already.  How
do they do it?

 any chance to improve this with automatic detection uid and gid using
 getpwnam function ?

I'm not sure if this would be considered an improvement.  Parsing /etc/passwd
every time a vpopmail binary is invoked could be expensive on some systems.

I'm looking at adding a configuration file to vpopmail for the 5.5 branch that
will contain all the stuff that usually you have to set at configure time.  The
UID/GID would be contained here as well, but that's not currently available.
Just an OT about the config: It will be compiled so as to be very quick to load.

Thoughts anyone?
- --
/*
Matt Brookings m...@inter7.com   GnuPG Key FAE0672C
Software developer Systems technician
Inter7 Internet Technologies, Inc. (815)776-9465
*/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqJgssACgkQIwet2/rgZyzmXQCeOl04M9MG0QVTyPUpXjxj6AIa
wLUAn0LhtOYsOjPaDYLmm27vpMpWaRMp
=0abu
-END PGP SIGNATURE-

!DSPAM:4a89c1de32714733445293!


Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-17 Thread Matt Brookings
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tren Blackburn wrote:
 And since no one else has mentioned this...some of us don't use
 /etc/passwd for authentication. So searching /etc/passwd would not work
 anyway. Isn't there a C function call to check user/group id? Or at
 least a universal alternative...

I was being too general for the sake of brevity when I referenced parsing of 
/etc/passwd.
The getpwnam and related functions use whatever authentication system you have 
for authenticating
system users.
- --
/*
Matt Brookings m...@inter7.com   GnuPG Key FAE0672C
Software developer Systems technician
Inter7 Internet Technologies, Inc. (815)776-9465
*/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqJwwMACgkQIwet2/rgZyzK2QCfRztW8ghVEwGbKHntqZpwXPyz
ZTMAnjfCSn8gEdyG4pZGea4vybV2Q003
=jUad
-END PGP SIGNATURE-


Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-17 Thread Itamar Reis Peixoto
my suggestion is related about which user and group vpopmail run's

not about authentication.

no authentication is involved in this




On Mon, Aug 17, 2009 at 5:52 PM, Matt Brookingsm...@inter7.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Tren Blackburn wrote:
 And since no one else has mentioned this...some of us don't use
 /etc/passwd for authentication. So searching /etc/passwd would not work
 anyway. Isn't there a C function call to check user/group id? Or at
 least a universal alternative...

 I was being too general for the sake of brevity when I referenced parsing of 
 /etc/passwd.
 The getpwnam and related functions use whatever authentication system you 
 have for authenticating
 system users.
 - --
 /*
    Matt Brookings m...@inter7.com       GnuPG Key FAE0672C
    Software developer                     Systems technician
    Inter7 Internet Technologies, Inc.     (815)776-9465
 */
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iEYEARECAAYFAkqJwwMACgkQIwet2/rgZyzK2QCfRztW8ghVEwGbKHntqZpwXPyz
 ZTMAnjfCSn8gEdyG4pZGea4vybV2Q003
 =jUad
 -END PGP SIGNATURE-




-- 


Itamar Reis Peixoto

e-mail/msn: ita...@ispbrasil.com.br
sip: ita...@ispbrasil.com.br
skype: itamarjp
icq: 81053601
+55 11 4063 5033
+55 34 3221 8599

!DSPAM:4a89c3a432716349971963!



Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-17 Thread Matt Brookings
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Itamar Reis Peixoto wrote:
 my suggestion is related about which user and group vpopmail run's
 
 not about authentication.
 
 no authentication is involved in this

That may be the case, but the fact is, your system-level authentication backend 
stores
user and group information.  This means you're accessing an authentication 
database
for uid/gid information.  Whether you choose to do password comparisons is up 
to you,
but the call is just as expensive.
- --
/*
Matt Brookings m...@inter7.com   GnuPG Key FAE0672C
Software developer Systems technician
Inter7 Internet Technologies, Inc. (815)776-9465
*/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqJxCQACgkQIwet2/rgZyyBvwCeLVeK8H4Xi2dhvuuLtCg5P2WA
uEQAn1P46CJ6LTM/p+Hl6+9VGAL79nOD
=j0tC
-END PGP SIGNATURE-


Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-17 Thread Itamar Reis Peixoto
storing uid / gid in a config file will be light

On Mon, Aug 17, 2009 at 5:57 PM, Matt Brookingsm...@inter7.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Itamar Reis Peixoto wrote:
 my suggestion is related about which user and group vpopmail run's

 not about authentication.

 no authentication is involved in this

 That may be the case, but the fact is, your system-level authentication 
 backend stores
 user and group information.  This means you're accessing an authentication 
 database
 for uid/gid information.  Whether you choose to do password comparisons is up 
 to you,
 but the call is just as expensive.
 - --
 /*
    Matt Brookings m...@inter7.com       GnuPG Key FAE0672C
    Software developer                     Systems technician
    Inter7 Internet Technologies, Inc.     (815)776-9465
 */
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iEYEARECAAYFAkqJxCQACgkQIwet2/rgZyyBvwCeLVeK8H4Xi2dhvuuLtCg5P2WA
 uEQAn1P46CJ6LTM/p+Hl6+9VGAL79nOD
 =j0tC
 -END PGP SIGNATURE-




-- 


Itamar Reis Peixoto

e-mail/msn: ita...@ispbrasil.com.br
sip: ita...@ispbrasil.com.br
skype: itamarjp
icq: 81053601
+55 11 4063 5033
+55 34 3221 8599

!DSPAM:4a89c4b832714512116850!



Re: [vchkpw] vpopmail UID/GID hardcoded in config.h

2009-08-17 Thread Matt Brookings
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Itamar Reis Peixoto wrote:
 storing uid / gid in a config file will be light

Lighter than accessing an authentication database, agreed.  Like I said, I'm 
hoping
to add configuration API to vpopmail that will replace all the configure-time 
options
and settings.

The vusage client and daemon use some admittedly rather older and hastily put 
together
configuration code, that really isn't as efficient as it should be, considering 
the
vusage client is built for speed.
- --
/*
Matt Brookings m...@inter7.com   GnuPG Key FAE0672C
Software developer Systems technician
Inter7 Internet Technologies, Inc. (815)776-9465
*/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqJxa0ACgkQIwet2/rgZywqQgCgj0iLnSaC+h5JU8yfSAJcbwAY
KcgAoJMJpbgNzOhkNJwwvtz2JcxuE5tg
=vypA
-END PGP SIGNATURE-