tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "Jonathan Rozes" <jrozes () gumbo ! tcs ! tufts ! edu>
To: tru64-unix-managers
Subject: SUMMARY: Need IMAP patches for Enhanced Security
Date: Tue, 09 Jan 1996 17:26:44 +0000	[thread overview]
Message-ID: <96076327921135.tru64-unix-managers.marc@archive.invalid> (raw)

Hi again--

My original query was for working diffs to enable C2 authorization in the
IMAP server distributed with Pine 3.91. I got no responses, so I hacked
the broken patch I had together and got it working. Sorry, but I can't
attribute the patch to anybody, as I only had bits and pieces of it. If
it looks like your code, please speak up!

This runs on 3.0 and 3.2c (and probably others)...

jonathan

Apply this in the pine3.91/imap/ANSI/c-client directory:

---snip---

--- os_osf.c.ORIG	Tue Jan  9 12:17:01 1996
+++ os_osf.c	Tue Jan  2 17:04:23 1996
@@ -32,7 +32,10 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
  */
-
+
+#include <sia.h>
+#include <siad.h>
+
 #include "tcp_unix.h"		/* must be before osdep includes tcp.h */
 #include "mail.h"
 #include "osdep.h"
@@ -48,14 +51,50 @@
 extern int errno;		/* just in case */
 #include <pwd.h>
 #include "misc.h"
-extern char *crypt();
-

 #include "fs_unix.c"
 #include "ftl_unix.c"
 #include "nl_unix.c"
 #include "env_unix.c"
-#include "log_std.c"
 #include "gr_waitp.c"
 #include "tcp_unix.c"
 #include "tz_bsd.c"
+
+long server_login (char *user,char *pass,char **home,int argc,char *argv[])
+{
+  SIAENTITY *entity = NULL;
+  int sia_argc;
+  char *sia_argv[3];
+  static int stderr_closed = 0; /* workaround for OSF/1 T3.0-2 bug */
+
+  sia_argc = 2;
+  sia_argv[0] = "imapd";
+  sia_argv[1] = user;
+  sia_argv[2] = NULL;
+  if (sia_ses_init(&entity, sia_argc, sia_argv,
+                   NULL, user, NULL, FALSE, NULL) != SIASUCCESS)
+    fatal("sia_ses_init failed");
+  if (!stderr_closed)
+    {
+      /* In OSF/1 T3.0-2, if sia_ses_authent is given a wrong password
+	 it writes an audgenl error message to stderr. */
+      fclose(stderr);
+      stderr_closed = 1;
+    }
+  /* Check they have the correct password */
+  if (sia_ses_authent(NULL, pass, entity) != SIASUCCESS)
+    return NIL;
+  /* Check they are allowed to login */
+  if (sia_ses_estab(NULL, entity) != SIASUCCESS)
+    return NIL;
+
+  setgid(entity->pwd->pw_gid);      /* all OK, login in as that user */
+  initgroups(user, entity->pwd->pw_gid);    /* initialize groups */
+  setuid (entity->pwd->pw_uid);
+  /* note home directory */
+  if (home)
+    *home = cpystr(entity->pwd->pw_dir);
+  if (sia_ses_release(&entity) != SIASUCCESS)
+    fatal("sia_ses_release failed");
+  return T;
+}

-- 
+++ Jonathan Rozes, Unix Systems Administrator, Tufts University
++  jrozes@tcs.tufts.edu, http://gumbo.tcs.tufts.edu/~jrozes/
+   Mind Over Liver: The liver probably contains 100 million cells, but
    1,000 livers do not add up to a rich inner life. <GDF:SA 09/92>

                 reply	other threads:[~1996-01-09 17:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox