2 more patches....
Toomas Soome
tsoome at ut.ee
Wed Feb 7 14:40:25 GMT 2001
patches are against SAMBA_2_2
1. rpc_server/srv_netlog.c
patch will make it possible to use per user data - if there is some data
and it will fallback to smb.conf if there is no custom data. the code
assumes that passdb functions will fill sam_passwd structure correctly.
this feature is handy with nis+ smbpasswd table for example (my case:).
also - you may notice, unix fullname option is still there (and not in
passdb) - this is just because other data from passwd structure is being
used anyway. I think, fullname initialization should be done in passdb
as well.
2. rpc_server/srv_samr.c
patch will elliminate duplicated group entryes. getgrent() can return
the same group multiple times - if you are useing several group
databases (/etc/group file, nis, nis+ etc).
as current code just will create list of unix groups (and not members),
this patch should be just ok.
toomas
--
Parts that positively cannot be assembled in improper order will be.
-------------- next part --------------
Index: rpc_server/srv_netlog.c
===================================================================
RCS file: /cvsroot/samba/source/rpc_server/srv_netlog.c,v
retrieving revision 1.75.2.1
diff -c -r1.75.2.1 srv_netlog.c
*** rpc_server/srv_netlog.c 2001/01/31 18:34:27 1.75.2.1
--- rpc_server/srv_netlog.c 2001/02/07 14:24:25
***************
*** 645,650 ****
--- 645,651 ----
uint32 status = 0x0;
DOM_CRED srv_cred;
struct smb_passwd *smb_pass = NULL;
+ struct sam_passwd *sam_pass = NULL;
UNISTR2 *uni_samlogon_user = NULL;
fstring nt_username;
struct passwd *pw;
***************
*** 714,719 ****
--- 715,721 ----
pw=Get_Pwnam(nt_username, True);
become_root();
+ sam_pass = getsam21pwnam(nt_username);
smb_pass = getsmbpwnam(nt_username);
unbecome_root();
***************
*** 774,799 ****
sam_logon_in_ssb = True;
pstrcpy(samlogon_user, nt_username);
! pstrcpy(logon_script, lp_logon_script());
standard_sub_advanced(-1, nt_username, "", pw->pw_gid, logon_script);
! pstrcpy(profile_path, lp_logon_path());
standard_sub_advanced(-1, nt_username, "", pw->pw_gid, profile_path);
pstrcpy(my_workgroup, lp_workgroup());
! pstrcpy(home_drive, lp_logon_drive());
standard_sub_advanced(-1, nt_username, "", pw->pw_gid, home_drive);
! pstrcpy(home_dir, lp_logon_home());
standard_sub_advanced(-1, nt_username, "", pw->pw_gid, home_dir);
pstrcpy(my_name, global_myname);
strupper(my_name);
! fstrcpy(full_name, "<Full Name>");
! if (lp_unix_realname())
! fstrcpy(full_name, pw->pw_gecos);
/*
* This is the point at which we get the group
--- 776,804 ----
sam_logon_in_ssb = True;
pstrcpy(samlogon_user, nt_username);
! pstrcpy(logon_script, sam_pass->logon_script);
standard_sub_advanced(-1, nt_username, "", pw->pw_gid, logon_script);
! pstrcpy(profile_path, sam_pass->profile_path);
standard_sub_advanced(-1, nt_username, "", pw->pw_gid, profile_path);
pstrcpy(my_workgroup, lp_workgroup());
! pstrcpy(home_drive, sam_pass->dir_drive);
standard_sub_advanced(-1, nt_username, "", pw->pw_gid, home_drive);
! pstrcpy(home_dir, sam_pass->home_dir);
standard_sub_advanced(-1, nt_username, "", pw->pw_gid, home_dir);
pstrcpy(my_name, global_myname);
strupper(my_name);
! pstrcpy(full_name, sam_pass->full_name );
! if( !*full_name ) {
! fstrcpy(full_name, "<Full Name>");
! if (lp_unix_realname())
! fstrcpy(full_name, strtok(pw->pw_gecos, ","));
! }
/*
* This is the point at which we get the group
-------------- next part --------------
Index: rpc_server/srv_samr.c
===================================================================
RCS file: /cvsroot/samba/source/rpc_server/srv_samr.c,v
retrieving revision 1.106.2.19
diff -c -r1.106.2.19 srv_samr.c
*** rpc_server/srv_samr.c 2001/02/03 16:20:58 1.106.2.19
--- rpc_server/srv_samr.c 2001/02/07 14:25:04
***************
*** 791,796 ****
--- 791,798 ----
while (num_entries < MAX_SAM_ENTRIES && ((grp = getgrent()) != NULL))
{
+ int i;
+ uint32 trid;
name = grp->gr_name;
/* Don't return winbind groups as they are not local! */
***************
*** 799,806 ****
continue;
}
init_unistr2(&(pass[num_entries].uni_user_name), name, strlen(name)+1);
! pass[num_entries].user_rid = pdb_gid_to_group_rid(grp->gr_gid);
num_entries++;
}
--- 801,814 ----
continue;
}
+ trid = pdb_gid_to_group_rid(grp->gr_gid);
+ for( i = 0; i <= num_entries; i++)
+ if ( pass[i].user_rid == trid ) break;
+ if ( i <= num_entries )
+ continue; /* rid was there, dup! */
+
init_unistr2(&(pass[num_entries].uni_user_name), name, strlen(name)+1);
! pass[num_entries].user_rid = trid;
num_entries++;
}
More information about the samba-technical
mailing list