OpenSSH 2.2.0p1 port to QNX 4
Andreas Schneider
andreas at ds3.etech.fh-hamburg.de
Wed Sep 13 04:30:58 EST 2000
Dear OpenSSH porting developers,
finally I succeded in porting OpenSSH to QNX 4.
To get things going I had to take over some definitions from Linux'
include files, since they are not available under QNX (e.g. the howmany
makro, NFDBITS, the lastlog structure). With this email I send a patch
with all my changes as well as the file "qnx-term.h" which I created
because IXANY and ONLCR are not supported under QNX.
Please include my changes into the OpenSSH portable distribution to allow
others to install OpenSSH under QNX easily.
Greetings
Andreas
-------------- next part --------------
/* Things the system doesn't provide under QNX */
#if defined(__QNX__) && !defined(__QNXNTO__)
#ifndef QNX_TERM_H
#define QNX_TERM_H
#define IXANY 0 /* not supported on QNX; under Linux 0004000 */
#define ONLCR 0 /* not supported on QNX; under Linux 0000004 */
#endif /* !QNX_TERM_H */
#endif /* __QNX__ && !__QNXNTO__ */
-------------- next part --------------
diff -cr openssh-2.2.0p1.orig/clientloop.c openssh-2.2.0p1.qnx/clientloop.c
*** openssh-2.2.0p1.orig/clientloop.c Wed Aug 23 02:46:24 2000
--- openssh-2.2.0p1.qnx/clientloop.c Tue Sep 12 10:23:58 2000
***************
*** 32,37 ****
--- 32,41 ----
#include "buffer.h"
#include "bufaux.h"
+ #if defined(__QNX__) && !defined(__QNXNTO__)
+ #include "qnx-term.h"
+ #endif /* __QNX__ && !__QNXNTO__ */
+
/* Flag indicating that stdin should be redirected from /dev/null. */
extern int stdin_null_flag;
diff -cr openssh-2.2.0p1.orig/includes.h openssh-2.2.0p1.qnx/includes.h
*** openssh-2.2.0p1.orig/includes.h Fri Aug 18 06:59:59 2000
--- openssh-2.2.0p1.qnx/includes.h Tue Sep 12 10:26:21 2000
***************
*** 27,33 ****
--- 27,35 ----
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
+ #if !defined(__QNX__) || defined(__QNXNTO__)
#include <sys/resource.h>
+ #endif /* !__QNX__ || __QNXNTO__ */
#include <netinet/tcp.h>
#include <arpa/inet.h>
diff -cr openssh-2.2.0p1.orig/loginrec.c openssh-2.2.0p1.qnx/loginrec.c
*** openssh-2.2.0p1.orig/loginrec.c Tue Aug 29 05:30:37 2000
--- openssh-2.2.0p1.qnx/loginrec.c Tue Sep 12 09:26:36 2000
***************
*** 744,755 ****
--- 744,760 ----
}
#else /* FIXME */
+ #if defined(__QNX__) && !defined(__QNXNTO__)
+ tty = 1;
+ #else
tty = ttyslot(); /* seems only to work for /dev/ttyp? style names */
+ #endif /* __QNX__ && !__QNXNTO__ */
#endif /* HAVE_GETTTYENT */
if (tty > 0 && (fd = open(UTMP_FILE, O_RDWR|O_CREAT, 0644)) >= 0) {
(void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
+ #ifdef HAVE_HOST_IN_UTMP
/*
* Prevent luser from zero'ing out ut_host.
* If the new ut_line is empty but the old one is not
***************
*** 761,766 ****
--- 766,772 ----
(strncmp(old_ut.ut_name, ut->ut_name, sizeof(ut->ut_name)) == 0)) {
(void)memcpy(ut->ut_host, old_ut.ut_host, sizeof(ut->ut_host));
}
+ #endif /* HAVE_HOST_IN_UTMP */
(void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
if (atomicio(write, fd, ut, sizeof(*ut)) != sizeof(*ut))
***************
*** 1319,1324 ****
--- 1325,1349 ----
#define LL_FILE 1
#define LL_DIR 2
#define LL_OTHER 3
+
+ /* struct lastlog is not defined under QNX: define it */
+ #if defined(__QNX__) && !defined(__QNXNTO__)
+ #define __time_t time_t
+
+ /* from Linux's <bits/utmp.h> */
+ #define UT_LINESIZE 32
+ #define UT_NAMESIZE 32
+ #define UT_HOSTSIZE 256
+
+ /* The structure describing an entry in the database of
+ previous logins. */
+ struct lastlog
+ {
+ __time_t ll_time;
+ char ll_line[UT_LINESIZE];
+ char ll_host[UT_HOSTSIZE];
+ };
+ #endif /* __QNX__ && !__QNXNTO__ */
static void
lastlog_construct(struct logininfo *li, struct lastlog *last)
diff -cr openssh-2.2.0p1.orig/scp.c openssh-2.2.0p1.qnx/scp.c
*** openssh-2.2.0p1.orig/scp.c Wed Aug 30 01:11:30 2000
--- openssh-2.2.0p1.qnx/scp.c Tue Sep 12 10:29:21 2000
***************
*** 650,656 ****
--- 650,660 ----
return;
}
while ((dp = readdir(dirp))) {
+ #if defined(__QNX__) && !defined(__QNXNTO__)
+ if (dp->d_stat.st_ino == 0)
+ #else /* !__QNX__ || __QNXNTO__ */
if (dp->d_ino == 0)
+ #endif /* !__QNX__ || __QNXNTO__ */
continue;
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
continue;
***************
*** 1050,1055 ****
--- 1054,1064 ----
bad: fprintf(stderr, "%s: invalid user name\n", cp0);
return (0);
}
+
+
+ #if defined(__QNX__) && !defined(__QNXNTO__)
+ #define st_blksize st_size /* other naming under QNX */
+ #endif /* __QNX__ && !__QNX_NTO__ */
BUF *
allocbuf(bp, fd, blksize)
diff -cr openssh-2.2.0p1.orig/session.c openssh-2.2.0p1.qnx/session.c
*** openssh-2.2.0p1.orig/session.c Wed Aug 30 00:21:22 2000
--- openssh-2.2.0p1.qnx/session.c Tue Sep 12 09:27:19 2000
***************
*** 1861,1863 ****
--- 1861,1874 ----
if (xauthfile)
xauthfile_cleanup_proc(NULL);
}
+
+
+ #if defined(__QNX__) && !defined(__QNXNTO__)
+ /* Thanks to liug at mama.indstate.edu */
+
+ int initgroups(char *name,gid_t id)
+ {
+ return(0);
+ }
+
+ #endif /* __QNX__ && !__QNXNTO__ */
diff -cr openssh-2.2.0p1.orig/ssh.c openssh-2.2.0p1.qnx/ssh.c
*** openssh-2.2.0p1.orig/ssh.c Tue Aug 29 02:33:51 2000
--- openssh-2.2.0p1.qnx/ssh.c Tue Sep 12 10:30:53 2000
***************
*** 215,220 ****
--- 215,221 ----
original_real_uid = getuid();
original_effective_uid = geteuid();
+ #if !defined(__QNX__) || defined(__QNXNTO__)
/* If we are installed setuid root be careful to not drop core. */
if (original_real_uid != original_effective_uid) {
struct rlimit rlim;
***************
*** 222,227 ****
--- 223,229 ----
if (setrlimit(RLIMIT_CORE, &rlim) < 0)
fatal("setrlimit failed: %.100s", strerror(errno));
}
+ #endif /* !__QNX__ || __QNXNTO__ */
/*
* Use uid-swapping to give up root privileges for the duration of
* option processing. We will re-instantiate the rights when we are
diff -cr openssh-2.2.0p1.orig/sshd.c openssh-2.2.0p1.qnx/sshd.c
*** openssh-2.2.0p1.orig/sshd.c Tue Aug 29 02:05:50 2000
--- openssh-2.2.0p1.qnx/sshd.c Tue Sep 12 12:21:29 2000
***************
*** 49,54 ****
--- 49,76 ----
int deny_severity = LOG_WARNING;
#endif /* LIBWRAP */
+ #if defined(__QNX__) && !defined(__QNXNTO__)
+ /* Define some things not available under QNX */
+
+ /* from Linux's <sys/param.h> */
+ #ifndef howmany
+ # define howmany(x, y) (((x)+((y)-1))/(y))
+ #endif /* !howmany */
+ /* from the Linux kernel */
+ //#define __NFDBITS (8 * sizeof(unsigned long)) /* results in 32 under QNX and Linux (A.S.) */
+
+ /* from Linux's <bits/types.h> */
+ /* One element in the file descriptor mask array. */
+ typedef unsigned long int __fd_mask;
+ /* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
+ #define __NFDBITS (8 * sizeof (__fd_mask)) /* results in 32 under QNX and Linux (A.S.) */
+
+ /* from Linux's <sys/select.h> */
+ /* Number of bits per word of `fd_set' (some code assumes this is 32). */
+ #define NFDBITS __NFDBITS
+ typedef __fd_mask fd_mask;
+ #endif /* __QNX__ && !__QNXNTO__ */
+
#ifndef O_NOCTTY
#define O_NOCTTY 0
#endif
diff -cr openssh-2.2.0p1.orig/ttymodes.h openssh-2.2.0p1.qnx/ttymodes.h
*** openssh-2.2.0p1.orig/ttymodes.h Thu Jun 22 13:32:32 2000
--- openssh-2.2.0p1.qnx/ttymodes.h Tue Sep 12 10:32:13 2000
***************
*** 32,37 ****
--- 32,41 ----
* is only intended for including from ttymodes.c.
*/
+ #if defined(__QNX__) && !defined(__QNXNTO__)
+ #include "qnx-term.h"
+ #endif /* __QNX__ && !__QNXNTO__ */
+
/* termios macro */ /* sgtty macro */
/* name, op */
TTYCHAR(VINTR, 1) SGTTYCHAR(tiotc.t_intrc, 1)
More information about the openssh-unix-dev
mailing list