summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorSam Hartman <hartmans@mit.edu>1995-08-02 17:20:59 +0000
committerSam Hartman <hartmans@mit.edu>1995-08-02 17:20:59 +0000
commitfdca30279f2ac4e63d8f49ff7af6a37ebcdbba42 (patch)
tree97c1ee5df08605c37b2476c59e283604f560614b /src/util
parentdcf05d27e2a54eeb2049ff136baabeca32534bbe (diff)
downloadkrb5-fdca30279f2ac4e63d8f49ff7af6a37ebcdbba42.tar.gz
krb5-fdca30279f2ac4e63d8f49ff7af6a37ebcdbba42.tar.xz
krb5-fdca30279f2ac4e63d8f49ff7af6a37ebcdbba42.zip
* Fix tests for length of slave buffer.
* Add pty_init to initialize error tables. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6379 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util')
-rw-r--r--src/util/pty/.Sanitize1
-rw-r--r--src/util/pty/ChangeLog5
-rw-r--r--src/util/pty/Makefile.in7
-rw-r--r--src/util/pty/getpty.c4
-rw-r--r--src/util/pty/init.c29
-rw-r--r--src/util/pty/libpty.h2
-rw-r--r--src/util/pty/pty-int.h5
7 files changed, 47 insertions, 6 deletions
diff --git a/src/util/pty/.Sanitize b/src/util/pty/.Sanitize
index b50536221..d988ede18 100644
--- a/src/util/pty/.Sanitize
+++ b/src/util/pty/.Sanitize
@@ -31,6 +31,7 @@ cleanup.c
getpty.c
initialize_slave.c
libpty.h
+init.c
logwtmp.c
open_ctty.c
open_slave.c
diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog
index 190e05ca4..0a4c2cf9f 100644
--- a/src/util/pty/ChangeLog
+++ b/src/util/pty/ChangeLog
@@ -1,3 +1,8 @@
+Wed Aug 2 11:59:19 1995 Sam Hartman <hartmans@tertius.mit.edu>
+
+ * init.c (pty_init): New file to handle initialization--currently only error tables.
+
+ * getpty.c (pty_getpty): Reverse sense of logic tests so they work.
Tue Aug 1 08:20:06 1995 Sam Hartman <hartmans@tertius.mit.edu>
diff --git a/src/util/pty/Makefile.in b/src/util/pty/Makefile.in
index 1e6545888..d80a81579 100644
--- a/src/util/pty/Makefile.in
+++ b/src/util/pty/Makefile.in
@@ -6,7 +6,8 @@ SED = sed
$(CC) $(CFLAGS) -c $(srcdir)/$*.c
-LIBOBJS= cleanup.o getpty.o initialize_slave.o open_ctty.o open_slave.o update_utmp.o update_wtmp.o vhangup.o void_assoc.o pty_err.o logwtmp.o
+LIBOBJS= cleanup.o getpty.o initialize_slave.o open_ctty.o open_slave.o \
+ update_utmp.o update_wtmp.o vhangup.o void_assoc.o pty_err.o logwtmp.o init.o
LIBDONE=DONE
LIB_SUBDIRS=.
@@ -16,10 +17,10 @@ INSTALLFILE = cp
LOCALINCLUDE=-I. -I$(srcdir)
FILES= Makefile cleanup.c getpty.c initialize_slave.c open_ctty.c open_slave.c update_utmp.c update_wtmp.c vhangup.c void_assoc.c pty_err.h pty_err.c\
-logwtmp.c
+logwtmp.c init.c
CFILES=cleanup.c getpty.c initialize_slave.c open_ctty.c open_slave.c\
-update_utmp.c update_wtmp.c vhangup.c void_assoc.c pty_err.c logwtmp.c
+update_utmp.c update_wtmp.c vhangup.c void_assoc.c pty_err.c logwtmp.c init.c
SRCS=pty_err.h $(CFILES)
diff --git a/src/util/pty/getpty.c b/src/util/pty/getpty.c
index 7968e4256..b0eb602a7 100644
--- a/src/util/pty/getpty.c
+++ b/src/util/pty/getpty.c
@@ -63,7 +63,7 @@ close(slavefd);
#endif
#endif
if (p) {
- if ( strlen(p) < slavelength)
+ if ( strlen(p) > slavelength)
{
close (*fd);
*fd = -1;
@@ -80,7 +80,7 @@ close(slavefd);
}
ptynum = (int)(stb.st_rdev&0xFF);
sprintf(slavebuf, "/dev/ttyp%x", ptynum);
- if ( strlen(slavebuf) < slavelength) {
+ if ( strlen(slavebuf) > slavelength) {
close(*fd);
*fd = -1;
return PTY_GETPTY_SLAVE_TOOLONG;
diff --git a/src/util/pty/init.c b/src/util/pty/init.c
new file mode 100644
index 000000000..40cf2396b
--- /dev/null
+++ b/src/util/pty/init.c
@@ -0,0 +1,29 @@
+/*
+ * pty_init: Initialize internal state of pty.
+ * Currently initializes error tables.
+ * Copyright 1990 by the Massachusetts Institute of Technology.
+ *
+ *
+ *Permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ *
+ */
+
+#include "mit-copyright.h"
+#include <com_err.h>
+#include "libpty.h"
+#include "pty-int.h"
+
+long pty_init()
+{
+ initialize_pty_error_table();
+ return 0;
+}
diff --git a/src/util/pty/libpty.h b/src/util/pty/libpty.h
index b8e9a5aa4..685ce61bd 100644
--- a/src/util/pty/libpty.h
+++ b/src/util/pty/libpty.h
@@ -24,6 +24,7 @@
#ifdef __STDC__ /* use prototypes */
+long pty_init(void);
long pty_getpty ( int *fd, char *slave, int slavelength);
long pty_open_slave (const char *slave, int *fd);
@@ -37,6 +38,7 @@ long pty_logwtmp (char *tty, char * user, char *host);
long pty_cleanup(char *slave, int pid, int update_utmp);
#else /*__STDC__*/
+long pty_init();
long pty_getpty();
long pty_open_slave();
diff --git a/src/util/pty/pty-int.h b/src/util/pty/pty-int.h
index 95d5dd220..675079259 100644
--- a/src/util/pty/pty-int.h
+++ b/src/util/pty/pty-int.h
@@ -1,6 +1,7 @@
/* Includes needed by libpty*/
#ifndef __PTY_INT_H__
#include <pty_err.h>
+#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -12,7 +13,7 @@
#endif
#include <stdio.h>
-#include <sys/types.h>
+
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
@@ -83,6 +84,7 @@
/* Internal functions */
#ifdef __STDC__
+void initialize_pty_error_table(void);
long ptyint_void_association(void);
long ptyint_open_ctty (char *slave, int *fd);
void ptyint_vhangup(void);
@@ -90,6 +92,7 @@ void ptyint_vhangup(void);
long ptyint_void_association();
void ptyint_vhangup();
+void initialize_pty_error_table();
#endif /* __STDC__*/
#define __PTY_INT_H__