patch against 2.0.7 for NIS+ username maps
Nicholas J Brealey
nick at orpwood.demon.co.uk
Wed Jun 7 00:42:32 GMT 2000
I just realised that the code I sent has a memory leak.
Applying this additional patch should fix it:
(It also fixes indenting).
-------------- next part --------------
--- samba-2.0.7/source/lib/username.c.old Wed Jun 7 01:26:31 2000
+++ samba-2.0.7/source/lib/username.c Wed Jun 7 01:29:23 2000
@@ -130,16 +130,17 @@
mapped_user = True;
} else if ( NIS_RES_STATUS(res) == NIS_NOTFOUND ) {
snprintf(buf,sizeof(buf),"[key=\"*\"],%s",mapfile);
+ nis_freeresult(res);
res = nis_list(buf,
FOLLOW_LINKS|FOLLOW_PATH|EXPAND_NAME,
NULL,NULL);
if ( NIS_RES_STATUS(res) == NIS_SUCCESS ) {
- unixname = ENTRY_VAL(NIS_RES_OBJECT(res),1);
- DEBUG(3,("Mapped user %s to %s\n",user,unixname));
- fstrcpy(last_from,user);
- fstrcpy(user,unixname);
- fstrcpy(last_to,user);
- mapped_user = True;
+ unixname = ENTRY_VAL(NIS_RES_OBJECT(res),1);
+ DEBUG(3,("Mapped user %s to %s\n",user,unixname));
+ fstrcpy(last_from,user);
+ fstrcpy(user,unixname);
+ fstrcpy(last_to,user);
+ mapped_user = True;
}
} else {
DEBUG(0,("can't search NIS+ username map %s:\n%s\n",mapfile,
More information about the samba-technical
mailing list