From 6f7d77ba43dc37be946c71724a88f9ee542c3efa Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Tue, 31 Mar 1992 21:51:34 +0000
Subject: [PATCH] Began to integrate rfc-931 authentication into the server.

---
 src/server/ChangeLog |  5 ++++
 src/server/Makefile  |  8 +++---
 src/server/rfc931.c  | 60 ++++++++++++++++++++++++++++++++++++++++++++
 src/server/rfc931.h  | 26 +++++++++++++++++++
 4 files changed, 95 insertions(+), 4 deletions(-)
 create mode 100644 src/server/rfc931.c
 create mode 100644 src/server/rfc931.h

diff --git a/src/server/ChangeLog b/src/server/ChangeLog
index 9299e1a3d..df7b3b909 100644
--- a/src/server/ChangeLog
+++ b/src/server/ChangeLog
@@ -1,3 +1,8 @@
+Tue Mar 31 23:48:47 1992  Per Cederqvist  (ceder@robert)
+
+	* rfc931.[hc]: New file.
+	* Makefile: (GEN_OBJS, GEN_SRCS): Use it.
+
 Tue Mar 24 18:05:18 1992  Per Cederqvist  (ceder@robert)
 
 	* simple-cache.c (save_one_text): Check that the entire file made
diff --git a/src/server/Makefile b/src/server/Makefile
index 4ba35502b..ba8d2c385 100755
--- a/src/server/Makefile
+++ b/src/server/Makefile
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile,v 0.21 1992/02/26 18:45:23 ceder Exp $
+# $Id: Makefile,v 0.22 1992/03/31 21:51:25 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,7 +22,7 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-# $Id: Makefile,v 0.21 1992/02/26 18:45:23 ceder Exp $
+# $Id: Makefile,v 0.22 1992/03/31 21:51:25 ceder Exp $
 
 include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
@@ -64,13 +64,13 @@ GENOBJS = connections.o log.o $(ATOMS) \
           kom-types.o \
           send-async.o server-config.o text-garb.o \
           missing-ansi.o isc-parse.o memory.o $(PROTA) $(MUX) \
-	  internal-connections.o
+	  internal-connections.o rfc931.o
 
 GEN_SRCS = connections.c log.c $(ATOMS_SRCS) \
           kom-types.c \
           send-async.c server-config.c text-garb.c \
           missing-ansi.c isc-parse.c memory.c $(PROTA_SRCS) $(MUX_SRCS) \
-	  internal-connections.c
+	  internal-connections.c rfc931.o
 
 # Files for lyskomd.
 
diff --git a/src/server/rfc931.c b/src/server/rfc931.c
new file mode 100644
index 000000000..e78cbb937
--- /dev/null
+++ b/src/server/rfc931.c
@@ -0,0 +1,60 @@
+/*
+ * $Id: rfc931.c,v 1.1 1992/03/31 21:51:30 ceder Exp $
+ * Copyright (C) 1991  Lysator Academic Computer Association.
+ *
+ * This file is part of the LysKOM server.
+ * 
+ * LysKOM is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by 
+ * the Free Software Foundation; either version 1, or (at your option) 
+ * any later version.
+ * 
+ * LysKOM is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with LysKOM; see the file COPYING.  If not, write to
+ * Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
+ * or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
+ * MA 02139, USA.
+ *
+ * Please mail bug reports to bug-lyskom@lysator.liu.se. 
+ */
+
+/*
+ * This function retrieves the real user that owns the TCP/IP link
+ * that is connecting via the IscSession "scb". The returned string
+ * points to static data which is overwritten on the next call.
+ *
+ * Link with "-lauthuser".
+ */
+
+#include <stddef.h>
+#include "isc-interface.h"
+#include <m-config.h>
+#include "rfc931.h"
+#include <authuser.h>
+
+#ifdef RFC_931
+
+char *
+get_real_username(IscSession *scb)
+{
+    extern int auth_fd2();
+    extern char *auth_tcpuser2();
+	  
+    unsigned long inlocal;
+    unsigned long inremote;
+    unsigned short local;
+    unsigned short remote;
+
+
+    if (auth_fd2(scb->fd, &inlocal, &inremote,
+		 &local, &remote) == -1)
+ 	return NULL;
+
+    return auth_tcpuser2(inlocal, inremote, local, remote);
+}
+#endif
diff --git a/src/server/rfc931.h b/src/server/rfc931.h
new file mode 100644
index 000000000..5e1380430
--- /dev/null
+++ b/src/server/rfc931.h
@@ -0,0 +1,26 @@
+/*
+ * $Id: rfc931.h,v 1.1 1992/03/31 21:51:34 ceder Exp $
+ * Copyright (C) 1991  Lysator Academic Computer Association.
+ *
+ * This file is part of the LysKOM server.
+ * 
+ * LysKOM is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by 
+ * the Free Software Foundation; either version 1, or (at your option) 
+ * any later version.
+ * 
+ * LysKOM is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with LysKOM; see the file COPYING.  If not, write to
+ * Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
+ * or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
+ * MA 02139, USA.
+ *
+ * Please mail bug reports to bug-lyskom@lysator.liu.se. 
+ */
+
+char *get_real_username(IscSession *scb);
-- 
GitLab