Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 3 Aug 1999 17:22:13 +0000 (17:22 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 3 Aug 1999 17:22:13 +0000 (17:22 +0000)
1999-08-02  Thorsten Kukuk  <kukuk@suse.de>

* nis/nis_callback.c: Fix port problem on big-endian machines
* sunrpc/clnt_udp.c: Cast to uint32_t pointer, not short. RPC
fields are always 32 bit.
Patches from Paul Mackerras <paulus@cs.anu.edu.au>

* nis/nss_nis/nis-service.c: Remove htons, port is always in
network-byte-order.
* nis/nss_nisplus/nisplus-service.c: Rename number to port.

ChangeLog
nis/nis_callback.c
nis/nss_nis/nis-service.c
nis/nss_nisplus/nisplus-service.c
sunrpc/clnt_udp.c

index 95602f12f4d5aca75e631784f80799e25f402604..e4356852d2cc4e8bee8de19a1026bf18e691cb31 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+1999-08-02  Thorsten Kukuk  <kukuk@suse.de>
+
+       * nis/nis_callback.c: Fix port problem on big-endian machines
+       * sunrpc/clnt_udp.c: Cast to uint32_t pointer, not short. RPC
+       fields are always 32 bit.
+       Patches from Paul Mackerras <paulus@cs.anu.edu.au>
+
+       * nis/nss_nis/nis-service.c: Remove htons, port is always in
+       network-byte-order.
+       * nis/nss_nisplus/nisplus-service.c: Rename number to port.
+
 1999-08-03  Andreas Schwab  <schwab@suse.de>
 
        * sysdeps/posix/sigset.c: Unblock the signal after setting its
index eb5464479dec232202499ba5b21c743da4e296cc..cf96b42dcfb4dcfb7d7ebaeaca1439f98dc59ab0 100644 (file)
@@ -351,10 +351,10 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
       syslog (LOG_ERR, "NIS+: failed to read local socket info");
       return NULL;
     }
-  port = sin.sin_port;
+  port = ntohs (sin.sin_port);
   get_myaddress (&sin);
   snprintf (addr, sizeof (addr), "%s.%d.%d", inet_ntoa (sin.sin_addr),
-           port & 0x00FF, (port & 0xFF00) >> 8);
+           (port & 0xFF00) >> 8, port & 0x00FF);
   cb->serv->ep.ep_val[0].uaddr = strdup (addr);
 
   return cb;
index 91bd65b22a8ab3473ad9c7536ac93c47b16b37db..103b1e4115adb7e8700a9a2d5f6a3cba73bdf713 100644 (file)
@@ -1,6 +1,6 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
+   Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -270,8 +270,7 @@ _nss_nis_getservbyport_r (int port, char *protocol, struct servent *serv,
   while (!found &&
          ((status = internal_nis_getservent_r (serv, buffer, buflen, errnop,
                                               &data)) == NSS_STATUS_SUCCESS))
-    if (htons (serv->s_port) == port
-       &&  strcmp (serv->s_proto, protocol) == 0)
+    if (serv->s_port == port && strcmp (serv->s_proto, protocol) == 0)
       found = 1;
 
   internal_nis_endservent (&data);
index 6dfae5e2ef1d9e192373171e915c46656c07d8a5..36bf25a22a54a6264c195d8110a4685dff0d6ea5 100644 (file)
@@ -1,6 +1,6 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+   Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -347,9 +347,9 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
 }
 
 enum nss_status
-_nss_nisplus_getservbynumber_r (const int number, const char *protocol,
-                               struct servent *serv,
-                               char *buffer, size_t buflen, int *errnop)
+_nss_nisplus_getservbyport_r (const int number, const char *protocol,
+                             struct servent *serv,
+                             char *buffer, size_t buflen, int *errnop)
 {
   if (tablename_val == NULL)
     {
@@ -370,7 +370,7 @@ _nss_nisplus_getservbynumber_r (const int number, const char *protocol,
       nis_result *result;
       char buf[60 + strlen (protocol) + tablename_len];
 
-      sprintf (buf, "[number=%d,proto=%s],%s",
+      sprintf (buf, "[port=%d,proto=%s],%s",
               number, protocol, tablename_val);
 
       result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
index eeac79c3e62ce0db5b9eade2d3e734881884c57f..0733206c9b62b837736fcce0e20a219a0467494f 100644 (file)
@@ -290,7 +290,7 @@ call_again:
   /*
    * the transaction is the first thing in the out buffer
    */
-  (*(u_short *) (cu->cu_outbuf))++;
+  (*(uint32_t *) (cu->cu_outbuf))++;
   if ((!XDR_PUTLONG (xdrs, (long *) &proc)) ||
       (!AUTH_MARSHALL (cl->cl_auth, xdrs)) ||
       (!(*xargs) (xdrs, argsp)))