diff -c -N -r sendmail-8.9.3/src/Makefile.m4 sendmail+mysql/src/Makefile.m4
*** sendmail-8.9.3/src/Makefile.m4	Sat Jan 23 18:51:41 1999
--- sendmail+mysql/src/Makefile.m4	Sat Jul 10 19:17:21 1999
***************
*** 32,38 ****
  # see also conf.h for additional compilation flags
  
  # include directories
! INCDIRS=confINCDIRS
  
  # loader options
  LDOPTS=	ifdef(`confLDOPTS', `confLDOPTS')
--- 32,38 ----
  # see also conf.h for additional compilation flags
  
  # include directories
! INCDIRS=confINCDIRS -I/usr/local/include/mysql
  
  # loader options
  LDOPTS=	ifdef(`confLDOPTS', `confLDOPTS')
***************
*** 42,48 ****
  
  # libraries required on your system
  #  delete -l44bsd if you are not running BIND 4.9.x
! LIBS=	ifdef(`confLIBS', `confLIBS')
  
  # location of sendmail binary (usually /usr/sbin or /usr/lib)
  BINDIR=	${DESTDIR}ifdef(`confMBINDIR', `confMBINDIR', `/usr/sbin')
--- 42,48 ----
  
  # libraries required on your system
  #  delete -l44bsd if you are not running BIND 4.9.x
! LIBS=	-lmysqlclient ifdef(`confLIBS', `confLIBS')
  
  # location of sendmail binary (usually /usr/sbin or /usr/lib)
  BINDIR=	${DESTDIR}ifdef(`confMBINDIR', `confMBINDIR', `/usr/sbin')
***************
*** 72,78 ****
  	daemon.o deliver.o domain.o envelope.o err.o headers.o macro.o \
  	main.o map.o mci.o mime.o parseaddr.o queue.o readcf.o recipient.o \
  	safefile.o savemail.o snprintf.o srvrsmtp.o stab.o stats.o \
! 	sysexits.o trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
  
  LINKS=	ifdef(`confLINKS', `confLINKS',
  	`${UBINDIR}/newaliases \
--- 72,79 ----
  	daemon.o deliver.o domain.o envelope.o err.o headers.o macro.o \
  	main.o map.o mci.o mime.o parseaddr.o queue.o readcf.o recipient.o \
  	safefile.o savemail.o snprintf.o srvrsmtp.o stab.o stats.o \
! 	sysexits.o trace.o udb.o usersmtp.o util.o version.o \
! 	get_mysql_pwd.o ${OBJADD}
  
  LINKS=	ifdef(`confLINKS', `confLINKS',
  	`${UBINDIR}/newaliases \
diff -c -N -r sendmail-8.9.3/src/recipient.c sendmail+mysql/src/recipient.c
*** sendmail-8.9.3/src/recipient.c	Sat Jan 23 19:34:33 1999
--- sendmail+mysql/src/recipient.c	Sat Jul 10 19:17:21 1999
***************
*** 16,22 ****
  
  # include "sendmail.h"
  # include <grp.h>
! 
  /*
  **  SENDTOLIST -- Designate a send list.
  **
--- 16,22 ----
  
  # include "sendmail.h"
  # include <grp.h>
! #include "get_pwd.h"
  /*
  **  SENDTOLIST -- Designate a send list.
  **
***************
*** 497,508 ****
  		/* warning -- finduser may trash buf */
  		pw = finduser(buf, &fuzzy);
  		if (pw == NULL || strlen(pw->pw_name) > MAXNAME)
! 		{
! 			a->q_flags |= QBADADDR;
! 			a->q_status = "5.1.1";
! 			giveresponse(EX_NOUSER, m, NULL, a->q_alias,
! 				     (time_t) 0, e);
! 		}
  		else
  		{
  			char nbuf[MAXNAME + 1];
--- 497,510 ----
  		/* warning -- finduser may trash buf */
  		pw = finduser(buf, &fuzzy);
  		if (pw == NULL || strlen(pw->pw_name) > MAXNAME)
!                        pw = get_mysql_pwd(buf);
! 			  if (pw == NULL || strlen(pw->pw_name) > MAXNAME)
! 				{
! 					a->q_flags |= QBADADDR;
! 					a->q_status = "5.1.1";
! 					giveresponse(EX_NOUSER, m, NULL, a->q_alias,
! 		            		     (time_t) 0, e);
! 				}
  		else
  		{
  			char nbuf[MAXNAME + 1];
***************
*** 685,691 ****
  #endif
  
  	/* look up this login name using fast path */
! 	if ((pw = sm_getpwnam(name)) != NULL)
  	{
  		if (tTd(29, 4))
  			printf("found (non-fuzzy)\n");
--- 687,693 ----
  #endif
  
  	/* look up this login name using fast path */
! 	if (((pw = sm_getpwnam(name)) != NULL) || (get_mysql_pwd(name) != NULL)) 
  	{
  		if (tTd(29, 4))
  			printf("found (non-fuzzy)\n");
***************
*** 702,708 ****
  			tryagain = TRUE;
  		}
  	}
! 	if (tryagain && (pw = sm_getpwnam(name)) != NULL)
  	{
  		if (tTd(29, 4))
  			printf("found (lower case)\n");
--- 704,710 ----
  			tryagain = TRUE;
  		}
  	}
! 	if (tryagain && (pw = sm_getpwnam(name)) && get_mysql_pwd(name) != NULL)
  	{
  		if (tTd(29, 4))
  			printf("found (lower case)\n");
diff -c -N -r sendmail-8.9.3/src/get_pwd.h sendmail+mysql/src/get_pwd.h
*** sendmail-8.9.3/src/get_pwd.h	Sat Jul 10 19:43:38 1999
--- sendmail+mysql/src/get_pwd.h	Sat Jul 10 19:43:14 1999
***************
*** 0 ****
--- 1,13 ----
+ #include <pwd.h>
+ #include <sys/types.h>
+ 
+ struct passwd *get_mysql_pwd(char *user_name);
+ struct passwd *get_mysql_uid(int user_id);
+ struct passwd pw;
+ 
+ #define MYSQL_HOST "_put_your_host_here_"
+ #define MYSQL_USER "_put_your_username_here_"
+ #define MYSQL_PASS "_put_your_password_here_"
+ #define MYSQL_DB "_put_your_database_here_"
+ #define MYSQL_TABLE "_put_your_table_name_here_"
+ 
diff -c -N -r sendmail-8.9.3/src/get_mysql_pwd.c sendmail+mysql/src/get_mysql_pwd.c
*** sendmail-8.9.3/src/get_mysql_pwd.c	Sat Jul 10 22:33:56 1999
--- sendmail+mysql/src/get_mysql_pwd.c	Sat Jul 10 22:32:03 1999
***************
*** 0 ****
--- 1,52 ----
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include "mysql/mysql.h"
+ #include <pwd.h>
+ #include <sys/types.h>
+ #include "get_pwd.h"
+ 
+ struct passwd *pw_p;
+ 
+ MYSQL mysql;
+ MYSQL_RES *result;
+ char queryBuf[64];
+ my_ulonglong num_rows;
+ MYSQL_ROW field;
+ my_ulonglong num_fields;
+ 
+ struct passwd * get_mysql_pwd(char * user_name)
+ {
+ 	mysql_init(&mysql);
+ 	if(!mysql_real_connect(&mysql,MYSQL_HOST,MYSQL_USER,MYSQL_PASS,MYSQL_DB,0,NULL,0))
+ 	{
+ 		mysql_close(&mysql);
+ 		return NULL;
+ 	}
+ 	sprintf(queryBuf,"select * from %s where username = \'%s\'",MYSQL_TABLE,user_name);
+ 	mysql_query(&mysql, queryBuf);
+ 	result=mysql_store_result(&mysql);
+ 	num_rows=mysql_num_rows(result);
+ 	num_fields=mysql_num_fields(result);
+ 	if(num_rows == 0)
+ 	{
+ 		mysql_free_result(result);
+ 		mysql_close(&mysql);
+ 		return NULL;
+ 	}
+ 	field=mysql_fetch_row(result);
+ 
+ pw_p = &pw;
+ pw.pw_name = field[0];
+ pw.pw_passwd = field[1];
+ pw.pw_uid = atoi(field[2]);
+ pw.pw_gid = atoi(field[3]);
+ pw.pw_gecos = field[4];
+ pw.pw_dir = field[5];
+ pw.pw_shell = field[6];
+ 
+ 
+ mysql_free_result(result);
+ mysql_close(&mysql);
+ return pw_p;
+ } 
diff -c -N -r sendmail-8.9.3/src/version.c sendmail+mysql/src/version.c
*** sendmail-8.9.3/src/version.c        Thu Feb  4 19:38:46 1999
--- sendmail+mysql/src/version.c        Sun Jul 11 16:25:37 1999
***************
*** 14,17 ****
  static char sccsid[] = "@(#)version.c 8.9.3.1 (Berkeley) 2/4/1999";
  #endif /* not lint */

! char  Version[] = "8.9.3";
--- 14,17 ----
  static char sccsid[] = "@(#)version.c 8.9.3.1 (Berkeley) 2/4/1999";
  #endif /* not lint */

! char  Version[] = "8.9.3-MySQL-0.1a";

