[1349] in Moira

home help back first fref pref prev next nref lref last post

Feature Request: use hes_getservbyname as fallback for entry in /etc/services

daemon@ATHENA.MIT.EDU (epeisach@MIT.EDU)
Sat Feb 12 17:50:46 2000

From: epeisach@MIT.EDU
Date: Sat, 12 Feb 2000 17:50:43 -0500
Message-Id: <10002122250.AA02433@kangaroo.mit.edu>
To: moiradev@MIT.EDU


The moira applications already have the compile time option of using hesiod
to determine the service location. The following patch adds the use
of hesiod to determine the service port if not present in /etc/services.

(This might invalidate the win2000 changes in which the port is hardwired into 
the application).

I used the Hesiod compatibility API as that is what was in use already in the
same file.

Take it or leave it - your call...

Index: lib/mr_connect.c
===================================================================
RCS file: /mit/moiradev/repository/moira/lib/mr_connect.c,v
retrieving revision 1.31
diff -c -r1.31 mr_connect.c
*** mr_connect.c	1999/05/27 19:04:49	1.31
--- mr_connect.c	2000/02/12 22:50:07
***************
*** 137,143 ****
--- 137,153 ----
        if (s)
  	target.sin_port = s->s_port;
        else
+ #ifdef HAVE_HESIOD
+         {
+           s = hes_getservbyname(port, "tcp");
+           if (s)
+             target.sin_port = s->s_port;
+           else
+            return 0;
+         }
+ #else
  	return 0;
+ #endif
      }
  
    memcpy(&target.sin_addr, shost->h_addr, shost->h_length);

home help back first fref pref prev next nref lref last post