Good day!
I have patch for run popa3d-1.0.2 on Minix3.
I test basic functionality of popa3d in Minix3 and want add this patch
in mainstream. How I can make this?
Thanks.
diff -cr ./popa3d-1.0.2.orig/Makefile ./popa3d-1.0.2/Makefile
*** ./popa3d-1.0.2.orig/Makefile	Thu Aug 19 10:31:06 2010
--- ./popa3d-1.0.2/Makefile	Thu Aug 19 10:40:02 2010
***************
*** 1,12 ****
! CC = gcc
  LD = $(CC)
  RM = rm -f
  MKDIR = mkdir -p
  INSTALL = install -c
! CFLAGS = -Wall -O2 -fomit-frame-pointer
  # You may use OpenSSL's MD5 routines instead of the ones supplied here
  #CFLAGS += -DHAVE_OPENSSL
! LDFLAGS = -s
  LIBS =
  # Linux with glibc, FreeBSD, NetBSD
  #LIBS += -lcrypt
--- 1,13 ----
! CC = cc
  LD = $(CC)
  RM = rm -f
  MKDIR = mkdir -p
  INSTALL = install -c
! #CFLAGS = -Wall -O2 -fomit-frame-pointer
! CFLAGS = -D_MINIX -D_POSIX_SOURCE
  # You may use OpenSSL's MD5 routines instead of the ones supplied here
  #CFLAGS += -DHAVE_OPENSSL
! #LDFLAGS = -s
  LIBS =
  # Linux with glibc, FreeBSD, NetBSD
  #LIBS += -lcrypt
diff -cr ./popa3d-1.0.2.orig/auth_shadow.c ./popa3d-1.0.2/auth_shadow.c
*** ./popa3d-1.0.2.orig/auth_shadow.c	Thu Aug 19 10:31:06 2010
--- ./popa3d-1.0.2/auth_shadow.c	Thu Aug 19 10:40:02 2010
***************
*** 19,25 ****
--- 19,27 ----
  #include <string.h>
  #include <stdlib.h>
  #include <pwd.h>
+ #if !_MINIX
  #include <shadow.h>
+ #endif
  #include <sys/wait.h>
  #include <sys/types.h>
  
***************
*** 29,37 ****
  {
  	int channel[2];
  	struct passwd *pw;
  	struct spwd *spw;
  	char result;
! 
  	if ((*known = (pw = getpwnam(user)) != NULL))
  		memset(pw->pw_passwd, 0, strlen(pw->pw_passwd));
  	endpwent();
--- 31,45 ----
  {
  	int channel[2];
  	struct passwd *pw;
+ #if !_MINIX
  	struct spwd *spw;
+ #else
+ 	struct passwd *spw;
+ #endif
  	char result;
! #if _MINIX
! 	setpwent();
! #endif
  	if ((*known = (pw = getpwnam(user)) != NULL))
  		memset(pw->pw_passwd, 0, strlen(pw->pw_passwd));
  	endpwent();
***************
*** 49,62 ****
  
  	case 0:
  		close(channel[0]);
  		if (!(spw = getspnam(user)) || !pw || !*spw->sp_pwdp ||
  		    *spw->sp_pwdp == '*' || *spw->sp_pwdp == '!')
  			crypt(pass, AUTH_DUMMY_SALT);
  		else
! 		if (!strcmp(crypt(pass, spw->sp_pwdp), spw->sp_pwdp))
  			result = 1;
  		write(channel[1], &result, 1);
  		exit(0);
  	}
  
  	if (close(channel[1]))
--- 57,86 ----
  
  	case 0:
  		close(channel[0]);
+ #if !_MINIX
  		if (!(spw = getspnam(user)) || !pw || !*spw->sp_pwdp ||
  		    *spw->sp_pwdp == '*' || *spw->sp_pwdp == '!')
  			crypt(pass, AUTH_DUMMY_SALT);
+                 else
+                 if (!strcmp(crypt(pass, spw->sp_pwdp), spw->sp_pwdp))
+                         result = 1;
+                 write(channel[1], &result, 1);
+                 exit(0);
+ #else
+                 setpwfile("/etc/shadow");
+                 setpwent();
+                 if (!(spw = getpwnam(user)) || !pw || !*spw->pw_passwd ||
+                     *spw->pw_passwd == '*' || *spw->pw_passwd == '!')
+ 		{
+                         crypt(pass, AUTH_DUMMY_SALT);
+ 			endpwent();
+ 		}
  		else
! 		if (!strcmp(crypt(pass, spw->pw_passwd), spw->pw_passwd))
  			result = 1;
  		write(channel[1], &result, 1);
  		exit(0);
+ #endif
  	}
  
  	if (close(channel[1]))
diff -cr ./popa3d-1.0.2.orig/params.h ./popa3d-1.0.2/params.h
*** ./popa3d-1.0.2.orig/params.h	Thu Aug 19 10:31:06 2010
--- ./popa3d-1.0.2/params.h	Thu Aug 19 10:40:02 2010
***************
*** 13,19 ****
  /*
   * Are we going to be a standalone server or start via an inetd clone?
   */
! #define POP_STANDALONE			0
  
  #if POP_STANDALONE
  
--- 13,19 ----
  /*
   * Are we going to be a standalone server or start via an inetd clone?
   */
! #define POP_STANDALONE			1
  
  #if POP_STANDALONE
  
***************
*** 103,109 ****
   * A pseudo-user to run as before authentication.  The user and its UID
   * must not be used for any other purpose.
   */
! #define POP_USER			POP_SERVER
  
  /*
   * An empty directory to chroot to before authentication.  The directory
--- 103,109 ----
   * A pseudo-user to run as before authentication.  The user and its UID
   * must not be used for any other purpose.
   */
! #define POP_USER			"pop"
  
  /*
   * An empty directory to chroot to before authentication.  The directory
***************
*** 191,197 ****
   *
   * #undef this for qmail-style $HOME/Mailbox mailboxes.
   */
! #define MAIL_SPOOL_PATH			"/var/mail"
  
  #ifndef MAIL_SPOOL_PATH
  /*
--- 191,197 ----
   *
   * #undef this for qmail-style $HOME/Mailbox mailboxes.
   */
! #define MAIL_SPOOL_PATH			"/usr/spool/mail"
  
  #ifndef MAIL_SPOOL_PATH
  /*
diff -cr ./popa3d-1.0.2.orig/pop_root.c ./popa3d-1.0.2/pop_root.c
*** ./popa3d-1.0.2.orig/pop_root.c	Thu Aug 19 10:31:06 2010
--- ./popa3d-1.0.2/pop_root.c	Thu Aug 19 10:40:02 2010
***************
*** 46,52 ****
--- 46,56 ----
  
  int log_error(char *s)
  {
+ #if !_MINIX
  	syslog(SYSLOG_PRI_ERROR, "%s: %m", s);
+ #else
+         syslog(SYSLOG_PRI_ERROR, "%s: %s", s, strerror(errno));
+ #endif
  	return 1;
  }
  
diff -cr ./popa3d-1.0.2.orig/popa3d.8 ./popa3d-1.0.2/popa3d.8
*** ./popa3d-1.0.2.orig/popa3d.8	Thu Aug 19 10:31:06 2010
--- ./popa3d-1.0.2/popa3d.8	Thu Aug 19 10:40:02 2010
***************
*** 33,39 ****
  In this mode,
  .B popa3d
  will become a daemon, accepting connections on the pop3 port (110/tcp)
! and forking child processes to handle them.
  This has lower overhead than starting
  .B popa3d
  from an inetd equivalent (which
--- 33,41 ----
  In this mode,
  .B popa3d
  will become a daemon, accepting connections on the pop3 port (110/tcp)
! and forking child processes to handle them. In Minix,
! .B popa3d
! will not become a daemon, and may be launched by "popa3d -D &" command.
  This has lower overhead than starting
  .B popa3d
  from an inetd equivalent (which
diff -cr ./popa3d-1.0.2.orig/standalone.c ./popa3d-1.0.2/standalone.c
*** ./popa3d-1.0.2.orig/standalone.c	Thu Aug 19 10:31:06 2010
--- ./popa3d-1.0.2/standalone.c	Thu Aug 19 10:40:02 2010
***************
*** 138,144 ****
  
  	chdir("/");
  	setsid();
! 
  	switch (fork()) {
  	case -1:
  		return log_error("fork");
--- 138,144 ----
  
  	chdir("/");
  	setsid();
! #if !_MINIX
  	switch (fork()) {
  	case -1:
  		return log_error("fork");
***************
*** 151,156 ****
--- 151,157 ----
  	}
  
  	setsid();
+ #endif
  
  #if defined(_SC_CLK_TCK) || !defined(CLK_TCK)
  	min_delay = MIN_DELAY * sysconf(_SC_CLK_TCK);

Reply via email to