SUMMARY: Need IMAP patches for Enhanced Security

From: Jonathan Rozes <jrozes_at_gumbo.tcs.tufts.edu>
Date: Tue, 9 Jan 1996 12:26:44 -0500

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
_at__at_ -32,7 +32,10 _at__at_
  * 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"
_at__at_ -48,14 +51,50 _at__at_
 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_at_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>
Received on Tue Jan 09 1996 - 18:57:43 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT