nis+ auto_home fix...

Toomas Soome tsoome at ut.ee
Mon Jan 8 23:41:40 GMT 2001


2 problems: automount_lookup was declared static, but it's called from
lib/substitute.c - result is link failure (solaris 8).

another problem - nis+ indexed name syntax is [key=value],table -- code
missed the separator ','. I also made code much cleaner. flags to nis_list
are needed to test table path as well (we are useing this nis+ table
feature a lot).

Index: lib/util.c
===================================================================
RCS file: /cvsroot/samba/source/lib/util.c,v
retrieving revision 1.287.4.3
diff -c -r1.287.4.3 util.c
*** lib/util.c	2000/11/16 01:19:04	1.287.4.3
--- lib/util.c	2001/01/08 23:33:51
***************
*** 855,884 ****
  *******************************************************************/
  
  #ifdef WITH_NISPLUS_HOME
! static char *automount_lookup(char *user_name)
  {
    static fstring last_key = "";
    static pstring last_value = "";
   
    char *nis_map = (char *)lp_nis_home_map_name();
   
-   char nis_domain[NIS_MAXNAMELEN + 1];
    char buffer[NIS_MAXATTRVAL + 1];
    nis_result *result;
    nis_object *object;
    entry_obj  *entry;
   
-   strncpy(nis_domain, (char *)nis_local_directory(), NIS_MAXNAMELEN);
-   nis_domain[NIS_MAXNAMELEN] = '\0';
-  
-   DEBUG(5, ("NIS+ Domain: %s\n", nis_domain));
-  
    if (strcmp(user_name, last_key))
    {
!     slprintf(buffer, sizeof(buffer)-1, "[%s=%s]%s.%s", "key", user_name, nis_map, nis_domain);
      DEBUG(5, ("NIS+ querystring: %s\n", buffer));
   
!     if (result = nis_list(buffer, RETURN_RESULT, NULL, NULL))
      {
         if (result->status != NIS_SUCCESS)
        {
--- 855,878 ----
  *******************************************************************/
  
  #ifdef WITH_NISPLUS_HOME
! char *automount_lookup(char *user_name)
  {
    static fstring last_key = "";
    static pstring last_value = "";
   
    char *nis_map = (char *)lp_nis_home_map_name();
   
    char buffer[NIS_MAXATTRVAL + 1];
    nis_result *result;
    nis_object *object;
    entry_obj  *entry;
   
    if (strcmp(user_name, last_key))
    {
!     slprintf(buffer, sizeof(buffer)-1, "[key=%s],%s", user_name, nis_map);
      DEBUG(5, ("NIS+ querystring: %s\n", buffer));
   
!     if (result = nis_list(buffer, FOLLOW_PATH|EXPAND_NAME|HARD_LOOKUP, NULL, NULL))
      {
         if (result->status != NIS_SUCCESS)
        {


toomas
-- 
What sane person could live in this world and not be crazy?
		-- Ursula K. LeGuin





More information about the samba-technical mailing list