[PATCH] Next cleanup part 4 or 5 by now.=)
Ben Lindstrom
mouring at pconline.com
Fri Sep 29 08:36:52 EST 2000
Changes:
* Removed utimes() posix hack since scp.c moved to utimes()
* Fixed waitpid() to be more proper. It was driving me nuts.
* Made setsid() a #define in next-posix.h
* Removed WCOREDUMP() from next-posix.h since we really don't support
it and now #ifdef .. #else .. #endif around the single place it was
used.
* Fixed typecasting issue in sshd.c with sizeof() returning "long int"
on next when we expect "int".
Current known issues:
* sftp-server still is broken under NeXT, and I'm still unsure why. It
manifests itself in readdir() in the form of a lstat() issue which
is bogus.
* None of the syslog stuff is working under NeXT (found that out recently
while debugging sftp-server =). Either syslogd is quietly dropping them
or it's not making it to syslogd. Unsure which at the moment since I
was undergoing a domain change recently.
-------------- next part --------------
diff -ru openssh/next-posix.c onext/next-posix.c
--- openssh/next-posix.c Thu Aug 31 22:14:37 2000
+++ onext/next-posix.c Thu Sep 28 16:19:39 2000
@@ -1,3 +1,25 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
#include "includes.h"
#ifdef HAVE_NEXT
@@ -8,46 +30,32 @@
pid_t
posix_wait(int *status)
{
- #undef wait /* Use NeXT's wait() function */
union wait statusp;
pid_t wait_pid;
+ #undef wait /* Use NeXT's wait() function */
wait_pid = wait(&statusp);
status = (int *) statusp.w_status;
return wait_pid;
}
-
-int
-posix_utime(char *filename,struct utimbuf *buf)
-{
- time_t timep[2];
-
- timep[0] = buf->actime;
- timep[1] = buf->modtime;
-
- #undef utime /* Use NeXT's utime() function */
- return utime(filename,timep);
-}
-
-
-int
-waitpid(int pid, int *stat_loc, int options)
+pid_t
+waitpid(int pid, int *stat_loc, int options)
{
+ union wait statusp;
+ pid_t wait_pid;
+
if (pid <= 0) {
if (pid != -1) {
errno = EINVAL;
return -1;
}
- pid = 0; /* wait4() expects pid=0 for indiscriminate wait. */
+ pid = 0; /* wait4() wants pid=0 for indiscriminate wait. */
}
- return wait4(pid, (union wait *)stat_loc, options, NULL);
-}
-
-pid_t setsid(void)
-{
- return setpgrp(0, getpid());
+ wait_pid = wait4(pid, &statusp, options, NULL);
+ stat_loc = (int *)statusp.w_status;
+ return wait_pid;
}
int
@@ -81,10 +89,7 @@
int tcsetpgrp(int fd, pid_t pgrp)
{
- int s;
-
- s = pgrp;
- return (ioctl(fd, TIOCSPGRP, &s));
+ return (ioctl(fd, TIOCSPGRP, &pgrp));
}
speed_t cfgetospeed(const struct termios *t)
diff -ru openssh/next-posix.h onext/next-posix.h
--- openssh/next-posix.h Sat Sep 23 19:10:13 2000
+++ onext/next-posix.h Thu Sep 28 16:11:21 2000
@@ -1,5 +1,24 @@
/*
- * Defines and prototypes specific to NeXT system
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
*/
#ifndef _NEXT_POSIX_H
@@ -9,15 +28,9 @@
#include <sys/dir.h>
-/* readdir() returns struct direct (BSD) not struct dirent (POSIX) */
+/* NeXT's Readdir() is BSD (struct direct) not POSIX (struct dirent) */
#define dirent direct
-/* POSIX utime() struct */
-struct utimbuf {
- time_t actime;
- time_t modtime;
-};
-
/* FILE */
#define O_NONBLOCK 00004 /* non-blocking open */
@@ -31,19 +44,14 @@
#define WIFSIGNALED(w) (!WIFEXITED(w) && !WIFSTOPPED(w))
#define WEXITSTATUS(w) (int)(WIFEXITED(w) ? (((w) >> 8) & 0377) : -1)
#define WTERMSIG(w) (int)(WIFSIGNALED(w) ? ((w) & 0177) : -1)
-#define WCOREFLAG 0x80
-#define WCOREDUMP(w) ((w) & WCOREFLAG)
-
-/* POSIX "wrapper" functions to replace to BSD functions */
-int posix_utime(char *filename, struct utimbuf *buf); /* new utime() */
-#define utime posix_utime
-pid_t posix_wait(int *status); /* new wait() */
-#define wait posix_wait
+/* Swap out the next 'BSDish' wait() for a more POSIX complient one */
+pid_t posix_wait(int *status);
+#define wait(a) posix_wait(a)
/* MISC functions */
-int waitpid(int pid, int *stat_loc, int options);
-pid_t setsid(void);
+#define setsid() setpgrp(0, getpid())
+pid_t waitpid(int pid, int *stat_loc, int options);
/* TERMCAP */
int tcgetattr(int fd, struct termios *t);
@@ -54,5 +62,4 @@
int cfsetospeed(struct termios *t, int speed);
#endif /* HAVE_NEXT */
-
#endif /* _NEXT_POSIX_H */
Only in onext: ssh_prng_cmds
diff -ru openssh/sshd.c onext/sshd.c
--- openssh/sshd.c Sat Sep 23 01:15:57 2000
+++ onext/sshd.c Thu Sep 28 15:38:39 2000
@@ -1259,7 +1259,7 @@
if (len < 0 || len > sizeof(session_key))
fatal("do_connection: bad len from %s: session_key_int %d > sizeof(session_key) %d",
get_remote_ipaddr(),
- len, sizeof(session_key));
+ len, (int) sizeof(session_key));
memset(session_key, 0, sizeof(session_key));
BN_bn2bin(session_key_int, session_key + sizeof(session_key) - len);
More information about the openssh-unix-dev
mailing list