home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume3 / rfs / patches2 / text0000.txt < prev   
Encoding:
Text File  |  1986-11-30  |  7.4 KB  |  286 lines

  1.  
  2. Thanks to everyone for contributing time to fix up RFS!
  3.  
  4. Joe Othmer at Bell Labs found the problems related to the execution of a
  5. remote binary.  The reason that ksh tended to fail on all remote executions
  6. seemed to be a particular sequence of system calls.  The problem was that
  7. if a file was remote, u.u_count was not initialized, but it was used.
  8. Here's the fix for 4.2 /sys/sys/kern_exec.c:
  9.  
  10. ***************
  11. *** 128,133
  12.       u.u_count = resid;
  13.   #ifdef REMOTEFS
  14.   }
  15.   
  16.   remote_again:
  17.   
  18.  
  19. --- 128,135 -----
  20.       u.u_count = resid;
  21.   #ifdef REMOTEFS
  22.   }
  23. + else
  24. +     u.u_count = 0;
  25.   
  26.   remote_again:
  27.   
  28.  
  29. And Here's the same fix for 4.3 /sys/sys/kern_exec.c (4.3 uses resid
  30. instead of u.u_count):
  31.  
  32. ***************
  33. *** 129,133
  34.   #ifdef REMOTEFS
  35.   }
  36.   
  37.   remote_again:
  38.   
  39.  
  40. --- 129,135 -----
  41.   #ifdef REMOTEFS
  42.   }
  43. + else
  44. +     resid = 0;
  45.   
  46.   remote_again:
  47.   
  48.  
  49. The reason that you could execute all remote files, reguardless of their
  50. mode was due to the wrong error being returned in the server.  Joe also
  51. found the fix for this in remote/serversyscall.c in the routine
  52. s_execinfo():  There error returned should be EACCES.
  53. ***************
  54. *** 441,447
  55.       if ((st.st_mode & S_IFMT) != S_IFREG
  56.       || ! myaccess(&st, proc->p_ruser->r_user, X_OK))
  57.       {
  58. !         err = ENOEXEC;
  59.           debug12("%s mode=0%o %sreg file, %sexecutable\n",
  60.               path, st.st_mode,
  61.               (st.st_mode & S_IFMT) != S_IFREG ? "not " : "",
  62.  
  63. --- 441,457 -----
  64.       if ((st.st_mode & S_IFMT) != S_IFREG
  65.       || ! myaccess(&st, proc->p_ruser->r_user, X_OK))
  66.       {
  67. !         err = EACCES;
  68.           debug12("%s mode=0%o %sreg file, %sexecutable\n",
  69.               path, st.st_mode,
  70.               (st.st_mode & S_IFMT) != S_IFREG ? "not " : "",
  71.  
  72.  
  73. Bill Sommerfeld at MIT has found that the server code is not compatible
  74. with the BIND nameserver.  No fix for this... but he said using the
  75. old compatibility routines works fine.
  76.  
  77. He also found that in later 4.3 beta releases, the names of one of the
  78. structure elements used by the server conflicts with a define in
  79. /usr/include/netdb.h; specifically, h_addr.  The following diffs
  80. show where the changes need to be made to change h_addr to h_iaddr
  81. (for "internet address").  Note that not all of the occurences of
  82. h_addr can be changed.
  83.  
  84. ------ remote/find.c --------
  85. ***************
  86. *** 102,108
  87.   
  88.       debug4("find %s...\n", inet_ntoa(*addr));
  89.       for(h=hostlist; h; h=h->h_next)
  90. !         if (bcmp(addr, &h->h_addr, sizeof(struct in_addr)) == 0)
  91.           {
  92.               toplist(&hostlist, h);
  93.               debug4("\tis %s (%s)\n",
  94.  
  95. --- 102,108 -----
  96.   
  97.       debug4("find %s...\n", inet_ntoa(*addr));
  98.       for(h=hostlist; h; h=h->h_next)
  99. !         if (bcmp(addr, &h->h_iaddr, sizeof(struct in_addr)) == 0)
  100.           {
  101.               toplist(&hostlist, h);
  102.               debug4("\tis %s (%s)\n",
  103. ***************
  104. *** 106,112
  105.           {
  106.               toplist(&hostlist, h);
  107.               debug4("\tis %s (%s)\n",
  108. !                 h->h_names[0], inet_ntoa(h->h_addr));
  109.               return(h);
  110.           }
  111.           else
  112.  
  113. --- 106,112 -----
  114.           {
  115.               toplist(&hostlist, h);
  116.               debug4("\tis %s (%s)\n",
  117. !                 h->h_names[0], inet_ntoa(h->h_iaddr));
  118.               return(h);
  119.           }
  120.           else
  121. ***************
  122. *** 111,117
  123.           }
  124.           else
  125.               debug4("\tnot %s (%s)\n",
  126. !                 h->h_names[0], inet_ntoa(h->h_addr));
  127.       log("no host entry for %s, continuing anyway.\n", inet_ntoa(*addr));
  128.       /*
  129.        * Kludge up a hosts structure for this guy
  130.  
  131. --- 111,117 -----
  132.           }
  133.           else
  134.               debug4("\tnot %s (%s)\n",
  135. !                 h->h_names[0], inet_ntoa(h->h_iaddr));
  136.       log("no host entry for %s, continuing anyway.\n", inet_ntoa(*addr));
  137.       /*
  138.        * Kludge up a hosts structure for this guy
  139. ***************
  140. *** 118,124
  141.        */
  142.       h = newhost();
  143.       h->h_names = newname(NULL, BOGUSHOST);
  144. !     bcopy(addr, &h->h_addr, sizeof(struct in_addr));
  145.       addlist(&hostlist, h);
  146.       return(h);
  147.   }
  148.  
  149. --- 118,124 -----
  150.        */
  151.       h = newhost();
  152.       h->h_names = newname(NULL, BOGUSHOST);
  153. !     bcopy(addr, &h->h_iaddr, sizeof(struct in_addr));
  154.       addlist(&hostlist, h);
  155.       return(h);
  156.   }
  157.  
  158.  
  159.  
  160. --- remote/info.c ------
  161. ***************
  162. *** 320,326
  163.           sin = &sinbuf;
  164.           debug6("path %s mapped to host %s\n", path, h->h_names[0]);
  165.           bzero((char *)sin, sizeof (struct sockaddr_in));
  166. !         bcopy(&h->h_addr, (char *)&sin->sin_addr,
  167.               sizeof(struct in_addr));
  168.           sin->sin_family = AF_INET;
  169.           sin->sin_port = serviceport;
  170.  
  171. --- 320,326 -----
  172.           sin = &sinbuf;
  173.           debug6("path %s mapped to host %s\n", path, h->h_names[0]);
  174.           bzero((char *)sin, sizeof (struct sockaddr_in));
  175. !         bcopy(&h->h_iaddr, (char *)&sin->sin_addr,
  176.               sizeof(struct in_addr));
  177.           sin->sin_family = AF_INET;
  178.           sin->sin_port = serviceport;
  179.  
  180.  
  181. --- remote/init.c ------
  182. ***************
  183. *** 210,216
  184.               hst->h_names = newname(hst->h_names,
  185.                       h->h_aliases[ i ]);
  186.   
  187. !         hst->h_addr = *((struct in_addr *)(h->h_addr));
  188.           addlist(&hostlist, hst);
  189.   
  190.           /*
  191.  
  192. --- 210,216 -----
  193.               hst->h_names = newname(hst->h_names,
  194.                       h->h_aliases[ i ]);
  195.   
  196. !         hst->h_iaddr = *((struct in_addr *)(h->h_addr));
  197.           addlist(&hostlist, hst);
  198.   
  199.           /*
  200. ***************
  201. *** 234,240
  202.               hst->h_default_user = user;
  203.               debug2("default user for host %s (%s) is %s\n",
  204.                   hst->h_names[ 0 ],
  205. !                 inet_ntoa(hst->h_addr), user->u_name);
  206.           }
  207.           ruser = hst->h_default_ruser = newruser();
  208.           if (user)
  209.  
  210. --- 234,240 -----
  211.               hst->h_default_user = user;
  212.               debug2("default user for host %s (%s) is %s\n",
  213.                   hst->h_names[ 0 ],
  214. !                 inet_ntoa(hst->h_iaddr), user->u_name);
  215.           }
  216.           ruser = hst->h_default_ruser = newruser();
  217.           if (user)
  218.  
  219.  
  220. --- remote/serverio.c
  221. ***************
  222. *** 131,137
  223.       register long    s;
  224.   
  225.       bzero((char *)&sin, sizeof (sin));
  226. !     bcopy(&h->h_addr, (char *)&sin.sin_addr, sizeof(struct in_addr));
  227.       sin.sin_family = AF_INET;
  228.       sin.sin_port = serviceport;
  229.       s = socket(AF_INET, SOCK_STREAM, 0);
  230.  
  231. --- 131,137 -----
  232.       register long    s;
  233.   
  234.       bzero((char *)&sin, sizeof (sin));
  235. !     bcopy(&h->h_iaddr, (char *)&sin.sin_addr, sizeof(struct in_addr));
  236.       sin.sin_family = AF_INET;
  237.       sin.sin_port = serviceport;
  238.       s = socket(AF_INET, SOCK_STREAM, 0);
  239.  
  240.  
  241. --- remote/server.h -----
  242. ***************
  243. *** 207,213
  244.       long    h_portnum;    /* port number that we connected on */
  245.       char    *h_mntpt;    /* mount point for this machine */
  246.       process    *h_proclist;    /* processes we know about on this host */
  247. !     struct in_addr    h_addr;    /* network address */
  248.       union h_bytes {
  249.           long    hu_mounted; /* non-zero if host has been mounted */
  250.           u_char    hu_byteorder[4]; /* byte order for this host */
  251.  
  252. --- 207,213 -----
  253.       long    h_portnum;    /* port number that we connected on */
  254.       char    *h_mntpt;    /* mount point for this machine */
  255.       process    *h_proclist;    /* processes we know about on this host */
  256. !     struct in_addr    h_iaddr;/* internet address */
  257.       union h_bytes {
  258.           long    hu_mounted; /* non-zero if host has been mounted */
  259.           u_char    hu_byteorder[4]; /* byte order for this host */
  260.  
  261.  
  262. "bruce" @ think noticed that new kernel include file, remotefs.h, contained an
  263. interesting octal constant: 08000.  Fortunately pcc interprets this the way
  264. I meant it as 010000.  The following is the context diff for that change.
  265. --- /sys/remote/remotefs.h -----
  266. ***************
  267. *** 85,91
  268.   #if vax || magnolia || P4400
  269.   #define        SREMOTE        0x08000000 /* proc.h: activity has occured */
  270.   #define        SNOREMOTE    0x10000000 /* proc.h: disallow remote access */
  271. ! #define        FREMOTE        08000       /* file.h: this is a remote file */
  272.   #endif vax || magnolia || P4400
  273.   
  274.   /*
  275.  
  276. --- 85,91 -----
  277.   #if vax || magnolia || P4400
  278.   #define        SREMOTE        0x08000000 /* proc.h: activity has occured */
  279.   #define        SNOREMOTE    0x10000000 /* proc.h: disallow remote access */
  280. ! #define        FREMOTE        010000       /* file.h: this is a remote file */
  281.   #endif vax || magnolia || P4400
  282.   
  283.   /*
  284.  
  285.  
  286.