Homedir maps (+small patch)

Hannu Martikka martikka at gamgee.ntc.nokia.com
Fri Oct 3 07:28:20 GMT 1997


I have following setup: User homedir are on server B and I have samba 
running on server A and B (B is dec/osf1, A is HPUX).

In Luke's reply to "Spiros B" (tue 12 aug 97) he said:

> because (and this is the bit about the home.map support that i don't
> exactly understand, and don't quite follow) when you do a domain logon
> to server A, the home.map support will feed the client with 
> \\auto-home-server\share (don't know what the share is - it's probably 
> homes).
> where auto-home-server should be the server component of the home.map
> entry.

This seems to implicate that samba server A should send message back to
client saying "Please connect to server B (\\B\homes) instead". I
sniffered the network messages between server A and client and didn't find
anything that could point to this.  Is this "homedir map/nis homedir"
feature really working?

Getting the servername (B == bilbo) seems to work ok. From logfile:

Setting default HOMESHR to: \\logon server\HOMES
NIS Domain: mydomain
NIS lookup succeeded
        Home server length: 5
        Allocated 17 bytes for HOMESHR
        User = martikka
        UID = 1220
        NIS result = bilbo:/net/bilbo/home/martikka

        HOMESHR = \\bilbo\homes

After that everything seems to be going like normal smb-session. Nothing
to indicate that client actually should connect to server B (bilbo).
Also in server B logfiles there is no evidence that client had tried to
call it up.
This option could be very useful once it works :)

Does anyone have any idea how samba is supposed to continue? What kind of
packet should be sent?

Here is a small patch for password.c (1.9.17p1 and maybe for 17p2). It
tries to remove possible mount options from nis_result. 

- Goodi
"UNIX should be used as an adjective." -- AT&T

--- password.c.orig	Thu Sep 18 12:21:48 1997
+++ password.c	Thu Sep 18 13:48:31 1997
@@ -220,6 +220,20 @@
                         &nis_result, &nis_result_len))
     DEBUG(3, ("YP Error: %s\n", yperr_string(nis_error)));
   if (!nis_error && lp_nis_home_map()) {
+    /* Try to remove mount options (user: -rw,intr hostname:/foo/home/user)
+       when yp_match returns "-rw,intr hostname:/foo/home/user"
+       This will screw up if hostname starts with '-', but - is unlikely
+       first char in hostnames anyway...
+       Hannu.Martikka at ntc.nokia.com
+    */
+    if (*nis_result == '-') {
+      /* Search upto whitespace */
+      for (;*nis_result != ' ' && *nis_result != '\t';nis_result++) ;
+      /* Remove whitespaces */
+      for (;*nis_result == ' ' || *nis_result == '\t';nis_result++) ;
+    }
     home_server_len = strcspn(nis_result,":");
     DEBUG(3, ("NIS lookup succeeded\n\tHome server length: %d\n",home_server_len));
     vuser->home_share = (char *)Realloc(vuser->home_share, home_server_len+12);

More information about the samba mailing list