[Samba] logon home with ldap under win98
Michael Sievers
sievers at netlife.de
Fri Mar 15 07:49:16 GMT 2002
Hello,
I hope this is the correct place for this mail... I have found that
samba-2.2.3a (--with-ldapsam) gives the correct logon home for win2k,
but not for win98. Obviously the two systems request the information in
a different way.
For win98 machines, in lanman.c, the information is taken only from
smb.conf, and not from ldap (or other backends).
I have attached a small patch that yields the right home directories
found in the sam, just as for win2k. The patch is a bit crude (I don't
speak C fluently), and I hope no memory is leaking. It works for me,
feel free to use it in any way you like. Take it as a proof of concept,
it might break other things (NIS auto.home?).
Bye,
Michael
--
Michael Sievers
(Systems Manager)
_________________________________________________
Netlife Internet Consulting und Software GmbH
Service & Support / Headquarter Hamburg
-------------- next part --------------
*** lanman.c.orig Fri Mar 15 13:02:01 2002
--- lanman.c Fri Mar 15 16:11:49 2002
***************
*** 2454,2459 ****
--- 2454,2463 ----
char *p = skip_string(UserName,1);
int uLevel = SVAL(p,0);
char *p2;
+ pstring logon_home;
+
+ BOOL logon_home_frompassdb;
+ SAM_ACCOUNT *sampass=NULL;
/* get NIS home of a previously validated user - simeon */
/* With share level security vuid will always be zero.
***************
*** 2463,2468 ****
--- 2467,2495 ----
DEBUG(3,(" Username of UID %d is %s\n", (int)vuser->uid,
vuser->user.unix_name));
+ /***********************************************/
+ /* M. Sievers test area: get logon drive name from sam,
+ * to make it work with ldap */
+
+ pdb_init_sam(&sampass);
+ become_root();
+ logon_home_frompassdb = pdb_getsampwuid(sampass,vuser->uid);
+ unbecome_root();
+
+ if ( logon_home_frompassdb == False ){
+ DEBUG(3,(" MS: Could not find entry in sam. \n"));
+ } else {
+ DEBUG(3,(" MS: Home Directory is %s\n", sampass->home_dir));
+ if ( strlen(sampass->home_dir) != 0 )
+ pstrcpy(logon_home,sampass->home_dir);
+ else
+ logon_home_frompassdb = False;
+ pdb_free_sam(sampass);
+ }
+
+ /* end of test area */
+ /***********************************************/
+
*rparam_len = 6;
*rparam = REALLOC(*rparam,*rparam_len);
***************
*** 2521,2527 ****
--- 2548,2559 ----
SIVAL(p,usri11_auth_flags,AF_OP_PRINT); /* auth flags */
SIVALS(p,usri11_password_age,-1); /* password age */
SIVAL(p,usri11_homedir,PTR_DIFF(p2,p)); /* home dir */
+ /* MS: take home dir from passdb if found */
+ if ( logon_home_frompassdb == False ) {
pstrcpy(p2, lp_logon_home());
+ } else {
+ pstrcpy(p2, logon_home);
+ }
standard_sub_conn(conn, p2);
p2 = skip_string(p2,1);
SIVAL(p,usri11_parms,PTR_DIFF(p2,p)); /* parms */
More information about the samba
mailing list