samba main cvs branch seems to be broken on 64-bit boxes.....

Tim Rice tim at trr.metro.NET
Thu May 14 03:56:12 GMT 1998


On Thu, 14 May 1998, Elijah L. Wright wrote:

> hi there :)
> 
> the code in util.c seems to have some bugs w/regard to compilation on
> 64-bit machines.  in this case, the hardware is an Alpha running redhat
> 4.2 with pam turned off in the makefile.
> 
> i get a whole series of errors, all of which say "passing arg 'n' of
> 'function' from incompatible pointer type.  in util.c, checked out of the
> main branch the day before yesterday, errors are as follows:
> 
> in line			function 	arg
>    368			getsockopt	5
>   2096			recvfrom	6
>   2545			recvfrom	6
>   3757			getpeername	3
>   3802			getpeername	3
> 

That's because the samba code assumes all machines have a socket length of int.
That's not the case for not only your environment but all versions of UnixWare.
I sent a patch to samba-bugs to fix this back on 1.9.18p3
Here it is again against 1.9.18p7. It should do the trick for you.

After you apply the patch add to your FLAGSM = line in Makefile
-DCONFIG_SOCKARGLENTYPE=size_t
or whatever socket length is in your envirnoment. Without this
it will still default to int.

> 
> i'm not a code grunt, and the old release (.17something) still works for
> me here.....   (and yes, axproc is defined in the makefile  :)  )
> but it still might be nice if someone wanted to look at this....   :)
> 
> it looks like the standard errors that people make with assumptions about
> pointer size.....   :)
> 
> thank you (and hats off!) to the team.
> 
> --elijah
> ---------------------------------------------------------------
> "I am death that carries off all,
> And the origin of things that are to be."
> -- Bhagavad Gita, 10.34
> ---------------------------------------------------------------
> 
> 

--
Tim Rice			Multitalents	(707) 887-1469 (voice)
tim at trr.metro.net

-------------- next part --------------
*** includes.h.old	Tue May 12 18:46:49 1998
--- includes.h	Wed May 13 19:53:53 1998
***************
*** 1376,1379 ****
--- 1376,1385 ----
  #include "mem_man/mem_man.h"
  #endif
  
+ #ifdef CONFIG_SOCKARGLENTYPE
+ 	typedef CONFIG_SOCKARGLENTYPE socklen_t;
+ #else
+ 	typedef int socklen_t;
+ #endif
+   
  #endif
*** server.c.old	Tue May 12 18:46:56 1998
--- server.c	Wed May 13 19:53:54 1998
***************
*** 2534,2540 ****
        for( ; num > 0; num--)
        {
          struct sockaddr addr;
!         int in_addrlen = sizeof(addr);
  
          s = -1;
          for(i = 0; i < num_interfaces; i++)
--- 2534,2540 ----
        for( ; num > 0; num--)
        {
          struct sockaddr addr;
!         socklen_t in_addrlen = sizeof(addr);
  
          s = -1;
          for(i = 0; i < num_interfaces; i++)
***************
*** 2686,2692 ****
  static BOOL open_oplock_ipc(void)
  {
    struct sockaddr_in sock_name;
!   int len = sizeof(sock_name);
  
    DEBUG(3,("open_oplock_ipc: opening loopback UDP socket.\n"));
  
--- 2686,2692 ----
  static BOOL open_oplock_ipc(void)
  {
    struct sockaddr_in sock_name;
!   socklen_t len = sizeof(sock_name);
  
    DEBUG(3,("open_oplock_ipc: opening loopback UDP socket.\n"));
  
*** util.c.old	Tue May 12 18:46:58 1998
--- util.c	Wed May 13 19:55:42 1998
***************
*** 363,370 ****
  ****************************************************************************/
  BOOL is_a_socket(int fd)
  {
!   int v,l;
!   l = sizeof(int);
    return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
  }
  
--- 363,370 ----
  ****************************************************************************/
  BOOL is_a_socket(int fd)
  {
!   int v;
!   socklen_t l = sizeof(socklen_t);
    return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
  }
  
***************
*** 2082,2088 ****
  {
    int ret;
    struct sockaddr_in sock;
!   int socklen;
    
    socklen = sizeof(sock);
    bzero((char *)&sock,socklen);
--- 2082,2088 ----
  {
    int ret;
    struct sockaddr_in sock;
!   socklen_t socklen;
    
    socklen = sizeof(sock);
    bzero((char *)&sock,socklen);
***************
*** 2496,2502 ****
  BOOL receive_local_message(int fd, char *buffer, int buffer_len, int timeout)
  {
    struct sockaddr_in from;
!   int fromlen = sizeof(from);
    int32 msg_len = 0;
  
    smb_read_error = 0;
--- 2496,2502 ----
  BOOL receive_local_message(int fd, char *buffer, int buffer_len, int timeout)
  {
    struct sockaddr_in from;
!   socklen_t fromlen = sizeof(from);
    int32 msg_len = 0;
  
    smb_read_error = 0;
***************
*** 3732,3738 ****
  {
    struct sockaddr sa;
    struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
!   int     length = sizeof(sa);
    static pstring name_buf;
    struct hostent *hp;
  
--- 3732,3738 ----
  {
    struct sockaddr sa;
    struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
!   socklen_t     length = sizeof(sa);
    static pstring name_buf;
    struct hostent *hp;
  
***************
*** 3774,3780 ****
  {
    struct sockaddr sa;
    struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
!   int     length = sizeof(sa);
    static fstring addr_buf;
  
    if (global_client_addr_done) 
--- 3774,3780 ----
  {
    struct sockaddr sa;
    struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
!   socklen_t length = sizeof(sa);
    static fstring addr_buf;
  
    if (global_client_addr_done) 


More information about the samba mailing list