From: <pdo...@us...> - 2010-07-25 05:31:58
|
Revision: 13986 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13986&view=rev Author: pdontthink Date: 2010-07-25 05:31:50 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.1.1 Modified Paths: -------------- trunk/imap_proxy/README trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/request.c Added Paths: ----------- trunk/imap_proxy/ChangeLog Added: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog (rev 0) +++ trunk/imap_proxy/ChangeLog 2010-07-25 05:31:50 UTC (rev 13986) @@ -0,0 +1,73 @@ +2003-01-22 Dave McMurtrie <dg...@pi...> + + * Version 1.1.1 released. + + * imapproxy.h: function prototype for Get_Server_sd updated + to reflect the literal password flag argument. + + * request.c: Added logic to support passwords sent as string + literals on login. Also fixed bug that prevented passwords + with space characters from working. + + * imapcommon.c: Added logic to support passwords sent as string + literals on login. + +2002-12-18 Dave McMurtrie <dg...@pi...> + + * imapcommon.c: Fixed bug in for loop that does string literal + processing. + +2002-12-17 Dave McMurtrie <dg...@pi...> + + * Global configuration file support added. + + * Version 1.1 released. + + * main.c: minor bugfixes from Gary Mills <mi...@cc...> + incorporated. + + * main.c: changed accepted command line arguments. + +2002-09-06 Dave McMurtrie <dg...@pi...> + + * main.c: added code to ignore SIGPIPE so EPIPE on a + failed send() won't kill us. Also ignore SIGHUP. + +2002-08-30 Dave McMurtrie <dg...@pi...> + + * main.c: added initialization of the trace mutex that I forgot. + + * pimpstat.c newly introduced. + + * added total client logins counter. + +2002-08-29 Dave McMurtrie <dg...@pi...> + + * Pitt common functions moved out of external libraries into this + source tree. + + * imapcommon.c: fixed nasty socket descriptor leak. + +2002-08-28 Dave McMurtrie <dg...@pi...> + + * replaced all internal logging calls with standard syslog + calls. + + * main.c: made call to setrlimit dynamic. + + * request.c: added p_resetcounters command. + + * request.c: added poll() timeout in raw proxy loop. + +2002-08-27 Dave McMurtrie <dg...@pi...> + + * request.c: no longer do a hostname lookup. Just log IP instead. + +2002-07-18 Dave McMurtrie <dg...@pi...> + + * request.c: added p_dumpicc and p_newlog commands. renamed trace + command to p_trace. + +2002-07-03 Dave McMurtrie <dg...@pi...> + + * Version 1.0 released. Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 05:13:10 UTC (rev 13985) +++ trunk/imap_proxy/README 2010-07-25 05:31:50 UTC (rev 13986) @@ -9,9 +9,11 @@ dg...@pi... -For that matter, if you decide to use this software, pop me an email and let me -know how it works for you. +If you want to subscribe to the imapproxy-info mailing list, visit: + +http://lists.pitt.edu/mailman/listinfo/imapproxy-info + ############################################################################## KNOWN ISSUES ############################################################################## @@ -32,7 +34,7 @@ this directory. "make install" will attempt to install the following files: /usr/local/sbin/in.imapproxyd -/usr/local/bin/pimpstat +/usr/local/sbin/pimpstat /etc/init.d/imapproxy /etc/rc2.d/S99imapproxy /etc/rc0.d/K10imapproxy Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 05:13:10 UTC (rev 13985) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 05:31:50 UTC (rev 13986) @@ -36,11 +36,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.4 2002/12/19 21:41:32 dgm Exp $ +** $Id: imapproxy.h,v 1.5 2003/01/22 15:33:53 dgm Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.5 2003/01/22 15:33:53 dgm +** Changed Get_Server_sd() function prototype to reflect the addition of +** the literal password flag. +** ** Revision 1.4 2002/12/19 21:41:32 dgm ** Added support for global configuration. ** @@ -187,7 +191,7 @@ extern void HandleRequest( int ); extern char *memtok( char *, char *, char ** ); extern int imparse_isatom( const char * ); -extern int Get_Server_sd( char *, char *, const char * ); +extern int Get_Server_sd( char *, char *, const char *, unsigned char ); extern void ICC_Logout( char *, int ); extern void ICC_Recycle( unsigned int ); extern void ICC_Recycle_Loop( void ); Modified: trunk/imap_proxy/src/imapcommon.c =================================================================== --- trunk/imap_proxy/src/imapcommon.c 2010-07-25 05:13:10 UTC (rev 13985) +++ trunk/imap_proxy/src/imapcommon.c 2010-07-25 05:31:50 UTC (rev 13986) @@ -37,11 +37,18 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/imapcommon.c,v $ -** $Id: imapcommon.c,v 1.5 2002/12/18 14:39:55 dgm Exp $ +** $Id: imapcommon.c,v 1.7 2003/01/23 16:24:31 dgm Exp $ ** ** Modification History: ** ** $Log: imapcommon.c,v $ +** Revision 1.7 2003/01/23 16:24:31 dgm +** NonSyncLiteral flag was not being cleared properly. +** +** Revision 1.6 2003/01/22 12:56:30 dgm +** Changes to Get_Server_sd() so it can support login attempts where +** the client sends the password as a string literal. +** ** Revision 1.5 2002/12/18 14:39:55 dgm ** Fixed bug in for loop for string literal processing. ** @@ -160,6 +167,8 @@ * Parameters: ptr to username string * ptr to password string * const ptr to client hostname or IP string (for logging only) + * unsigned char - flag to indicate that the client sent the + * password as a string literal. * * Returns: int sd on success * -1 on failure @@ -170,7 +179,8 @@ */ extern int Get_Server_sd( char *Username, char *Password, - const char *ClientAddr ) + const char *ClientAddr, + unsigned char LiteralPasswd ) { char *fn = "Get_Server_sd()"; unsigned int HashIndex; @@ -313,25 +323,73 @@ if ( IMAP_Line_Read( &Server ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: No banner line received from IMAP server", - Username, ClientAddr ); + syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: No banner line received from IMAP server", Username, ClientAddr ); close( Server.sd ); return( -1 ); } /* - * Send the login command off to the IMAP server. + * Send the login command off to the IMAP server. Have to treat a literal + * password different. */ - snprintf( SendBuf, BufLen, "A0001 LOGIN %s %s\r\n", - Username, Password ); - - if ( send( Server.sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + if ( LiteralPasswd ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: send() failed attempting to send LOGIN command to IMAP server: %s", Username, ClientAddr, strerror( errno ) ); - close( Server.sd ); - return( -1 ); + snprintf( SendBuf, BufLen, "A0001 LOGIN %s {%d}\r\n", + Username, strlen( Password ) ); + if ( send( Server.sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: send() failed attempting to send LOGIN command to IMAP server: %s", Username, ClientAddr, strerror( errno ) ); + close( Server.sd ); + return( -1 ); + } + + /* + * the server response should be a go ahead + */ + if ( ( rc = IMAP_Line_Read( &Server ) ) == -1 ) + { + syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: Failed to receive go-ahead from IMAP server after sending LOGIN command", Username, ClientAddr ); + close( Server.sd ); + return( -1 ); + } + + + if ( strncasecmp( "+ go ahead\r\n", Server.ReadBuf, rc ) ) + { + syslog( LOG_INFO, "LOGIN: '%s' (%s) failed: bad response from server after sending string literal specifier", Username, ClientAddr ); + close( Server.sd ); + return( -1 ); + } + + /* + * now send the password + */ + snprintf( SendBuf, BufLen, "%s\r\n", Password ); + + if ( send( Server.sd, SendBuf, strlen( SendBuf ), 0 ) == -1 ) + { + syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: send() failed attempting to send literal password to IMAP server: %s", Username, ClientAddr, strerror( errno ) ); + close( Server.sd ); + return( -1 ); + } } + else + { + /* + * just send the login command via normal means. + */ + snprintf( SendBuf, BufLen, "A0001 LOGIN %s %s\r\n", + Username, Password ); + + if ( send( Server.sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: send() failed attempting to send LOGIN command to IMAP server: %s", Username, ClientAddr, strerror( errno ) ); + close( Server.sd ); + return( -1 ); + } + } + /* * Read the server response */ @@ -824,7 +882,13 @@ * sending a literal to a server. */ if ( *(LiteralEnd - 1) == '+' ) + { ITD->NonSyncLiteral = 1; + } + else + { + ITD->NonSyncLiteral = 0; + } /* To grab the number, bump our Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 05:13:10 UTC (rev 13985) +++ trunk/imap_proxy/src/request.c 2010-07-25 05:31:50 UTC (rev 13986) @@ -41,11 +41,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.5 2002/08/30 13:24:43 dgm Exp $ +** $Id: request.c,v 1.6 2003/01/22 13:03:25 dgm Exp $ ** ** Modification History: ** ** $Log: request.c,v $ +** Revision 1.6 2003/01/22 13:03:25 dgm +** Changes to HandleRequest() and cmd_login() to support clients that +** send the password as a literal string on login. +** ** Revision 1.5 2002/08/30 13:24:43 dgm ** Added support for total client logins counter ** @@ -110,7 +114,7 @@ static int cmd_logout( ITD_Struct *, char * ); static int cmd_capability( ITD_Struct *, char * ); static int cmd_authenticate( ITD_Struct *, char * ); -static int cmd_login( ITD_Struct *, char *, char *, int, char * ); +static int cmd_login( ITD_Struct *, char *, char *, int, char *, unsigned char ); static int cmd_trace( ITD_Struct *, char *, char * ); static int cmd_dumpicc( ITD_Struct *, char * ); static int cmd_newlog( ITD_Struct *, char * ); @@ -133,6 +137,8 @@ * * Returns: 0 on success * -1 on failure + * + * Authors: dgm *-- */ static int cmd_newlog( ITD_Struct *itd, char *Tag ) @@ -225,6 +231,8 @@ * * Returns: 0 on success * -1 on failure + * + * Authors: dgm *-- */ static int cmd_dumpicc( ITD_Struct *itd, char *Tag ) @@ -284,6 +292,8 @@ * * Returns: 0 on success * -1 on failure + * + * Authors: dgm *-- */ static int cmd_trace( ITD_Struct *itd, char *Tag, char *Username ) @@ -370,6 +380,8 @@ * * Returns: 0 on success * -1 on failure + * + * Authors: dgm *-- */ static int cmd_noop( ITD_Struct *itd, char *Tag ) @@ -401,6 +413,8 @@ * * Returns: 0 on success * -1 on failure + * + * Authors: dgm *-- */ static int cmd_logout( ITD_Struct *itd, char *Tag ) @@ -433,6 +447,8 @@ * * Returns: 0 on success * -1 on failure + * + * Authors: dgm *-- */ static int cmd_capability( ITD_Struct *itd, char *Tag ) @@ -466,6 +482,8 @@ * Returns: 0 on success * -1 on failure * + * Authors: dgm + * * Notes: This will need to be changed such that the entire * session is proxied. For now, we'll just drop it. *-- @@ -500,11 +518,15 @@ * ptr to password * int length of password buffer * ptr to client tag + * unsigned char - flag to indicate literal password in login + * command. * * Returns: 0 on success prior to authentication * 1 on success after authentication (we caught a logout) * -1 on failure * + * Authors: dgm + * * Note: Not too many things are really considered "failure" in the * context of this routine, because returning failure would * result in the client connection being closed. When most @@ -519,7 +541,8 @@ char *Username, char *Password, int passlen, - char *Tag ) + char *Tag, + unsigned char LiteralLogin ) { char *fn = "cmd_login()"; char SendBuf[BUFSIZE]; @@ -550,7 +573,7 @@ return( -1 ); } - sd = Get_Server_sd( Username, Password, hostaddr ); + sd = Get_Server_sd( Username, Password, hostaddr, LiteralLogin ); /* * wipe out the passwd so we don't have it sitting in memory somewhere. @@ -608,7 +631,7 @@ Server.TraceOn = 0; } UnLockMutex( &trace ); - + rc = Raw_Proxy( Client, &Server ); /* @@ -671,8 +694,6 @@ fds[ SERVER ].events = POLLIN; fds[ CLIENT ].events = POLLIN; - - /* * POLL loop */ @@ -850,8 +871,8 @@ * make a half-hearted attempt to eat whatever the * server sends back. */ - send( Server->sd, "ZZZ CLOSE\r\n", - strlen("ZZZ CLOSE\r\n"), 0 ); + send( Server->sd, "C64 CLOSE\r\n", + strlen("C64 CLOSE\r\n"), 0 ); recv( Server->sd, Server->ReadBuf, sizeof Server->ReadBuf, 0 ); memset( Server->ReadBuf, 0, sizeof Server->ReadBuf ); @@ -991,16 +1012,15 @@ * Notes: This function actually only handles unauthenticated * traffic from an imap client. As such it can only make sense * of the following IMAP commands (rfc 2060): NOOP, CAPABILITY, - * AUTHENTICATE, LOGIN, and LOGOUT. None of these commands should - * ever send enough data to fill our buffer. None of these - * commands should ever send a string literal specifier. For - * these reasons, you'll notice that both of these conditions are - * checked after our call to IMAP_Line_Read() such that we can - * boot any client trying to send us rubbish. Our behaviour - * may not be identical to a "real" IMAP server implementation - * in this regard, but a "real" client should never send us - * crap like this in the first place. This is a simple, but - * not graceful way to handle the problem. + * AUTHENTICATE, LOGIN, and LOGOUT. Also, it handles the + * commands that are internal to the proxy server such as + * P_TRACE, P_NEWLOG, P_DUMPICC and P_RESETCOUNTERS. + * + * None of these commands should ever have the need to send + * a boatload of data, so we avoid some error checking and + * undue complexity in this routine by just making sure that + * any given read from the client doesn't fill our read + * buffer. If it does, we just drop the connection. *-- */ extern void HandleRequest( int clientsd ) @@ -1013,6 +1033,7 @@ char *Password; char *Lasts; char *EndOfLine; + char *CP; char SendBuf[BUFSIZE]; int BytesRead; int rc; @@ -1020,7 +1041,10 @@ char S_UserName[MAXUSERNAMELEN]; char S_Tag[MAXTAGLEN]; char S_Password[MAXPASSWDLEN]; + unsigned char LiteralFlag; /* flag to deal with passwords sent */ + /* as string literals */ + struct pollfd fds[1]; nfds_t nfds; int PollFailCount; @@ -1051,6 +1075,8 @@ /* start a command loop */ for ( ; ; ) { + LiteralFlag = 0; + fds[ 0 ].revents = 0; rc = poll( fds, nfds, POLL_TIMEOUT ); @@ -1104,16 +1130,16 @@ BytesRead = IMAP_Line_Read( &Client ); - if ( Client.MoreData || Client.LiteralBytesRemaining ) + if ( BytesRead == -1 ) { - syslog(LOG_WARNING, "%s: Received junk from unauthenticated client. Disconnecting.", fn ); IMAPCount->CurrentClientConnections--; close( Client.sd ); return; } - if ( BytesRead == -1 ) + if ( Client.MoreData ) { + syslog( LOG_WARNING, "%s: Too much data read from unauthenticated client. Dropping the connection.", fn ); IMAPCount->CurrentClientConnections--; close( Client.sd ); return; @@ -1123,7 +1149,7 @@ /* First grab the tag */ EndOfLine = Client.ReadBuf + BytesRead; - + Tag = memtok( Client.ReadBuf, EndOfLine, &Lasts ); if ( ( !Tag ) || ( !imparse_isatom( Tag ) ) || @@ -1222,42 +1248,131 @@ } continue; } + strncpy( S_UserName, Username, sizeof S_UserName - 1 ); - Password = memtok( NULL, EndOfLine, &Lasts ); - if ( !Password ) + /* + * Clients can send the password as a literal bytestream. Check + * for that here. + */ + if ( Client.LiteralBytesRemaining ) { - /* no password -- complain back to the client */ - snprintf( SendBuf, BufLen, "%s BAD Missing required argument to Login\r\n", Tag ); - if ( send( Client.sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + if ( ( sizeof S_Password - 1 ) < Client.LiteralBytesRemaining ) { - IMAPCount->CurrentClientConnections--; - close( Client.sd ); - return; + syslog( LOG_ERR, "%s: password length would cause buffer overflow.", fn ); + /* + * we have to at least eat the literal bytestream because + * of the way our I/O routines work. + */ + memset( &Client.ReadBuf, 0, sizeof Client.ReadBuf ); + Client.BytesInReadBuffer = 0; + Client.ReadBytesProcessed = 0; + Client.LiteralBytesRemaining = 0; + Client.NonSyncLiteral = 0; + Client.MoreData = 0; + + snprintf( SendBuf, BufLen, "%s NO LOGIN failed\r\n", Tag ); + if ( send( Client.sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + IMAPCount->CurrentClientConnections--; + close( Client.sd ); + return; + } + continue; } - continue; + + LiteralFlag = 1; + + CP = S_Password; + + if ( ! Client.NonSyncLiteral ) + { + sprintf( SendBuf, "+ go ahead\r\n" ); + if ( send( Client.sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + IMAPCount->CurrentClientConnections--; + close( Client.sd ); + return; + } + } + + while ( Client.LiteralBytesRemaining ) + { + BytesRead = IMAP_Literal_Read( &Client ); + + if ( BytesRead == -1 ) + { + syslog( LOG_NOTICE, "%s: Failed to read string literal from client on login." ); + snprintf( SendBuf, BufLen, "%s NO LOGIN failed\r\n", Tag ); + if ( send( Client.sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + IMAPCount->CurrentClientConnections--; + close( Client.sd ); + return; + } + continue; + } + + memcpy ( (void *)CP, (const void *)Client.ReadBuf, BytesRead ); + CP += BytesRead; + } + *CP = '\0'; + + /* + * I'm not sure if IMAP_Literal_Read() is written entirely + * in a correct fashion. There will be a CRLF at the end + * of the literal bytestream that it doesn't deal with. + * If we don't eat that here, it will be read as a separate + * (Null) command... Reading it here is more of a hack than + * a real solution, but I hesitate to fiddle with + * IMAP_Literal_Read() right now since it works properly + * otherwise. + */ + rc = IMAP_Line_Read( &Client ); } + else + { + /* + * The password is just being sent as a plain old string. + * Can't use memtok() because it uses a single space as the + * token delimeter and any password with a space in it would + * break. + */ + CP = EndOfLine - 2; + Lasts++; + + if ( Lasts >= CP ) + { + /* no password -- complain back to the client */ + snprintf( SendBuf, BufLen, "%s BAD Missing required argument to Login\r\n", Tag ); + if ( send( Client.sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + IMAPCount->CurrentClientConnections--; + close( Client.sd ); + return; + } + continue; + } + + *CP = '\0'; + strncpy( S_Password, Lasts, sizeof S_Password - 1 ); + } - /* - * All looks well at this point. We're almost ready to call our - * login handler. It's key to note, however that the pointer to - * our Username is pointing to storage allocated in our client - * read buffer. That's storage that's likely to be wiped out as - * soon as we read more data from the client. Since we'll need to - * keep track of the username, make a static copy of it first and - * then pass a pointer to the static copy into our login handler. - * Do the same for the password... - */ - strncpy( S_UserName, Username, sizeof S_UserName - 1 ); - strncpy( S_Password, Password, sizeof S_Password - 1 ); + /* * wipe out the the client read buffer since a copy of the * password lives in there. */ memset( &Client.ReadBuf, 0, sizeof Client.ReadBuf ); + Client.BytesInReadBuffer = 0; + Client.ReadBytesProcessed = 0; + Client.LiteralBytesRemaining = 0; + Client.NonSyncLiteral = 0; + Client.MoreData = 0; - rc = cmd_login( &Client, S_UserName, S_Password, sizeof S_Password, S_Tag ); + rc = cmd_login( &Client, S_UserName, S_Password, sizeof S_Password, S_Tag, LiteralFlag ); + if ( rc == 0) continue; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 06:09:31
|
Revision: 13988 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13988&view=rev Author: pdontthink Date: 2010-07-25 06:09:25 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.1.2 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/Makefile trunk/imap_proxy/README trunk/imap_proxy/src/config.c trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/pimpstat.c Added Paths: ----------- trunk/imap_proxy/Makefile.linux Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 06:04:34 UTC (rev 13987) +++ trunk/imap_proxy/ChangeLog 2010-07-25 06:09:25 UTC (rev 13988) @@ -1,3 +1,28 @@ +2003-01-27 Dave McMurtrie <dg...@pi...> + + * Version 1.1.2 released. + + * Makefile: added patches by Gary Mills <mi...@cc...> + + * Makefile: added patches for linux support by + Frode Nordahl <fr...@po...> + + * config.c: added patch by Gary Mills <mi...@cc...> so it + will compile properly using Sun's cc. + + * imapcommon.c: added patch for linux support by + Frode Nordahl <fr...@po...> + + * main.c: added patch for linux support by + Frode Nordahl <fr...@po...> + + * pimpstat.c: added patch for linux support by + Frode Nordahl <fr...@po...> + +2003-01-23 Dave McMurtrie <dg...@pi...> + + * imapcommon.c: NonSyncLiteral flag was not being cleared properly. + 2003-01-22 Dave McMurtrie <dg...@pi...> * Version 1.1.1 released. Modified: trunk/imap_proxy/Makefile =================================================================== --- trunk/imap_proxy/Makefile 2010-07-25 06:04:34 UTC (rev 13987) +++ trunk/imap_proxy/Makefile 2010-07-25 06:09:25 UTC (rev 13988) @@ -24,7 +24,11 @@ # Libraries +# Solaris XYD_LIB = -lpthread -lmd5 -lsocket -lnsl +# Linux +#XYD_LIB = -lpthread -lnsl -lcrypto + TAT_LIB = -lcurses # Object files @@ -43,6 +47,9 @@ $(XYD_OBJ) $(TAT_OBJ): $(MAKEFILE) ./include/common.h ./include/imapproxy.h +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + $(XYD_BIN): $(XYD_OBJ) $(CC) -o $@ $(XYD_OBJ) $(XYD_LIB) @@ -55,9 +62,13 @@ install: $(XYD_BIN) $(TAT_BIN) $(INSTALL) -c -o bin -g bin -m 0755 $(XYD_BIN) $(EBIN) $(INSTALL) -c -o bin -g bin -m 0755 $(TAT_BIN) $(EBIN) + +install-init: $(INSTALL) -c -o root -g sys -m 0755 ./scripts/imapproxy $(ETC)/init.d ln -s ../init.d/imapproxy /etc/rc2.d/S99imapproxy ln -s ../init.d/imapproxy /etc/rc0.d/K10imapproxy + +install-conf: $(INSTALL) -c -o root -g bin -m 0755 ./scripts/imapproxy.conf $(ETC) Added: trunk/imap_proxy/Makefile.linux =================================================================== --- trunk/imap_proxy/Makefile.linux (rev 0) +++ trunk/imap_proxy/Makefile.linux 2010-07-25 06:09:25 UTC (rev 13988) @@ -0,0 +1,75 @@ +#### Makefile for IMAP proxy +#### Contributed by Gary Mills <mi...@cc...> + +## Tuneables + +# Paths + +INSTALL = /usr/bin/install +EBIN = /usr/local/sbin +MAN = /usr/local/man/man +ETC = /etc + +# Compiler flags +CC = gcc +RANLIB = : +CFLAGS = -I./include -DLINUX +LDLIBS = + +# Man sections +MANLIB = 3 +MANADM = 1m + +## Nothing to change after this point + +# Libraries + +# Solaris +#XYD_LIB = -lpthread -lmd5 -lsocket -lnsl +# Linux +XYD_LIB = -lpthread -lnsl -lcrypto + +TAT_LIB = -lcurses + +# Object files + +XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o ./src/hash.o ./src/becomenonroot.o ./src/config.o +TAT_OBJ = ./src/pimpstat.o ./src/config.o + +# Final targets + +XYD_BIN = ./bin/in.imapproxyd +TAT_BIN = ./bin/pimpstat + +# Rules + +all: $(XYD_BIN) $(TAT_BIN) + +$(XYD_OBJ) $(TAT_OBJ): $(MAKEFILE) ./include/common.h ./include/imapproxy.h + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +$(XYD_BIN): $(XYD_OBJ) + $(CC) -o $@ $(XYD_OBJ) $(XYD_LIB) + +$(TAT_BIN): $(TAT_OBJ) + $(CC) -o $@ $(TAT_OBJ) $(TAT_LIB) + +clean: + rm -f ./src/core ./src/$(XYD_OBJ) ./src/$(TAT_OBJ) $(XYD_BIN) $(TAT_BIN) + +install: $(XYD_BIN) $(TAT_BIN) + $(INSTALL) -c -o bin -g bin -m 0755 $(XYD_BIN) $(EBIN) + $(INSTALL) -c -o bin -g bin -m 0755 $(TAT_BIN) $(EBIN) + +install-init: + $(INSTALL) -c -o root -g sys -m 0755 ./scripts/imapproxy $(ETC)/init.d + ln -s ../init.d/imapproxy /etc/rc2.d/S99imapproxy + ln -s ../init.d/imapproxy /etc/rc0.d/K10imapproxy + +install-conf: + $(INSTALL) -c -o root -g bin -m 0755 ./scripts/imapproxy.conf $(ETC) + + +#### Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 06:04:34 UTC (rev 13987) +++ trunk/imap_proxy/README 2010-07-25 06:09:25 UTC (rev 13988) @@ -9,7 +9,6 @@ dg...@pi... - If you want to subscribe to the imapproxy-info mailing list, visit: http://lists.pitt.edu/mailman/listinfo/imapproxy-info @@ -18,27 +17,39 @@ KNOWN ISSUES ############################################################################## -Currently, this server will only build correctly on Solaris platforms. The -largest reason is because the md5 routines used for internal storage of -user passwords is Solaris specific. There are other smaller dependencies, -though. +Though this should now build on Solaris and Linux, it's still +Makefile based and hence, quite hokey. It's still better than before when +it only built on Solaris. -Also note that the proxy server only supports LOGIN, not AUTHENTICATE. +I'm working to autoconf this whole thing, but I've been a little busy lately. +Also note that the proxy server only supports LOGIN, not AUTHENTICATE. I +want to change this, also. ############################################################################## HOW TO BUILD ############################################################################## -To build the proxy server on a Solaris platform, just run "make" in -this directory. "make install" will attempt to install the following files: +By default, Makefile will only work on solaris platforms. Use Makefile.linux +for others. Again, once this is autoconf'd it shouldn't be as ugly to build. +After you're sure that you're using the correct Makefile, just run "make" +in this directory to build the proxy server. + +"make install" will attempt to install the following files: + /usr/local/sbin/in.imapproxyd /usr/local/sbin/pimpstat + +"make install-conf" will attempt to install the sample configuration file: + +/etc/imapproxy.conf + +"make install-init" will attempt to install the startup script and symlinks: + /etc/init.d/imapproxy /etc/rc2.d/S99imapproxy /etc/rc0.d/K10imapproxy -/etc/imapproxy.conf After you successfully build the proxy server, you'll need to edit the @@ -47,7 +58,7 @@ can change this at runtime by supplying the -f argument to /usr/local/sbin/in.imapproxyd. -/usr/local/bin/pimpstat is the Pitt IMap Proxy Statistical tool. It's a little +/usr/local/sbin/pimpstat is the Pitt IMap Proxy Statistical tool. It's a curses-based application that you can use to monitor the proxy server. It's aware of the same global configuration file as the proxy server, and can also be told to look at a different configuration file by supplying it as a Modified: trunk/imap_proxy/src/config.c =================================================================== --- trunk/imap_proxy/src/config.c 2010-07-25 06:04:34 UTC (rev 13987) +++ trunk/imap_proxy/src/config.c 2010-07-25 06:09:25 UTC (rev 13988) @@ -37,11 +37,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/config.c,v $ -** $Id: config.c,v 1.1 2002/12/17 14:26:49 dgm Exp $ +** $Id: config.c,v 1.2 2003/01/27 13:59:15 dgm Exp $ ** ** Modification History: ** ** $Log: config.c,v $ +** Revision 1.2 2003/01/27 13:59:15 dgm +** Patch by Gary Mills <mi...@cc...> to allow compilation +** using Sun's cc instead of gcc. +** ** Revision 1.1 2002/12/17 14:26:49 dgm ** Initial revision ** @@ -188,8 +192,7 @@ if ( ( ! *Value ) && ( errno == EINVAL ) ) { - syslog( LOG_ERR, "%s: numeric value specified at line %d - of config file is invalid -- Exiting.", fn, linenum ); + syslog( LOG_ERR, "%s: numeric value specified at line %d of config file is invalid -- Exiting.", fn, linenum ); exit( 1 ); } @@ -312,7 +315,7 @@ Value = CP; - for (i = 0; ConfigTable[i].Keyword; i++ ) + for (i = 0; ConfigTable[i].Keyword[0] != '\0'; i++ ) { if ( ! strcasecmp( (const char *)Keyword, ConfigTable[i].Keyword ) ) { Modified: trunk/imap_proxy/src/imapcommon.c =================================================================== --- trunk/imap_proxy/src/imapcommon.c 2010-07-25 06:04:34 UTC (rev 13987) +++ trunk/imap_proxy/src/imapcommon.c 2010-07-25 06:09:25 UTC (rev 13988) @@ -37,11 +37,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/imapcommon.c,v $ -** $Id: imapcommon.c,v 1.7 2003/01/23 16:24:31 dgm Exp $ +** $Id: imapcommon.c,v 1.8 2003/01/27 13:59:53 dgm Exp $ ** ** Modification History: ** ** $Log: imapcommon.c,v $ +** Revision 1.8 2003/01/27 13:59:53 dgm +** Patch by Frode Nordahl <fr...@po...> to allow +** compilation on Linux platforms. +** ** Revision 1.7 2003/01/23 16:24:31 dgm ** NonSyncLiteral flag was not being cleared properly. ** @@ -76,7 +80,13 @@ #include "imapproxy.h" #include <string.h> #include <errno.h> + +#ifndef LINUX #include <md5.h> +#else +#include <openssl/evp.h> +#endif + #include <pthread.h> #include <sys/types.h> #include <sys/socket.h> @@ -197,11 +207,25 @@ int rc; unsigned int Expiration; +#ifdef LINUX + EVP_MD_CTX mdctx; + const EVP_MD *md; + unsigned char md_value[EVP_MAX_MD_SIZE]; + int md_len; +#endif + Expiration = PC_Struct.cache_expiration_time; memset( &Server, 0, sizeof Server ); /* need to md5 the passwd regardless, so do that now */ +#ifndef LINUX md5_calc( md5pw, Password, strlen( Password ) ); +#else + EVP_DigestInit(&mdctx, EVP_md5()); + EVP_DigestUpdate(&mdctx, Password, strlen(Password)); + EVP_DigestFinal(&mdctx, md_value, &md_len); + strcat(md5pw, md_value); +#endif /* see if we have a reusable connection available */ ICC_Active = NULL; Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 06:04:34 UTC (rev 13987) +++ trunk/imap_proxy/src/main.c 2010-07-25 06:09:25 UTC (rev 13988) @@ -38,11 +38,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.5 2002/12/17 14:25:14 dgm Exp $ +** $Id: main.c,v 1.6 2003/01/27 13:58:18 dgm Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.6 2003/01/27 13:58:18 dgm +** patch by Frode Nordahl <fr...@po...> to allow +** compilation on Linux platforms. +** ** Revision 1.5 2002/12/17 14:25:14 dgm ** Added support for global configuration structure. ** Modified supported command line arguments. @@ -66,7 +70,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.5 2002/12/17 14:25:14 dgm Exp $"; +static char *rcsId = "$Id: main.c,v 1.6 2003/01/27 13:58:18 dgm Exp $"; static char *rcsSource = "$Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dgm $"; @@ -92,7 +96,11 @@ #include <syslog.h> #include <signal.h> +#ifdef LINUX +#include <sys/param.h> +#endif + /* * Global variables. Many of these things are global just as an optimization. * For example, there's no reason to have to do a hostname lookup every @@ -281,7 +289,11 @@ srvaddr.sin_addr.s_addr = htonl(INADDR_ANY); syslog(LOG_INFO, "%s: Binding to tcp port %d", fn, PC_Struct.listen_port ); +#ifndef LINUX srvaddr.sin_port = PC_Struct.listen_port; +#else + srvaddr.sin_port = htons(PC_Struct.listen_port); +#endif listensd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if ( listensd == -1 ) @@ -527,7 +539,11 @@ syslog(LOG_INFO, "%s: Proxying to IMAP port %d", fn, PC_Struct.server_port ); +#ifndef LINUX ISD.serv.s_port = PC_Struct.server_port; +#else + ISD.serv.s_port = htons(PC_Struct.server_port); +#endif /* * fill in the address family, the host address, and the Modified: trunk/imap_proxy/src/pimpstat.c =================================================================== --- trunk/imap_proxy/src/pimpstat.c 2010-07-25 06:04:34 UTC (rev 13987) +++ trunk/imap_proxy/src/pimpstat.c 2010-07-25 06:09:25 UTC (rev 13988) @@ -36,11 +36,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/pimpstat.c,v $ -** $Id: pimpstat.c,v 1.2 2002/12/17 14:24:11 dgm Exp $ +** $Id: pimpstat.c,v 1.3 2003/01/27 13:49:36 dgm Exp $ ** ** Modification History: ** ** $Log: pimpstat.c,v $ +** Revision 1.3 2003/01/27 13:49:36 dgm +** Added patch by Frode Nordahl <fr...@po...> to allow +** compilation on Linux platforms. +** ** Revision 1.2 2002/12/17 14:24:11 dgm ** Added support for global configuration structure. ** @@ -64,6 +68,10 @@ #include <strings.h> #include <signal.h> +#ifdef LINUX +#include <sys/param.h> +#endif + #define DIGITS 11 extern WINDOW *stdscr; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 06:14:30
|
Revision: 13990 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13990&view=rev Author: pdontthink Date: 2010-07-25 06:14:24 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.1.3 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/Makefile trunk/imap_proxy/Makefile.linux trunk/imap_proxy/README trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/src/config.c trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/request.c Added Paths: ----------- trunk/imap_proxy/src/COPYING trunk/imap_proxy/src/base64.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 06:09:56 UTC (rev 13989) +++ trunk/imap_proxy/ChangeLog 2010-07-25 06:14:24 UTC (rev 13990) @@ -1,3 +1,31 @@ +2003-02-19 Dave McMurtrie <dg...@pi...> + + * imapcommon.c: Was previously checking for "+ go ahead" server + response after sending string literal specifier in Get_Server_sd(). + Now I'm just checking for "+" instead. + + * imapproxy.h: Added definitions for LITERAL_PASSWORD and + NON_LITERAL_PASSWORD to remove ambiguous 1 and 0 flags from the + code. + + * base64.c: Newly introduced base64 encoding and decoding routines + by Eric S. Raymond. + + * COPYING: license file that must accompany base64.c added into + src directory. + + * request.c: Removed cmd_authenticate() function. Added + cmd_authenticate_login() function and additional code necessary to + support "AUTHENTICATE LOGIN". + +2003-02-17 Dave McMurtrie <dg...@pi...> + + * config.c: added an fclose() for the config file that I had forgotten. + +2003-02-14 Dave McMurtrie <dg...@pi...> + + * request.c: added lseek() call in cmd_newlog(). + 2003-01-27 Dave McMurtrie <dg...@pi...> * Version 1.1.2 released. Modified: trunk/imap_proxy/Makefile =================================================================== --- trunk/imap_proxy/Makefile 2010-07-25 06:09:56 UTC (rev 13989) +++ trunk/imap_proxy/Makefile 2010-07-25 06:14:24 UTC (rev 13990) @@ -33,7 +33,7 @@ # Object files -XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o ./src/hash.o ./src/becomenonroot.o ./src/config.o +XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o ./src/hash.o ./src/becomenonroot.o ./src/config.o ./src/base64.o TAT_OBJ = ./src/pimpstat.o ./src/config.o # Final targets Modified: trunk/imap_proxy/Makefile.linux =================================================================== --- trunk/imap_proxy/Makefile.linux 2010-07-25 06:09:56 UTC (rev 13989) +++ trunk/imap_proxy/Makefile.linux 2010-07-25 06:14:24 UTC (rev 13990) @@ -33,7 +33,7 @@ # Object files -XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o ./src/hash.o ./src/becomenonroot.o ./src/config.o +XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o ./src/hash.o ./src/becomenonroot.o ./src/config.o ./src/base64.o TAT_OBJ = ./src/pimpstat.o ./src/config.o # Final targets Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 06:09:56 UTC (rev 13989) +++ trunk/imap_proxy/README 2010-07-25 06:14:24 UTC (rev 13990) @@ -18,14 +18,11 @@ ############################################################################## Though this should now build on Solaris and Linux, it's still -Makefile based and hence, quite hokey. It's still better than before when +Makefile based and hence, quite hokey. It's better than before when it only built on Solaris. I'm working to autoconf this whole thing, but I've been a little busy lately. -Also note that the proxy server only supports LOGIN, not AUTHENTICATE. I -want to change this, also. - ############################################################################## HOW TO BUILD ############################################################################## Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 06:09:56 UTC (rev 13989) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 06:14:24 UTC (rev 13990) @@ -36,11 +36,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.5 2003/01/22 15:33:53 dgm Exp $ +** $Id: imapproxy.h,v 1.6 2003/02/19 13:03:35 dgm Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.6 2003/02/19 13:03:35 dgm +** Added LITERAL_PASSWORD and NON_LITERAL_PASSWORD definitions. +** ** Revision 1.5 2003/01/22 15:33:53 dgm ** Changed Get_Server_sd() function prototype to reflect the addition of ** the literal password flag. @@ -83,8 +86,9 @@ #define POLL_TIMEOUT_MINUTES 30 /* Poll timeout in minutes */ #define POLL_TIMEOUT (POLL_TIMEOUT_MINUTES * 60000) #define DEFAULT_CONFIG_FILE "/etc/imapproxy.conf" +#define LITERAL_PASSWORD 1 +#define NON_LITERAL_PASSWORD 0 - /* * One IMAPServerDescriptor will be globally allocated such that each thread * can save the time of doing host lookups, service lookups, and filling Added: trunk/imap_proxy/src/COPYING =================================================================== --- trunk/imap_proxy/src/COPYING (rev 0) +++ trunk/imap_proxy/src/COPYING 2010-07-25 06:14:24 UTC (rev 13990) @@ -0,0 +1,306 @@ +This file was included with Eric S. Raymond's fetchmail distribution. It is +included here to accompany the file "base64.c" that was originally distributed +as part of Eric S. Raymond's fetchmail distribution. + + +The code in the fetchmail distribution is Copyright 1997 by Eric S. Raymond. +Portions are also copyrighted by Carl Harris, 1993 and 1995. Copyright +retained for the purpose of protecting free redistribution of source. + +The MD5 support is copyright by RSA Data Security, Inc. See the header +comment of the md5.c module for license terms. + + NO-VIRUS CLAUSE + +The intent of this license is to protect free redistribution and reuse of the +source of the licensed distribution, not to prejudice the authorship +rights of programmers of other code to control their original inventions. + +No portion of this license is to be interpreted as forbidding the reuse of +this code or its constituent parts, algorithms, or inventions in commercial +products. + +Nor shall such inclusion be construed to require the GPLing or disclosure of +any portions of said commercial products other than those falling under +the copyright of the licensed distribution. + +------------------------------------------------------------------------------- + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. +------------------------------------------------------------------------------- Added: trunk/imap_proxy/src/base64.c =================================================================== --- trunk/imap_proxy/src/base64.c (rev 0) +++ trunk/imap_proxy/src/base64.c 2010-07-25 06:14:24 UTC (rev 13990) @@ -0,0 +1,103 @@ +/* + * CREDIT: Written 1997 by Eric S. Raymond as part of his fetchmail + * distribution. + * + * Used here with explicit written permission from Eric S. Raymond. + * + * base64.c -- base-64 conversion routines. + * + * For license terms, see the file COPYING in this directory. + * + * This base 64 encoding is defined in RFC2045 section 6.8, + * "Base64 Content-Transfer-Encoding", but lines must not be broken in the + * scheme used here. + */ + +#include <ctype.h> + +static const char base64digits[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +#define BAD -1 +static const char base64val[] = { + BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, + BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, + BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD, 62, BAD,BAD,BAD, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,BAD,BAD, BAD,BAD,BAD,BAD, + BAD, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,BAD, BAD,BAD,BAD,BAD, + BAD, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,BAD, BAD,BAD,BAD,BAD +}; +#define DECODE64(c) (isascii(c) ? base64val[c] : BAD) + +void to64frombits(unsigned char *out, const unsigned char *in, int inlen) +/* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ +{ + for (; inlen >= 3; inlen -= 3) + { + *out++ = base64digits[in[0] >> 2]; + *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)]; + *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; + *out++ = base64digits[in[2] & 0x3f]; + in += 3; + } + if (inlen > 0) + { + unsigned char fragment; + + *out++ = base64digits[in[0] >> 2]; + fragment = (in[0] << 4) & 0x30; + if (inlen > 1) + fragment |= in[1] >> 4; + *out++ = base64digits[fragment]; + *out++ = (inlen < 2) ? '=' : base64digits[(in[1] << 2) & 0x3c]; + *out++ = '='; + } + *out = '\0'; +} + +int from64tobits(char *out, const char *in) +/* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */ +{ + int len = 0; + register unsigned char digit1, digit2, digit3, digit4; + + if (in[0] == '+' && in[1] == ' ') + in += 2; + if (*in == '\r') + return(0); + + do { + digit1 = in[0]; + if (DECODE64(digit1) == BAD) + return(-1); + digit2 = in[1]; + if (DECODE64(digit2) == BAD) + return(-1); + digit3 = in[2]; + if (digit3 != '=' && DECODE64(digit3) == BAD) + return(-1); + digit4 = in[3]; + if (digit4 != '=' && DECODE64(digit4) == BAD) + return(-1); + in += 4; + *out++ = (DECODE64(digit1) << 2) | (DECODE64(digit2) >> 4); + ++len; + if (digit3 != '=') + { + *out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2); + ++len; + if (digit4 != '=') + { + *out++ = ((DECODE64(digit3) << 6) & 0xc0) | DECODE64(digit4); + ++len; + } + } + } while + (*in && *in != '\r' && digit4 != '='); + + return (len); +} + +/* base64.c ends here */ Modified: trunk/imap_proxy/src/config.c =================================================================== --- trunk/imap_proxy/src/config.c 2010-07-25 06:09:56 UTC (rev 13989) +++ trunk/imap_proxy/src/config.c 2010-07-25 06:14:24 UTC (rev 13990) @@ -37,11 +37,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/config.c,v $ -** $Id: config.c,v 1.2 2003/01/27 13:59:15 dgm Exp $ +** $Id: config.c,v 1.3 2003/02/17 14:08:42 dgm Exp $ ** ** Modification History: ** ** $Log: config.c,v $ +** Revision 1.3 2003/02/17 14:08:42 dgm +** added an fclose() that I forgot. +** ** Revision 1.2 2003/01/27 13:59:15 dgm ** Patch by Gary Mills <mi...@cc...> to allow compilation ** using Sun's cc instead of gcc. @@ -339,7 +342,6 @@ } } - + + fclose( FP ); } - - Modified: trunk/imap_proxy/src/imapcommon.c =================================================================== --- trunk/imap_proxy/src/imapcommon.c 2010-07-25 06:09:56 UTC (rev 13989) +++ trunk/imap_proxy/src/imapcommon.c 2010-07-25 06:14:24 UTC (rev 13990) @@ -37,11 +37,16 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/imapcommon.c,v $ -** $Id: imapcommon.c,v 1.8 2003/01/27 13:59:53 dgm Exp $ +** $Id: imapcommon.c,v 1.9 2003/02/19 12:47:31 dgm Exp $ ** ** Modification History: ** ** $Log: imapcommon.c,v $ +** Revision 1.9 2003/02/19 12:47:31 dgm +** Replaced check for server response of "+ go ahead" with a check for +** "+". the "go ahead" appears to be cyrus specific and not RFC compliant +** on my part. +** ** Revision 1.8 2003/01/27 13:59:53 dgm ** Patch by Frode Nordahl <fr...@po...> to allow ** compilation on Linux platforms. @@ -377,8 +382,7 @@ return( -1 ); } - - if ( strncasecmp( "+ go ahead\r\n", Server.ReadBuf, rc ) ) + if ( Server.ReadBuf[0] != '+' ) { syslog( LOG_INFO, "LOGIN: '%s' (%s) failed: bad response from server after sending string literal specifier", Username, ClientAddr ); close( Server.sd ); Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 06:09:56 UTC (rev 13989) +++ trunk/imap_proxy/src/main.c 2010-07-25 06:14:24 UTC (rev 13990) @@ -38,11 +38,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.6 2003/01/27 13:58:18 dgm Exp $ +** $Id: main.c,v 1.7 2003/02/19 13:01:40 dgm Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.7 2003/02/19 13:01:40 dgm +** Changes to SetBannerAndCapability() to strip out unsupported AUTH= +** mechanisms from the capability string. +** ** Revision 1.6 2003/01/27 13:58:18 dgm ** patch by Frode Nordahl <fr...@po...> to allow ** compilation on Linux platforms. @@ -70,7 +74,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.6 2003/01/27 13:58:18 dgm Exp $"; +static char *rcsId = "$Id: main.c,v 1.7 2003/02/19 13:01:40 dgm Exp $"; static char *rcsSource = "$Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dgm $"; @@ -570,6 +574,9 @@ * -1 on failure * * Authors: dgm + * + * Notes: All AUTH mechanisms will be stripped from the capability + * string. AUTH=LOGIN will be added. *-- */ static int SetBannerAndCapability( void ) @@ -578,7 +585,8 @@ ITD_Struct itd; int BytesRead; char *fn = "SetBannerAndCapability()"; - + char *CP; + /* initialize some stuff */ memset( &itd, 0, sizeof itd ); @@ -669,10 +677,48 @@ close( itd.sd ); return( -1 ); } + + /* + * strip out all of the AUTH mechanisms except the ones that we support. + * Right now, this is just AUTH=LOGIN. Note that the use of + * non-MT safe strtok is okay here. This function is called before any + * other threads are launched and should never be called again. + */ + itd.ReadBuf[BytesRead - 2] = '\0'; + CP = strtok( itd.ReadBuf, " " ); - memcpy( Capability, itd.ReadBuf, BytesRead ); - CapabilityLen = BytesRead; + if ( !CP ) + { + syslog( LOG_ERR, "%s: No tokens found in capability string sent from IMAP server.", fn); + close( itd.sd ); + return( -1 ); + } + sprintf( Capability, CP ); + + for( ; ; ) + { + CP = strtok( NULL, " " ); + + if ( !CP ) + break; + + /* + * If this token happens to be an auth mechanism, we want to + * discard it unless it's an auth mechanism we can support. + */ + if ( ! strncasecmp( CP, "AUTH=", strlen( "AUTH=" ) ) && + ( strncasecmp( CP, "AUTH=LOGIN", strlen( "AUTH=LOGIN" ) ) ) ) + continue; + + strcat( Capability, " "); + strcat( Capability, CP ); + } + + strcat( Capability, "\r\n" ); + + CapabilityLen = strlen( Capability ); + /* Now read the tagged response and make sure it's OK */ BytesRead = IMAP_Line_Read( &itd ); if ( BytesRead == -1 ) Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 06:09:56 UTC (rev 13989) +++ trunk/imap_proxy/src/request.c 2010-07-25 06:14:24 UTC (rev 13990) @@ -41,11 +41,18 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.6 2003/01/22 13:03:25 dgm Exp $ +** $Id: request.c,v 1.8 2003/02/19 12:57:15 dgm Exp $ ** ** Modification History: ** ** $Log: request.c,v $ +** Revision 1.8 2003/02/19 12:57:15 dgm +** Added support for "AUTHENTICATE LOGIN". +** +** Revision 1.7 2003/02/14 18:25:40 dgm +** Fixed bug in cmd_newlog. ftruncate doesn't reset file pointer so +** I added an lseek. +** ** Revision 1.6 2003/01/22 13:03:25 dgm ** Changes to HandleRequest() and cmd_login() to support clients that ** send the password as a literal string on login. @@ -113,7 +120,7 @@ static int cmd_noop( ITD_Struct *, char * ); static int cmd_logout( ITD_Struct *, char * ); static int cmd_capability( ITD_Struct *, char * ); -static int cmd_authenticate( ITD_Struct *, char * ); +static int cmd_authenticate_login( ITD_Struct *, char * ); static int cmd_login( ITD_Struct *, char *, char *, int, char *, unsigned char ); static int cmd_trace( ITD_Struct *, char *, char * ); static int cmd_dumpicc( ITD_Struct *, char * ); @@ -156,19 +163,44 @@ { syslog(LOG_ERR, "%s: ftruncate() failed: %s", fn, strerror( errno ) ); snprintf( SendBuf, BufLen, "%s NO internal server error\r\n", Tag ); + + if ( send( itd->sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + syslog(LOG_WARNING, "%s: send() failed: %s", fn, strerror(errno) ); + return( -1 ); + } + + return( -1 ); } - else + + /* + * bugfix. ftruncate doesn't reset the file pointer... + */ + rc = lseek( Tracefd, 0, SEEK_SET ); + + if ( rc < 0 ) { - snprintf( SendBuf, BufLen, "%s OK Completed\r\n", Tag ); + syslog(LOG_ERR, "%s: lseek() failed: %s", fn, strerror( errno ) ); + snprintf( SendBuf, BufLen, "%s NO internal server error\r\n", Tag ); + + if ( send( itd->sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + syslog(LOG_WARNING, "%s: send() failed: %s", fn, strerror(errno) ); + return( -1 ); + } + + return( -1 ); } + snprintf( SendBuf, BufLen, "%s OK Completed\r\n", Tag ); + if ( send( itd->sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) { syslog(LOG_WARNING, "%s: send() failed: %s", fn, strerror(errno) ); return( -1 ); } - - return( rc ); + + return( 0 ); } @@ -470,44 +502,213 @@ } - - /*++ - * Function: cmd_authenticate + * Function: cmd_authenticate_login * - * Purpose: implement the AUTHENTICATE IMAP command. + * Purpose: implement the AUTHENTICATE LOGIN mechanism * * Parameters: ptr to ITD_Struct for client connection. + * ptr to client tag * - * Returns: 0 on success - * -1 on failure + * Returns: 0 on success prior to authentication + * 1 on success after authentication (we caught a logout) + * -1 on failure * - * Authors: dgm + * Authors: dgm * - * Notes: This will need to be changed such that the entire - * session is proxied. For now, we'll just drop it. + * Notes: *-- */ -static int cmd_authenticate( ITD_Struct *itd, char *Tag ) +static int cmd_authenticate_login( ITD_Struct *Client, + char *Tag ) { - char *fn = "cmd_authenticate"; + char *fn = "cmd_authenticate_login()"; char SendBuf[BUFSIZE]; + char Username[MAXUSERNAMELEN]; + char EncodedUsername[BUFSIZE]; + char Password[MAXPASSWDLEN]; + char EncodedPassword[BUFSIZE]; + int sd; + int rc; + ITD_Struct Server; + int BytesRead; + struct sockaddr_in cli_addr; + int addrlen; + char *hostaddr; + unsigned int BufLen = BUFSIZE - 1; + memset ( &Server, 0, sizeof Server ); + addrlen = sizeof( struct sockaddr_in ); - SendBuf[BUFSIZE - 1] = '\0'; + /* + * send a base64 encoded username prompt to the client. Note that we're + * using our Username and EncodedUsername buffers temporarily here to + * avoid allocating additional buffers. Keep this in mind for future + * code modification... + */ + snprintf( Username, BufLen, "Username:" ); - snprintf( SendBuf, BufLen, "%s NO AUTHENTICATE failed\r\n", Tag ); - if ( send( itd->sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + to64frombits( EncodedUsername, Username, strlen( Username ) ); + + snprintf( SendBuf, BufLen, "+ %s\r\n", EncodedUsername ); + + if ( send( Client->sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) { - syslog(LOG_WARNING, "%s: send() failed: %s", fn, strerror(errno) ); + syslog(LOG_ERR, "%s: Unable to send base64 encoded username prompt to client: %s", fn, strerror(errno) ); return( -1 ); } + + /* + * The response from the client should be a base64 encoded version of the + * username. + */ + BytesRead = IMAP_Line_Read( Client ); - return( 0 ); + if ( BytesRead == -1 ) + { + syslog( LOG_NOTICE, "%s: Failed to read base64 encoded username from client on socket %d", fn, Client->sd ); + return( -1 ); + } + + /* + * Easy, but not perfect sanity check. If the client sent enough data + * to fill our entire buffer, we're not even going to bother looking at it. + */ + if ( Client->MoreData || + BytesRead > BufLen ) + { + syslog( LOG_NOTICE, "%s: Base64 encoded username sent from client on sd %d is too large.", fn, Client->sd ); + return( -1 ); + } + + /* + * copy BytesRead -2 so we don't include the CRLF. + */ + memcpy( (void *)EncodedUsername, (const void *)Client->ReadBuf, + BytesRead - 2 ); + EncodedUsername[BytesRead - 2] = '\0'; + + rc = from64tobits( Username, EncodedUsername ); + Username[rc] = '\0'; + + /* + * Same drill all over again, except this time it's for the password. + */ + snprintf( Password, BufLen, "Password:" ); + + to64frombits( EncodedPassword, Password, strlen( Password ) ); + + snprintf( SendBuf, BufLen, "+ %s\r\n", EncodedPassword ); + + if ( send( Client->sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + syslog(LOG_ERR, "%s: Unable to send base64 encoded password prompt to +client: %s", fn, strerror(errno) ); + return( -1 ); + } + + BytesRead = IMAP_Line_Read( Client ); + + if ( BytesRead == -1 ) + { + syslog( LOG_NOTICE, "%s: Failed to read base64 encoded password from client on socket %d", fn, Client->sd ); + return( -1 ); + } + + if ( Client->MoreData || + BytesRead > BufLen ) + { + syslog( LOG_NOTICE, "%s: Base64 encoded password sent from client on sd %d is too large.", fn, Client->sd ); + return( -1 ); + } + + memcpy( (void *)EncodedPassword, (const void *)Client->ReadBuf, + BytesRead - 2 ); + EncodedPassword[BytesRead - 2] = '\0'; + + rc = from64tobits( Password, EncodedPassword ); + Password[rc] = '\0'; + + if ( getpeername( Client->sd, (struct sockaddr *)&cli_addr, &addrlen ) < 0 ) + { + syslog( LOG_WARNING, "AUTH_LOGIN: failed: getpeername() failed for client sd: %s", Username, strerror( errno ) ); + return( -1 ); + } + + hostaddr = inet_ntoa( ( ( struct sockaddr_in *)&cli_addr )->sin_addr ); + + if ( !hostaddr ) + { + syslog(LOG_WARNING, "AUTH_LOGIN: '%s' failed: inet_ntoa() failed for client sd: %s", Username, strerror( errno ) ); + return( -1 ); + } + + + /* + * Tell Get_Server_sd() to send the password as a string literal if + * he needs to login. This is just in case there are any special + * characters in the password that we decoded. + */ + sd = Get_Server_sd( Username, Password, hostaddr, LITERAL_PASSWORD ); + + /* + * all the code from here to the end is basically identical to that + * in cmd_login(). + */ + + memset( Password, 0, MAXPASSWDLEN ); + + if ( sd == -1 ) + { + snprintf( SendBuf, BufLen, "%s NO AUTHENTICATE failed\r\n", Tag ); + + if ( send( Client->sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + syslog( LOG_ERR, "%s: Unable to send failure message back to client: %s", fn, strerror( errno ) ); + return( -1 ); + } + return( 0 ); + } + + Server.sd = sd; + + snprintf( SendBuf, BufLen, "%s OK User authenticated\r\n", Tag ); + if ( send( Client->sd, SendBuf, strlen( SendBuf ), 0 ) == -1 ) + { + IMAPCount->InUseServerConnections--; + close( Server.sd ); + syslog( LOG_ERR, "%s: Unable to send successful authentication message back to client: %s -- closing connection.", fn, strerror( errno ) ); + return( -1 ); + } + + IMAPCount->TotalClientLogins++; + + LockMutex ( &trace ); + if ( ! strcmp( Username, TraceUser ) ) + { + Client->TraceOn = 1; + Server.TraceOn = 1; + } + else + { + Client->TraceOn = 0; + Server.TraceOn = 0; + } + UnLockMutex( &trace ); + + rc = Raw_Proxy( Client, &Server ); + + Client->TraceOn = 0; + Server.TraceOn = 0; + + ICC_Logout( Username, Server.sd ); + + return( rc ); } + /*++ * Function: cmd_login * @@ -1031,6 +1232,7 @@ char *Command; char *Username; char *Password; + char *AuthMech; char *Lasts; char *EndOfLine; char *CP; @@ -1075,7 +1277,7 @@ /* start a command loop */ for ( ; ; ) { - LiteralFlag = 0; + LiteralFlag = NON_LITERAL_PASSWORD; fds[ 0 ].revents = 0; @@ -1197,8 +1399,56 @@ } else if ( ! strcasecmp( (const char *)Command, "AUTHENTICATE" ) ) { - cmd_authenticate( &Client, S_Tag ); - continue; + AuthMech = memtok( NULL, EndOfLine, &Lasts ); + if ( !AuthMech ) + { + snprintf( SendBuf, BufLen, "%s BAD Missing required argument to Authenticate\r\n", Tag ); + if ( send( Client.sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + IMAPCount->CurrentClientConnections--; + close( Client.sd ); + return; + } + continue; + } + + if ( !strcasecmp( (const char *)AuthMech, "LOGIN" ) ) + { + rc = cmd_authenticate_login( &Client, S_Tag ); + + if ( rc == 0 ) + continue; + + if ( rc == 1 ) + { + /* caught a logout */ + Tag = memtok( Client.ReadBuf, EndOfLine, &Lasts ); + if ( Tag ) + { + strncpy( S_Tag, Tag, MAXTAGLEN - 1 ); + cmd_logout( &Client, S_Tag ); + } + } + + IMAPCount->CurrentClientConnections--; + close( Client.sd ); + return; + } + else + { + /* + * an auth mechanism we can't handle. + */ + snprintf( SendBuf, BufLen, "%s NO no mechanism available\r\n", Tag, Command ); + if ( send( Client.sd, SendBuf, strlen(SendBuf), 0 ) == -1 ) + { + IMAPCount->CurrentClientConnections--; + close( Client.sd ); + return; + } + continue; + } + } else if ( ! strcasecmp( (const char *)Command, "LOGOUT" ) ) { @@ -1280,7 +1530,7 @@ continue; } - LiteralFlag = 1; + LiteralFlag = LITERAL_PASSWORD; CP = S_Password; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 06:20:56
|
Revision: 13992 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13992&view=rev Author: pdontthink Date: 2010-07-25 06:20:49 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.1.4 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/README trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/request.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 06:14:52 UTC (rev 13991) +++ trunk/imap_proxy/ChangeLog 2010-07-25 06:20:49 UTC (rev 13992) @@ -1,5 +1,24 @@ +2003-02-25 Dave McMurtrie <dg...@pi...> + + * Version 1.1.4 released. + +2003-02-20 Dave McMurtrie <dg...@pi...> + + * imapcommon.c: Get_Server_sd() now attempts to re-authenticate to the + real server if it encounters a non-matching password. + + * imapproxy.h: Added support for UNSELECT. + + * main.c: SetBannerAndCapability() modified to set a flag in the + global proxy config struct if the server supports UNSELECT. + + * request.c: Raw_Proxy() now sends the server an UNSELECT instead of + a CLOSE if the server supports it. + 2003-02-19 Dave McMurtrie <dg...@pi...> + * Version 1.1.3 released. + * imapcommon.c: Was previously checking for "+ go ahead" server response after sending string literal specifier in Get_Server_sd(). Now I'm just checking for "+" instead. Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 06:14:52 UTC (rev 13991) +++ trunk/imap_proxy/README 2010-07-25 06:20:49 UTC (rev 13992) @@ -17,18 +17,23 @@ KNOWN ISSUES ############################################################################## -Though this should now build on Solaris and Linux, it's still -Makefile based and hence, quite hokey. It's better than before when -it only built on Solaris. +More than ever before, this thing really needs to be autoconfed. It now +should build on linux and solaris, and I've also received patches for +FreeBSD that I'm hoping to incorporate very soon. Before I do, I'd really +like to get autoconf thrown into the picture because if I continuously add +support for new platforms by adding new Makefiles it'll eventually become +a trainwreck. -I'm working to autoconf this whole thing, but I've been a little busy lately. +If anyone has the time to throw together an autoconf solution for +up-imapproxy, I'd really appreciate it. Until then, I'll try to find the +time to do it myself. ############################################################################## HOW TO BUILD ############################################################################## By default, Makefile will only work on solaris platforms. Use Makefile.linux -for others. Again, once this is autoconf'd it shouldn't be as ugly to build. +for others. After you're sure that you're using the correct Makefile, just run "make" in this directory to build the proxy server. Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 06:14:52 UTC (rev 13991) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 06:20:49 UTC (rev 13992) @@ -36,11 +36,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.6 2003/02/19 13:03:35 dgm Exp $ +** $Id: imapproxy.h,v 1.7 2003/02/20 12:40:08 dgm Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.7 2003/02/20 12:40:08 dgm +** Added UNSELECT support. +** ** Revision 1.6 2003/02/19 13:03:35 dgm ** Added LITERAL_PASSWORD and NON_LITERAL_PASSWORD definitions. ** @@ -88,6 +91,8 @@ #define DEFAULT_CONFIG_FILE "/etc/imapproxy.conf" #define LITERAL_PASSWORD 1 #define NON_LITERAL_PASSWORD 0 +#define UNSELECT_SUPPORTED 1 +#define UNSELECT_NOT_SUPPORTED 0 /* * One IMAPServerDescriptor will be globally allocated such that each thread @@ -135,7 +140,9 @@ /* * One ProxyConfig structure will be used globally to keep track of - * configurable options. + * configurable options. All of these options are set by reading values + * from the global config file except for support_unselect. That's set + * based on the CAPABILITY string from the real imap server. */ struct ProxyConfig { @@ -148,6 +155,7 @@ char *proc_groupname; /* groupname to run as */ char *stat_filename; /* mmap()ed stat filename */ char *protocol_log_filename; /* global trace filename */ + unsigned char support_unselect; /* unselect support flag */ }; Modified: trunk/imap_proxy/src/imapcommon.c =================================================================== --- trunk/imap_proxy/src/imapcommon.c 2010-07-25 06:14:52 UTC (rev 13991) +++ trunk/imap_proxy/src/imapcommon.c 2010-07-25 06:20:49 UTC (rev 13992) @@ -37,11 +37,16 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/imapcommon.c,v $ -** $Id: imapcommon.c,v 1.9 2003/02/19 12:47:31 dgm Exp $ +** $Id: imapcommon.c,v 1.10 2003/02/20 13:52:16 dgm Exp $ ** ** Modification History: ** ** $Log: imapcommon.c,v $ +** Revision 1.10 2003/02/20 13:52:16 dgm +** Logic changed in Get_Server_sd() such that authentication is attempted to the +** real server when the md5 checksums don't match instead of just dropping +** the connection. +** ** Revision 1.9 2003/02/19 12:47:31 dgm ** Replaced check for server response of "+ go ahead" with a check for ** "+". the "go ahead" appears to be cyrus specific and not RFC compliant @@ -256,79 +261,80 @@ */ if ( memcmp( md5pw, ICC_Active->hashedpw, sizeof md5pw ) ) { - /* the passwords don't match. Shake this guy. */ - UnLockMutex( &mp ); - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: password incorrect", Username, ClientAddr ); - return( -1 ); - } - - /* - * We found a matching password on an inactive server socket. We - * can use this guy. Before we release the mutex, set the - * logouttime such that we mark this connection as "active" again. - */ - ICC_Active->logouttime = 0; - - /* - * The fact that we have this stored in a table as an open server - * socket doesn't really mean that it's open. The server could've - * closed it on us. - * We need a speedy way to make sure this is still open. - * We'll set the fd to non-blocking and try to read from it. If we - * get a zero back, the connection is closed. If we get - * EWOULDBLOCK (or some data) we know it's still open. If we do - * read data, make sure we read all the data so we "drain" any - * puss that may be left on this socket. - */ - fcntl( ICC_Active->server_sd, F_SETFL, - fcntl( ICC_Active->server_sd, F_GETFL, 0) | O_NONBLOCK ); - - while ( ( rc = recv( ICC_Active->server_sd, Server.ReadBuf, - sizeof Server.ReadBuf, 0 ) ) > 0 ); - - if ( !rc ) - { - syslog(LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s). Connection closed by server.", fn, ICC_Active->server_sd, Username, ClientAddr ); + syslog( LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s) because password doesn't match.", fn, ICC_Active->server_sd, Username, ClientAddr ); ICC_Active->logouttime = 1; - continue; } - - if ( errno != EWOULDBLOCK ) + else { - syslog(LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s). recv() error: %s", fn, ICC_Active->server_sd, Username, ClientAddr, strerror( errno ) ); - ICC_Active->logouttime = 1; - continue; - } + /* + * We found a matching password on an inactive server socket. + * We can use this guy. Before we release the mutex, set the + * logouttime such that we mark this connection as "active" + * again. + */ + ICC_Active->logouttime = 0; + + /* + * The fact that we have this stored in a table as an open + * server socket doesn't really mean that it's open. The + * server could've closed it on us. + * We need a speedy way to make sure this is still open. + * We'll set the fd to non-blocking and try to read from it. + * If we get a zero back, the connection is closed. If we get + * EWOULDBLOCK (or some data) we know it's still open. If we + * do read data, make sure we read all the data so we "drain" + * any puss that may be left on this socket. + */ + fcntl( ICC_Active->server_sd, F_SETFL, + fcntl( ICC_Active->server_sd, F_GETFL, 0) | O_NONBLOCK ); + + while ( ( rc = recv( ICC_Active->server_sd, Server.ReadBuf, + sizeof Server.ReadBuf, 0 ) ) > 0 ); + + if ( !rc ) + { + syslog(LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s). Connection closed by server.", fn, ICC_Active->server_sd, Username, ClientAddr ); + ICC_Active->logouttime = 1; + continue; + } - - fcntl( ICC_Active->server_sd, F_SETFL, - fcntl( ICC_Active->server_sd, F_GETFL, 0) & ~O_NONBLOCK ); - - - /* now release the mutex and return the sd to the caller */ - UnLockMutex( &mp ); + if ( errno != EWOULDBLOCK ) + { + syslog(LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s). recv() error: %s", fn, ICC_Active->server_sd, Username, ClientAddr, strerror( errno ) ); + ICC_Active->logouttime = 1; + continue; + } + + fcntl( ICC_Active->server_sd, F_SETFL, + fcntl( ICC_Active->server_sd, F_GETFL, 0) & ~O_NONBLOCK ); + + /* now release the mutex and return the sd to the caller */ + UnLockMutex( &mp ); - /* - * We're reusing an existing server socket. There are a few - * counters we have to deal with. - */ - IMAPCount->RetainedServerConnections--; - IMAPCount->InUseServerConnections++; - IMAPCount->TotalServerConnectionsReused++; + /* + * We're reusing an existing server socket. There are a few + * counters we have to deal with. + */ + IMAPCount->RetainedServerConnections--; + IMAPCount->InUseServerConnections++; + IMAPCount->TotalServerConnectionsReused++; + + if ( IMAPCount->InUseServerConnections > + IMAPCount->PeakInUseServerConnections ) + IMAPCount->PeakInUseServerConnections = IMAPCount->InUseServerConnections; - if ( IMAPCount->InUseServerConnections > - IMAPCount->PeakInUseServerConnections ) - IMAPCount->PeakInUseServerConnections = IMAPCount->InUseServerConnections; - - syslog(LOG_INFO, "LOGIN: '%s' (%s) on existing sd [%d]", Username, ClientAddr, ICC_Active->server_sd ); - return( ICC_Active->server_sd ); + syslog(LOG_INFO, "LOGIN: '%s' (%s) on existing sd [%d]", Username, ClientAddr, ICC_Active->server_sd ); + return( ICC_Active->server_sd ); + } } } + UnLockMutex( &mp ); /* - * We don't have an active connection for this user. + * We don't have an active connection for this user, or the password + * didn't match. * Open a connection to the IMAP server so we can attempt to login */ Server.sd = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 06:14:52 UTC (rev 13991) +++ trunk/imap_proxy/src/main.c 2010-07-25 06:20:49 UTC (rev 13992) @@ -38,11 +38,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.7 2003/02/19 13:01:40 dgm Exp $ +** $Id: main.c,v 1.8 2003/02/20 12:55:03 dgm Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.8 2003/02/20 12:55:03 dgm +** SetBannerAndCapability() now checks to see if the server supports +** UNSELECT and sets a flag in the global proxy config struct. +** ** Revision 1.7 2003/02/19 13:01:40 dgm ** Changes to SetBannerAndCapability() to strip out unsupported AUTH= ** mechanisms from the capability string. @@ -74,7 +78,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.7 2003/02/19 13:01:40 dgm Exp $"; +static char *rcsId = "$Id: main.c,v 1.8 2003/02/20 12:55:03 dgm Exp $"; static char *rcsSource = "$Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dgm $"; @@ -577,6 +581,9 @@ * * Notes: All AUTH mechanisms will be stripped from the capability * string. AUTH=LOGIN will be added. + * The support_unselect flag in the global copy of the + * ProxyConfig struct will be set in this function depending on + * whether the server supports UNSELECT or not. *-- */ static int SetBannerAndCapability( void ) @@ -696,6 +703,11 @@ sprintf( Capability, CP ); + /* + * initially assume that the server doesn't support UNSELECT. + */ + PC_Struct.support_unselect = UNSELECT_NOT_SUPPORTED; + for( ; ; ) { CP = strtok( NULL, " " ); @@ -703,6 +715,11 @@ if ( !CP ) break; + if ( !strncasecmp( CP, "UNSELECT", strlen( "UNSELECT" ) ) ) + { + PC_Struct.support_unselect = UNSELECT_SUPPORTED; + } + /* * If this token happens to be an auth mechanism, we want to * discard it unless it's an auth mechanism we can support. Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 06:14:52 UTC (rev 13991) +++ trunk/imap_proxy/src/request.c 2010-07-25 06:20:49 UTC (rev 13992) @@ -41,11 +41,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.8 2003/02/19 12:57:15 dgm Exp $ +** $Id: request.c,v 1.9 2003/02/20 12:57:26 dgm Exp $ ** ** Modification History: ** ** $Log: request.c,v $ +** Revision 1.9 2003/02/20 12:57:26 dgm +** Raw_Proxy() sends UNSELECT instead of CLOSE if the server supports it. +** ** Revision 1.8 2003/02/19 12:57:15 dgm ** Added support for "AUTHENTICATE LOGIN". ** @@ -113,6 +116,7 @@ extern char TraceUser[MAXUSERNAMELEN]; extern int Tracefd; extern ICC_Struct *ICC_HashTable[ HASH_TABLE_SIZE ]; +extern ProxyConfig_Struct PC_Struct; /* * Function prototypes for internal entry points. @@ -879,6 +883,7 @@ int BytesSent; char *CP; char TraceBuf[ BUFSIZE ]; + char SendBuf[ BUFSIZE ]; #define SERVER 0 #define CLIENT 1 @@ -1065,15 +1070,19 @@ /* * Since we want to potentially reuse this server * connection, we want to return it to an unselected - * state. + * state. Use UNSELECT if the server supports it, + * otherwise use CLOSE. * * This may not be entirely necessary, so don't go * crazy trying to check return codes, etc... Also, * make a half-hearted attempt to eat whatever the * server sends back. */ - send( Server->sd, "C64 CLOSE\r\n", - strlen("C64 CLOSE\r\n"), 0 ); + snprintf( SendBuf, sizeof SendBuf - 1, + "C64 %s\r\n", ( (PC_Struct.support_unselect) ? "UNSELECT" : "CLOSE" ) ); + + send( Server->sd, SendBuf, + strlen(SendBuf), 0 ); recv( Server->sd, Server->ReadBuf, sizeof Server->ReadBuf, 0 ); memset( Server->ReadBuf, 0, sizeof Server->ReadBuf ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 06:35:26
|
Revision: 13994 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13994&view=rev Author: pdontthink Date: 2010-07-25 06:35:19 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.1.5 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/README trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/scripts/imapproxy.conf trunk/imap_proxy/src/config.c trunk/imap_proxy/src/main.c Added Paths: ----------- trunk/imap_proxy/Makefile.in trunk/imap_proxy/config.guess trunk/imap_proxy/config.h.in trunk/imap_proxy/config.sub trunk/imap_proxy/configure trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/install-sh trunk/imap_proxy/mkinstalldirs trunk/imap_proxy/scripts/imapproxy.init trunk/imap_proxy/src/logging.c trunk/imap_proxy/stamp-h Removed Paths: ------------- trunk/imap_proxy/Makefile trunk/imap_proxy/Makefile.linux trunk/imap_proxy/scripts/imapproxy Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 06:21:18 UTC (rev 13993) +++ trunk/imap_proxy/ChangeLog 2010-07-25 06:35:19 UTC (rev 13994) @@ -1,3 +1,32 @@ +2003-04-16 Dave McMurtrie <dg...@pi...> + + * Version 1.1.5 released. + + * logging.c: Newly introduced to allow syslog configuration. + + * config.c: Added commodore logo ascii art comment block at the + end. How could I have forgotten that?!? + + * config.c: Added syslog_facility and syslog_prioritymask keywords + to allow for syslog configuration. + + * main.c: Added call to SetLogOptions(). + + * main.c: Removed 2 "ifdef LINUX" directives by always storing the + tcp service port as a network short. + + * imapproxy.h: Added syslog_facility and syslog_prioritymask fields + to struct ProxyConfig. + + * imapproxy.h: Added base64 routine prototypes that I previously + forgot. + +2003-03-18 Devrim Seral <de...@ga...> + + * Added autoconf capability + + * Added spec file for rpm based systems + 2003-02-25 Dave McMurtrie <dg...@pi...> * Version 1.1.4 released. Deleted: trunk/imap_proxy/Makefile =================================================================== --- trunk/imap_proxy/Makefile 2010-07-25 06:21:18 UTC (rev 13993) +++ trunk/imap_proxy/Makefile 2010-07-25 06:35:19 UTC (rev 13994) @@ -1,75 +0,0 @@ -#### Makefile for IMAP proxy -#### Contributed by Gary Mills <mi...@cc...> - -## Tuneables - -# Paths - -INSTALL = /usr/ucb/install -EBIN = /usr/local/sbin -MAN = /usr/local/man/man -ETC = /etc - -# Compiler flags -CC = gcc -RANLIB = : -CFLAGS = -I./include -LDLIBS = - -# Man sections -MANLIB = 3 -MANADM = 1m - -## Nothing to change after this point - -# Libraries - -# Solaris -XYD_LIB = -lpthread -lmd5 -lsocket -lnsl -# Linux -#XYD_LIB = -lpthread -lnsl -lcrypto - -TAT_LIB = -lcurses - -# Object files - -XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o ./src/hash.o ./src/becomenonroot.o ./src/config.o ./src/base64.o -TAT_OBJ = ./src/pimpstat.o ./src/config.o - -# Final targets - -XYD_BIN = ./bin/in.imapproxyd -TAT_BIN = ./bin/pimpstat - -# Rules - -all: $(XYD_BIN) $(TAT_BIN) - -$(XYD_OBJ) $(TAT_OBJ): $(MAKEFILE) ./include/common.h ./include/imapproxy.h - -.c.o: - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - -$(XYD_BIN): $(XYD_OBJ) - $(CC) -o $@ $(XYD_OBJ) $(XYD_LIB) - -$(TAT_BIN): $(TAT_OBJ) - $(CC) -o $@ $(TAT_OBJ) $(TAT_LIB) - -clean: - rm -f ./src/core ./src/$(XYD_OBJ) ./src/$(TAT_OBJ) $(XYD_BIN) $(TAT_BIN) - -install: $(XYD_BIN) $(TAT_BIN) - $(INSTALL) -c -o bin -g bin -m 0755 $(XYD_BIN) $(EBIN) - $(INSTALL) -c -o bin -g bin -m 0755 $(TAT_BIN) $(EBIN) - -install-init: - $(INSTALL) -c -o root -g sys -m 0755 ./scripts/imapproxy $(ETC)/init.d - ln -s ../init.d/imapproxy /etc/rc2.d/S99imapproxy - ln -s ../init.d/imapproxy /etc/rc0.d/K10imapproxy - -install-conf: - $(INSTALL) -c -o root -g bin -m 0755 ./scripts/imapproxy.conf $(ETC) - - -#### Added: trunk/imap_proxy/Makefile.in =================================================================== --- trunk/imap_proxy/Makefile.in (rev 0) +++ trunk/imap_proxy/Makefile.in 2010-07-25 06:35:19 UTC (rev 13994) @@ -0,0 +1,110 @@ +#### Makefile for IMAP proxy +#### Contributed by Gary Mills <mi...@cc...> + +# Fixed to work with configure script +# by Devrim SERAL <de...@ga...> + +## Tuneables + +# Paths +SHELL = /bin/sh +VPATH = @srcdir@ + +top_srcdir = @top_srcdir@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = $(exec_prefix)/bin +sbindir = $(exec_prefix)/sbin +infodir = $(prefix)/info +libdir = $(prefix)/lib/gnudl +mandir = $(prefix)/man/man3 +rpm_prefix = @rpm_prefix@ + +CC = @CC@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +OSLIBS = @LIBS@ +DEFINES = @DEFINES@ +OS = @OS@ +FLAGS = $(CPPFLAGS) @CFLAGS@ -I/usr/include -I./include $(OS) + +INSTALL = @INSTALL@ +EBIN = $(sbindir) +MAN = $(mandir) +ETC = /etc +# ETC = @sysconfdir@ + +# Compiler flags +#CC = gcc +#RANLIB = : +#CFLAGS = -I./include -DLINUX +#LDLIBS = + +# Man sections +#MANLIB = 3 +#MANADM = 1m + +## Nothing to change after this point + +# Libraries + +# Solaris +#XYD_LIB = -lpthread -lmd5 -lsocket -lnsl +# Linux +#XYD_LIB = -lpthread -lnsl -lcrypto + +#TAT_LIB = -lcurses + + +XYD_LIB = $(OSLIBS) +TAT_LIB = @NCURLIB@ + +# Object files + +XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o ./src/hash.o ./src/becomenonroot.o ./src/config.o ./src/base64.o ./src/logging.o +TAT_OBJ = ./src/pimpstat.o ./src/config.o + +# Final targets + +XYD_BIN = ./bin/in.imapproxyd +TAT_BIN = ./bin/pimpstat + +# Rules + +all: $(XYD_BIN) $(TAT_BIN) + +$(XYD_OBJ) $(TAT_OBJ): $(MAKEFILE) ./include/common.h ./include/imapproxy.h + +.c.o: + $(CC) $(CFLAGS) $(FLAGS) -c -o $@ $< + +$(XYD_BIN): $(XYD_OBJ) + $(CC) -o $@ $(XYD_OBJ) $(XYD_LIB) + +$(TAT_BIN): $(TAT_OBJ) + $(CC) -o $@ $(TAT_OBJ) $(TAT_LIB) + +clean: + rm -f ./src/core $(XYD_OBJ) $(TAT_OBJ) $(XYD_BIN) $(TAT_BIN) + +distclean: clean + rm -f config.cache config.log config.h Makefile + +install: $(XYD_BIN) $(TAT_BIN) + $(INSTALL) -o bin -g bin -m 0755 $(XYD_BIN) $(EBIN) + $(INSTALL) -o bin -g bin -m 0755 $(TAT_BIN) $(EBIN) + +install-init: + $(INSTALL) -o root -g sys -m 0755 ./scripts/imapproxy.init $(ETC)/init.d/imapproxy + ln -s ../init.d/imapproxy /etc/rc2.d/S99imapproxy + ln -s ../init.d/imapproxy /etc/rc0.d/K10imapproxy + +install-conf: + $(INSTALL) -o root -g bin -m 0755 ./scripts/imapproxy.conf $(ETC) + +rpm-install: install + $(INSTALL) -o root -g sys -m 0755 ./scripts/imapproxy.conf $(rpm_prefix)/etc + $(INSTALL) -o root -g sys -m 0755 ./scripts/imapproxy.init $(rpm_prefix)/etc/init.d/imapproxy + +#### Deleted: trunk/imap_proxy/Makefile.linux =================================================================== --- trunk/imap_proxy/Makefile.linux 2010-07-25 06:21:18 UTC (rev 13993) +++ trunk/imap_proxy/Makefile.linux 2010-07-25 06:35:19 UTC (rev 13994) @@ -1,75 +0,0 @@ -#### Makefile for IMAP proxy -#### Contributed by Gary Mills <mi...@cc...> - -## Tuneables - -# Paths - -INSTALL = /usr/bin/install -EBIN = /usr/local/sbin -MAN = /usr/local/man/man -ETC = /etc - -# Compiler flags -CC = gcc -RANLIB = : -CFLAGS = -I./include -DLINUX -LDLIBS = - -# Man sections -MANLIB = 3 -MANADM = 1m - -## Nothing to change after this point - -# Libraries - -# Solaris -#XYD_LIB = -lpthread -lmd5 -lsocket -lnsl -# Linux -XYD_LIB = -lpthread -lnsl -lcrypto - -TAT_LIB = -lcurses - -# Object files - -XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o ./src/hash.o ./src/becomenonroot.o ./src/config.o ./src/base64.o -TAT_OBJ = ./src/pimpstat.o ./src/config.o - -# Final targets - -XYD_BIN = ./bin/in.imapproxyd -TAT_BIN = ./bin/pimpstat - -# Rules - -all: $(XYD_BIN) $(TAT_BIN) - -$(XYD_OBJ) $(TAT_OBJ): $(MAKEFILE) ./include/common.h ./include/imapproxy.h - -.c.o: - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - -$(XYD_BIN): $(XYD_OBJ) - $(CC) -o $@ $(XYD_OBJ) $(XYD_LIB) - -$(TAT_BIN): $(TAT_OBJ) - $(CC) -o $@ $(TAT_OBJ) $(TAT_LIB) - -clean: - rm -f ./src/core ./src/$(XYD_OBJ) ./src/$(TAT_OBJ) $(XYD_BIN) $(TAT_BIN) - -install: $(XYD_BIN) $(TAT_BIN) - $(INSTALL) -c -o bin -g bin -m 0755 $(XYD_BIN) $(EBIN) - $(INSTALL) -c -o bin -g bin -m 0755 $(TAT_BIN) $(EBIN) - -install-init: - $(INSTALL) -c -o root -g sys -m 0755 ./scripts/imapproxy $(ETC)/init.d - ln -s ../init.d/imapproxy /etc/rc2.d/S99imapproxy - ln -s ../init.d/imapproxy /etc/rc0.d/K10imapproxy - -install-conf: - $(INSTALL) -c -o root -g bin -m 0755 ./scripts/imapproxy.conf $(ETC) - - -#### Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 06:21:18 UTC (rev 13993) +++ trunk/imap_proxy/README 2010-07-25 06:35:19 UTC (rev 13994) @@ -17,26 +17,19 @@ KNOWN ISSUES ############################################################################## -More than ever before, this thing really needs to be autoconfed. It now -should build on linux and solaris, and I've also received patches for -FreeBSD that I'm hoping to incorporate very soon. Before I do, I'd really -like to get autoconf thrown into the picture because if I continuously add -support for new platforms by adding new Makefiles it'll eventually become -a trainwreck. +Currently, the proxy has only been tested on Solaris and Linux. +I received FreeBSD patches that I still haven't had time to incorporate. +Sorry... If enough people need it and bug me about it, I'll probably +find the motivation to finish it. -If anyone has the time to throw together an autoconf solution for -up-imapproxy, I'd really appreciate it. Until then, I'll try to find the -time to do it myself. - ############################################################################## HOW TO BUILD ############################################################################## -By default, Makefile will only work on solaris platforms. Use Makefile.linux -for others. +It should be pretty painless: -After you're sure that you're using the correct Makefile, just run "make" -in this directory to build the proxy server. +./configure +make "make install" will attempt to install the following files: @@ -129,7 +122,18 @@ by client or server. This file is opened at server startup, and is held open until the server is shut down. +syslog_facility +--------------- +The logging facility to be used for all syslog calls. Any of the possible +facilities listed in the syslog(3C) manpage may be specified here except +for LOG_KERN. +syslog_prioritymask +------------------- +The syslog LOG_UPT() priority mask. Read more about what this does in the +syslog(3C) manpage. Any of the possible priorities specified in the +syslog(3c) manpage my be specified here. + ############################################################################## ADDITIONAL COMMANDS: ############################################################################## Added: trunk/imap_proxy/config.guess =================================================================== --- trunk/imap_proxy/config.guess (rev 0) +++ trunk/imap_proxy/config.guess 2010-07-25 06:35:19 UTC (rev 13994) @@ -0,0 +1,1121 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 +# Free Software Foundation, Inc. +# +# This file 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 2 of the License, or +# (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner <bo...@cy...>. +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# Please send patches to <aut...@gn...>. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# Use $HOST_CC if defined. $CC may point to a cross-compiler +if test x"$CC_FOR_BUILD" = x; then + if test x"$HOST_CC" != x; then + CC_FOR_BUILD="$HOST_CC" + else + if test x"$CC" != x; then + CC_FOR_BUILD="$CC" + else + CC_FOR_BUILD=cc + fi + fi +fi + + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (gh...@no... 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <<EOF >$dummy.s + .globl main + .ent main +main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:NetBSD:*:*) + echo m68k-cbm-netbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + arm32:NetBSD:*:*) + echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # ak...@wp... (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:NetBSD:*:*) + echo m68k-atari-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:NetBSD:*:*) + echo m68k-sun-netbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:NetBSD:*:*) + echo m68k-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + macppc:NetBSD:*:*) + echo powerpc-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + sed 's/^ //' << EOF >$dummy.c + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + rm -f $dummy.c $dummy + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*T3E:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + if test -x /usr/bin/objformat; then + if test "elf" = "`/usr/bin/objformat`"; then + echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` + exit 0 + fi + fi + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_help_string=`cd /; ld --help 2>&1` + ld_supported_emulations=`echo $ld_help_string \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + *ia64) + echo "${UNAME_MACHINE}-unknown-linux" + exit 0 + ;; + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + sparclinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + armlinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32arm*) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; + armelf_linux*) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; + m68klinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32ppc) + # Determine Lib Version + cat >$dummy.c <<EOF +#include <features.h> +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unkown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 + ;; + esac + + if test "${UNAME_MACHINE}" = "alpha" ; then + sed 's/^ //' <<EOF >$dummy.s + .globl main + .ent main + main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >$dummy.c <<EOF +#ifdef __cplusplus + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + else + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" + test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c <<EOF +#include <features.h> +#ifdef __cplusplus + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + fi ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i?86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + pc:*:*:*) + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Ric...@cc...> + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <he...@op...>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From se...@sw.... + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:*:6*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-qnx-qnx${UNAME_VERSION} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 Property changes on: trunk/imap_proxy/config.guess ___________________________________________________________________ Added: svn:executable + * Added: trunk/imap_proxy/config.h.in =================================================================== --- trunk/imap_proxy/config.h.in (rev 0) +++ trunk/imap_proxy/config.h.in 2010-07-25 06:35:19 UTC (rev 13994) @@ -0,0 +1,85 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define if you don't have vprintf but do have _doprnt. */ +#undef HAVE_DOPRNT + +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + +/* Define if you have the wait3 system call. */ +#undef HAVE_WAIT3 + +/* Define as the return type of signal handlers (int or void). */ +#undef RETSIGTYPE + +/* Define if the `setpgrp' function takes no argument. */ +#undef SETPGRP_VOID + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* Define if you have the regcomp function. */ +#undef HAVE_REGCOMP + +/* Define if you have the select function. */ +#undef HAVE_SELECT + +/* Define if you have the socket function. */ +#undef HAVE_SOCKET + +/* Define if you have the strcspn function. */ +#undef HAVE_STRCSPN + +/* Define if you have the strdup function. */ +#undef HAVE_STRDUP + +/* Define if you have the strtol function. */ +#undef HAVE_STRTOL + +/* Define if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define if you have the <malloc.h> header file. */ +#undef HAVE_MALLOC_H + +/* Define if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the <sys/file.h> header file. */ +#undef HAVE_SYS_FILE_H + +/* Define if you have the <sys/ioctl.h> header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the <syslog.h> header file. */ +#undef HAVE_SYSLOG_H + +/* Define if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the c library (-lc). */ +#undef HAVE_LIBC + +/* Define if you have the crypto library (-lcrypto). */ +#undef HAVE_LIBCRYPTO + +/* Define if you have the nsl library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the og library (-log). */ +#undef HAVE_LIBOG + +/* Define if you have the socket library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define DEFAULT_CONFIG_FILE */ +#undef DEFAULT_CONFIG_FILE Added: trunk/imap_proxy/config.sub =================================================================== --- trunk/imap_proxy/config.sub (rev 0) +++ trunk/imap_proxy/config.sub 2010-07-25 06:35:19 UTC (rev 13994) @@ -0,0 +1,1232 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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 2 of the License, or +# (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ + | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | fr30) + basic_machine=$basic_machine-unknown + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[34567]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ + | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f301-* | armv*-* | t3e-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* ) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + i386-go32 | go32) + basic_machine=i386-unknown + os=-go32 + ;; + i386-mingw32 | mingw32) + basic_machine=i386-unknown + os=-mingw32 + ;; + i386-qnx | qnx) + basic_machine=i386-qnx + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-unknown + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + ... [truncated message content] |
From: <pdo...@us...> - 2010-07-25 06:59:53
|
Revision: 13996 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13996&view=rev Author: pdontthink Date: 2010-07-25 06:59:40 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/Makefile.in trunk/imap_proxy/README trunk/imap_proxy/config.h.in trunk/imap_proxy/configure trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/common.h trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/scripts/imapproxy.conf trunk/imap_proxy/scripts/imapproxy.init trunk/imap_proxy/src/becomenonroot.c trunk/imap_proxy/src/config.c trunk/imap_proxy/src/hash.c trunk/imap_proxy/src/icc.c trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/logging.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/pimpstat.c trunk/imap_proxy/src/request.c Added Paths: ----------- trunk/imap_proxy/COPYING trunk/imap_proxy/README.debian trunk/imap_proxy/README.ssl trunk/imap_proxy/acconfig.h trunk/imap_proxy/aclocal.m4 trunk/imap_proxy/configure.in trunk/imap_proxy/copyright trunk/imap_proxy/pkginfo trunk/imap_proxy/prototype Removed Paths: ------------- trunk/imap_proxy/src/COPYING trunk/imap_proxy/src/base64.c Added: trunk/imap_proxy/COPYING =================================================================== --- trunk/imap_proxy/COPYING (rev 0) +++ trunk/imap_proxy/COPYING 2010-07-25 06:59:40 UTC (rev 13996) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program 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 2 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 06:37:19 UTC (rev 13995) +++ trunk/imap_proxy/ChangeLog 2010-07-25 06:59:40 UTC (rev 13996) @@ -1,5 +1,97 @@ -2003-04-16 Dave McMurtrie <dg...@pi...> +2003-05-22 Dave McMurtrie <dav...@ho...> + * Version 1.2 released. + +2003-05-21 Dave McMurtrie <dav...@ho...> + + * Many many many comment changes to GPL the distribution. + +2003-05-15 Dave McMurtrie <dav...@ho...> + + * imapproxy.h: included netinet/in.h. + + * configure.in: Applied patch by Ken Murchison <ke...@oc...> + to fix build issues on FreeBSD and SUSE. + + * acconfig.h: Newly contributed by Ken Murchison <ke...@oc...> + to clean up build process. + + * pimpstat.c: Patch by Ken Murchison <ke...@oc...> to clean up + build process. + + * main.c: Patch by Ken Murchison <ke...@oc...> to clean up build + process. + + * request.c: Patch by Ken Murchison <ke...@oc...> to clean up + build process. + + * imapcommon.c: Modified Get_Server_conn() to deal with possible + unsolicited, untagged capability response from server on + successful login. + +2003-05-13 Dave McMurtrie <dav...@ho...> + + * imapproxy.h, imapcommon.c, main.c, request.c, pimpstat.c, + configure.in, Makefile.in: Applied patches by Ken Murchison + <ke...@oc...> to clean up build process. + + * imapcommon.c, main.c: Replaced all AF_INET constant usage with + PF_INET constants. + +2003-05-08 Dave McMurtrie <dav...@ho...> + + * configure.in: Applied patch by Ken Murchison <ke...@oc...> to + deal with krb5/openssl issue. + + * request.c: Added code to send any untagged server responses back to + a client on logout. + +2003-05-06 Dave McMurtrie <dav...@ho...> + + * prototype: Added by Ken Murchison <ke...@oc...> to allow + building Sun packages. + + * pkginfo: Added by Ken Murchison <ke...@oc...> to allow building + Sun packages. + + * copyright: Added by Ken Murchison <ke...@oc...> to allow building + Sun packages. + + * base64.c: Removed this source file. It's no longer needed. + + * COPYING: Removed this file. It was only related to base64.c. + + * imapproxy.h: Applied patch by Ken Murchison <ke...@oc...> to + remove base64 function prototypes. + + * imapcommon.c: Applied patch by Ken Murchison <ke...@oc...> to + remove Solaris md5 library dependencies (use openssl instead). + + * request.c: Applied patch by Ken Murchison <ke...@oc...> to + replace base64 calls with openssl routines. + +2003-04-29 Dave McMurtrie <dav...@ho...> + + * imapproxy.h: Applied patch by Ken Murchison <ke...@oc...> to + add SSL/TLS support. + + * config.c: Applied patch by Ken Murchison <ke...@oc...> to add + SSL/TLS support. + + * icc.c: Applied patch by Ken Murchison <ke...@oc...> to add + SSL/TLS support. + + * main.c: Applied patch by Ken Murchison <ke...@oc...> to add + SSL/TLS support. + + * request.c: Applied patch by Ken Murchison <ke...@oc...> to add + SSL/TLS support. + + * imapcommon.c: Applied patch by Ken Murchison <ke...@oc...> to + add SSL/TLS support. + +2003-04-16 Dave McMurtrie <dav...@ho...> + * Version 1.1.5 released. * logging.c: Newly introduced to allow syslog configuration. @@ -27,11 +119,11 @@ * Added spec file for rpm based systems -2003-02-25 Dave McMurtrie <dg...@pi...> +2003-02-25 Dave McMurtrie <dav...@ho...> * Version 1.1.4 released. -2003-02-20 Dave McMurtrie <dg...@pi...> +2003-02-20 Dave McMurtrie <dav...@ho...> * imapcommon.c: Get_Server_sd() now attempts to re-authenticate to the real server if it encounters a non-matching password. @@ -44,7 +136,7 @@ * request.c: Raw_Proxy() now sends the server an UNSELECT instead of a CLOSE if the server supports it. -2003-02-19 Dave McMurtrie <dg...@pi...> +2003-02-19 Dave McMurtrie <dav...@ho...> * Version 1.1.3 released. @@ -66,15 +158,15 @@ cmd_authenticate_login() function and additional code necessary to support "AUTHENTICATE LOGIN". -2003-02-17 Dave McMurtrie <dg...@pi...> +2003-02-17 Dave McMurtrie <dav...@ho...> * config.c: added an fclose() for the config file that I had forgotten. -2003-02-14 Dave McMurtrie <dg...@pi...> +2003-02-14 Dave McMurtrie <dav...@ho...> * request.c: added lseek() call in cmd_newlog(). -2003-01-27 Dave McMurtrie <dg...@pi...> +2003-01-27 Dave McMurtrie <dav...@ho...> * Version 1.1.2 released. @@ -95,11 +187,11 @@ * pimpstat.c: added patch for linux support by Frode Nordahl <fr...@po...> -2003-01-23 Dave McMurtrie <dg...@pi...> +2003-01-23 Dave McMurtrie <dav...@ho...> * imapcommon.c: NonSyncLiteral flag was not being cleared properly. -2003-01-22 Dave McMurtrie <dg...@pi...> +2003-01-22 Dave McMurtrie <dav...@ho...> * Version 1.1.1 released. @@ -113,12 +205,12 @@ * imapcommon.c: Added logic to support passwords sent as string literals on login. -2002-12-18 Dave McMurtrie <dg...@pi...> +2002-12-18 Dave McMurtrie <dav...@ho...> * imapcommon.c: Fixed bug in for loop that does string literal processing. -2002-12-17 Dave McMurtrie <dg...@pi...> +2002-12-17 Dave McMurtrie <dav...@ho...> * Global configuration file support added. @@ -129,12 +221,12 @@ * main.c: changed accepted command line arguments. -2002-09-06 Dave McMurtrie <dg...@pi...> +2002-09-06 Dave McMurtrie <dav...@ho...> * main.c: added code to ignore SIGPIPE so EPIPE on a failed send() won't kill us. Also ignore SIGHUP. -2002-08-30 Dave McMurtrie <dg...@pi...> +2002-08-30 Dave McMurtrie <dav...@ho...> * main.c: added initialization of the trace mutex that I forgot. @@ -142,14 +234,14 @@ * added total client logins counter. -2002-08-29 Dave McMurtrie <dg...@pi...> +2002-08-29 Dave McMurtrie <dav...@ho...> * Pitt common functions moved out of external libraries into this source tree. * imapcommon.c: fixed nasty socket descriptor leak. -2002-08-28 Dave McMurtrie <dg...@pi...> +2002-08-28 Dave McMurtrie <dav...@ho...> * replaced all internal logging calls with standard syslog calls. @@ -160,15 +252,15 @@ * request.c: added poll() timeout in raw proxy loop. -2002-08-27 Dave McMurtrie <dg...@pi...> +2002-08-27 Dave McMurtrie <dav...@ho...> * request.c: no longer do a hostname lookup. Just log IP instead. -2002-07-18 Dave McMurtrie <dg...@pi...> +2002-07-18 Dave McMurtrie <dav...@ho...> * request.c: added p_dumpicc and p_newlog commands. renamed trace command to p_trace. -2002-07-03 Dave McMurtrie <dg...@pi...> +2002-07-03 Dave McMurtrie <dav...@ho...> * Version 1.0 released. Modified: trunk/imap_proxy/Makefile.in =================================================================== --- trunk/imap_proxy/Makefile.in 2010-07-25 06:37:19 UTC (rev 13995) +++ trunk/imap_proxy/Makefile.in 2010-07-25 06:59:40 UTC (rev 13996) @@ -4,6 +4,8 @@ # Fixed to work with configure script # by Devrim SERAL <de...@ga...> +# Cleaned up by Ken Murchison + ## Tuneables # Paths @@ -24,10 +26,9 @@ CC = @CC@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ -OSLIBS = @LIBS@ +LIBS = @LIBS@ DEFINES = @DEFINES@ -OS = @OS@ -FLAGS = $(CPPFLAGS) @CFLAGS@ -I/usr/include -I./include $(OS) +FLAGS = $(CPPFLAGS) @CFLAGS@ -I. -I./include INSTALL = @INSTALL@ EBIN = $(sbindir) @@ -35,34 +36,18 @@ ETC = /etc # ETC = @sysconfdir@ -# Compiler flags -#CC = gcc -#RANLIB = : -#CFLAGS = -I./include -DLINUX -#LDLIBS = -# Man sections -#MANLIB = 3 -#MANADM = 1m - ## Nothing to change after this point # Libraries -# Solaris -#XYD_LIB = -lpthread -lmd5 -lsocket -lnsl -# Linux -#XYD_LIB = -lpthread -lnsl -lcrypto +XYD_LIB = $(LIBS) +TAT_LIB = @LIB_CURSES@ -#TAT_LIB = -lcurses - - -XYD_LIB = $(OSLIBS) -TAT_LIB = @NCURLIB@ - # Object files -XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o ./src/hash.o ./src/becomenonroot.o ./src/config.o ./src/base64.o ./src/logging.o +XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o \ + ./src/hash.o ./src/becomenonroot.o ./src/config.o ./src/logging.o TAT_OBJ = ./src/pimpstat.o ./src/config.o # Final targets @@ -80,7 +65,7 @@ $(CC) $(CFLAGS) $(FLAGS) -c -o $@ $< $(XYD_BIN): $(XYD_OBJ) - $(CC) -o $@ $(XYD_OBJ) $(XYD_LIB) + $(CC) -o $@ $(XYD_OBJ) $(LDFLAGS) $(XYD_LIB) $(TAT_BIN): $(TAT_OBJ) $(CC) -o $@ $(TAT_OBJ) $(TAT_LIB) @@ -107,4 +92,6 @@ $(INSTALL) -o root -g sys -m 0755 ./scripts/imapproxy.conf $(rpm_prefix)/etc $(INSTALL) -o root -g sys -m 0755 ./scripts/imapproxy.init $(rpm_prefix)/etc/init.d/imapproxy +pkg: + pkgmk -o -r . #### Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 06:37:19 UTC (rev 13995) +++ trunk/imap_proxy/README 2010-07-25 06:59:40 UTC (rev 13996) @@ -1,36 +1,41 @@ - Copyright 2002, University of Pittsburgh + Copyright (c) 2002,2003 Dave McMurtrie -This directory contains the source distribution of the University of Pittsburgh -IMAP proxy server. +This directory contains the source distribution of up-imapproxy. -Send any bugs, questions, comments, patches, kind words, feature requests, -or hostile words to: +If you find any bugs in up-imapproxy, please visit http://bugs.imapproxy.org -d...@pi... - If you want to subscribe to the imapproxy-info mailing list, visit: http://lists.pitt.edu/mailman/listinfo/imapproxy-info -############################################################################## -KNOWN ISSUES -############################################################################## +For some Debian specific issues that have come up, read the file README.debian. -Currently, the proxy has only been tested on Solaris and Linux. -I received FreeBSD patches that I still haven't had time to incorporate. -Sorry... If enough people need it and bug me about it, I'll probably -find the motivation to finish it. +To read a little bit about SSL support in imapproxy, read README.ssl. +There's not much in the README.ssl file except a pointer to better +documentation that's already available. Please feel free to contribute more +complete documentation if you have the time. ############################################################################## HOW TO BUILD ############################################################################## +Before you build imapproxy, you're going to need to obtain the OpenSSL +libraries. Build and install them, then you're ready to move on. + It should be pretty painless: ./configure make +If the configure script yells about not being able to find libcrypto or +other SSL related stuff, you'll have to specify the location of your OpenSSL +libraries when you invoke the configure script. Something like this should do +it: + +./configure --with-openssl=/usr/local/ssl + + "make install" will attempt to install the following files: /usr/local/sbin/in.imapproxyd @@ -46,6 +51,7 @@ /etc/rc2.d/S99imapproxy /etc/rc0.d/K10imapproxy +"make pkg" will attempt to install a sun package into /var/spool/package. After you successfully build the proxy server, you'll need to edit the global configuration file to suit your needs. By default, the proxy @@ -53,8 +59,8 @@ can change this at runtime by supplying the -f argument to /usr/local/sbin/in.imapproxyd. -/usr/local/sbin/pimpstat is the Pitt IMap Proxy Statistical tool. It's a -curses-based application that you can use to monitor the proxy server. It's +/usr/local/sbin/pimpstat is the Polling Imap Mail Proxy Statistical tool. It's +a curses-based application that you can use to monitor the proxy server. It's aware of the same global configuration file as the proxy server, and can also be told to look at a different configuration file by supplying it as a parameter with the -f argument. Both pimpstat and in.imapproxyd must be using @@ -132,8 +138,29 @@ ------------------- The syslog LOG_UPT() priority mask. Read more about what this does in the syslog(3C) manpage. Any of the possible priorities specified in the -syslog(3c) manpage my be specified here. +syslog(3C) manpage my be specified here. +tls_ca_file +----------- +File containing one or more Certificate Authority (CA) certificates. +See README.ssl for more information. + +tls_ca_path +----------- +Path to directory with certificates of CAs. This directory must have +filenames with the hashed value of the certificate (see openssl(1)). +See README.ssl for more information. + +tls_cert_file +------------- +File containing the certificate presented by imapproxy to the server for +client authentication during STARTTLS. See README.ssl for more information. + +tls_key_file +------------ +File containing the private key belonging to the client certificate. See +README.ssl for more information. + ############################################################################## ADDITIONAL COMMANDS: ############################################################################## @@ -177,8 +204,9 @@ Happy proxying, -Dave +Dave <dav...@ho...> + _________ / | / | Added: trunk/imap_proxy/README.debian =================================================================== --- trunk/imap_proxy/README.debian (rev 0) +++ trunk/imap_proxy/README.debian 2010-07-25 06:59:40 UTC (rev 13996) @@ -0,0 +1,45 @@ +Michael Faurot <mfaurot at atww.org> submitted some helpful information +for people building and installing up-imapproxy on Debian Linux systems. +I've included his information here, exactly as he submitted it. + + +o) On a Debian system that uses UW IMAP you'll need to rename + /etc/rc2.d/S99rmnologin to something like S98rmnologin. Then be + sure the rc script for imapproxy is run as S99imapproxy. + This insures that when imapproxy goes to query the imap + daemon, the imap daemon will actually say it's ready. UW IMAP + respects the /etc/nologin file, and if imapproxy queries while + /etc/nologin is still present, imapproxy will fail to start. + Debian creates /etc/nologin during the early stages of bootup, + to prevent premature logins, and then removes it in the last + stages of going multiuser. + + +o) Add a PATH statement close to the top of the rc script + and then adjust the call to basename not to use a full + pathname. The original script called /bin/basename. On a + Debian system basename is in /usr/bin. For example: + + PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:" + export PATH + + +o) If building against locally created OpenSSL libraries that + have been installed into the default locations under + /usr/local these variables will need to be exported before + running "configure": + + CFLAGS="-I/usr/local/ssl/include" + LIBS="-L/usr/local/ssl/lib" + export CFLAGS LIBS + + +o) I built my installation of imapproxy against my own locally + compiled copies of OpenSSL's static libraries on a Debian stable + system. It appears, from some messages that were on the + mailing list, that people attempting to build imapproxy using + the stock Debian OpenSSL libraries may not realize they also + need to install the development package for OpenSSL to get its + headers and libraries. That can be done like this: + + apt-get install libssl-dev Added: trunk/imap_proxy/README.ssl =================================================================== --- trunk/imap_proxy/README.ssl (rev 0) +++ trunk/imap_proxy/README.ssl 2010-07-25 06:59:40 UTC (rev 13996) @@ -0,0 +1,23 @@ +up-imapproxy now supports SSL/TLS between the proxy server and the real +IMAP server. It does not support SSL/TLS between a client (usually webmail) +and the proxy server. The idea here is that you can run the imap proxy on +the same machine as your webserver. If you're using SSL/TLS to your webserver, +the webserver can then send plaintext auth to the proxy without the password +ever crossing the network, then the proxy can use SSL/TLS to the IMAP server. + +The proxy will only use SSL if the real imap server forces it to do so by +advertising LOGINDISABLED in the capability string. +This brings up the obvious point that if the server advertises LOGINDISABLED +and the proxy isn't built with SSL support, things aren't going to work. + +There are four configuration file options that you'll have to set in order +for SSL to work. They are tls_ca_file, tls_ca_path, tls_cert_file and +tls_key_file. + +I haven't had time to write my own ssl tuturial (and I might never) but you +can find a wealth of information here: + +http://www.sendmail.org/~ca/email/starttls.html + +If anyone wants to contribute to this project by submitting some good +documentation about configuring up-imapproxy with SSL, it would be appreciated. Added: trunk/imap_proxy/acconfig.h =================================================================== --- trunk/imap_proxy/acconfig.h (rev 0) +++ trunk/imap_proxy/acconfig.h 2010-07-25 06:59:40 UTC (rev 13996) @@ -0,0 +1,32 @@ + +#ifndef _IMAPROXY_CONFIG_H +#define _IMAPROXY_CONFIG_H + +@TOP@ + +/* Define if you have the nfds_t typedef. */ +#undef HAVE_NFDS_T + +@BOTTOM@ + +#if HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *) -1) +#endif + +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + +#ifndef MAXPATHLEN +#define MAXPATHLEN 4096 +#endif + +#ifndef HAVE_NFDS_T +typedef unsigned int nfds_t; +#endif + +#endif /* _IMAPROXY_CONFIG_H */ Added: trunk/imap_proxy/aclocal.m4 =================================================================== --- trunk/imap_proxy/aclocal.m4 (rev 0) +++ trunk/imap_proxy/aclocal.m4 2010-07-25 06:59:40 UTC (rev 13996) @@ -0,0 +1,24 @@ +dnl ## +dnl ## Check for an ANSI C typedef in a header +dnl ## +dnl ## configure.in: +dnl ## AC_CHECK_TYPEDEF(<typedef>, <header>) +dnl ## acconfig.h: +dnl ## #undef HAVE_<typedef> +dnl ## + +AC_DEFUN(AC_CHECK_TYPEDEF,[dnl +AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for typedef $1) +AC_CACHE_VAL(ac_cv_typedef_$1, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [ +#include <$2> +], ac_cv_typedef_$1=yes, ac_cv_typedef_$1=no)])dnl +AC_MSG_RESULT($ac_cv_typedef_$1) +if test $ac_cv_typedef_$1 = yes; then + AC_DEFINE(HAVE_[]translit($1, [a-z], [A-Z])) +fi +]) Modified: trunk/imap_proxy/config.h.in =================================================================== --- trunk/imap_proxy/config.h.in 2010-07-25 06:37:19 UTC (rev 13995) +++ trunk/imap_proxy/config.h.in 2010-07-25 06:59:40 UTC (rev 13996) @@ -1,85 +1,112 @@ -/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* config.h.in. Generated from configure.in by autoheader. */ -/* Define to empty if the keyword does not work. */ -#undef const +#ifndef _IMAPROXY_CONFIG_H +#define _IMAPROXY_CONFIG_H -/* Define if you don't have vprintf but do have _doprnt. */ -#undef HAVE_DOPRNT -/* Define if you have the vprintf function. */ -#undef HAVE_VPRINTF +/* Define if you have the nfds_t typedef. */ +#undef HAVE_NFDS_T -/* Define if you have the wait3 system call. */ -#undef HAVE_WAIT3 -/* Define as the return type of signal handlers (int or void). */ -#undef RETSIGTYPE +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H -/* Define if the `setpgrp' function takes no argument. */ -#undef SETPGRP_VOID +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#undef HAVE_LIBCRYPTO -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS +/* Define to 1 if you have the `c_r' library (-lc_r). */ +#undef HAVE_LIBC_R -/* Define if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL -/* Define if you have the regcomp function. */ -#undef HAVE_REGCOMP +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD -/* Define if you have the select function. */ -#undef HAVE_SELECT +/* Define to 1 if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET -/* Define if you have the socket function. */ -#undef HAVE_SOCKET +/* Define to 1 if you have the `ssl' library (-lssl). */ +#undef HAVE_LIBSSL -/* Define if you have the strcspn function. */ -#undef HAVE_STRCSPN +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H -/* Define if you have the strdup function. */ -#undef HAVE_STRDUP +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL -/* Define if you have the strtol function. */ -#undef HAVE_STRTOL +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET -/* Define if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H -/* Define if you have the <malloc.h> header file. */ -#undef HAVE_MALLOC_H +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H -/* Define if you have the <strings.h> header file. */ +/* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H -/* Define if you have the <sys/file.h> header file. */ -#undef HAVE_SYS_FILE_H +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H -/* Define if you have the <sys/ioctl.h> header file. */ -#undef HAVE_SYS_IOCTL_H +/* Define to 1 if you have the <sys/mman.h> header file. */ +#undef HAVE_SYS_MMAN_H -/* Define if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H -/* Define if you have the <syslog.h> header file. */ -#undef HAVE_SYSLOG_H +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H -/* Define if you have the <unistd.h> header file. */ +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H -/* Define if you have the c library (-lc). */ -#undef HAVE_LIBC +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT -/* Define if you have the crypto library (-lcrypto). */ -#undef HAVE_LIBCRYPTO +/* Define to the full name of this package. */ +#undef PACKAGE_NAME -/* Define if you have the nsl library (-lnsl). */ -#undef HAVE_LIBNSL +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING -/* Define if you have the og library (-log). */ -#undef HAVE_LIBOG +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME -/* Define if you have the socket library (-lsocket). */ -#undef HAVE_LIBSOCKET +/* Define to the version of this package. */ +#undef PACKAGE_VERSION -/* Define DEFAULT_CONFIG_FILE */ -#undef DEFAULT_CONFIG_FILE +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +#if HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *) -1) +#endif + +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + +#ifndef MAXPATHLEN +#define MAXPATHLEN 4096 +#endif + +#ifndef HAVE_NFDS_T +typedef unsigned int nfds_t; +#endif + +#endif /* _IMAPROXY_CONFIG_H */ Modified: trunk/imap_proxy/configure =================================================================== --- trunk/imap_proxy/configure 2010-07-25 06:37:19 UTC (rev 13995) +++ trunk/imap_proxy/configure 2010-07-25 06:59:40 UTC (rev 13996) @@ -1,26 +1,309 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.53. # +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -# Defaults: -ac_help= +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + + +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + + # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -29,10 +312,15 @@ silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -46,17 +334,9 @@ infodir='${prefix}/info' mandir='${prefix}/man' -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - ac_prev= for ac_option do - # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" @@ -64,59 +344,59 @@ continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; + cache_file=$ac_optarg ;; + --config-cache | -C) + cache_file=config.cache ;; + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -125,95 +405,47 @@ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in ... [truncated message content] |
From: <pdo...@us...> - 2010-07-25 07:18:17
|
Revision: 13998 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13998&view=rev Author: pdontthink Date: 2010-07-25 07:18:10 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.1 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/README trunk/imap_proxy/configure trunk/imap_proxy/configure.in trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/pkginfo trunk/imap_proxy/scripts/imapproxy.conf trunk/imap_proxy/src/config.c trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/request.c Added Paths: ----------- trunk/imap_proxy/README.known_issues Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/ChangeLog 2010-07-25 07:18:10 UTC (rev 13998) @@ -1,3 +1,66 @@ +2003-11-07 Dave McMurtrie <dav...@ho...> + + * Version 1.2.1 released. + +2003-10-23 Dave McMurtrie <dav...@ho...> + + * config.c: Fixed bug in SetBooleanValue doing upcase of Value. + +2003-10-22 Dave McMurtrie <dav...@ho...> + + * imapcommon.c: Fixed for loop for string literal detection. + explicitly clear errno prior to atol() call. + +2003-10-10 Dave McMurtrie <dav...@ho...> + + * main.c: Applied patch by Ken Murchison <ke...@oc...> to + discard "SASL" capability if advertised by a server. + +2003-10-09 Dave McMurtrie <dav...@ho...> + + * config.c: Added the ability to handle boolean config file options. + + * imapcommon.c: Added source port number to syslog messages. + Added the ability to send tcp keepalives. Added a poll() call + in IMAP_Literal_Read() so read calls can't block forever. + + * main.c: Changes to allow configurable tcp keelalive support. + Added retry logic for the initial socket connection to the + real imap server (patch submitted by Gary Mills + <mi...@cc...>). + + * request.c: Bugfix by Geoffrey Hort <g....@un...> submitted + to set TotalClientLogins to 0 in cmd_resetcounters. Changes to + allow syslogging of the client source port. Added timestamps + to protocol log entries. + + * README: Pruned some things from here and added to + README.known_issues. + + * README.known_issues: Newly added to the distribution. + +2003-07-14 Dave McMurtrie <dav...@ho...> + + * main.c: Applied patch by Gary Windham + <win...@em...> to add tcp wrappers support. + + * imapproxy.spec: Applied patch by William Hooper + <wh...@fr...> to enhance rpm support. + + * main.c, imapcommon.c, imapproxy.h: Applied patch by William + Yodlowsky <wyo...@an...> + to allow TLS to work on machines without /dev/random. + + * request.c: Removed erroneous newline from syslog() call to + prevent compiler warning. + +2003-07-07 Dave McMurtrie <dav...@ho...> + + * request.c: Applied patch by Gary Windham + <win...@em...> so Raw_Proxy() correctly deals + with string literals when the server responds with a NO or BAD + instead of a +. + 2003-05-22 Dave McMurtrie <dav...@ho...> * Version 1.2 released. Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/README 2010-07-25 07:18:10 UTC (rev 13998) @@ -28,14 +28,10 @@ ./configure make -If the configure script yells about not being able to find libcrypto or -other SSL related stuff, you'll have to specify the location of your OpenSSL -libraries when you invoke the configure script. Something like this should do -it: +If you encounter any problems with this, check out README.known_issues to +see if your problem is addressed in there. If not, ask on the list or file +a bug report. -./configure --with-openssl=/usr/local/ssl - - "make install" will attempt to install the following files: /usr/local/sbin/in.imapproxyd @@ -140,6 +136,11 @@ syslog(3C) manpage. Any of the possible priorities specified in the syslog(3C) manpage my be specified here. +send_tcp_keepalives +------------------- +Allows tcp keepalives to be enabled on all sockets if the tcp implementation +supports it. + tls_ca_file ----------- File containing one or more Certificate Authority (CA) certificates. Added: trunk/imap_proxy/README.known_issues =================================================================== --- trunk/imap_proxy/README.known_issues (rev 0) +++ trunk/imap_proxy/README.known_issues 2010-07-25 07:18:10 UTC (rev 13998) @@ -0,0 +1,68 @@ +README was starting to become too cluttered, so I split out a few known +issues that you may encounter and stuck them in this file. If you already +built up-imapproxy and didn't encounter any problems, you probably don't +need to read any further. + +------------------------------------------------------------------------------- +Problem: configure cannot find the openssl libraries. + +Symptom: When you run the configure script, you'll see an error + similar to the following: + +checking for EVP_DigestInit in -lcrypto... no +configure: error: Can't compile without OpenSSL crypto library!!! + +Fix: Tell configure where your OpenSSL libraries have been + installed to. For example: + + ./configure --with-openssl=/usr/local/ssl +------------------------------------------------------------------------------- + + +------------------------------------------------------------------------------- +Problem: Some versions of OpenSSL require kerberos 5 libraries. + +Symptom: When you run "make" you'll see a bunch of errors similar to the + following: + +In file included from /usr/include/openssl/ssl.h:179, +from include/imapproxy.h:102, +from src/icc.c:68: +/usr/include/openssl/kssl.h:72:18: krb5.h: No such file or directory +In file included from /usr/include/openssl/ssl.h:179, +from include/imapproxy.h:102, +from src/icc.c:68: +/usr/include/openssl/kssl.h:132: parse error before "krb5_enctype" +/usr/include/openssl/kssl.h:134: parse error before "FAR" +/usr/include/openssl/kssl.h:135: parse error before '}' token +...snipped... + +Fix: Tell configure where your kerberos 5 libraries have been installed + to. For example: + + ./configure --with-openssl=/usr/local/ssl --with-krb5=/usr/kerberos +------------------------------------------------------------------------------- + + +------------------------------------------------------------------------------- +Problem: Mac OSX (some versions) do not include a native poll implementation. + +Symptom: During make, the linker will complain that it cannot resove poll() + symbols. + +Fix: Install the poll implementation from www.clapper.org. +------------------------------------------------------------------------------- + + +------------------------------------------------------------------------------- +Problem: Tru64 Unix pthreads implementation requires a compiler flag -pthread + to be passed. + +Symptom: configure will complain that it can't find a pthreads implementation. + +Fix: This is not yet resolved. If you have a lot of free time, you can + monkey with the configure script to make the pthreads check succeed + then manually compile any modules that fail by passing the -pthread + argument to gcc. Ultimately, this will need to be fixed so the + configure script does the right thing. Patches welcome. +------------------------------------------------------------------------------- Modified: trunk/imap_proxy/configure =================================================================== --- trunk/imap_proxy/configure 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/configure 2010-07-25 07:18:10 UTC (rev 13998) @@ -830,6 +830,7 @@ --with-openssl-inc=DIR use OpenSSL headers from DIR --with-openssl-lib=DIR use OpenSSL libs from DIR --with-krb5=DIR use Kerberos5 rooted in DIR + --with-libwrap=DIR use libwrap rooted in DIR Some influential environment variables: CC C compiler command @@ -2595,6 +2596,11 @@ if test -d $with_openssl; then CPPFLAGS="${CPPFLAGS} -I${with_openssl}/include" LDFLAGS="${LDFLAGS} -L${with_openssl}/lib" + case "$target_os" in + solaris2*) + LDFLAGS="${LDFLAGS} -R${with_openssl}/lib" + ;; + esac fi @@ -2621,6 +2627,11 @@ if test -d $with_openssl_lib; then LDFLAGS="${LDFLAGS} -L${with_openssl_lib}" + case "$target_os" in + solaris2*) + LDFLAGS="${LDFLAGS} -R${with_openssl_lib}" + ;; + esac fi @@ -2640,6 +2651,170 @@ +# Check whether --with-libwrap or --without-libwrap was given. +if test "${with_libwrap+set}" = set; then + withval="$with_libwrap" + with_libwrap=$withval +else + with_libwrap=yes +fi; + +if test -d $with_libwrap; then + CPPFLAGS="${CPPFLAGS} -I${with_libwrap}/include" + LDFLAGS="${LDFLAGS} -L${with_libwrap}/lib" +fi + + +save_LIBS="$LIBS" +if test "$with_libwrap" != no; then + +echo "$as_me:$LINENO: checking for yp_get_default_domain in -lnsl" >&5 +echo $ECHO_N "checking for yp_get_default_domain in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_yp_get_default_domain+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yp_get_default_domain (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +yp_get_default_domain (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_yp_get_default_domain=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_nsl_yp_get_default_domain=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_yp_get_default_domain" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_yp_get_default_domain" >&6 +if test $ac_cv_lib_nsl_yp_get_default_domain = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBNSL 1 +_ACEOF + + LIBS="-lnsl $LIBS" + +else + + with_libwrap=no + { echo "$as_me:$LINENO: WARNING: nsl library not found!!! Wrappers will be disabled." >&5 +echo "$as_me: WARNING: nsl library not found!!! Wrappers will be disabled." >&2;} + +fi + + if test "$with_libwrap" != no; then + +echo "$as_me:$LINENO: checking for request_init in -lwrap" >&5 +echo $ECHO_N "checking for request_init in -lwrap... $ECHO_C" >&6 +if test "${ac_cv_lib_wrap_request_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lwrap $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char request_init (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +request_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_wrap_request_init=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_wrap_request_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_wrap_request_init" >&5 +echo "${ECHO_T}$ac_cv_lib_wrap_request_init" >&6 +if test $ac_cv_lib_wrap_request_init = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBWRAP 1 +_ACEOF + + LIBS="-lwrap $LIBS" + +else + + LIBS="$save_LIBS" + { echo "$as_me:$LINENO: WARNING: Wrappers library not found!!! Wrappers will be disabled." >&5 +echo "$as_me: WARNING: Wrappers library not found!!! Wrappers will be disabled." >&2;} + +fi + + fi +fi + + + echo "$as_me:$LINENO: checking for EVP_DigestInit in -lcrypto" >&5 echo $ECHO_N "checking for EVP_DigestInit in -lcrypto... $ECHO_C" >&6 if test "${ac_cv_lib_crypto_EVP_DigestInit+set}" = set; then Modified: trunk/imap_proxy/configure.in =================================================================== --- trunk/imap_proxy/configure.in 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/configure.in 2010-07-25 07:18:10 UTC (rev 13998) @@ -77,6 +77,32 @@ fi +dnl Set location of libwrap, the access control library +AC_ARG_WITH(libwrap, [ --with-libwrap=DIR use libwrap rooted in DIR], + with_libwrap=$withval, with_libwrap=yes) + +if test -d $with_libwrap; then + CPPFLAGS="${CPPFLAGS} -I${with_libwrap}/include" + LDFLAGS="${LDFLAGS} -L${with_libwrap}/lib" +fi + + +dnl Check for libwrap +save_LIBS="$LIBS" +if test "$with_libwrap" != no; then + AC_CHECK_LIB(nsl, yp_get_default_domain, , [ + with_libwrap=no + AC_WARN([nsl library not found!!! Wrappers will be disabled.]) + ]) + if test "$with_libwrap" != no; then + AC_CHECK_LIB(wrap, request_init, , [ + LIBS="$save_LIBS" + AC_WARN([Wrappers library not found!!! Wrappers will be disabled.]) + ]) + fi +fi + + dnl Check for crypto library AC_CHECK_LIB(crypto, EVP_DigestInit, , AC_ERROR([Can't compile without OpenSSL crypto library!!!]) Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 07:18:10 UTC (rev 13998) @@ -1,21 +1,28 @@ #This is imapproxy rpm spec file -%define ver 1.2 +%define ver 1.2.1rel %define rel 1 %define prefix /usr/local +%define withkrb5 0 +# Check for option at command line, ie: +# rpmbuild -bb imapproxy.spec --define 'with_krb5 1' +# with_krb5 indicates the Kerberos includes are needed (ie: Red Hat Linux 9) +%{?with_krb5:%define withkrb5 1} + Summary: Imapproxy Daemon Name: up-imapproxy Version: %ver Release: %rel Copyright: Dave McMurtrie Group: Networking/Daemons -Source0: ftp://ftp.pitt.edu/users/d/g/dgm/up-imapproxy-%{ver}.tar.gz +Source0: http://www.imapproxy.org/downloads/up-imapproxy-%{ver}.tar.gz Source1: imapproxy.conf Source2: imapproxy.init -Url: ftp://ftp.pitt.edu/users/d/g/dgm +Url: http://www.imapproxy.org Packager: Devrim SERAL <de...@ga...> -BuildRoot: /var/tmp/imapproxy-%{ver}-root +#BuildRoot: /var/tmp/imapproxy-%{ver}-root +BuildRoot: %{_tmppath}/%{name}-%{ver}-root %description This is a connection caching imapproxy daemon for proxied imap connections @@ -25,9 +32,13 @@ %build chmod 755 ./configure +#make clean - -./configure --with-prefix=%{prefix} +%if %{withkrb5} +./configure --with-prefix=%{prefix} --with-krb5=/usr/kerberos +%else +./configure --with-prefix=%{prefix} +%endif make OPT_FLAGS="$RPM_OPT_FLAGS" %install Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 07:18:10 UTC (rev 13998) @@ -33,12 +33,22 @@ ** ** RCS: ** -** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.13 2003/05/20 19:18:00 dgm Exp $ +** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/up-imapproxy-1.2.1/include/imapproxy.h,v $ +** $Id: imapproxy.h,v 1.1 2003/11/14 13:00:48 dgm Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.1 2003/11/14 13:00:48 dgm +** Initial revision +** +** Revision 1.15 2003/10/09 15:05:01 dgm +** Added tcp keepalive support. +** +** Revision 1.14 2003/07/14 16:41:18 dgm +** Applied patch by William Yodlowsky <wyo...@an...> to +** allow TLS to work on machines without /dev/random. +** ** Revision 1.13 2003/05/20 19:18:00 dgm ** Comment changes only. ** @@ -100,6 +110,8 @@ #if HAVE_LIBSSL #include <openssl/ssl.h> +#include <openssl/rand.h> +#include <limits.h> #endif @@ -200,6 +212,7 @@ unsigned int server_port; /* port we proxy to */ unsigned long cache_size; /* number of cache slots */ unsigned long cache_expiration_time; /* cache exp time in seconds */ + unsigned int send_tcp_keepalives; /* flag to send keepalives */ char *proc_username; /* username to run as */ char *proc_groupname; /* groupname to run as */ char *stat_filename; /* mmap()ed stat filename */ @@ -263,7 +276,7 @@ extern void HandleRequest( int ); extern char *memtok( char *, char *, char ** ); extern int imparse_isatom( const char * ); -extern ICD_Struct *Get_Server_conn( char *, char *, const char *, unsigned char ); +extern ICD_Struct *Get_Server_conn( char *, char *, const char *, in_port_t, unsigned char ); extern void ICC_Logout( char *, ICD_Struct * ); extern void ICC_Recycle( unsigned int ); extern void ICC_Recycle_Loop( void ); Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/pkginfo 2010-07-25 07:18:10 UTC (rev 13998) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2 +VERSION=1.2.1 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections Modified: trunk/imap_proxy/scripts/imapproxy.conf =================================================================== --- trunk/imap_proxy/scripts/imapproxy.conf 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/scripts/imapproxy.conf 2010-07-25 07:18:10 UTC (rev 13998) @@ -108,3 +108,13 @@ ## log messages. # #syslog_prioritymask LOG_WARNING + + +# +## send_tcp_keepalives +## +## This determines whether the SO_KEEPALIVE option will be set on all +## sockets. +# +send_tcp_keepalives no + Modified: trunk/imap_proxy/src/config.c =================================================================== --- trunk/imap_proxy/src/config.c 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/src/config.c 2010-07-25 07:18:10 UTC (rev 13998) @@ -35,11 +35,17 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/config.c,v $ -** $Id: config.c,v 1.6 2003/05/20 18:42:04 dgm Exp $ +** $Id: config.c,v 1.8 2003/10/23 06:18:58 dgm Exp $ ** ** Modification History: ** ** $Log: config.c,v $ +** Revision 1.8 2003/10/23 06:18:58 dgm +** Fixed bug in SetBooleanValue doing upcase of Value. +** +** Revision 1.7 2003/10/09 12:36:08 dgm +** Added the ability to set boolean configuration options. +** ** Revision 1.6 2003/05/20 18:42:04 dgm ** comment changes only. ** @@ -70,9 +76,11 @@ #include <errno.h> #include <string.h> +#include <strings.h> #include <syslog.h> #include <stdlib.h> #include <stdio.h> +#include <ctype.h> #include "common.h" #include "imapproxy.h" @@ -88,9 +96,9 @@ */ static void SetStringValue( char *, char **, unsigned int ); static void SetNumericValue( char *, int *, unsigned int ); +static void SetBooleanValue( char *, unsigned int *, unsigned int ); - /* * An array of Config_Structs will need to be allocated, one for * every possible keyword/value combination (plus a NULL). Note that @@ -212,7 +220,81 @@ } + + /*++ + * Function: SetBooleanValue + * + * Purpose: Common routine to assign true/false (or yes/no) values in + * the config options struct. + * + * Parameters: ptr to string value from configfile (yes, no, true, false) + * ptr to unsigned int -- where to store the boolean value (1/0) + * unsigned int -- Config file line number + * + * Returns: nada -- exit()s on errors. + * + * Authors: Dave McMurtrie <dav...@ho...> + * + * Notes: This function is not case sensitive. + * It will parse any of y, yes, true and store it as 1. + * It will parse any of n, no, false and store it as 0. + * + * Major note -- the Value passed into here will be upcased. + *-- + */ +static void SetBooleanValue( char *Value, + unsigned int *StoredValue, + unsigned int linenum ) +{ + char *fn = "SetBooleanValue()"; + char *CP; + + /* + * Upcase for ease of comparison + */ + CP = Value; + while( *CP ) + { + *CP = toupper( *CP ); + CP++; + } + + if ( ( ( Value[0] == 'Y' ) && ( Value[1] == '\0' ) ) || + ( ( Value[0] == 'Y' ) && ( Value[1] == 'E' ) && ( Value[2] == 'S' ) ) ) + { + *StoredValue = 1; + return; + } + + if ( ( ( Value[0] == 'N' ) && ( Value[1] == '\0' ) ) || + ( ( Value[0] == 'N' ) && ( Value[1] == 'O' ) ) ) + { + *StoredValue = 0; + return; + } + + if ( !strcmp( "TRUE", Value ) ) + { + *StoredValue = 1; + return; + } + + if ( !strcmp( "FALSE", Value ) ) + { + *StoredValue = 0; + return; + } + + syslog( LOG_WARNING, "%s: Invalid boolean value '%s' specified at line %d of config file. Defaulting to FALSE.", fn, Value, linenum ); + *StoredValue = 0; + return; +} + + + + +/*++ * Function: SetConfigOptions * * Purpose: Set global configuration options by reading and parsing @@ -294,8 +376,10 @@ ADD_TO_TABLE( "tls_key_file", SetStringValue, &PC_Struct.tls_key_file, index ); - + ADD_TO_TABLE( "send_tcp_keepalives", SetBooleanValue, + &PC_Struct.send_tcp_keepalives, index ); + ConfigTable[index].Keyword[0] = '\0'; FP = fopen( ConfigFile, "r" ); Modified: trunk/imap_proxy/src/imapcommon.c =================================================================== --- trunk/imap_proxy/src/imapcommon.c 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/src/imapcommon.c 2010-07-25 07:18:10 UTC (rev 13998) @@ -35,11 +35,24 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/imapcommon.c,v $ -** $Id: imapcommon.c,v 1.15 2003/05/20 18:49:53 dgm Exp $ +** $Id: imapcommon.c,v 1.18 2003/10/22 13:39:24 dgm Exp $ ** ** Modification History: ** ** $Log: imapcommon.c,v $ +** Revision 1.18 2003/10/22 13:39:24 dgm +** Fixed really bad bug in for loop for string literal detection. +** Explicitly clear errno prior to calling atol(). +** +** Revision 1.17 2003/10/09 12:53:49 dgm +** Added source port to syslog messages. Added ability to send +** tcp keepalives. Added a poll() call in IMAP_Literal_Read() so +** read calls can't block forever. +** +** Revision 1.16 2003/07/14 16:37:44 dgm +** Applied patch by William Yodlowsky <wyo...@an...> +** to allow TLS to work without /dev/random. +** ** Revision 1.15 2003/05/20 18:49:53 dgm ** Comment changes only. ** @@ -116,6 +129,7 @@ #endif #include <fcntl.h> #include <syslog.h> +#include <poll.h> /* * External globals @@ -130,9 +144,49 @@ #if HAVE_LIBSSL extern SSL_CTX *tls_ctx; -#endif +/*++ + * Function: SSLerrmessage + * + * Purpose: Obtain reason string for last SSL error + * + * Parameters: none + * + * Returns: SSL error text + * + * + * Authors: http://developer.postgresql.org/docs/pgsql/src/backend/libpq/be-secure.c + * + * Notes: Some caution is needed here since ERR_reason_error_string will + * return NULL if it doesn't recognize the error code. We don't + * want to return NULL ever. + * + * This function submitted as a patch by William Yodlowsky + * <wyo...@an...> + *-- + */ +static const char *SSLerrmessage( void ) +{ + unsigned long errcode; + const char *errreason; + static char errbuf[32]; + + errcode = ERR_get_error(); + if ( errcode == 0 ) + return "No SSL error reported"; + errreason = (const char *)ERR_reason_error_string( errcode ); + + if (errreason != NULL) + return errreason; + + snprintf(errbuf, sizeof( errbuf ) - 1, "SSL error code %lu", errcode); + return errbuf; +} + +#endif /* HAVE_LIBSSL */ + + /*++ * Function: LockMutex * @@ -204,6 +258,7 @@ * Parameters: ptr to username string * ptr to password string * const ptr to client hostname or IP string (for logging only) + * in_port_t, client port number (for logging only) * unsigned char - flag to indicate that the client sent the * password as a string literal. * @@ -219,6 +274,7 @@ extern ICD_Struct *Get_Server_conn( char *Username, char *Password, const char *ClientAddr, + in_port_t sin_port, unsigned char LiteralPasswd ) { char *fn = "Get_Server_conn()"; @@ -271,7 +327,7 @@ */ if ( memcmp( md5pw, ICC_Active->hashedpw, sizeof md5pw ) ) { - syslog( LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s) because password doesn't match.", fn, ICC_Active->server_conn->sd, Username, ClientAddr ); + syslog( LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s:%d) because password doesn't match.", fn, ICC_Active->server_conn->sd, Username, ClientAddr, sin_port ); ICC_Active->logouttime = 1; } else @@ -303,14 +359,14 @@ if ( !rc ) { - syslog(LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s). Connection closed by server.", fn, ICC_Active->server_conn->sd, Username, ClientAddr ); + syslog(LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s:%d). Connection closed by server.", fn, ICC_Active->server_conn->sd, Username, ClientAddr, sin_port ); ICC_Active->logouttime = 1; continue; } if ( errno != EWOULDBLOCK ) { - syslog(LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s). IMAP_read() error: %s", fn, ICC_Active->server_conn->sd, Username, ClientAddr, strerror( errno ) ); + syslog(LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s:%d). IMAP_read() error: %s", fn, ICC_Active->server_conn->sd, Username, ClientAddr, sin_port, strerror( errno ) ); ICC_Active->logouttime = 1; continue; } @@ -333,7 +389,7 @@ IMAPCount->PeakInUseServerConnections ) IMAPCount->PeakInUseServerConnections = IMAPCount->InUseServerConnections; - syslog(LOG_INFO, "LOGIN: '%s' (%s) on existing sd [%d]", Username, ClientAddr, ICC_Active->server_conn->sd ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) on existing sd [%d]", Username, ClientAddr, sin_port, ICC_Active->server_conn->sd ); return( ICC_Active->server_conn ); } } @@ -352,15 +408,20 @@ Server.conn->sd = socket( PF_INET, SOCK_STREAM, IPPROTO_TCP ); if ( Server.conn->sd == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: Unable to open server socket: %s", - Username, ClientAddr, strerror( errno ) ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Unable to open server socket: %s", Username, ClientAddr, sin_port, strerror( errno ) ); goto fail; } + + if ( PC_Struct.send_tcp_keepalives ) + { + int onoff = 1; + setsockopt( Server.conn->sd, SOL_SOCKET, SO_KEEPALIVE, &onoff, sizeof onoff ); + } if ( connect( Server.conn->sd, (struct sockaddr *)&ISD.srv, sizeof(ISD.srv) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: Unable to connect to IMAP server: %s", Username, ClientAddr, strerror( errno ) ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Unable to connect to IMAP server: %s", Username, ClientAddr, sin_port, strerror( errno ) ); goto fail; } @@ -369,7 +430,7 @@ if ( IMAP_Line_Read( &Server ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: No banner line received from IMAP server", Username, ClientAddr ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: No banner line received from IMAP server", Username, ClientAddr, sin_port ); goto fail; } @@ -467,8 +528,8 @@ rc = SSL_connect( Server.conn->tls ); if ( rc <= 0 ) { - syslog(LOG_INFO, "STARTTLS failed: SSL_connect() failed: %d", - SSL_get_error( Server.conn->tls, rc ) ); + syslog(LOG_INFO, "STARTTLS failed: SSL_connect() failed, %d: %s", + SSL_get_error( Server.conn->tls, rc ), SSLerrmessage() ); goto fail; } @@ -487,7 +548,7 @@ Username, strlen( Password ) ); if ( IMAP_Write( Server.conn, SendBuf, strlen(SendBuf) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: IMAP_Write() failed attempting to send LOGIN command to IMAP server: %s", Username, ClientAddr, strerror( errno ) ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: IMAP_Write() failed attempting to send LOGIN command to IMAP server: %s", Username, ClientAddr, sin_port, strerror( errno ) ); goto fail; } @@ -496,13 +557,13 @@ */ if ( ( rc = IMAP_Line_Read( &Server ) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: Failed to receive go-ahead from IMAP server after sending LOGIN command", Username, ClientAddr ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Failed to receive go-ahead from IMAP server after sending LOGIN command", Username, ClientAddr, sin_port ); goto fail; } if ( Server.ReadBuf[0] != '+' ) { - syslog( LOG_INFO, "LOGIN: '%s' (%s) failed: bad response from server after sending string literal specifier", Username, ClientAddr ); + syslog( LOG_INFO, "LOGIN: '%s' (%s:%d) failed: bad response from server after sending string literal specifier", Username, ClientAddr, sin_port ); goto fail; } @@ -513,7 +574,7 @@ if ( IMAP_Write( Server.conn, SendBuf, strlen( SendBuf ) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: IMAP_Write() failed attempting to send literal password to IMAP server: %s", Username, ClientAddr, strerror( errno ) ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: IMAP_Write() failed attempting to send literal password to IMAP server: %s", Username, ClientAddr, sin_port, strerror( errno ) ); goto fail; } } @@ -527,7 +588,7 @@ if ( IMAP_Write( Server.conn, SendBuf, strlen(SendBuf) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: IMAP_Write() failed attempting to send LOGIN command to IMAP server: %s", Username, ClientAddr, strerror( errno ) ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: IMAP_Write() failed attempting to send LOGIN command to IMAP server: %s", Username, ClientAddr, sin_port, strerror( errno ) ); goto fail; } } @@ -552,7 +613,7 @@ { if ( ( rc = IMAP_Line_Read( &Server ) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: No response from IMAP server after sending LOGIN command", Username, ClientAddr ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: No response from IMAP server after sending LOGIN command", Username, ClientAddr, sin_port ); goto fail; } @@ -574,7 +635,7 @@ * no tokens found in server response? Not likely, but we still * have to check. */ - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: server response to LOGIN command contained no tokens.", Username, ClientAddr ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: server response to LOGIN command contained no tokens.", Username, ClientAddr, sin_port ); goto fail; } @@ -585,7 +646,7 @@ * non-matching tag read back from the server... Lord knows what this * is, so we'll fail. */ - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: server response to LOGIN command contained non-matching tag.", Username, ClientAddr ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: server response to LOGIN command contained non-matching tag.", Username, ClientAddr, sin_port ); goto fail; } @@ -598,7 +659,7 @@ if ( !tokenptr ) { /* again, not likely but we still have to check... */ - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: Malformed server response to LOGIN command", Username, ClientAddr ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Malformed server response to LOGIN command", Username, ClientAddr, sin_port ); goto fail; } @@ -609,7 +670,7 @@ * server logs to figure out why. We don't have to break our ass here * putting the string back together just for the sake of logging. */ - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: non-OK server response to LOGIN command", Username, ClientAddr ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: non-OK server response to LOGIN command", Username, ClientAddr, sin_port ); goto fail; } @@ -658,7 +719,7 @@ if ( IMAPCount->InUseServerConnections > IMAPCount->PeakInUseServerConnections ) IMAPCount->PeakInUseServerConnections = IMAPCount->InUseServerConnections; - syslog(LOG_INFO, "LOGIN: '%s' (%s) on new sd [%d]", Username, ClientAddr, Server.conn->sd ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) on new sd [%d]", Username, ClientAddr, sin_port, Server.conn->sd ); return( Server.conn ); } @@ -675,7 +736,7 @@ */ if ( Expiration <= 2 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s) failed: Out of free ICC structs.", Username, ClientAddr ); + syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Out of free ICC structs.", Username, ClientAddr, sin_port ); goto fail; } @@ -859,6 +920,9 @@ */ extern int IMAP_Read( ICD_Struct *ICD, void *buf, int count ) { + char *fn = "IMAP_Read()"; + + #if HAVE_LIBSSL if ( ICD->tls ) return SSL_read( ICD->tls, buf, count ); @@ -888,6 +952,9 @@ { char *fn = "IMAP_Literal_Read()"; int Status, i, j; + struct pollfd fds[2]; + nfds_t nfds; + int pollstatus; /* * If there aren't any LiteralBytesRemaining, just return 0. @@ -929,7 +996,30 @@ * No data left in the buffer. Have to call read. Read either * the number of literal bytes left, or the rest of our buffer -- * whichever is smaller. - */ + * + */ + nfds = 1; + fds[0].fd = ITD->conn->sd; + fds[0].events = POLLIN; + fds[0].revents = 0; + + pollstatus = poll( fds, nfds, POLL_TIMEOUT ); + if ( !pollstatus ) + { + syslog( LOG_ERR, "%s: poll() for data on sd [%d] timed out.", fn, ITD->conn->sd ); + return( -1 ); + } + if ( pollstatus < 0 ) + { + syslog( LOG_ERR, "%s: poll() for data on sd [%d] failed: %s.", fn, ITD->conn->sd, strerror( errno ) ); + return( -1 ); + } + if ( !( fds[0].revents & POLLIN ) ) + { + syslog( LOG_ERR, "%s: poll() for data on sd [%d] returned nothing.", fn, ITD->conn->sd ); + return( -1 ); + } + Status = IMAP_Read(ITD->conn, &ITD->ReadBuf[ITD->BytesInReadBuffer], (sizeof ITD->ReadBuf - ITD->BytesInReadBuffer ) ); @@ -1077,7 +1167,7 @@ LiteralEnd = CP - 2; CP -= 2; - for ( ; LiteralEnd >= ITD->ReadBuf; CP-- ) + for ( ; CP >= ITD->ReadBuf; CP-- ) { if ( *CP == '{' ) { @@ -1086,53 +1176,58 @@ } } - if ( !LiteralStart ) + if ( LiteralStart ) { - /* - * we have a line ending with } but no beginning - * '{'. + /* + * We found an opening and closing { } pair. The + * thing in between should be a number specifying + * a byte count. That would be as much as we needed + * to know if it wasn't for the fact that RFC 2088 + * allows for a + sign in the literal specification + * that has a different meaning when a client is + * sending a literal to a server. */ - syslog(LOG_WARNING, "%s: Found line ending with '}' (expected string literal byte specification) but no opening '{' was found. No action taken.", fn); - return(0); - } + if ( *(LiteralEnd - 1) == '+' ) + { + ITD->NonSyncLiteral = 1; + } + else if ( *(LiteralEnd - 1) == '{' ) + { + /* + * This is a {}. No clue why any client + * would ever send this, but just pretend + * we never saw it. + */ + return( ITD->ReadBytesProcessed ); + } + else + { + ITD->NonSyncLiteral = 0; + } - /* - * We found an opening and closing { } pair. The - * thing in between should be a number specifying - * a byte count. That would be as much as we needed - * to know if it wasn't for the fact that RFC 2088 - * allows for a + sign in the literal specification - * that has a different meaning when a client is - * sending a literal to a server. - */ - if ( *(LiteralEnd - 1) == '+' ) - { - ITD->NonSyncLiteral = 1; - } - else - { - ITD->NonSyncLiteral = 0; - } - - /* To grab the number, bump our - * starting char pointer forward a byte and temporarily - * turn the closing '}' into a NULL. Don't worry about - * the potential '+' sign, atol won't care. - */ - LiteralStart++; - *LiteralEnd = '\0'; - ITD->LiteralBytesRemaining = atol( LiteralStart ); - - if ( ! ITD->LiteralBytesRemaining && errno ) - { - syslog(LOG_WARNING, "%s: atol() failed on string '%s': %s.", fn, CP, strerror(errno) ); + /* To grab the number, bump our + * starting char pointer forward a byte and temporarily + * turn the closing '}' into a NULL. Don't worry about + * the potential '+' sign, atol won't care. + */ + LiteralStart++; + *LiteralEnd = '\0'; + errno = 0; + ITD->LiteralBytesRemaining = atol( LiteralStart ); + + if ( ! ITD->LiteralBytesRemaining && errno ) + { + syslog(LOG_WARNING, "%s: atol() failed on string '%s': %s.", fn, CP, strerror(errno) ); + *LiteralEnd = '}'; + return(0); + } + *LiteralEnd = '}'; - return(0); } - - *LiteralEnd = '}'; } + + /* * This looks redundant, huh? */ Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/src/main.c 2010-07-25 07:18:10 UTC (rev 13998) @@ -36,11 +36,29 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.14 2003/05/20 19:04:23 dgm Exp $ +** $Id: main.c,v 1.17 2003/10/10 15:07:02 dgm Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.17 2003/10/10 15:07:02 dgm +** Patch by Ken Murchison <ke...@oc...> applied. Discard "SASL" +** capability if advertised by the server. This is a new extension +** that will be supported in Cyrus v2.2.2. +** +** Revision 1.16 2003/10/09 13:03:52 dgm +** Added configurable tcp keepalive support. Added retry logic for +** initial socket connection to imap server in SetBannerAndCapability() +** so it won't just fatally exit on ECONNREFUSED (submitted by Gary +** Mills <mi...@cc...>). +** +** Revision 1.15 2003/07/14 16:39:58 dgm +** Applied patch by William Yodlowsky <wyo...@an...> +** to allow TLS to work on machines without /dev/random. +** +** Applied patch by Gary Windham <win...@em...> to add +** tcp wrappers support. +** ** Revision 1.14 2003/05/20 19:04:23 dgm ** Comment changes only. ** @@ -98,7 +116,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.14 2003/05/20 19:04:23 dgm Exp $"; +static char *rcsId = "$Id: main.c,v 1.17 2003/10/10 15:07:02 dgm Exp $"; static char *rcsSource = "$Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dgm $"; @@ -130,6 +148,9 @@ #include <sys/param.h> #endif +#ifdef HAVE_LIBWRAP +#include <tcpd.h> +#endif /* * Global variables. Many of these things are global just as an optimization. @@ -160,6 +181,12 @@ static int set_cert_stuff( SSL_CTX *, const char *, const char * ); #endif +#ifdef HAVE_LIBWRAP +int allow_severity = LOG_DEBUG; +int deny_severity = LOG_ERR; +char *service; +#endif + /* * Internal Prototypes */ @@ -172,6 +199,7 @@ int main( int argc, char *argv[] ) { char *fn = "main()"; + char f_randfile[ PATH_MAX ]; int listensd; /* socket descriptor we'll bind to */ int clientsd; /* incoming socket descriptor */ int addrlen; @@ -188,6 +216,9 @@ extern char *optarg; extern int optind; char ConfigFile[ MAXPATHLEN ]; /* path to our config file */ +#ifdef HAVE_LIBWRAP + struct request_info r; /* request struct for libwrap */ +#endif flag = 1; ConfigFile[0] = '\0'; @@ -236,6 +267,15 @@ SetConfigOptions( ConfigFile ); SetLogOptions(); +#ifdef HAVE_LIBWRAP + /* + * Set our tcpd service name + */ + if (service = strrchr(argv[0], '/')) + service++; + else + service = argv[0]; +#endif /* * Initialize some stuff. @@ -287,6 +327,37 @@ memset( ICC_HashTable, 0, sizeof ICC_HashTable ); ServerInit(); + + /* detach from our parent if necessary */ + if (! (getppid() == 1) ) + { + if ( (pid = fork()) < 0) + { + syslog(LOG_ERR, "%s: initial call to fork() failed: %s", fn, strerror(errno)); + exit( 1 ); + } + else if ( pid > 0) + { + exit( 0 ); + } + + if (setsid() == -1) + { + syslog(LOG_WARNING, "%s: setsid() failed: %s", + fn, strerror(errno)); + } + if ( (pid = fork()) < 0) + { + syslog(LOG_ERR, "%s: secondary call to fork() failed: %s", fn, + strerror(errno)); + exit( 1 ); + } + else if ( pid > 0) + { + exit( 0 ); + } + } + if ( SetBannerAndCapability() ) { @@ -301,6 +372,15 @@ { /* Initialize SSL_CTX */ SSL_library_init(); + + /* Need to seed PRNG, too! */ + if ( RAND_egd( RAND_file_name( f_randfile, sizeof( f_randfile ) ) ) < 0) + { + /* Not an EGD, so read and write it. */ + if ( RAND_load_file( f_randfile, -1 ) ) + RAND_write_file( f_randfile ); + } + SSL_load_error_strings(); tls_ctx = SSL_CTX_new( TLSv1_client_method() ); if ( tls_ctx == NULL ) @@ -340,36 +420,8 @@ } } - /* detach from our parent if necessary */ - if (! (getppid() == 1) ) - { - if ( (pid = fork()) < 0) - { - syslog(LOG_ERR, "%s: initial call to fork() failed: %s", fn, strerror(errno)); - exit( 1 ); - } - else if ( pid > 0) - { - exit( 0 ); - } - - if (setsid() == -1) - { - syslog(LOG_WARNING, "%s: setsid() failed: %s", - fn, strerror(errno)); - } - if ( (pid = fork()) < 0) - { - syslog(LOG_ERR, "%s: secondary call to fork() failed: %s", fn, - strerror(errno)); - exit( 1 ); - } - else if ( pid > 0) - { - exit( 0 ); - } - } + memset( (char *) &srvaddr, 0, sizeof srvaddr ); srvaddr.sin_family = PF_INET; srvaddr.sin_addr.s_addr = htonl(INADDR_ANY); @@ -390,7 +442,15 @@ lingerstruct.l_linger = 5; setsockopt(listensd, SOL_SOCKET, SO_LINGER, (void *)&lingerstruct, sizeof(lingerstruct)); - + + if ( PC_Struct.send_tcp_keepalives ) + { + lingerstruct.l_onoff = 1; + syslog( LOG_INFO, "%s: Enabling SO_KEEPALIVE.", fn ); + setsockopt( listensd, SOL_SOCKET, SO_KEEPALIVE, (void *)&lingerstruct.l_onoff, sizeof lingerstruct.l_onoff ); + } + + if ( bind(listensd, (struct sockaddr *)&srvaddr, sizeof( srvaddr ) ) < 0 ) { syslog(LOG_ERR, "%s: bind() failed: %s", fn, strerror(errno) ); @@ -491,6 +551,19 @@ continue; } +#ifdef HAVE_LIBWRAP + request_init(&r, RQ_DAEMON, service, 0); + request_set(&r, RQ_FILE, clientsd, 0); + sock_host(&r); + if (!hosts_access(&r)) + { + shutdown(clientsd, SHUT_RDWR); + close(clientsd); + syslog(deny_severity, "refused connection from %s", eval_client(&r)); + continue; + } +#endif + IMAPCount->TotalClientConnectionsAccepted++; IMAPCount->CurrentClientConnections++; @@ -664,23 +737,35 @@ int BytesRead; char *fn = "SetBannerAndCapability()"; char *CP; + int NumRef = 0; /* initialize some stuff */ memset( &itd, 0, sizeof itd ); - sd = socket( PF_INET, SOCK_STREAM, IPPROTO_TCP ); - if ( sd == -1 ) + for ( ;; ) { - syslog(LOG_ERR, "%s: socket() failed: %s", fn, strerror(errno) ); - return( -1 ); + sd = socket( PF_INET, SOCK_STREAM, IPPROTO_TCP ); + if ( sd == -1 ) + { + syslog(LOG_ERR, "%s: socket() failed: %s", fn, strerror(errno) ); + return( -1 ); + } + + if ( connect( sd, (struct sockaddr *)&ISD.srv, sizeof(ISD.srv) ) == -1 ) + { + syslog(LOG_ERR, "%s: connect() to imap server on socket [%d] failed: %s", fn, sd, strerror(errno)); + close( sd ); + + if ( errno == ECONNREFUSED && ++NumRef < 10 ) + { + sleep( 60 ); /* IMAP server may not be started yet. */ + continue; + } + return( -1 ); + } + break; /* Success */ } - if ( connect( sd, (struct sockaddr *)&ISD.srv, sizeof(ISD.srv) ) == -1 ) - { - syslog(LOG_ERR, "%s: connect() to imap server on socket [%d] failed: %s", fn, sd, strerror(errno)); - close( sd ); - return(-1); - } memset( &conn, 0, sizeof ( ICD_Struct ) ); itd.conn = &conn; @@ -809,9 +894,20 @@ */ if ( ! strncasecmp( CP, "AUTH=", strlen( "AUTH=" ) ) && ( strncasecmp( CP, "AUTH=LOGIN", strlen( "AUTH=LOGIN" ) ) ) ) + { continue; + } /* + * If this token happens to be SASL, we want to discard it + * since we don't support any auth mechs that can use it. + */ + if ( !strncasecmp( CP, "SASL", strlen( "SASL" ) ) ) + { + continue; + } + + /* * If this token happens to be STARTTLS, we want to discard it * since we don't support it on the client-side. */ Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 07:01:44 UTC (rev 13997) +++ trunk/imap_proxy/src/request.c 2010-07-25 07:18:10 UTC (rev 13998) @@ -39,11 +39,25 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.14 2003/05/20 19:11:25 dgm Exp $ +** $Id: request.c,v 1.17 2003/10/09 14:11:13 dgm Exp $ ** ** Modification History: ** ** $Log: request.c,v $ +** Revision 1.17 2003/10/09 14:11:13 dgm +** bugfix: set TotalClientLogins to zero in cmd_resetcounters, submitted +** by Geoffrey Hort <g....@un...>. Changes to allow syslogging of the +** client source port. Added timestamps to protocol log entries. +** +** Revision 1.16 2003/07/14 16:26:02 dgm +** Removed erroneous newline from syslog() call to prevent compiler +** warning. +** +** Revision 1.15 2003/07/07 13:31:09 dgm +** Bugfix by Gary Windham <win...@em...>. Raw_Proxy() loop +** was not dealing with string literals correctly when the server +** responded with something other than a '+'. +** ** Revision 1.14 2003/05/20 19:11:25 dgm ** Comment changes only. ** @@ -257,7 +271,11 @@ unsigned int BufLen = BUFSIZE -1; SendBuf[BufLen] = '\0'; - + + /* + * Bugfix by Geoffrey Hort <g....@un...> -- I forgot to zero + * out TotalClientLogins... + */ IMAPCount->CountTime = time( 0 ); IMAPCount->PeakClientConnections = 0; IMAPCount->PeakInUseServerConnections = 0; @@ -265,6 +283,7 @@ IMAPCount->TotalClientConnectionsAccepted = 0; IMAPCount->TotalServerConnectionsCreated = 0; IMAPCount->TotalServerConnectionsReused = 0; + IMAPCount->TotalClientLogins = 0; snprintf( SendBuf, BufLen, "%s OK Completed\r\n", Tag ); @@ -377,7 +396,7 @@ if ( !Username ) { - snprintf( SendBuf, BufLen, "\n\n-----> C= %s PROXY: user tracing disabled. Expect further output until client logout.\n", TraceUser ); + snprintf( SendBuf, BufLen, "\n\n-----> C= %d %s PROXY: user tracing disabled. Expect further output until client logout.\n", time( 0 ), TraceUser ); write( Tracefd, SendBuf, strlen( SendBuf ) ); memset( TraceUser, 0, sizeof TraceUser ); @@ -420,7 +439,7 @@ return( -1 ); } - snprintf( SendBuf, BufLen, "\n\n-----> C= %s PROXY: user tracing enabled.\n", TraceUser ); + snprintf( SendBuf, BufLen, "\n\n-----> C= %d %s PROXY: user tracing enabled.\n", time( 0 ), TraceUser ); write( Tracefd, SendBuf, strlen( SendBuf ) ); UnLockMutex( &trace ); @@ -561,6 +580,7 @@ struct sockaddr_in cli_addr; int addrlen; char *hostaddr; + in_port_t sin_port; unsigned int BufLen = BUFSIZE - 1; memset ( &Server, 0, sizeof Server ); @@ -627,8 +647,7 @@ if ( IMAP_Write( Client->conn, SendBuf, strlen(SendBuf) ) == -1 ) { - syslog(LOG_ERR, "%s: Unable to send base64 encoded password prompt to -client: %s", fn, strerror(errno) ); + syslog(LOG_ERR, "%s: Unable to send base64 encoded password prompt to client: %s", fn, strerror(errno) ); return( -1 ); } @@ -660,6 +679,7 @@ } hostaddr = inet_ntoa( ( ( struct sockaddr_in *)&cli_addr )->sin_addr ); + sin_port = ntohs( cli_addr.sin_port ); if ( !hostaddr ) { @@ -673,7 +693,7 @@ * he needs to login. This is just in case there are any special * characters in the password that we decoded. */ - conn = Get_Server_conn( Username, Password, hostaddr, LITERAL_PASSWORD ); + conn = Get_Server_conn( Username, Password, hostaddr, sin_port, LITERAL_PASSWORD ); /* * all the code from here to the end is basically identical to that @@ -779,6 +799,7 @@ struct sockaddr_in cli_addr; int addrlen; char *hostaddr; + in_port_t sin_port; memset( &Server, 0, sizeof Server ); @@ -791,6 +812,7 @@ } hostaddr = inet_ntoa( ( ( struct sockaddr_in *)&cli_addr )->sin_addr ); + sin_port = ntohs( cli_addr.sin_port ); if ( !hostaddr ) { @@ -798,7 +820,7 @@ return( -1 ); } - conn = Get_Server_conn( Username, Password, hostaddr, LiteralLogin ); + conn = Get_Server_conn( Username, Password, hostaddr, sin_port, LiteralLogin ); /* * wipe out the passwd so we don't have it sitting in memory somewhere. @@ -809,7 +831,7 @@ if ( conn == NULL ) { /* - * All logging is done in Get_Server_sd, so don't bother to + * All logging is done in Get_Server_conn, so don't bother to * log anything here. */ snprintf( SendBuf, BufLen, "%s NO LOGIN failed\r\n", Tag ); @@ -1034,7 +1056,7 @@ if ( Server->TraceOn ) { - snprintf( TraceBuf, sizeof TraceBuf - 1, "\n\n-----> C= %s SERVER: sd [%d]\n", ( (TraceUser) ? TraceUser : "Null username" ), Server->conn->sd ); + snprintf( TraceBuf, sizeof TraceBuf - 1, "\n\n-----> C= %d %s SERVER: sd [%d]\n", time( 0 ), ( (TraceUser) ? TraceUser : "Null username" ), Server->conn->sd ); write( Tracefd, TraceBuf, strlen( TraceBuf ) ); write( Tracefd, Server->ReadBuf, status ); } @@ -1080,7 +1102,7 @@ if ( Client->TraceOn ) { - snprintf( TraceBuf, sizeof TraceBuf - 1, "\n\n-----> C= %s CLIENT: sd [%d]\n", ( (TraceUser) ? TraceUser : "Null username" ), Client->conn->sd ); + snprintf( TraceBuf, sizeof TraceBuf - 1, "\n\n-----> C= %d %s CLIENT: sd [%d]\n", time( 0 ), ( (TraceUser) ? TraceUser : "Null username" ), Client->conn->sd ); write( Tracefd, TraceBuf, strlen( TraceBuf ) ); write( Tracefd, Client->ReadBuf, status ); } @@ -1200,11 +1222,14 @@ status = IMAP_Line_Read( Server ); if ( Server->TraceOn ) { - snprintf( TraceBuf, sizeof TraceBuf - 1, "\n\n-----> C= %s SERVER: sd [%d]\n", ( (TraceUser) ? TraceUser : "Null username" ), Server->conn->sd ); + snprintf( TraceBuf, sizeof TraceBuf - 1, "\n\n-----> C= %d %s SERVER: sd [%d]\n", time( 0 ), ( (TraceUser) ? TraceUser : "Null username" ), Server->conn->sd ); write( Tracefd, TraceBuf, strlen( TraceBuf ) ); write( Tracefd, Server->ReadBuf, status ); } + if ( Server->ReadBuf[0] != '+' ) + Client->LiteralBytesRemaining = 0; + for ( ; ; ) { BytesSent = IMAP_Write( Client->conn, Server->ReadBuf, status ); @@ -1219,7 +1244,6 @@ break; } } - while ( Client->LiteralBytesRemaining ) { @@ -1233,7 +1257,7 @@ if ( Client->TraceOn ) { - snprintf( TraceBuf, sizeof TraceBuf - 1, "\n\n-----> C= %s CLIENT: sd [%d]\n", ( (TraceUser) ? TraceUser : "Null username" ), Client->conn->sd ); + snprintf( TraceBuf, sizeof TraceBuf - 1, "\n\n-----> C= %d %s CLIENT: sd [%d]\n", time( 0 ), ( (TraceUser) ? TraceUser : "Null username" ), Client->conn->sd ); write( Tracefd, TraceBuf, strlen( TraceBuf ) ); write( Tracefd, Client->ReadBuf, status ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 07:28:48
|
Revision: 14000 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14000&view=rev Author: pdontthink Date: 2010-07-25 07:28:41 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.2-devel Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/Makefile.in trunk/imap_proxy/README trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/scripts/imapproxy.conf trunk/imap_proxy/src/config.c trunk/imap_proxy/src/icc.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/pimpstat.c trunk/imap_proxy/src/request.c Added Paths: ----------- trunk/imap_proxy/src/select.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 07:19:03 UTC (rev 13999) +++ trunk/imap_proxy/ChangeLog 2010-07-25 07:28:41 UTC (rev 14000) @@ -1,3 +1,22 @@ +2003-11-14 Dave McMurtrie <dav...@ho...> + + * imapproxy.h: Included patches by Geoffrey Hort <g....@un...> + to allow configurable listen address. + + * imapproxy.h: Changed default buffer size from 1024 to 4096. + + * imapproxy.conf: Patch by Geoffrey Hort <g....@un...> to + include default listen_address config option. + + * config.c: Patch by Geoffrey Hort <g....@un...> to allow + configurable listen address. + + * main.c: Patch by Geoffrey Hort <g....@un...> to allow + configurable listen address. + + * main.c: Updated prior patch (2003-10-10) by Ken Murchison. The + token we're discarding is now "SASL-IR" instead of "SASL". + 2003-11-07 Dave McMurtrie <dav...@ho...> * Version 1.2.1 released. Modified: trunk/imap_proxy/Makefile.in =================================================================== --- trunk/imap_proxy/Makefile.in 2010-07-25 07:19:03 UTC (rev 13999) +++ trunk/imap_proxy/Makefile.in 2010-07-25 07:28:41 UTC (rev 14000) @@ -47,7 +47,8 @@ # Object files XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o \ - ./src/hash.o ./src/becomenonroot.o ./src/config.o ./src/logging.o + ./src/hash.o ./src/becomenonroot.o ./src/config.o ./src/logging.o \ + ./src/select.o TAT_OBJ = ./src/pimpstat.o ./src/config.o # Final targets Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 07:19:03 UTC (rev 13999) +++ trunk/imap_proxy/README 2010-07-25 07:28:41 UTC (rev 14000) @@ -162,6 +162,10 @@ File containing the private key belonging to the client certificate. See README.ssl for more information. +enable_select_cache +------------------- +Allows SELECT data caching to be enabled or disabled. + ############################################################################## ADDITIONAL COMMANDS: ############################################################################## Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 07:19:03 UTC (rev 13999) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 07:28:41 UTC (rev 14000) @@ -33,14 +33,16 @@ ** ** RCS: ** -** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/up-imapproxy-1.2.1/include/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.1 2003/11/14 13:00:48 dgm Exp $ +** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ +** $Id: imapproxy.h,v 1.16 2003/11/14 15:06:14 dgm Exp dgm $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ -** Revision 1.1 2003/11/14 13:00:48 dgm -** Initial revision +** Revision 1.16 2003/11/14 15:06:14 dgm +** Patch by Geoffrey Hort <g....@un...> to include listen_address +** config option. Also, I changed the default buffer size from +** 1024 to 4096. ** ** Revision 1.15 2003/10/09 15:05:01 dgm ** Added tcp keepalive support. @@ -121,13 +123,19 @@ #define PGM "in.imapproxyd" #define IMAP_UNTAGGED_OK "* OK " /* untagged OK response */ #define IMAP_TAGGED_OK "1 OK " /* tagged OK response */ -#define BUFSIZE 1024 /* default buffer size */ +#define BUFSIZE 4096 /* default buffer size */ #define MAX_CONN_BACKLOG 5 /* tcp connection backlog */ #define MAXTAGLEN 256 /* max IMAP tag length */ +#define MAXMAILBOXNAME 512 /* max mailbox name length */ #define MAXUSERNAMELEN 64 /* max username length */ #define MAXPASSWDLEN 64 /* max passwd length */ #define POLL_TIMEOUT_MINUTES 30 /* Poll timeout in minutes */ #define POLL_TIMEOUT (POLL_TIMEOUT_MINUTES * 60000) +#define SELECT_BUF_SIZE 1024 /* max length of a SELECT */ + /* string we can cache */ +#define SELECT_CACHE_EXP 10 /* # of seconds before we */ + /* expire a SELECT cache */ +#define SELECT_STATUS_BUF_SIZE 256 /* size of select status */ #ifndef DEFAULT_CONFIG_FILE #define DEFAULT_CONFIG_FILE "/etc/imapproxy.conf" @@ -156,6 +164,18 @@ /* + * IMAPSelectCaches provide for caching of SELECT output from an IMAP server + */ +struct IMAPSelectCache +{ + time_t ISCTime; + char MailboxName[ MAXMAILBOXNAME ]; + char SelectString[ SELECT_BUF_SIZE ]; + char SelectStatus[ SELECT_STATUS_BUF_SIZE ]; +}; + + +/* * IMAPConnectionDescriptors contain the info needed to communicate on an * IMAP connection. */ @@ -165,6 +185,7 @@ #if HAVE_LIBSSL SSL *tls; /* TLS connection context */ #endif + struct IMAPSelectCache ISC; /* Cached SELECT data */ }; @@ -208,11 +229,13 @@ struct ProxyConfig { unsigned int listen_port; /* port we bind to */ + char *listen_addr; /* address we bind to */ char *server_hostname; /* server we proxy to */ unsigned int server_port; /* port we proxy to */ unsigned long cache_size; /* number of cache slots */ unsigned long cache_expiration_time; /* cache exp time in seconds */ unsigned int send_tcp_keepalives; /* flag to send keepalives */ + unsigned int enable_select_cache; /* flag to enable select cache */ char *proc_username; /* username to run as */ char *proc_groupname; /* groupname to run as */ char *stat_filename; /* mmap()ed stat filename */ @@ -254,6 +277,9 @@ unsigned long TotalClientLogins; unsigned long TotalServerConnectionsCreated; unsigned long TotalServerConnectionsReused; + unsigned long TotalSelectCommands; + unsigned long SelectCacheHits; + unsigned long SelectCacheMisses; }; @@ -264,8 +290,8 @@ typedef struct IMAPConnectionContext ICC_Struct; typedef struct IMAPCounter IMAPCounter_Struct; typedef struct ProxyConfig ProxyConfig_Struct; +typedef struct IMAPSelectCache ISC_Struct; - /* * Function prototypes for external entry points. */ @@ -284,6 +310,9 @@ extern void UnLockMutex( pthread_mutex_t * ); extern void SetConfigOptions( char * ); extern void SetLogOptions( void ); +extern int Handle_Select_Command( ITD_Struct *, ITD_Struct *, ISC_Struct *, char *, int ); +extern unsigned int Is_Safe_Command( char *Command ); +extern void Invalidate_Cache_Entry( ISC_Struct * ); #endif /* __IMAPPROXY_H */ Modified: trunk/imap_proxy/scripts/imapproxy.conf =================================================================== --- trunk/imap_proxy/scripts/imapproxy.conf 2010-07-25 07:19:03 UTC (rev 13999) +++ trunk/imap_proxy/scripts/imapproxy.conf 2010-07-25 07:28:41 UTC (rev 14000) @@ -35,6 +35,16 @@ # +## listen_address +## +## This setting specifies which address the proxy server will bind to and +## accept incoming connections to. If undefined, bind to all. +## Must be a dotted decimal IP address. +# +#listen_address 127.0.0.1 + + +# ## server_port ## ## This setting specifies the port that server_hostname is listening on. @@ -118,3 +128,12 @@ # send_tcp_keepalives no + +# +## enable_select_cache +## +## This configuration option allows you to turn select caching on or off. +## When select caching is enabled, up-imapproxy will cache SELECT responses +## from an imap server. +# +enable_select_cache yes Modified: trunk/imap_proxy/src/config.c =================================================================== --- trunk/imap_proxy/src/config.c 2010-07-25 07:19:03 UTC (rev 13999) +++ trunk/imap_proxy/src/config.c 2010-07-25 07:28:41 UTC (rev 14000) @@ -35,11 +35,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/config.c,v $ -** $Id: config.c,v 1.8 2003/10/23 06:18:58 dgm Exp $ +** $Id: config.c,v 1.9 2003/11/14 15:03:58 dgm Exp dgm $ ** ** Modification History: ** ** $Log: config.c,v $ +** Revision 1.9 2003/11/14 15:03:58 dgm +** Patch by Geoffrey Hort <g....@un...> to allow +** configurable listen address. +** ** Revision 1.8 2003/10/23 06:18:58 dgm ** Fixed bug in SetBooleanValue doing upcase of Value. ** @@ -338,6 +342,9 @@ ADD_TO_TABLE( "listen_port", SetNumericValue, &PC_Struct.listen_port, index ); + ADD_TO_TABLE( "listen_address", SetStringValue, + &PC_Struct.listen_addr, index ); + ADD_TO_TABLE( "server_port", SetNumericValue, &PC_Struct.server_port, index ); @@ -380,6 +387,9 @@ ADD_TO_TABLE( "send_tcp_keepalives", SetBooleanValue, &PC_Struct.send_tcp_keepalives, index ); + ADD_TO_TABLE( "enable_select_cache", SetBooleanValue, + &PC_Struct.enable_select_cache, index ); + ConfigTable[index].Keyword[0] = '\0'; FP = fopen( ConfigFile, "r" ); Modified: trunk/imap_proxy/src/icc.c =================================================================== --- trunk/imap_proxy/src/icc.c 2010-07-25 07:19:03 UTC (rev 13999) +++ trunk/imap_proxy/src/icc.c 2010-07-25 07:28:41 UTC (rev 14000) @@ -34,7 +34,7 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/icc.c,v $ -** $Id: icc.c,v 1.5 2003/05/20 18:46:49 dgm Exp $ +** $Id: icc.c,v 1.5 2003/05/20 18:46:49 dgm Exp dgm $ ** ** Modification History: ** @@ -134,7 +134,11 @@ Expiration ) ) { syslog(LOG_INFO, "Expiring server sd [%d]", HashEntry->server_conn->sd); - /* Close the server socket. */ + /* Logout of the imap server and close the server socket. */ + + IMAP_Write( HashEntry->server_conn, "VIC20 LOGOUT\r\n", + strlen( "VIC20 LOGOUT\r\n" ) ); + #if HAVE_LIBSSL if ( HashEntry->server_conn->tls ) { Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 07:19:03 UTC (rev 13999) +++ trunk/imap_proxy/src/main.c 2010-07-25 07:28:41 UTC (rev 14000) @@ -36,11 +36,17 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.17 2003/10/10 15:07:02 dgm Exp $ +** $Id: main.c,v 1.18 2003/11/14 14:59:44 dgm Exp dgm $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.18 2003/11/14 14:59:44 dgm +** Applied patches by Geoffrey Hort <g....@un...> to allow +** configurable listen address. Discard token "SASL-IR" if server +** advertises it as a capability (previously, we were discarding +** "SASL"). Reference Revision 1.17 of this source module. +** ** Revision 1.17 2003/10/10 15:07:02 dgm ** Patch by Ken Murchison <ke...@oc...> applied. Discard "SASL" ** capability if advertised by the server. This is a new extension @@ -116,7 +122,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.17 2003/10/10 15:07:02 dgm Exp $"; +static char *rcsId = "$Id: main.c,v 1.18 2003/11/14 14:59:44 dgm Exp dgm $"; static char *rcsSource = "$Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dgm $"; @@ -190,7 +196,9 @@ /* * Internal Prototypes */ -static int SetBannerAndCapability( void ); +static void SetBannerAndCapability( void ); +static int ParseBannerAndCapability( char *, unsigned int, + char *, unsigned int ); static void ServerInit( void ); static void Usage( void ); @@ -266,7 +274,15 @@ SetConfigOptions( ConfigFile ); SetLogOptions(); - + + /* + * Just for logging purposes, are we doing SELECT caching or not? + */ + if ( PC_Struct.enable_select_cache ) + syslog( LOG_INFO, "%s: SELECT caching is enabled", fn ); + else + syslog( LOG_INFO, "%s: SELECT caching is disabled", fn ); + #ifdef HAVE_LIBWRAP /* * Set our tcpd service name @@ -358,13 +374,8 @@ } } + SetBannerAndCapability(); - if ( SetBannerAndCapability() ) - { - syslog(LOG_ERR, "%s: Failed to get banner string and capability from imap server. Exiting.", fn); - exit( 1 ); - } - if ( PC_Struct.login_disabled ) { #if HAVE_LIBSSL @@ -424,9 +435,18 @@ memset( (char *) &srvaddr, 0, sizeof srvaddr ); srvaddr.sin_family = PF_INET; - srvaddr.sin_addr.s_addr = htonl(INADDR_ANY); + if ( !PC_Struct.listen_addr ) + { + srvaddr.sin_addr.s_addr = htonl(INADDR_ANY); + } + else if ( ( srvaddr.sin_addr.s_addr = inet_addr( PC_Struct.listen_addr) ) == -1 ) + { + syslog( LOG_ERR, "%s: bad bind address: '%s' specified in config file. Exiting.", fn, PC_Struct.listen_addr ); + exit( 1 ); + } - syslog(LOG_INFO, "%s: Binding to tcp port %d", fn, PC_Struct.listen_port ); + syslog(LOG_INFO, "%s: Binding to tcp %s:%d", fn, PC_Struct.listen_addr ? + PC_Struct.listen_addr : "*", PC_Struct.listen_port ); srvaddr.sin_port = htons(PC_Struct.listen_port); listensd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); @@ -708,7 +728,135 @@ +/*++ + * Function: ParseBannerAndCapability + * + * Purpose: Weed out stuff that imapproxy does not support from a banner + * line or a capability line. + * + * Parameters: char * - Buffer for storing the cleaned up string. + * unsigned int - buflen + * char * - ptr to the string that needs to be cleaned up. + * unsigned int - buflen + * + * Returns: Number of bytes in the output string. + * exit()s on failure. + * + * Authors: Dave McMurtrie <dav...@ho...> + * + * Notes: The buffer that the third argument points to will be tokenized + * so make a copy of it first if you care about that. + *-- + */ +static int ParseBannerAndCapability( char *DestBuf, + unsigned int DestBufSize, + char *SourceBuf, + unsigned int SourceBufSize ) +{ + char *fn = "ParseBannerAndCapability"; + char *CP; + + if ( SourceBufSize >= DestBufSize ) + { + syslog( LOG_ERR, "%s: Unable to parse banner or capability because it would cause a buffer overflow -- exiting.", fn ); + exit( 1 ); + } + + + /* + * strip out all of the AUTH mechanisms except the ones that we support. + * Right now, this is just AUTH=LOGIN. Note that the use of + * non-MT safe strtok is okay here. This function is called before any + * other threads are launched and should never be called again. + */ + SourceBuf[SourceBufSize - 2] = '\0'; + CP = strtok( SourceBuf, " " ); + + if ( !CP ) + { + syslog( LOG_ERR, "%s: No tokens found in banner or capability from IMAP server -- exiting.", fn); + exit( 1 ); + } + + sprintf( DestBuf, CP ); + + /* + * initially assume that the server doesn't support UNSELECT. + */ + PC_Struct.support_unselect = UNSELECT_NOT_SUPPORTED; + /* + * initially assume that the server doesn't support STARTTLS. + */ + PC_Struct.support_starttls = STARTTLS_NOT_SUPPORTED; + + /* + * initially assume that the server doesn't disable LOGIN. + */ + PC_Struct.login_disabled = LOGIN_NOT_DISABLED; + + for( ; ; ) + { + CP = strtok( NULL, " " ); + + if ( !CP ) + break; + + if ( !strncasecmp( CP, "UNSELECT", strlen( "UNSELECT" ) ) ) + { + PC_Struct.support_unselect = UNSELECT_SUPPORTED; + } + + /* + * If this token happens to be an auth mechanism, we want to + * discard it unless it's an auth mechanism we can support. + */ + if ( ! strncasecmp( CP, "AUTH=", strlen( "AUTH=" ) ) && + ( strncasecmp( CP, "AUTH=LOGIN", strlen( "AUTH=LOGIN" ) ) ) ) + { + continue; + } + + /* + * If this token happens to be SASL-IR, we want to discard it + * since we don't support any auth mechs that can use it. + */ + if ( !strncasecmp( CP, "SASL-IR", strlen( "SASL-IR" ) ) ) + { + continue; + } + + /* + * If this token happens to be STARTTLS, we want to discard it + * since we don't support it on the client-side. + */ + if ( ! strncasecmp( CP, "STARTTLS", strlen( "STARTTLS" ) ) ) + { + PC_Struct.support_starttls = STARTTLS_SUPPORTED; + continue; + } + + /* + * If this token happens to be LOGINDISABLED, we want to discard it + * since we don't support it on the client-side. + */ + if ( ! strncasecmp( CP, "LOGINDISABLED", strlen( "LOGINDISABLED" ) ) ) + { + PC_Struct.login_disabled = LOGIN_DISABLED; + continue; + } + + strcat( DestBuf, " "); + strcat( DestBuf, CP ); + } + + + strcat( DestBuf, "\r\n" ); + + return( strlen( DestBuf ) ); +} + + /*++ * Function: SetBannerAndCapability * @@ -717,8 +865,7 @@ * * Parameters: none * - * Returns: 0 on success - * -1 on failure + * Returns: nuttin -- exits if there's a problem * * Authors: Dave McMurtrie <dav...@ho...> * @@ -729,14 +876,13 @@ * whether the server supports UNSELECT or not. *-- */ -static int SetBannerAndCapability( void ) +static void SetBannerAndCapability( void ) { int sd; ITD_Struct itd; ICD_Struct conn; int BytesRead; char *fn = "SetBannerAndCapability()"; - char *CP; int NumRef = 0; /* initialize some stuff */ @@ -747,8 +893,9 @@ sd = socket( PF_INET, SOCK_STREAM, IPPROTO_TCP ); if ( sd == -1 ) { - syslog(LOG_ERR, "%s: socket() failed: %s", fn, strerror(errno) ); - return( -1 ); + syslog(LOG_ERR, "%s: socket() failed: %s -- exiting", fn, + strerror(errno) ); + exit( 1 ); } if ( connect( sd, (struct sockaddr *)&ISD.srv, sizeof(ISD.srv) ) == -1 ) @@ -761,7 +908,8 @@ sleep( 60 ); /* IMAP server may not be started yet. */ continue; } - return( -1 ); + syslog( LOG_ERR, "%s: unable to connect() to imap server and retry limit exceeded -- exiting.", fn ); + exit( 1 ); } break; /* Success */ } @@ -778,40 +926,32 @@ BytesRead = IMAP_Line_Read( &itd ); if ( BytesRead == -1 ) { + syslog( LOG_ERR, "%s: Error reading banner line from server on initial connection: %s -- Exiting.", fn, strerror( errno ) ); close( itd.conn->sd ); - return( -1 ); + exit( 1 ); } + BannerLen = ParseBannerAndCapability( Banner, sizeof Banner - 1, + itd.ReadBuf, BytesRead ); - if ( sizeof Banner < BytesRead ) - { - syslog(LOG_ERR, "%s: Storing %d byte banner string from IMAP server would cause buffer overflow.", fn, BytesRead ); - close( itd.conn->sd ); - return( -1 ); - } - - memcpy( Banner, itd.ReadBuf, BytesRead ); - BannerLen = BytesRead; - - /* * See if the string we got back starts with "* OK" by comparing the * first 4 characters of the buffer. */ if ( strncasecmp( Banner, IMAP_UNTAGGED_OK, strlen(IMAP_UNTAGGED_OK)) ) { - syslog(LOG_ERR, "%s: Unexpected response from imap server on initial connection: %s", fn, Banner); + syslog(LOG_ERR, "%s: Unexpected response from imap server on initial connection: %s -- Exiting.", fn, Banner); close( itd.conn->sd ); - return( -1 ); + exit( 1 ); } /* Now we send a CAPABILITY command to the server. */ if ( IMAP_Write( itd.conn, "1 CAPABILITY\r\n", strlen("1 CAPABILITY\r\n") ) == -1 ) { - syslog(LOG_ERR, "%s: IMAP_Write() failed: %s", fn, strerror(errno) ); + syslog(LOG_ERR, "%s: Unable to send capability command to server: %s -- exiting.", fn, strerror(errno) ); close( itd.conn->sd ); - return( -1 ); + exit( 1 ); } /* @@ -828,146 +968,49 @@ BytesRead = IMAP_Line_Read( &itd ); if ( BytesRead == -1 ) { + syslog( LOG_ERR, "%s: Failed to read capability response from server: %s -- exiting.", fn, strerror( errno ) ); close( itd.conn->sd ); - return( -1 ); + exit( 1 ); } - - /* - * The read buffer should now contain the - * untagged response line. - */ - if ( sizeof Capability < BytesRead ) - { - syslog(LOG_ERR, "%s: Storing %d byte capability string from IMAP server would cause buffer overflow.", fn, BytesRead ); - close( itd.conn->sd ); - return( -1 ); - } - /* - * strip out all of the AUTH mechanisms except the ones that we support. - * Right now, this is just AUTH=LOGIN. Note that the use of - * non-MT safe strtok is okay here. This function is called before any - * other threads are launched and should never be called again. - */ - itd.ReadBuf[BytesRead - 2] = '\0'; - CP = strtok( itd.ReadBuf, " " ); + CapabilityLen = ParseBannerAndCapability( Capability, sizeof Capability - 1, + itd.ReadBuf, BytesRead ); - if ( !CP ) - { - syslog( LOG_ERR, "%s: No tokens found in capability string sent from IMAP server.", fn); - close( itd.conn->sd ); - return( -1 ); - } - - sprintf( Capability, CP ); - - /* - * initially assume that the server doesn't support UNSELECT. - */ - PC_Struct.support_unselect = UNSELECT_NOT_SUPPORTED; - /* - * initially assume that the server doesn't support STARTTLS. - */ - PC_Struct.support_starttls = STARTTLS_NOT_SUPPORTED; - - /* - * initially assume that the server doesn't disable LOGIN. - */ - PC_Struct.login_disabled = LOGIN_NOT_DISABLED; - - for( ; ; ) - { - CP = strtok( NULL, " " ); - - if ( !CP ) - break; - - if ( !strncasecmp( CP, "UNSELECT", strlen( "UNSELECT" ) ) ) - { - PC_Struct.support_unselect = UNSELECT_SUPPORTED; - } - - /* - * If this token happens to be an auth mechanism, we want to - * discard it unless it's an auth mechanism we can support. - */ - if ( ! strncasecmp( CP, "AUTH=", strlen( "AUTH=" ) ) && - ( strncasecmp( CP, "AUTH=LOGIN", strlen( "AUTH=LOGIN" ) ) ) ) - { - continue; - } - - /* - * If this token happens to be SASL, we want to discard it - * since we don't support any auth mechs that can use it. - */ - if ( !strncasecmp( CP, "SASL", strlen( "SASL" ) ) ) - { - continue; - } - - /* - * If this token happens to be STARTTLS, we want to discard it - * since we don't support it on the client-side. - */ - if ( ! strncasecmp( CP, "STARTTLS", strlen( "STARTTLS" ) ) ) - { - PC_Struct.support_starttls = STARTTLS_SUPPORTED; - continue; - } - - /* - * If this token happens to be LOGINDISABLED, we want to discard it - * since we don't support it on the client-side. - */ - if ( ! strncasecmp( CP, "LOGINDISABLED", strlen( "LOGINDISABLED" ) ) ) - { - PC_Struct.login_disabled = LOGIN_DISABLED; - continue; - } - - strcat( Capability, " "); - strcat( Capability, CP ); - } - - strcat( Capability, "\r\n" ); - - CapabilityLen = strlen( Capability ); - /* Now read the tagged response and make sure it's OK */ BytesRead = IMAP_Line_Read( &itd ); if ( BytesRead == -1 ) { + syslog( LOG_ERR, "%s: Failed to read capability response from server: %s -- exiting.", fn, strerror( errno ) ); close( itd.conn->sd ); - return( -1 ); + exit( 1 ); } if ( strncasecmp( itd.ReadBuf, IMAP_TAGGED_OK, strlen(IMAP_TAGGED_OK) ) ) { - syslog(LOG_ERR, "%s: Received non-OK tagged reponse from imap server on CAPABILITY command", fn ); + syslog(LOG_ERR, "%s: Received non-OK tagged reponse from imap server on CAPABILITY command -- exiting.", fn ); close( itd.conn->sd ); - return( -1 ); + exit( 1 ); } /* Be nice and logout */ if ( IMAP_Write( itd.conn, "2 LOGOUT\r\n", strlen("2 LOGOUT\r\n") ) == -1 ) { - syslog(LOG_WARNING, "%s: IMAP_Write() failed on LOGOUT: %s -- Returning success anyway.", fn, strerror(errno) ); + syslog(LOG_WARNING, "%s: IMAP_Write() failed on LOGOUT: %s -- Ignoring", fn, strerror(errno) ); close( itd.conn->sd ); - return( 0 ); + return; } /* read the final OK logout */ BytesRead = IMAP_Line_Read( &itd ); if ( BytesRead == -1 ) { - syslog(LOG_WARNING, "%s: IMAP_Line_Read() failed on LOGOUT. Returning success anyway.", fn ); + syslog(LOG_WARNING, "%s: IMAP_Line_Read() failed on LOGOUT -- Ignoring", fn ); } close( itd.conn->sd ); - return( 0 ); + return; } Modified: trunk/imap_proxy/src/pimpstat.c =================================================================== --- trunk/imap_proxy/src/pimpstat.c 2010-07-25 07:19:03 UTC (rev 13999) +++ trunk/imap_proxy/src/pimpstat.c 2010-07-25 07:28:41 UTC (rev 14000) @@ -34,7 +34,7 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/pimpstat.c,v $ -** $Id: pimpstat.c,v 1.6 2003/05/20 19:08:02 dgm Exp $ +** $Id: pimpstat.c,v 1.6 2003/05/20 19:08:02 dgm Exp dgm $ ** ** Modification History: ** @@ -142,17 +142,19 @@ int fd; char *fn = "pimpstat"; int i, rc; - char ccc[DIGITS+1]; - char pcc[DIGITS+1]; - char asc[DIGITS+1]; - char psc[DIGITS+1]; - char rsc[DIGITS+1]; - char prsc[DIGITS+1]; - char tcca[DIGITS+1]; - char tcl[DIGITS+1]; - char tscc[DIGITS+1]; - char tscr[DIGITS+1]; - char ssrr[DIGITS+4]; + char ccc[DIGITS+1]; /* current client conns */ + char pcc[DIGITS+1]; /* peak client conns */ + char asc[DIGITS+1]; /* active server conns */ + char psc[DIGITS+1]; /* peak server conns */ + char rsc[DIGITS+1]; /* retained (cached) server conns */ + char prsc[DIGITS+1]; /* peak retained (cached) server conns */ + char tcca[DIGITS+1]; /* total client connections accepted */ + char tcl[DIGITS+1]; /* total client logins */ + char tscc[DIGITS+1]; /* total server conns created */ + char tscr[DIGITS+1]; /* total server conns reused */ + char ssrr[DIGITS+4]; /* server socket reuse ration */ + char tsch[DIGITS+1]; /* total select cache hits */ + char tscm[DIGITS+1]; /* total select cache misses */ float Ratio; char stimebuf[64]; char ctimebuf[64]; @@ -236,13 +238,24 @@ mvaddstr( 13, 2, "CACHED SERVER CONNECTIONS" ); mvaddstr( 15, 5, "current:"); mvaddstr( 15, 40, "peak:" ); - mvaddstr( 17, 2, "TOTALS" ); + mvaddstr( 17, 2, "CONNECTION TOTALS" ); mvaddstr( 19, 5, "client connections accepted:" ); mvaddstr( 20, 5, "client logins:" ); mvaddstr( 21, 5, "server connections created:" ); mvaddstr( 22, 5, "server connection reuses:" ); mvaddstr( 23, 5, "client login to server login ratio:" ); - mvaddstr( 25, 2, "CTRL-C to quit." ); + if ( PC_Struct.enable_select_cache ) + { + mvaddstr( 25, 2, "SELECT CACHE TOTALS" ); + mvaddstr( 27, 5, "hit:" ); + mvaddstr( 27, 40, "miss:" ); + } + else + { + mvaddstr( 25, 2, "SELECT CACHE NOT ENABLED" ); + } + + mvaddstr( 29, 2, "CTRL-C to quit." ); for ( ; ; ) { @@ -294,6 +307,8 @@ snprintf( tcl, DIGITS, "%9d", IMAPCount->TotalClientLogins ); snprintf( tscr, DIGITS, "%9d", IMAPCount->TotalServerConnectionsReused ); snprintf( tscc, DIGITS, "%9d", IMAPCount->TotalServerConnectionsCreated ); + snprintf( tsch, DIGITS, "%9d", IMAPCount->SelectCacheHits ); + snprintf( tscm, DIGITS, "%9d", IMAPCount->SelectCacheMisses ); mvaddstr( 2, 31, stimebuf ); mvaddstr( 3, 31, ctimebuf ); @@ -308,7 +323,12 @@ mvaddstr( 21, 46, tscc ); mvaddstr( 22, 46, tscr ); mvaddstr( 23, 42, ssrr ); - + if ( PC_Struct.enable_select_cache ) + { + mvaddstr( 27, 14, tsch ); + mvaddstr( 27, 46, tscm ); + } + refresh(); sleep( 1 ); Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 07:19:03 UTC (rev 13999) +++ trunk/imap_proxy/src/request.c 2010-07-25 07:28:41 UTC (rev 14000) @@ -39,7 +39,7 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.17 2003/10/09 14:11:13 dgm Exp $ +** $Id: request.c,v 1.17 2003/10/09 14:11:13 dgm Exp dgm $ ** ** Modification History: ** @@ -166,7 +166,7 @@ static int cmd_dumpicc( ITD_Struct *, char * ); static int cmd_newlog( ITD_Struct *, char * ); static int cmd_resetcounters( ITD_Struct *, char * ); -static int Raw_Proxy( ITD_Struct *, ITD_Struct * ); +static int Raw_Proxy( ITD_Struct *, ITD_Struct *, ISC_Struct * ); @@ -740,7 +740,7 @@ } UnLockMutex( &trace ); - rc = Raw_Proxy( Client, &Server ); + rc = Raw_Proxy( Client, &Server, &Server.conn->ISC ); Client->TraceOn = 0; Server.TraceOn = 0; @@ -879,7 +879,7 @@ } UnLockMutex( &trace ); - rc = Raw_Proxy( Client, &Server ); + rc = Raw_Proxy( Client, &Server, &Server.conn->ISC ); /* * It's not necessary to take out the trace mutex here. The reason @@ -915,7 +915,8 @@ * Authors: Dave McMurtrie <dav...@ho...> *-- */ -static int Raw_Proxy( ITD_Struct *Client, ITD_Struct *Server ) +static int Raw_Proxy( ITD_Struct *Client, ITD_Struct *Server, + ISC_Struct *ISC ) { char *fn = "Raw_Proxy()"; struct pollfd fds[2]; @@ -926,6 +927,7 @@ char *CP; char TraceBuf[ BUFSIZE ]; char SendBuf[ BUFSIZE ]; + int rc; #define SERVER 0 #define CLIENT 1 @@ -1108,9 +1110,11 @@ } - /* this is a command -- is it logout? */ - CP = memchr(Client->ReadBuf, ' ', - Client->ReadBytesProcessed ); + /* + * This is a command. What command is it? + */ + CP = memchr( Client->ReadBuf, ' ', + Client->ReadBytesProcessed ); if ( CP ) { @@ -1122,61 +1126,101 @@ * Since we want to potentially reuse this server * connection, we want to return it to an unselected * state. Use UNSELECT if the server supports it. - * Otherwise, EXAMINE a null mailbox. + * Otherwise, EXAMINE a null mailbox. If SELECT + * caching is enabled, don't do this. */ - snprintf( SendBuf, sizeof SendBuf - 1, - "C64 %s\r\n", ( (PC_Struct.support_unselect) ? "UNSELECT" : "EXAMINE \"\"" ) ); - - IMAP_Write( Server->conn, SendBuf, - strlen(SendBuf) ); - /* - * To be more correct, we should send any untagged - * data back to the client before we're done. - */ - for( ;; ) + if ( ! PC_Struct.enable_select_cache ) { - /* - * If the server wants to send a literal for - * some reason, bag it... - */ - if ( Server->LiteralBytesRemaining ) - break; + snprintf( SendBuf, sizeof SendBuf - 1, + "C64 %s\r\n", ( (PC_Struct.support_unselect) ? "UNSELECT" : "EXAMINE \"\"" ) ); - status = IMAP_Line_Read( Server ); - + IMAP_Write( Server->conn, SendBuf, + strlen(SendBuf) ); /* - * If there's an error reading from the server, - * we'll catch it when (if) we try to reuse this - * connection. + * To be more correct, we should send any untagged + * data back to the client before we're done. */ - if ( ( status == -1 ) || ( status == 0 ) ) - break; + for( ;; ) + { + /* + * If the server wants to send a literal for + * some reason, bag it... + */ + if ( Server->LiteralBytesRemaining ) + break; + + status = IMAP_Line_Read( Server ); + + /* + * If there's an error reading from the server, + * we'll catch it when (if) we try to reuse this + * connection. + */ + if ( ( status == -1 ) || ( status == 0 ) ) + break; - /* - * If it's not untagged data, we're done. - */ - if ( Server->ReadBuf[0] != '*' ) - break; - - BytesSent = IMAP_Write( Client->conn, - Server->ReadBuf, status ); - if ( BytesSent == -1 ) - { - syslog( LOG_ERR, "%s: IMAP_Write() failed sending data to client on sd [%d]: %s", fn, Client->conn->sd, strerror( errno ) ); + /* + * If it's not untagged data, we're done. + */ + if ( Server->ReadBuf[0] != '*' ) + break; + + BytesSent = IMAP_Write( Client->conn, + Server->ReadBuf, status ); + if ( BytesSent == -1 ) + { + syslog( LOG_ERR, "%s: IMAP_Write() failed sending data to client on sd [%d]: %s", fn, Client->conn->sd, strerror( errno ) ); + } } - - } + } /* if ( ! PC_Struct.enable_select_cache ) */ memset( Server->ReadBuf, 0, sizeof Server->ReadBuf ); return( 1 ); } - } - /* - * it's some command other than a LOGOUT... - * just ship it over - */ + /* + * it's some command other than a LOGOUT... + * If we care about SELECT caching, do that now. + */ + if ( PC_Struct.enable_select_cache ) + { + if ( !strncasecmp( CP, "SELECT ", 7 ) ) + { + rc = Handle_Select_Command( Client, Server, + ISC, Client->ReadBuf, + status ); + + if ( rc == 0 ) + continue; + + if ( rc == -1 ) + return( -1 ); + + /* + * if Handle_Select_Command() returned 1, + * fall through the rest of the logic and the + * SELECT command should be proxied without + * looking at the cache. + */ + + } /* if the command is SELECT */ + + /* + * SELECT caching is enabled and we've encountered + * a command other than SELECT. See if we should + * invalidate the SELECT cache or not. + */ + if ( ! Is_Safe_Command( CP ) ) + { + Invalidate_Cache_Entry( ISC ); + } + + } /* if ( PC_Struct.enable_select_cache ) */ + + } /* if ( CP ) */ + + for ( ; ; ) { BytesSent = IMAP_Write( Server->conn, Client->ReadBuf, status ); @@ -1185,7 +1229,7 @@ if ( errno == EINTR ) continue; - syslog(LOG_ERR, "%s: IMAP_Write() failed sending data to client on sd [%d]: %s", fn, Client->conn->sd, strerror( errno ) ); + syslog(LOG_ERR, "%s: IMAP_Write() failed sending data to server on sd [%d]: %s", fn, Server->conn->sd, strerror( errno ) ); return( -1 ); } break; Added: trunk/imap_proxy/src/select.c =================================================================== --- trunk/imap_proxy/src/select.c (rev 0) +++ trunk/imap_proxy/src/select.c 2010-07-25 07:28:41 UTC (rev 14000) @@ -0,0 +1,521 @@ +/* +** +** Copyright (c) 2002-2004 Dave McMurtrie +** +** This file is part of imapproxy. +** +** imapproxy 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 2 of the License, or +** (at your option) any later version. +** +** imapproxy 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 imapproxy; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +** +** +** Facility: +** +** select.c +** +** Abstract: +** +** routines to support SELECT state caching in imapproxy. +** +** Authors: +** +** Dave McMurtrie <dav...@ho...> +** +** RCS: +** +** $Source$ +** $Id$ +** +** Modification History: +** +** $Log$ +** +** +*/ + +#define _REENTRANT + +#include <syslog.h> +#include <string.h> +#include <stdio.h> +#include <errno.h> + +#include "imapproxy.h" + +/* + * External globals + */ +extern int errno; +extern IMAPCounter_Struct *IMAPCount; + +/* + * Internal prototypes + */ +static int Send_Cached_Select_Response( ITD_Struct *, ISC_Struct *, char * ); +static int Populate_Select_Cache( ITD_Struct *, ISC_Struct *, char *, char *, unsigned int ); + + +/* + * Function definitions. + */ + +/*++ + * Function: Handle_Select_Command + * + * Purpose: The client sent a SELECT command. Either hit the cache, + * or get data from the imap server. + * + * Parameters: ptr to ITD -- client transaction descriptor + * ptr to ITD -- server transaction descriptor + * ptr to ISC -- imap select cache structure + * ptr to char -- The select command string from the client. + * unsigned int -- the length of the select command + * + * Returns: 0 - The caller should consider the entire SELECT + * transaction to be complete. This return code does not + * imply successful completion. Rather, it implies that + * neither the client nor the server should be sending more + * data wrt this transaction. + * + * 1 - This return code implies that this function was not able + * to really accomplish anything useful. The caller should + * attempt to send the SELECT command by an alternate means. + * The SELECT command is still in the client read buffer and + * may be proxied directly to the server without the use of + * this function. + * + * -1 - A hard failure condition. The client and server sockets + * should be shut down. + * + * Authors: Dave McMurtrie <dav...@ho...> + * + * Notes: The SELECT command string passed into here will be the + * entire command, including the tag. + *-- + */ +extern int Handle_Select_Command( ITD_Struct *Client, + ITD_Struct *Server, + ISC_Struct *ISC, + char *SelectCmd, + int SelectCmdLength ) +{ + char *fn = "Handle_Select_Command"; + char *Mailbox; + char *Tag; + char *CP; + + char Buf[ BUFSIZE ]; + + IMAPCount->TotalSelectCommands++; + + /* + * Make a local copy of the select buffer so we can chop it to hell without + * offending the caller. + */ + if ( SelectCmdLength >= BUFSIZE ) + { + IMAPCount->SelectCacheMisses++; + syslog( LOG_ERR, "%s: Length of SELECT command (%d bytes) would overflow %d byte buffer.", fn, SelectCmdLength, BUFSIZE ); + return( 1 ); + } + + memcpy( Buf, SelectCmd, SelectCmdLength ); + Buf[ SelectCmdLength ] = '\0'; + + /* + * NULL terminate the buffer at the end of the mailbox name + */ + CP = memchr( (const void *)Buf, '\r', SelectCmdLength ); + if ( ! CP ) + { + IMAPCount->SelectCacheMisses++; + + syslog( LOG_ERR, "%s: Sanity check failed! SELECT command from client sd [%d] has no CRLF after it.", fn, Client->conn->sd ); + return( -1 ); + } + *CP = '\0'; + + Tag = Buf; + CP = memchr( ( const void * )Buf, ' ', SelectCmdLength ); + + if ( ! CP ) + { + IMAPCount->SelectCacheMisses++; + + syslog( LOG_ERR, "%s: Sanity check failed! No tokens found in SELECT command '%s' sent from client sd [%d].", fn, Buf, Client->conn->sd ); + return( 1 ); + } + + *CP = '\0'; + CP++; + + Mailbox = memchr( ( const void * )CP, ' ', SelectCmdLength - + ( strlen( Tag ) + 1 ) ); + + if ( ! Mailbox ) + { + IMAPCount->SelectCacheMisses++; + + syslog( LOG_WARNING, "%s: Protocol error. Client sd [%d] sent SELECT command with no mailbox name: '%s'", fn, Client->conn->sd, SelectCmd ); + snprintf( Buf, sizeof Buf - 1, "%s BAD missing required argument to SELECT command\r\n", Tag ); + IMAP_Write( Client->conn, Buf, strlen( Buf ) ); + return( 0 ); + } + + Mailbox++; + + /* + * We have a valid SELECT command. See if we have a cache entry that + * isn't expired. + */ + if ( time( 0 ) > ( ISC->ISCTime + SELECT_CACHE_EXP ) ) + { + /* + * The SELECT data that's cached has expired. + */ + IMAPCount->SelectCacheMisses++; + + if ( Populate_Select_Cache( Server, ISC, Mailbox, SelectCmd, SelectCmdLength ) == -1 ) + { + snprintf( Buf, sizeof Buf - 1, "%s BAD internal proxy server error\r\n", Tag ); + IMAP_Write( Client->conn, Buf, strlen( Buf ) ); + return( 0 ); + } + + if ( Send_Cached_Select_Response( Client, ISC, Tag ) == -1 ) + { + snprintf( Buf, sizeof Buf - 1, "%s BAD internal proxy server error\r\n", Tag ); + IMAP_Write( Client->conn, Buf, strlen( Buf ) ); + return( 0 ); + } + + return( 0 ); + } + + + /* + * Our data isn't expired, but is it the correct mailbox? + */ + if ( ! strcmp( Mailbox, ISC->MailboxName ) ) + { + /* + * We have the correct mailbox selected and cached already + */ + IMAPCount->SelectCacheHits++; + + if ( Send_Cached_Select_Response( Client, ISC, Tag ) == -1 ) + { + snprintf( Buf, sizeof Buf - 1, "%s BAD internal proxy server error\r\n", Tag ); + IMAP_Write( Client->conn, Buf, strlen( Buf ) ); + return( 0 ); + } + + return( 0 ); + + } + + IMAPCount->SelectCacheMisses++; + + if ( Populate_Select_Cache( Server, ISC, Mailbox, SelectCmd, SelectCmdLength ) == -1 ) + { + snprintf( Buf, sizeof Buf - 1, "%s BAD internal proxy server error\r\n", Tag ); + IMAP_Write( Client->conn, Buf, strlen( Buf ) ); + return( 0 ); + } + + if ( Send_Cached_Select_Response( Client, ISC, Tag ) == -1 ) + { + snprintf( Buf, sizeof Buf - 1, "%s BAD internal proxy server error\r\n", Tag ); + IMAP_Write( Client->conn, Buf, strlen( Buf ) ); + return( 0 ); + } + + return( 0 ); + +} + + + +/*++ + * Function: Send_Cached_Select_Response + * + * Purpose: Send cached SELECT server response data back to a client. + * + * Parameters: ptr to ITD -- client transaction descriptor + * ptr to ISC -- imap select cache structure + * ptr to char -- client tag for response + * + * Returns: 0 on success + * -1 on failure + * + * Authors: Dave McMurtrie <dav...@ho...> + * + * Notes: + *-- + */ +static int Send_Cached_Select_Response( ITD_Struct *Client, + ISC_Struct *ISC, + char *Tag ) +{ + char *fn = "Send_Cached_Select_Response()"; + char SendBuf[ BUFSIZE ]; + + if ( IMAP_Write( Client->conn, ISC->SelectString, + strlen( ISC->SelectString ) ) == -1 ) + { + syslog( LOG_WARNING, "%s: Failed to send cached SELECT string to client on sd [%d]: %s", fn, Client->conn->sd, strerror( errno ) ); + return( -1 ); + } + + snprintf( SendBuf, sizeof SendBuf - 1, "%s %s", Tag, + ISC->SelectStatus ); + + if ( IMAP_Write( Client->conn, SendBuf, strlen( SendBuf ) ) == -1 ) + { + syslog( LOG_WARNING, "%s: Failed to send cached SELECT status to client on sd [%d]: %s", fn, Client->conn->sd, strerror( errno ) ); + return( -1 ); + } + + return( 0 ); + +} + + + + +/*++ + * Function: Populate_Select_Cache + * + * Purpose: Send a SELECT command to the server and cache the response. + * + * Parameters: ptr to ITD -- server transaction descriptor + * ptr to ISC -- the cache structure to populate + * ptr to char -- the mailbox name that's being selected + * ptr to char -- The select command string from the client. + * unsigned int -- the length of the select command + * + * Returns: 0 on success + * -1 on failure + * + * Authors: Dave McMurtrie <dav...@ho...> + * + * Notes: + *-- + */ +static int Populate_Select_Cache( ITD_Struct *Server, + ISC_Struct *ISC, + char *MailboxName, + char *ClientCommand, + unsigned int Length ) +{ + char *fn = "Populate_Select_Cache()"; + char SendBuf[ BUFSIZE ]; + int rc; + int BytesLeftInBuffer = SELECT_BUF_SIZE; + char *BufPtr; + char *CP; + char *EOS; + + rc = IMAP_Write( Server->conn, ClientCommand, Length ); + + if ( rc == -1 ) + { + syslog( LOG_ERR, "%s: Unable to send SELECT command to imap server so can't populate cache.", fn ); + return( -1 ); + } + + BufPtr = ISC->SelectString; + + for( ;; ) + { + if ( Server->LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Server response to SELECT command contains unexpected literal data on sd [%d].", fn ); + /* + * Must eat the literal. + */ + while ( Server->LiteralBytesRemaining ) + { + IMAP_Literal_Read( Server ); + } + + return( -1 ); + } + + rc = IMAP_Line_Read( Server ); + + if ( ( rc == -1 ) || ( rc == 0 ) ) + { + syslog( LOG_WARNING, "%s: Unable to read SELECT response from imap server so can't populate cache.", fn ); + return( -1 ); + } + + /* + * If it's not untagged data, we're done + */ + if ( Server->ReadBuf[0] != '*' ) + break; + + if ( rc >= BytesLeftInBuffer ) + { + syslog( LOG_WARNING, "%s: Size of SELECT response from server exceeds max cache size of %d bytes. Unable to cache this response.", fn, SELECT_BUF_SIZE ); + return( -1 ); + } + + memcpy( (void *)BufPtr, (const void *)Server->ReadBuf, rc ); + BytesLeftInBuffer -= rc; + BufPtr += rc; + } + + /* + * NULL terminate the buffer that contains the select response. Note + * that we used the >= conditional above so we'd leave one byte of + * space for this NULL + */ + *BufPtr = '\0'; + + /* + * The SELECT output string is filled in. Now fill in the status. + */ + CP = memchr( (const void *)Server->ReadBuf, ' ', rc ); + if ( ! CP ) + { + syslog( LOG_ERR, "%s: Invalid response to SELECT command. Contains no tokens.", fn ); + return( -1 ); + } + CP++; + + EOS = memchr( (const void *)Server->ReadBuf, '\r', rc ); + if ( ! EOS ) + { + syslog( LOG_ERR, "%s: Invalid response to SELECT command. Not CRLF terminated.", fn ); + return( -1 ); + } + + *EOS = '\0'; + snprintf( (char *)ISC->SelectStatus, SELECT_STATUS_BUF_SIZE - 1, "%s\r\n", + CP ); + *EOS = '\r'; + + /* + * Update the cache time + */ + ISC->ISCTime = time( 0 ); + + strncpy( (char *)ISC->MailboxName, (const char *)MailboxName, MAXMAILBOXNAME - 1 ); + + return( 0 ); + +} + + + + +/*++ + * Function: Is_Safe_Command + * + * Purpose: Determine whether a given command is "safe". A command that + * is not "safe" should cause the select cache for a given + * mailbox to be invalidated. + * + * Parameters: char ptr -- the command + * + * Returns: 1 if the command is safe + * 0 if the command is not safe + * + * Authors: Dave McMurtrie <dav...@ho...> + * + * Notes: + *-- + */ +extern unsigned int Is_Safe_Command( char *Command ) +{ + char *fn = "Is_Safe_Command"; + + unsigned int i; + + char *SafeCommands[] = + { + "CAPABILITY", + "NOOP", + "LOGOUT", + "CREATE", + "FETCH", + "SUBSCRIBE", + "UNSUBSCRIBE", + "LIST", + "LSUB", + "STATUS", + "CHECK", + "SEARCH", + "COPY", + "UID", + NULL + }; + + /* + * For a list this small a simple linear search should suffice. + */ + for ( i = 0; SafeCommands[i] != 0; i++ ) + { + if ( ! strncasecmp( SafeCommands[i], Command, + strlen( SafeCommands[i] ) ) ) + { + return( 1 ); + } + } + + return( 0 ); +} + + + +/*++ + * Function: Invalidate_Cache_Entry + * + * Purpose: Reset the cache time so the entry will not be valid + * + * Parameters: ptr to ISC -- imap select cache structure + * + * Returns: nothing + * + * Authors: Dave McMurtrie <dav...@ho...> + * + * Notes: + *-- + */ +extern void Invalidate_Cache_Entry( ISC_Struct *ISC ) +{ + ISC->ISCTime = 0; +} + + + + +/* + * _________ + * / | + * / | + * / ______| + * / / ________ + * | | | / + * | | |_____/ + * | | ______ + * | | | \ + * | | |______\ + * \ \_______ + * \ | + * \ | + * \_________| + */ + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 07:36:04
|
Revision: 14002 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14002&view=rev Author: pdontthink Date: 2010-07-25 07:35:58 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.2-RC_1 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/pkginfo trunk/imap_proxy/src/config.c trunk/imap_proxy/src/icc.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/pimpstat.c trunk/imap_proxy/src/request.c trunk/imap_proxy/src/select.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 07:30:36 UTC (rev 14001) +++ trunk/imap_proxy/ChangeLog 2010-07-25 07:35:58 UTC (rev 14002) @@ -1,3 +1,23 @@ +2004-02-24 Dave McMurtrie <dav...@ho...> + * config.c: Added 'enable_select_cache' config option. + + * pimpstat.c: Added SELECT cache stuff. + + * icc.c: Send LOGOUT to imap server before closing a connection. + + * select.c: newly added to the distribution. Source file containing + routines to allow SELECT caching. + + * main.c: Added new function ParseBannerAndCapability. Added SELECT + caching stuff. + + * request.c: Added support for SELECT caching. + + * imapproxy.h: Added support for SELECT caching. + + * imapproxy.conf: Added 'enable_select_cache' option to the default + configuration file. + 2003-11-14 Dave McMurtrie <dav...@ho...> * imapproxy.h: Included patches by Geoffrey Hort <g....@un...> Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 07:30:36 UTC (rev 14001) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 07:35:58 UTC (rev 14002) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.1rel +%define ver 1.2.2rc1 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 07:30:36 UTC (rev 14001) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 07:35:58 UTC (rev 14002) @@ -34,11 +34,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.16 2003/11/14 15:06:14 dgm Exp dgm $ +** $Id: imapproxy.h,v 1.17 2004/02/24 15:21:01 dgm Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.17 2004/02/24 15:21:01 dgm +** Added support for SELECT caching. +** ** Revision 1.16 2003/11/14 15:06:14 dgm ** Patch by Geoffrey Hort <g....@un...> to include listen_address ** config option. Also, I changed the default buffer size from Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 07:30:36 UTC (rev 14001) +++ trunk/imap_proxy/pkginfo 2010-07-25 07:35:58 UTC (rev 14002) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.1 +VERSION=1.2.2rc1 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections Modified: trunk/imap_proxy/src/config.c =================================================================== --- trunk/imap_proxy/src/config.c 2010-07-25 07:30:36 UTC (rev 14001) +++ trunk/imap_proxy/src/config.c 2010-07-25 07:35:58 UTC (rev 14002) @@ -35,11 +35,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/config.c,v $ -** $Id: config.c,v 1.9 2003/11/14 15:03:58 dgm Exp dgm $ +** $Id: config.c,v 1.10 2004/02/24 14:57:47 dgm Exp $ ** ** Modification History: ** ** $Log: config.c,v $ +** Revision 1.10 2004/02/24 14:57:47 dgm +** Added new config option 'enable_select_cache'. +** ** Revision 1.9 2003/11/14 15:03:58 dgm ** Patch by Geoffrey Hort <g....@un...> to allow ** configurable listen address. Modified: trunk/imap_proxy/src/icc.c =================================================================== --- trunk/imap_proxy/src/icc.c 2010-07-25 07:30:36 UTC (rev 14001) +++ trunk/imap_proxy/src/icc.c 2010-07-25 07:35:58 UTC (rev 14002) @@ -34,11 +34,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/icc.c,v $ -** $Id: icc.c,v 1.5 2003/05/20 18:46:49 dgm Exp dgm $ +** $Id: icc.c,v 1.6 2004/02/24 15:14:44 dgm Exp $ ** ** Modification History: ** ** $Log: icc.c,v $ +** Revision 1.6 2004/02/24 15:14:44 dgm +** Send LOGOUT to server when closing a connection. +** ** Revision 1.5 2003/05/20 18:46:49 dgm ** Comment changes only. ** Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 07:30:36 UTC (rev 14001) +++ trunk/imap_proxy/src/main.c 2010-07-25 07:35:58 UTC (rev 14002) @@ -36,11 +36,19 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.18 2003/11/14 14:59:44 dgm Exp dgm $ +** $Id: main.c,v 1.19 2004/02/24 15:17:20 dgm Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.19 2004/02/24 15:17:20 dgm +** Added ParseBannerAndCapability() function to allow for +** parsing the banner string and capability strings. Can +** now handle capability string in explicit capability +** response, or as part of the banner string. +** +** Added SELECT caching stuff. +** ** Revision 1.18 2003/11/14 14:59:44 dgm ** Applied patches by Geoffrey Hort <g....@un...> to allow ** configurable listen address. Discard token "SASL-IR" if server @@ -122,7 +130,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.18 2003/11/14 14:59:44 dgm Exp dgm $"; +static char *rcsId = "$Id: main.c,v 1.19 2004/02/24 15:17:20 dgm Exp $"; static char *rcsSource = "$Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dgm $"; Modified: trunk/imap_proxy/src/pimpstat.c =================================================================== --- trunk/imap_proxy/src/pimpstat.c 2010-07-25 07:30:36 UTC (rev 14001) +++ trunk/imap_proxy/src/pimpstat.c 2010-07-25 07:35:58 UTC (rev 14002) @@ -34,11 +34,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/pimpstat.c,v $ -** $Id: pimpstat.c,v 1.6 2003/05/20 19:08:02 dgm Exp dgm $ +** $Id: pimpstat.c,v 1.7 2004/02/24 14:56:10 dgm Exp $ ** ** Modification History: ** ** $Log: pimpstat.c,v $ +** Revision 1.7 2004/02/24 14:56:10 dgm +** Added SELECT cache stuff. +** ** Revision 1.6 2003/05/20 19:08:02 dgm ** Comment changes only. ** Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 07:30:36 UTC (rev 14001) +++ trunk/imap_proxy/src/request.c 2010-07-25 07:35:58 UTC (rev 14002) @@ -39,11 +39,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.17 2003/10/09 14:11:13 dgm Exp dgm $ +** $Id: request.c,v 1.18 2004/02/24 15:19:06 dgm Exp $ ** ** Modification History: ** ** $Log: request.c,v $ +** Revision 1.18 2004/02/24 15:19:06 dgm +** Added support for SELECT caching. +** ** Revision 1.17 2003/10/09 14:11:13 dgm ** bugfix: set TotalClientLogins to zero in cmd_resetcounters, submitted ** by Geoffrey Hort <g....@un...>. Changes to allow syslogging of the Modified: trunk/imap_proxy/src/select.c =================================================================== --- trunk/imap_proxy/src/select.c 2010-07-25 07:30:36 UTC (rev 14001) +++ trunk/imap_proxy/src/select.c 2010-07-25 07:35:58 UTC (rev 14002) @@ -33,14 +33,17 @@ ** ** RCS: ** -** $Source$ -** $Id$ +** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/select.c,v $ +** $Id: select.c,v 1.1 2004/02/24 15:13:21 dgm Exp $ ** ** Modification History: ** -** $Log$ +** $Log: select.c,v $ +** Revision 1.1 2004/02/24 15:13:21 dgm +** Initial revision ** ** +** */ #define _REENTRANT This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 07:41:02
|
Revision: 14004 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14004&view=rev Author: pdontthink Date: 2010-07-25 07:40:56 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.2 RC 2 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/pkginfo trunk/imap_proxy/src/select.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 07:38:53 UTC (rev 14003) +++ trunk/imap_proxy/ChangeLog 2010-07-25 07:40:56 UTC (rev 14004) @@ -1,4 +1,12 @@ +2004-03-11 Dave McMurtrie <dav...@ho...> + + * imapproxy.h: Changed size of select cache buffer. + + * select.c: updated "safe" command list. Changed behavior when + Populate_Select_Cache() fails so the client isn't sent a BAD. + 2004-02-24 Dave McMurtrie <dav...@ho...> + * config.c: Added 'enable_select_cache' config option. * pimpstat.c: Added SELECT cache stuff. Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 07:38:53 UTC (rev 14003) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 07:40:56 UTC (rev 14004) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.2rc1 +%define ver 1.2.2rc2 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 07:38:53 UTC (rev 14003) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 07:40:56 UTC (rev 14004) @@ -34,11 +34,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.17 2004/02/24 15:21:01 dgm Exp $ +** $Id: imapproxy.h,v 1.18 2004/03/11 15:17:58 dgm Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.18 2004/03/11 15:17:58 dgm +** SELECT_BUF_SIZE size changed from 1024 to BUFSIZE which is +** currently 4096 +** ** Revision 1.17 2004/02/24 15:21:01 dgm ** Added support for SELECT caching. ** @@ -134,7 +138,7 @@ #define MAXPASSWDLEN 64 /* max passwd length */ #define POLL_TIMEOUT_MINUTES 30 /* Poll timeout in minutes */ #define POLL_TIMEOUT (POLL_TIMEOUT_MINUTES * 60000) -#define SELECT_BUF_SIZE 1024 /* max length of a SELECT */ +#define SELECT_BUF_SIZE BUFSIZE /* max length of a SELECT */ /* string we can cache */ #define SELECT_CACHE_EXP 10 /* # of seconds before we */ /* expire a SELECT cache */ Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 07:38:53 UTC (rev 14003) +++ trunk/imap_proxy/pkginfo 2010-07-25 07:40:56 UTC (rev 14004) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.2rc1 +VERSION=1.2.2rc2 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections Modified: trunk/imap_proxy/src/select.c =================================================================== --- trunk/imap_proxy/src/select.c 2010-07-25 07:38:53 UTC (rev 14003) +++ trunk/imap_proxy/src/select.c 2010-07-25 07:40:56 UTC (rev 14004) @@ -34,11 +34,16 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/select.c,v $ -** $Id: select.c,v 1.1 2004/02/24 15:13:21 dgm Exp $ +** $Id: select.c,v 1.2 2004/03/11 15:14:06 dgm Exp $ ** ** Modification History: ** ** $Log: select.c,v $ +** Revision 1.2 2004/03/11 15:14:06 dgm +** Behavior of calling code when Populate_Select_Cache() fails +** modified to not send error back to client. +** "safe" command list updated. +** ** Revision 1.1 2004/02/24 15:13:21 dgm ** Initial revision ** @@ -190,9 +195,7 @@ if ( Populate_Select_Cache( Server, ISC, Mailbox, SelectCmd, SelectCmdLength ) == -1 ) { - snprintf( Buf, sizeof Buf - 1, "%s BAD internal proxy server error\r\n", Tag ); - IMAP_Write( Client->conn, Buf, strlen( Buf ) ); - return( 0 ); + return( 1 ); } if ( Send_Cached_Select_Response( Client, ISC, Tag ) == -1 ) @@ -231,9 +234,7 @@ if ( Populate_Select_Cache( Server, ISC, Mailbox, SelectCmd, SelectCmdLength ) == -1 ) { - snprintf( Buf, sizeof Buf - 1, "%s BAD internal proxy server error\r\n", Tag ); - IMAP_Write( Client->conn, Buf, strlen( Buf ) ); - return( 0 ); + return( 1 ); } if ( Send_Cached_Select_Response( Client, ISC, Tag ) == -1 ) @@ -447,20 +448,33 @@ unsigned int i; + /* + * The safety of some of these is very questionable, particularly + * APPEND. Since time also invalidates the cache, hopefully the + * contents will be accurate enough to not break stuff... + */ char *SafeCommands[] = { "CAPABILITY", "NOOP", "LOGOUT", + "STARTTLS", + "AUTHENTICATE", + "LOGIN", + "SELECT", + "EXAMINE", "CREATE", - "FETCH", + "DELETE", + "RENAME", "SUBSCRIBE", "UNSUBSCRIBE", "LIST", "LSUB", "STATUS", + "APPEND", "CHECK", "SEARCH", + "FETCH", "COPY", "UID", NULL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 07:44:47
|
Revision: 14006 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14006&view=rev Author: pdontthink Date: 2010-07-25 07:44:41 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.2 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/README.debian trunk/imap_proxy/README.ssl trunk/imap_proxy/copyright trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/pkginfo trunk/imap_proxy/scripts/imapproxy.conf Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 07:41:31 UTC (rev 14005) +++ trunk/imap_proxy/ChangeLog 2010-07-25 07:44:41 UTC (rev 14006) @@ -1,3 +1,7 @@ +2004-07-23 Dave McMurtrie <dav...@ho...> + + * Version 1.2.2 released. + 2004-03-11 Dave McMurtrie <dav...@ho...> * imapproxy.h: Changed size of select cache buffer. Modified: trunk/imap_proxy/README.debian =================================================================== --- trunk/imap_proxy/README.debian 2010-07-25 07:41:31 UTC (rev 14005) +++ trunk/imap_proxy/README.debian 2010-07-25 07:44:41 UTC (rev 14006) @@ -2,7 +2,11 @@ for people building and installing up-imapproxy on Debian Linux systems. I've included his information here, exactly as he submitted it. +It's now worth noting that there's an official Debian package for up-imapproxy +(courtesy of Jose Luis Tallon) so you might want to save yourself some time +and effort and just apt-get that. + o) On a Debian system that uses UW IMAP you'll need to rename /etc/rc2.d/S99rmnologin to something like S98rmnologin. Then be sure the rc script for imapproxy is run as S99imapproxy. Modified: trunk/imap_proxy/README.ssl =================================================================== --- trunk/imap_proxy/README.ssl 2010-07-25 07:41:31 UTC (rev 14005) +++ trunk/imap_proxy/README.ssl 2010-07-25 07:44:41 UTC (rev 14006) @@ -1,15 +1,20 @@ -up-imapproxy now supports SSL/TLS between the proxy server and the real -IMAP server. It does not support SSL/TLS between a client (usually webmail) +First, if you're using up-imapproxy with SSL, you have Ken Murchison +to thank for that. He added this feature. + +up-imapproxy only supports TLS between the proxy server and the real +IMAP server. It does not support TLS between a client (usually webmail) and the proxy server. The idea here is that you can run the imap proxy on -the same machine as your webserver. If you're using SSL/TLS to your webserver, +the same machine as your webserver. If you're using TLS to your webserver, the webserver can then send plaintext auth to the proxy without the password -ever crossing the network, then the proxy can use SSL/TLS to the IMAP server. +ever crossing the network, then the proxy can use TLS to the IMAP server. -The proxy will only use SSL if the real imap server forces it to do so by +The proxy will only use TLS if the real imap server forces it to do so by advertising LOGINDISABLED in the capability string. -This brings up the obvious point that if the server advertises LOGINDISABLED -and the proxy isn't built with SSL support, things aren't going to work. +imapproxy does not support the deprecated notion of imaps using port 993. +It only supports the use of the STARTTLS command to initiate SSL/TLS from +within a regular imap connection. + There are four configuration file options that you'll have to set in order for SSL to work. They are tls_ca_file, tls_ca_path, tls_cert_file and tls_key_file. @@ -20,4 +25,4 @@ http://www.sendmail.org/~ca/email/starttls.html If anyone wants to contribute to this project by submitting some good -documentation about configuring up-imapproxy with SSL, it would be appreciated. +documentation about configuring up-imapproxy with TLS, it would be appreciated. Modified: trunk/imap_proxy/copyright =================================================================== --- trunk/imap_proxy/copyright 2010-07-25 07:41:31 UTC (rev 14005) +++ trunk/imap_proxy/copyright 2010-07-25 07:44:41 UTC (rev 14006) @@ -1,3 +1,3 @@ - Copyright (c) 2002,2003 Dave McMurtrie - \ No newline at end of file + Copyright (c) 2002-2004 Dave McMurtrie + Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 07:41:31 UTC (rev 14005) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 07:44:41 UTC (rev 14006) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.2rc2 +%define ver 1.2.2 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 07:41:31 UTC (rev 14005) +++ trunk/imap_proxy/pkginfo 2010-07-25 07:44:41 UTC (rev 14006) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.2rc2 +VERSION=1.2.2 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections Modified: trunk/imap_proxy/scripts/imapproxy.conf =================================================================== --- trunk/imap_proxy/scripts/imapproxy.conf 2010-07-25 07:41:31 UTC (rev 14005) +++ trunk/imap_proxy/scripts/imapproxy.conf 2010-07-25 07:44:41 UTC (rev 14006) @@ -136,4 +136,4 @@ ## When select caching is enabled, up-imapproxy will cache SELECT responses ## from an imap server. # -enable_select_cache yes +enable_select_cache no This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 07:59:07
|
Revision: 14008 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14008&view=rev Author: pdontthink Date: 2010-07-25 07:59:01 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.3 RC 1 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/README trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/scripts/imapproxy.conf trunk/imap_proxy/src/config.c trunk/imap_proxy/src/main.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 07:49:57 UTC (rev 14007) +++ trunk/imap_proxy/ChangeLog 2010-07-25 07:59:01 UTC (rev 14008) @@ -1,3 +1,13 @@ +2004-10-11 Dave McMurtrie <dav...@ho...> + + * config.c: Added foreground_mode option. + + * imapproxy.h: Added foreground_mode option. + + * main.c: Added foreground_mode option. + + * imapproxy.conf: Added foreground_mode option. + 2004-07-23 Dave McMurtrie <dav...@ho...> * Version 1.2.2 released. Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 07:49:57 UTC (rev 14007) +++ trunk/imap_proxy/README 2010-07-25 07:59:01 UTC (rev 14008) @@ -166,6 +166,11 @@ ------------------- Allows SELECT data caching to be enabled or disabled. +foreground_mode +--------------- +When enabled, this will prevent imapproxy from detaching from his parent +process and controlling terminal. + ############################################################################## ADDITIONAL COMMANDS: ############################################################################## Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 07:49:57 UTC (rev 14007) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 07:59:01 UTC (rev 14008) @@ -34,11 +34,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.18 2004/03/11 15:17:58 dgm Exp $ +** $Id: imapproxy.h,v 1.19 2004/10/11 18:00:42 dgm Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.19 2004/10/11 18:00:42 dgm +** Added foreground_mode configuration option. +** ** Revision 1.18 2004/03/11 15:17:58 dgm ** SELECT_BUF_SIZE size changed from 1024 to BUFSIZE which is ** currently 4096 @@ -243,6 +246,7 @@ unsigned long cache_expiration_time; /* cache exp time in seconds */ unsigned int send_tcp_keepalives; /* flag to send keepalives */ unsigned int enable_select_cache; /* flag to enable select cache */ + unsigned int foreground_mode; /* flag to enable fg mode */ char *proc_username; /* username to run as */ char *proc_groupname; /* groupname to run as */ char *stat_filename; /* mmap()ed stat filename */ Modified: trunk/imap_proxy/scripts/imapproxy.conf =================================================================== --- trunk/imap_proxy/scripts/imapproxy.conf 2010-07-25 07:49:57 UTC (rev 14007) +++ trunk/imap_proxy/scripts/imapproxy.conf 2010-07-25 07:59:01 UTC (rev 14008) @@ -137,3 +137,12 @@ ## from an imap server. # enable_select_cache no + + +# +## foreground_mode +## +## This will prevent imapproxy from detaching from his parent process and +## controlling terminal on startup. +# +foreground_mode no Modified: trunk/imap_proxy/src/config.c =================================================================== --- trunk/imap_proxy/src/config.c 2010-07-25 07:49:57 UTC (rev 14007) +++ trunk/imap_proxy/src/config.c 2010-07-25 07:59:01 UTC (rev 14008) @@ -35,11 +35,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/config.c,v $ -** $Id: config.c,v 1.10 2004/02/24 14:57:47 dgm Exp $ +** $Id: config.c,v 1.11 2004/10/11 18:01:29 dgm Exp $ ** ** Modification History: ** ** $Log: config.c,v $ +** Revision 1.11 2004/10/11 18:01:29 dgm +** Added foreground mode configuration option. +** ** Revision 1.10 2004/02/24 14:57:47 dgm ** Added new config option 'enable_select_cache'. ** @@ -393,6 +396,10 @@ ADD_TO_TABLE( "enable_select_cache", SetBooleanValue, &PC_Struct.enable_select_cache, index ); + ADD_TO_TABLE( "foreground_mode", SetBooleanValue, + &PC_Struct.foreground_mode, index ); + + ConfigTable[index].Keyword[0] = '\0'; FP = fopen( ConfigFile, "r" ); Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 07:49:57 UTC (rev 14007) +++ trunk/imap_proxy/src/main.c 2010-07-25 07:59:01 UTC (rev 14008) @@ -36,11 +36,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.19 2004/02/24 15:17:20 dgm Exp $ +** $Id: main.c,v 1.20 2004/10/11 18:23:19 dgm Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.20 2004/10/11 18:23:19 dgm +** Added foreground_mode option. +** ** Revision 1.19 2004/02/24 15:17:20 dgm ** Added ParseBannerAndCapability() function to allow for ** parsing the banner string and capability strings. Can @@ -130,7 +133,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.19 2004/02/24 15:17:20 dgm Exp $"; +static char *rcsId = "$Id: main.c,v 1.20 2004/10/11 18:23:19 dgm Exp $"; static char *rcsSource = "$Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dgm $"; @@ -353,8 +356,10 @@ ServerInit(); /* detach from our parent if necessary */ - if (! (getppid() == 1) ) + if (! (getppid() == 1) && ( ! PC_Struct.foreground_mode ) ) { + syslog( LOG_INFO, "%s: Configured to run in background mode.", fn ); + if ( (pid = fork()) < 0) { syslog(LOG_ERR, "%s: initial call to fork() failed: %s", fn, strerror(errno)); @@ -381,6 +386,11 @@ exit( 0 ); } } + else + { + syslog( LOG_INFO, "%s: Configured to run in foreground mode.", fn ); + } + SetBannerAndCapability(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 08:07:43
|
Revision: 14010 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14010&view=rev Author: pdontthink Date: 2010-07-25 08:07:37 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.3 RC 2 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/pkginfo trunk/imap_proxy/src/config.c trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/logging.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/request.c trunk/imap_proxy/src/select.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 08:02:11 UTC (rev 14009) +++ trunk/imap_proxy/ChangeLog 2010-07-25 08:07:37 UTC (rev 14010) @@ -1,3 +1,27 @@ +2004-11-10 Dave McMurtrie <dav...@ho...> + + * config.c: Explictly NULL terminate all strings that are the + result of strncpy. + + * imapcommon.c: Explictly NULL terminate all strings that are the + result of strncpy. Also enforce checking of LiteralBytesRemaining + after any call to IMAP_Line_Read. Changed some signed + data types to unsigned. + + * logging.c: Explictly NULL terminate all strings that are the + result of strncpy. + + * main.c: Explictly NULL terminate all strings that are the + result of strncpy. Also enforce checking of LiteralBytesRemaining + after any call to IMAP_Line_Read. + + * request.c: Explictly NULL terminate all strings that are the + result of strncpy. Also enforce checking of LiteralBytesRemaining + after any call to IMAP_Line_Read. + + * select.c: Explictly NULL terminate all strings that are the + result of strncpy. + 2004-10-11 Dave McMurtrie <dav...@ho...> * config.c: Added foreground_mode option. Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 08:02:11 UTC (rev 14009) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 08:07:37 UTC (rev 14010) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.2 +%define ver 1.2.3rc2 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 08:02:11 UTC (rev 14009) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 08:07:37 UTC (rev 14010) @@ -34,11 +34,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.19 2004/10/11 18:00:42 dgm Exp $ +** $Id: imapproxy.h,v 1.20 2004/11/10 15:35:13 dgm Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.20 2004/11/10 15:35:13 dgm +** Changed LiteralBytesRemaining from signed long to unsigned long. +** ** Revision 1.19 2004/10/11 18:00:42 dgm ** Added foreground_mode configuration option. ** @@ -209,7 +212,7 @@ char ReadBuf[ BUFSIZE ]; /* Read Buffer */ unsigned int BytesInReadBuffer; /* bytes left in read buffer */ unsigned int ReadBytesProcessed; /* bytes already processed in read buf */ - long LiteralBytesRemaining; /* num of bytes left to read as literal */ + unsigned long LiteralBytesRemaining; /* num of bytes left as literal */ unsigned char NonSyncLiteral; /* rfc2088 alert flag */ unsigned char MoreData; /* flag to tell caller "more data" */ unsigned char TraceOn; /* trace this transaction? */ Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 08:02:11 UTC (rev 14009) +++ trunk/imap_proxy/pkginfo 2010-07-25 08:07:37 UTC (rev 14010) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.2 +VERSION=1.2.3rc2 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections Modified: trunk/imap_proxy/src/config.c =================================================================== --- trunk/imap_proxy/src/config.c 2010-07-25 08:02:11 UTC (rev 14009) +++ trunk/imap_proxy/src/config.c 2010-07-25 08:07:37 UTC (rev 14010) @@ -35,11 +35,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/config.c,v $ -** $Id: config.c,v 1.11 2004/10/11 18:01:29 dgm Exp $ +** $Id: config.c,v 1.12 2004/11/10 15:26:25 dgm Exp $ ** ** Modification History: ** ** $Log: config.c,v $ +** Revision 1.12 2004/11/10 15:26:25 dgm +** Explictly NULL terminate all strings that are the result of an strncpy. +** ** Revision 1.11 2004/10/11 18:01:29 dgm ** Added foreground mode configuration option. ** @@ -129,6 +132,7 @@ */ #define ADD_TO_TABLE( KEYWORD, SETFUNCTION, STA, INDEX ) \ strncpy( ConfigTable[ INDEX ].Keyword, KEYWORD, MAX_KEYWORD_LEN -1 ); \ + ConfigTable[ INDEX ].Keyword[ MAX_KEYWORD_LEN - 1 ] = '\0'; \ ConfigTable[ INDEX ].SetFunction = SETFUNCTION; \ ConfigTable[ INDEX ].StorageAddress = STA; \ INDEX++; Modified: trunk/imap_proxy/src/imapcommon.c =================================================================== --- trunk/imap_proxy/src/imapcommon.c 2010-07-25 08:02:11 UTC (rev 14009) +++ trunk/imap_proxy/src/imapcommon.c 2010-07-25 08:07:37 UTC (rev 14010) @@ -35,11 +35,16 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/imapcommon.c,v $ -** $Id: imapcommon.c,v 1.18 2003/10/22 13:39:24 dgm Exp $ +** $Id: imapcommon.c,v 1.19 2004/11/10 15:29:23 dgm Exp $ ** ** Modification History: ** ** $Log: imapcommon.c,v $ +** Revision 1.19 2004/11/10 15:29:23 dgm +** Explicitly NULL terminate all strings that are the result of +** strncpy. Also enforce checking of LiteralBytesRemaining +** after any calls to IMAP_Line_Read. +** ** Revision 1.18 2003/10/22 13:39:24 dgm ** Fixed really bad bug in for loop for string literal detection. ** Explicitly clear errno prior to calling atol(). @@ -434,6 +439,17 @@ goto fail; } + /* + * Sanity check. We don't deal with literal responses in the + * banner string. + */ + if ( Server.LiteralBytesRemaining ) + { + syslog(LOG_ERR, "%s: Unexpected string literal in server banner response.", fn ); + goto fail; + + } + /* * Do STARTTLS if necessary. @@ -456,6 +472,14 @@ syslog(LOG_INFO, "STARTTLS failed: No response from IMAP server after sending STARTTLS command" ); goto fail; } + + if ( Server.LiteralBytesRemaining ) + { + syslog(LOG_ERR, "%s: Unexpected string literal in server response.", fn ); + goto fail; + + } + /* * Try to match up the tag in the server response to the client tag. @@ -560,6 +584,13 @@ syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Failed to receive go-ahead from IMAP server after sending LOGIN command", Username, ClientAddr, sin_port ); goto fail; } + + if ( Server.LiteralBytesRemaining ) + { + syslog(LOG_ERR, "%s: Unexpected string literal in server banner response. Should be a continuation response.", fn ); + goto fail; + + } if ( Server.ReadBuf[0] != '+' ) { @@ -616,7 +647,14 @@ syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: No response from IMAP server after sending LOGIN command", Username, ClientAddr, sin_port ); goto fail; } - + + if ( Server.LiteralBytesRemaining ) + { + syslog(LOG_ERR, "%s: Unexpected string literal in server LOGIN response.", fn ); + goto fail; + + } + if ( Server.ReadBuf[0] != '*' ) break; } @@ -707,6 +745,7 @@ /* fill in the newest used (oxymoron?) structure */ strncpy( ICC_Active->username, Username, sizeof ICC_Active->username ); + ICC_Active->username[ sizeof ICC_Active->username - 1 ] = '\0'; memcpy( ICC_Active->hashedpw, md5pw, sizeof ICC_Active->hashedpw ); ICC_Active->logouttime = 0; /* zero means, "it's active". */ ICC_Active->server_conn = Server.conn; @@ -951,7 +990,8 @@ extern int IMAP_Literal_Read( ITD_Struct *ITD ) { char *fn = "IMAP_Literal_Read()"; - int Status, i, j; + int Status; + unsigned int i, j; struct pollfd fds[2]; nfds_t nfds; int pollstatus; @@ -1083,7 +1123,8 @@ extern int IMAP_Line_Read( ITD_Struct *ITD ) { char *CP; - int Status, i, j; + int Status; + unsigned int i, j; char *fn = "IMAP_Line_Read()"; char *EndOfBuffer; Modified: trunk/imap_proxy/src/logging.c =================================================================== --- trunk/imap_proxy/src/logging.c 2010-07-25 08:02:11 UTC (rev 14009) +++ trunk/imap_proxy/src/logging.c 2010-07-25 08:07:37 UTC (rev 14010) @@ -34,11 +34,15 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/logging.c,v $ -** $Id: logging.c,v 1.2 2003/05/20 19:01:49 dgm Exp $ +** $Id: logging.c,v 1.3 2004/11/10 15:30:17 dgm Exp $ ** ** Modification History: ** ** $Log: logging.c,v $ +** Revision 1.3 2004/11/10 15:30:17 dgm +** Explictly NULL terminate all strings that are the result +** of strncpy. +** ** Revision 1.2 2003/05/20 19:01:49 dgm ** Comment changes only. ** @@ -84,6 +88,7 @@ exit( 1 ); \ } \ strncpy( SyslogFacilityTable[ INDEX ].FacilityString, #FACILITY, MAX_FACILITY_STRINGLEN - 1 ); \ + SyslogFacilityTable[ INDEX ].FacilityString[ MAX_FACILITY_STRINGLEN - 1 ] = '\0'; \ SyslogFacilityTable[ INDEX ].FacilityValue = FACILITY; \ INDEX++; @@ -98,6 +103,7 @@ exit( 1 ); \ } \ strncpy( SyslogPriorityTable[ INDEX ].PriorityString, #PRIORITY, MAX_PRIORITY_STRINGLEN - 1 ); \ + SyslogPriorityTable[ INDEX ].PriorityString[ MAX_PRIORITY_STRINGLEN - 1 ] = '\0'; \ SyslogPriorityTable[ INDEX ].PriorityValue = PRIORITY; \ INDEX++; Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 08:02:11 UTC (rev 14009) +++ trunk/imap_proxy/src/main.c 2010-07-25 08:07:37 UTC (rev 14010) @@ -36,11 +36,16 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.20 2004/10/11 18:23:19 dgm Exp $ +** $Id: main.c,v 1.21 2004/11/10 15:32:02 dgm Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.21 2004/11/10 15:32:02 dgm +** Explictly NULL terminate all strings that are the result +** of strncpy. Also enforce checking of LiteralBytesRemaining +** after any calls to IMAP_Line_Read. +** ** Revision 1.20 2004/10/11 18:23:19 dgm ** Added foreground_mode option. ** @@ -133,7 +138,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.20 2004/10/11 18:23:19 dgm Exp $"; +static char *rcsId = "$Id: main.c,v 1.21 2004/11/10 15:32:02 dgm Exp $"; static char *rcsSource = "$Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dgm $"; @@ -257,6 +262,7 @@ case 'f': /* user specified a config filename */ strncpy( ConfigFile, optarg, sizeof ConfigFile -1 ); + ConfigFile[ sizeof ConfigFile - 1 ] = '\0'; syslog( LOG_INFO, "%s: Using configuration file '%s'", fn, ConfigFile ); break; @@ -279,6 +285,7 @@ if ( ! ConfigFile[0] ) { strncpy( ConfigFile, DEFAULT_CONFIG_FILE, sizeof ConfigFile -1 ); + ConfigFile[ sizeof ConfigFile - 1 ] = '\0'; syslog( LOG_INFO, "%s: Using default configuration file '%s'.", fn, ConfigFile ); } @@ -948,7 +955,14 @@ close( itd.conn->sd ); exit( 1 ); } + + if ( itd.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Server sent unexpected literal specifier in banner response -- Exiting.", fn ); + exit( 1 ); + } + BannerLen = ParseBannerAndCapability( Banner, sizeof Banner - 1, itd.ReadBuf, BytesRead ); @@ -991,10 +1005,18 @@ exit( 1 ); } + if ( itd.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Server sent unexpected literal specifier in CAPABILITY response -- Exiting.", fn ); + close( itd.conn->sd ); + exit ( 1 ); + + } + CapabilityLen = ParseBannerAndCapability( Capability, sizeof Capability - 1, itd.ReadBuf, BytesRead ); - + /* Now read the tagged response and make sure it's OK */ BytesRead = IMAP_Line_Read( &itd ); if ( BytesRead == -1 ) @@ -1003,8 +1025,13 @@ close( itd.conn->sd ); exit( 1 ); } + + if ( itd.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Server sent unexpected literal specifier in tagged CAPABILITY response -- exiting.", fn ); + exit( 1 ); + } - if ( strncasecmp( itd.ReadBuf, IMAP_TAGGED_OK, strlen(IMAP_TAGGED_OK) ) ) { syslog(LOG_ERR, "%s: Received non-OK tagged reponse from imap server on CAPABILITY command -- exiting.", fn ); @@ -1026,7 +1053,12 @@ { syslog(LOG_WARNING, "%s: IMAP_Line_Read() failed on LOGOUT -- Ignoring", fn ); } - + + if ( itd.LiteralBytesRemaining ) + { + syslog( LOG_WARNING, "%s: Server sent unexpected literal specifier in LOGOUT response -- Ignoring", fn ); + } + close( itd.conn->sd ); return; } Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 08:02:11 UTC (rev 14009) +++ trunk/imap_proxy/src/request.c 2010-07-25 08:07:37 UTC (rev 14010) @@ -39,11 +39,16 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.18 2004/02/24 15:19:06 dgm Exp $ +** $Id: request.c,v 1.19 2004/11/10 15:33:04 dgm Exp $ ** ** Modification History: ** ** $Log: request.c,v $ +** Revision 1.19 2004/11/10 15:33:04 dgm +** Explictly NULL terminate all strings that are the result +** of strncpy. Also enforce checking of LiteralBytesRemaining +** after any call to IMAP_Line_Read. +** ** Revision 1.18 2004/02/24 15:19:06 dgm ** Added support for SELECT caching. ** @@ -433,6 +438,7 @@ } strncpy( TraceUser, Username, sizeof TraceUser - 1 ); + TraceUser[ sizeof TraceUser - 1 ] = '\0'; snprintf( SendBuf, BufLen, "%s OK Tracing enabled\r\n", Tag ); if ( IMAP_Write( itd->conn, SendBuf, strlen(SendBuf) ) == -1 ) @@ -618,6 +624,15 @@ syslog( LOG_NOTICE, "%s: Failed to read base64 encoded username from client on socket %d", fn, Client->conn->sd ); return( -1 ); } + + /* + * Don't accept literals from the client here. + */ + if ( Client->LiteralBytesRemaining ) + { + syslog( LOG_NOTICE, "%s: Read unexpected literal specifier from client on socket %d", fn, Client->conn->sd ); + return( -1 ); + } /* * Easy, but not perfect sanity check. If the client sent enough data @@ -655,6 +670,12 @@ } BytesRead = IMAP_Line_Read( Client ); + + if ( Client->LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: received unexpected literal specifier from client on socket %d", fn, Client->conn->sd ); + return( -1 ); + } if ( BytesRead == -1 ) { @@ -1474,7 +1495,7 @@ PollFailCount = 0; BytesRead = IMAP_Line_Read( &Client ); - + if ( BytesRead == -1 ) { IMAPCount->CurrentClientConnections--; @@ -1530,18 +1551,42 @@ * appropriate... */ strncpy( S_Tag, Tag, MAXTAGLEN - 1 ); + S_Tag[ MAXTAGLEN - 1 ] = '\0'; + if ( ! strcasecmp( (const char *)Command, "NOOP" ) ) { + if ( Client.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Unexpected literal specifier read from client on socket %d as part of NOOP command -- disconnecting client", fn, Client.conn->sd ); + IMAPCount->CurrentClientConnections--; + close( Client.conn->sd ); + return; + } + cmd_noop( &Client, S_Tag ); continue; } else if ( ! strcasecmp( (const char *)Command, "CAPABILITY" ) ) { + if ( Client.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Unexpected literal specifier read from client on socket %d as part of CAPABILITY command -- disconnecting client", fn, Client.conn->sd ); + IMAPCount->CurrentClientConnections--; + close( Client.conn->sd ); + return; + } cmd_capability( &Client, S_Tag ); continue; } else if ( ! strcasecmp( (const char *)Command, "AUTHENTICATE" ) ) { + if ( Client.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Unexpected literal specifier read from client on socket %d as part of AUTHENTICATE command -- disconnecting client", fn, Client.conn->sd ); + IMAPCount->CurrentClientConnections--; + close( Client.conn->sd ); + return; + } AuthMech = memtok( NULL, EndOfLine, &Lasts ); if ( !AuthMech ) { @@ -1554,7 +1599,7 @@ } continue; } - + if ( !strcasecmp( (const char *)AuthMech, "LOGIN" ) ) { rc = cmd_authenticate_login( &Client, S_Tag ); @@ -1569,6 +1614,7 @@ if ( Tag ) { strncpy( S_Tag, Tag, MAXTAGLEN - 1 ); + S_Tag[ MAXTAGLEN - 1 ] = '\0'; cmd_logout( &Client, S_Tag ); } } @@ -1591,10 +1637,17 @@ } continue; } - + } else if ( ! strcasecmp( (const char *)Command, "LOGOUT" ) ) { + if ( Client.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Unexpected literal specifier read from client on socket %d as part of LOGOUT command -- disconnecting client", fn, Client.conn->sd ); + IMAPCount->CurrentClientConnections--; + close( Client.conn->sd ); + return; + } cmd_logout( &Client, S_Tag ); IMAPCount->CurrentClientConnections--; close( Client.conn->sd ); @@ -1602,22 +1655,50 @@ } else if ( ! strcasecmp( (const char *)Command, "P_TRACE" ) ) { + if ( Client.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Unexpected literal specifier read from client on socket %d as part of P_TRACE command -- disconnecting client", fn, Client.conn->sd ); + IMAPCount->CurrentClientConnections--; + close( Client.conn->sd ); + return; + } Username = memtok( NULL, EndOfLine, &Lasts ); cmd_trace( &Client, S_Tag, Username ); continue; } else if ( ! strcasecmp( (const char *)Command, "P_DUMPICC" ) ) { + if ( Client.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Unexpected literal specifier read from client on socket %d as part of P_DUMPICC command -- disconnecting client", fn, Client.conn->sd ); + IMAPCount->CurrentClientConnections--; + close( Client.conn->sd ); + return; + } cmd_dumpicc( &Client, S_Tag ); continue; } else if ( ! strcasecmp( (const char *)Command, "P_RESETCOUNTERS" ) ) { + if ( Client.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Unexpected literal specifier read from client on socket %d as part of P_RESETCOUNTERS command -- disconnecting client", fn, Client.conn->sd ); + IMAPCount->CurrentClientConnections--; + close( Client.conn->sd ); + return; + } cmd_resetcounters( &Client, S_Tag ); continue; } else if ( ! strcasecmp( (const char *)Command, "P_NEWLOG" ) ) { + if ( Client.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Unexpected literal specifier read from client on socket %d as part of P_NEWLOG command -- disconnecting client", fn, Client.conn->sd ); + IMAPCount->CurrentClientConnections--; + close( Client.conn->sd ); + return; + } cmd_newlog( &Client, S_Tag ); continue; } @@ -1641,7 +1722,8 @@ } continue; } - strncpy( S_UserName, Username, sizeof S_UserName - 1 ); + strncpy( S_UserName, Username, sizeof S_UserName - 1 ); + S_UserName[ sizeof S_UserName - 1 ] = '\0'; /* * Clients can send the password as a literal bytestream. Check @@ -1748,6 +1830,7 @@ *CP = '\0'; strncpy( S_Password, Lasts, sizeof S_Password - 1 ); + S_Password[ sizeof S_Password - 1 ] = '\0'; } @@ -1779,6 +1862,7 @@ if ( Tag ) { strncpy( S_Tag, Tag, MAXTAGLEN - 1 ); + S_Tag[ MAXTAGLEN - 1 ] = '\0'; cmd_logout( &Client, S_Tag ); } } @@ -1798,6 +1882,14 @@ * same way the cyrus implementation does -- tell the client to * log in first. */ + if ( Client.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Unexpected literal specifier read from client on socket %d as part of unknown command -- disconnecting client", fn, Client.conn->sd ); + IMAPCount->CurrentClientConnections--; + close( Client.conn->sd ); + return; + } + snprintf( SendBuf, BufLen, "%s BAD Please login first\r\n", Tag, Command ); if ( IMAP_Write( Client.conn, SendBuf, strlen(SendBuf) ) == -1 ) { Modified: trunk/imap_proxy/src/select.c =================================================================== --- trunk/imap_proxy/src/select.c 2010-07-25 08:02:11 UTC (rev 14009) +++ trunk/imap_proxy/src/select.c 2010-07-25 08:07:37 UTC (rev 14010) @@ -34,11 +34,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/select.c,v $ -** $Id: select.c,v 1.2 2004/03/11 15:14:06 dgm Exp $ +** $Id: select.c,v 1.3 2004/11/10 15:34:14 dgm Exp $ ** ** Modification History: ** ** $Log: select.c,v $ +** Revision 1.3 2004/11/10 15:34:14 dgm +** Explictly NULL terminate all strings that are the result of strncpy. +** ** Revision 1.2 2004/03/11 15:14:06 dgm ** Behavior of calling code when Populate_Select_Cache() fails ** modified to not send error back to client. @@ -417,6 +420,7 @@ ISC->ISCTime = time( 0 ); strncpy( (char *)ISC->MailboxName, (const char *)MailboxName, MAXMAILBOXNAME - 1 ); + ISC->MailboxName[ MAXMAILBOXNAME - 1 ] = '\0'; return( 0 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 08:19:38
|
Revision: 14012 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14012&view=rev Author: pdontthink Date: 2010-07-25 08:19:30 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.3 RC 3 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/Makefile.in trunk/imap_proxy/README.ssl trunk/imap_proxy/configure trunk/imap_proxy/configure.in trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/pkginfo trunk/imap_proxy/scripts/imapproxy.conf trunk/imap_proxy/src/config.c trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/main.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 08:11:18 UTC (rev 14011) +++ trunk/imap_proxy/ChangeLog 2010-07-25 08:19:30 UTC (rev 14012) @@ -1,3 +1,30 @@ +2005-01-12 Dave McMurtrie <dav...@ho...> + + * configure.in: Applied patch by Frederic Olivie to detect ncurses + as well as curses. + + * imapproxy.h: cache_size and cache_expiration_time in struct + ProxyConfig now declared as unsigned int instead of unsigned + long. Patch by Cameron Schaus to fix 64-bit issues since + SetNumericValue accepts int * as an argument. Added patch + by David Lancaster to provide force_tls config option. + + * main.c: Applied patch by Joseph Tam to prevent SIGSEGV in + RAND_egd(). Applied patch by David Lancaster to provide + force_tls config option. + + * imapcommon.c: Applied patch by David Lancaster to provide + force_tls config option. + + * config.c: Applied patch by David Lancaster to provide + force_tls config option. + + * README.ssl: Added documentation provided by Steve Lidie. + +2004-11-24 Dave McMurtrie <dav...@ho...> + + * Makefile.in: Applied patch by Matt Selsky to create $prefix/bin + 2004-11-10 Dave McMurtrie <dav...@ho...> * config.c: Explictly NULL terminate all strings that are the Modified: trunk/imap_proxy/Makefile.in =================================================================== --- trunk/imap_proxy/Makefile.in 2010-07-25 08:11:18 UTC (rev 14011) +++ trunk/imap_proxy/Makefile.in 2010-07-25 08:19:30 UTC (rev 14012) @@ -78,6 +78,7 @@ rm -f config.cache config.log config.h Makefile install: $(XYD_BIN) $(TAT_BIN) + mkdir -p $(EBIN) $(INSTALL) -o bin -g bin -m 0755 $(XYD_BIN) $(EBIN) $(INSTALL) -o bin -g bin -m 0755 $(TAT_BIN) $(EBIN) Modified: trunk/imap_proxy/README.ssl =================================================================== --- trunk/imap_proxy/README.ssl 2010-07-25 08:11:18 UTC (rev 14011) +++ trunk/imap_proxy/README.ssl 2010-07-25 08:19:30 UTC (rev 14012) @@ -24,5 +24,50 @@ http://www.sendmail.org/~ca/email/starttls.html -If anyone wants to contribute to this project by submitting some good -documentation about configuring up-imapproxy with TLS, it would be appreciated. + +Steve Lidie from lehigh.edu contributed the following information +that should help you along, also: + +The only change I found necessary was in the OpenSSL configuration file: + +# diff openssl.cnf~ openssl.cnf +37c37 +< dir = ./demoCA # Where everything is kept +--- +> dir = . # Where everything is kept + +Copied here vebatim, are the required steps: + +To make certificate authority: + + mkdir CA + cd CA + mkdir certs crl newcerts private + echo "01" > serial + cp /dev/null index.txt + cp /usr/local/openssl/openssl.cnf.sample openssl.cnf + vi openssl.cnf (set values) + openssl req -new -x509 -keyout private/cakey.pem -out cacert.pem -days 365 -config openssl.cnf + +To make a new certificate: + + cd CA (same directory created above) + openssl req -nodes -new -x509 -keyout newreq.pem -out newreq.pem -days 365 -config openssl.cnf + +Certificate and private key in file newreq.pem. +To sign new certificate with certificate authority: + + cd CA (same directory created above) + openssl x509 -x509toreq -in newreq.pem -signkey newreq.pem -out tmp.pem + openssl ca -config openssl.cnf -policy policy_anything -out newcert.pem -infiles tmp.pem + rm -f tmp.pem + +newcert.pem contains the signed certificate, newreq.pem still +contains the unsigned certificate and private key. + +The resulting imapproxy.config lines then look like this: + +tls_ca_path /usr/local/etc/CA/ +tls_ca_file /usr/local/etc/CA/cacert.pem +tls_cert_file /usr/local/etc/CA/newcert.pem +tls_key_file /usr/local/etc/CA/newreq.pem Modified: trunk/imap_proxy/configure =================================================================== --- trunk/imap_proxy/configure 2010-07-25 08:11:18 UTC (rev 14011) +++ trunk/imap_proxy/configure 2010-07-25 08:19:30 UTC (rev 14012) @@ -1,19 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.53. +# Generated by GNU Autoconf 2.59. # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - - ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -22,46 +13,57 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh -# NLS nuisances. # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi -(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && - { $as_unset LANG || test "${LANG+set}" != set; } || - { LANG=C; export LANG; } -(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && - { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || - { LC_ALL=C; export LC_ALL; } -(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && - { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || - { LC_TIME=C; export LC_TIME; } -(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && - { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || - { LC_CTYPE=C; export LC_CTYPE; } -(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && - { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || - { LANGUAGE=C; export LANGUAGE; } -(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && - { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || - { LC_COLLATE=C; export LC_COLLATE; } -(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && - { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || - { LC_NUMERIC=C; export LC_NUMERIC; } -(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && - { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || - { LC_MESSAGES=C; export LC_MESSAGES; } +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + # Name of the executable. -as_me=`(basename "$0") 2>/dev/null || +as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ @@ -72,6 +74,7 @@ /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` + # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -82,15 +85,15 @@ # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conftest.sh - echo "exit 0" >>conftest.sh - chmod +x conftest.sh - if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conftest.sh + rm -f conf$$.sh fi @@ -138,6 +141,8 @@ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} @@ -210,13 +215,20 @@ fi rm -f conf$$ conf$$.exe conf$$.file +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -226,7 +238,7 @@ IFS=" $as_nl" # CDPATH. -$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } +$as_unset CDPATH # Name of the host. @@ -240,6 +252,7 @@ # Initializations. # ac_default_prefix=/usr/local +ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= @@ -295,6 +308,8 @@ # include <unistd.h> #endif" +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os LIB_CURSES DEFINES CPP EGREP LIBOBJS LTLIBOBJS' +ac_subst_files='' # Initialize some variables set by options. ac_init_help= @@ -652,7 +667,7 @@ # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir + localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in @@ -692,10 +707,10 @@ # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -718,6 +733,9 @@ { (exit 1); exit 1; }; } fi fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias @@ -784,9 +802,9 @@ cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -877,13 +895,46 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then @@ -893,13 +944,13 @@ echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then + test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi - cd $ac_popdir + cd "$ac_popdir" done fi @@ -907,8 +958,7 @@ if $ac_init_version; then cat <<\_ACEOF -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -920,7 +970,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.53. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -972,27 +1022,54 @@ # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= +ac_configure_args0= +ac_configure_args1= ac_sep= -for ac_arg +ac_must_keep_next=false +for ac_pass in 1 2 do - case $ac_arg in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n ) continue ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - ac_sep=" " ;; - esac - # Get rid of the leading space. + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -1003,6 +1080,7 @@ # Save into config.log some information that might help in debugging. { echo + cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## @@ -1015,16 +1093,45 @@ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## @@ -1032,14 +1139,14 @@ ## ----------- ## _ASBOX echo - sed "/^$/d" confdefs.h + sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -1119,7 +1226,7 @@ # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" @@ -1136,13 +1243,13 @@ ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. @@ -1190,15 +1297,16 @@ -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: - @echo 'ac_maketemp="${MAKE}"' + @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` @@ -1423,9 +1531,7 @@ # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$as_dir/$ac_word" ${1+"$@"} - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi @@ -1530,8 +1636,10 @@ fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. @@ -1555,15 +1663,12 @@ (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1573,12 +1678,12 @@ } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe" +ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 @@ -1592,26 +1697,39 @@ # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= -for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; - ls a.out conftest 2>/dev/null; - ls a.* conftest.* 2>/dev/null`; do +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; - a.out ) # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool --akim. - export ac_cv_exeext - break;; - * ) break;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; esac done else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 -echo "$as_me: error: C compiler cannot create executables" >&2;} +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi @@ -1638,9 +1756,11 @@ cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&5 +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&2;} +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi @@ -1648,7 +1768,7 @@ echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 -rm -f a.out a.exe conftest$ac_cv_exeext +rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. @@ -1668,18 +1788,21 @@ # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. -for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; + export ac_cv_exeext + break;; * ) break;; esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -1696,15 +1819,12 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1721,16 +1841,19 @@ (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -1746,15 +1869,12 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1768,23 +1888,33 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi @@ -1800,15 +1930,12 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1819,23 +1946,33 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 @@ -1854,6 +1991,120 @@ CFLAGS= fi fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide @@ -1865,19 +2116,27 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - ''\ - '#include <stdlib.h>' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -1885,16 +2144,13 @@ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration #include <stdlib.h> -$ac_declaration -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1905,33 +2161,40 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_declaration -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1942,22 +2205,32 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -1968,9 +2241,10 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2013,6 +2287,7 @@ # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 @@ -2029,6 +2304,7 @@ case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2036,20 +2312,20 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi done done ;; @@ -2170,61 +2446,86 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define connect to an innocuous variant, in case <limits.h> declares connect. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define connect innocuous_connect + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char connect (); below. */ -#include <assert.h> + which can conflict with char connect (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef connect + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" +{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); -char (*f) (); - -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif -int -main () -{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else -f = connect; +char (*f) () = connect; #endif +#ifdef __cplusplus +} +#endif +int +main () +{ +return f != connect; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_func_connect=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 @@ -2241,8 +2542,11 @@ LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2251,12 +2555,6 @@ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2267,23 +2565,34 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_nsl_gethostbyname=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 @@ -2306,8 +2615,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2316,12 +2628,6 @@ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2332,23 +2638,34 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_socket_connect=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 @@ -2381,8 +2698,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2391,12 +2711,6 @@ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pthread_create (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2407,23 +2721,34 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pthread_pthread_create=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_pthread_pthread_create=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 @@ -2445,8 +2770,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2455,12 +2783,6 @@ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pthread_create (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2471,23 +2793,34 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_c_r_pthread_create=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_c_r_pthread_create=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_create" >&5 @@ -2516,61 +2849,86 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define mmap to an innocuous variant, in case <limits.h> declares mmap. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define mmap innocuous_mmap + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char mmap (); below. */ -#include <assert.h> + which can conflict with char mmap (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef mmap + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" +{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char mmap (); -char (*f) (); - -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif -int -main () -{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_mmap) || defined (__stub___mmap) choke me #else -f = mmap; +char (*f) () = mmap; #endif +#ifdef __cplusplus +} +#endif +int +main () +{ +return f != mmap; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mmap=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_func_mmap=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_mmap" >&5 echo "${ECHO_T}$ac_cv_func_mmap" >&6 @@ -2676,8 +3034,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2686,12 +3047,6 @@ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yp_get_default_domain (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2702,23 +3057,34 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_yp_get_default_domain=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_nsl_yp_get_default_domain=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_yp_get_default_domain" >&5 @@ -2748,8 +3114,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lwrap $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2758,12 +3127,6 @@ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char request_init (); -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2774,23 +3137,34 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_wrap_request_init=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_wrap_request_init=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINEN... [truncated message content] |
From: <pdo...@us...> - 2010-07-25 08:26:19
|
Revision: 14014 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14014&view=rev Author: pdontthink Date: 2010-07-25 08:26:13 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.3 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/pkginfo Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 08:22:11 UTC (rev 14013) +++ trunk/imap_proxy/ChangeLog 2010-07-25 08:26:13 UTC (rev 14014) @@ -1,3 +1,7 @@ +2005-02-21 Dave McMurtrie <dav...@gm...> + + * Version 1.2.3 released. + 2005-01-12 Dave McMurtrie <dav...@ho...> * configure.in: Applied patch by Frederic Olivie to detect ncurses Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 08:22:11 UTC (rev 14013) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 08:26:13 UTC (rev 14014) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.3rc3 +%define ver 1.2.3 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 08:22:11 UTC (rev 14013) +++ trunk/imap_proxy/pkginfo 2010-07-25 08:26:13 UTC (rev 14014) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.3rc3 +VERSION=1.2.3 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 08:33:12
|
Revision: 14016 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14016&view=rev Author: pdontthink Date: 2010-07-25 08:33:05 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.4 RC 1 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/README trunk/imap_proxy/README.known_issues trunk/imap_proxy/config.guess trunk/imap_proxy/config.sub trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/scripts/imapproxy.conf trunk/imap_proxy/src/becomenonroot.c trunk/imap_proxy/src/config.c trunk/imap_proxy/src/icc.c trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/logging.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/pimpstat.c trunk/imap_proxy/src/request.c trunk/imap_proxy/src/select.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 08:29:19 UTC (rev 14015) +++ trunk/imap_proxy/ChangeLog 2010-07-25 08:33:05 UTC (rev 14016) @@ -1,3 +1,47 @@ +2005-06-14 Dave McMurtrie <dav...@gm...> + + * imapproxy.spec: Patch by William Hooper to remove obsolete Copyright + tag, add license tag and remove extra source tags. + +2005-06-07 Dave McMurtrie <dav...@gm...> + + * icc.c: Conditionally include unistd.h for close prototype. + Remove a few unused variables. Include missing config.h + include directive. + + * main.c: Added missing include directives to avoid implicit + declarations. Assed missing config.h include directive. + + * imapcommon.c: Added missing include directive for openssl/err.h to + avoid implicit declarations. Added atoui function. Added include + directive for limits.h to accomodate atoui. Include missing + config.h directive. + + * request.c: Removed unused variables. Fixed snprintf argument lists. + Include missing config.h directive. + + * becomenonroot.c: Conditionally include unistd.h to avoid + implicit declarations. Include missing config.h directive. Patch + by Jarno Huuskonen to drop any supplemental group memberships. + Patch by Dave Steinberg (modified by Jarno Huuskonen) to allow + chroot. + + * logging.c: Include string.h to avoid implicit declarations. + + * select.c: Remove unused variables. + + * pimpstat.c: Patch by Mathew Anderson to add -c flag and behavior. + + * imapproxy.h: Changed all long values to int values. Changed + logouttime in IMAPConnectionContext to time_t. Added atoui + function prototype. Patch by Jarno Huuskonen to allow chroot. + + * imapproxy.conf: Added chroot_directory option (Patch by Dave + Steinberg and Jarno Huuskonen). + + * config.c: Added chroot_directory option (Patch by Dave Steinberg + and Jarno Huuskonen). + 2005-02-21 Dave McMurtrie <dav...@gm...> * Version 1.2.3 released. Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 08:29:19 UTC (rev 14015) +++ trunk/imap_proxy/README 2010-07-25 08:33:05 UTC (rev 14016) @@ -3,7 +3,8 @@ This directory contains the source distribution of up-imapproxy. -If you find any bugs in up-imapproxy, please visit http://bugs.imapproxy.org +If you find any bugs in up-imapproxy, please subscribe to the imapproxy-info +mailing list and post your bug there. If you want to subscribe to the imapproxy-info mailing list, visit: @@ -12,10 +13,8 @@ For some Debian specific issues that have come up, read the file README.debian. To read a little bit about SSL support in imapproxy, read README.ssl. -There's not much in the README.ssl file except a pointer to better -documentation that's already available. Please feel free to contribute more -complete documentation if you have the time. + ############################################################################## HOW TO BUILD ############################################################################## @@ -171,6 +170,11 @@ When enabled, this will prevent imapproxy from detaching from his parent process and controlling terminal. +chroot_directory +---------------- +If this value is set to anything, it implicitly causes imapproxy to run in +a chroot jail. + ############################################################################## ADDITIONAL COMMANDS: ############################################################################## @@ -214,7 +218,7 @@ Happy proxying, -Dave <dav...@ho...> +Dave <dav...@gm...> _________ Modified: trunk/imap_proxy/README.known_issues =================================================================== --- trunk/imap_proxy/README.known_issues 2010-07-25 08:29:19 UTC (rev 14015) +++ trunk/imap_proxy/README.known_issues 2010-07-25 08:33:05 UTC (rev 14016) @@ -66,3 +66,13 @@ argument to gcc. Ultimately, this will need to be fixed so the configure script does the right thing. Patches welcome. ------------------------------------------------------------------------------- + + +------------------------------------------------------------------------------- +Problem: Attempting to build rpm on RedHat 9 or RedHat Enterprise Linux 3 fails + because the kerberos include files can't be found. + +Symptom: + +Fix: rpmbuild -tb up-imapproxy-1.2.3.tar.gz --define 'with_krb5 1' +------------------------------------------------------------------------------- Modified: trunk/imap_proxy/config.guess =================================================================== --- trunk/imap_proxy/config.guess 2010-07-25 08:29:19 UTC (rev 14015) +++ trunk/imap_proxy/config.guess 2010-07-25 08:33:05 UTC (rev 14016) @@ -1,8 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 -# Free Software Foundation, Inc. -# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-10-03' + # This file 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 2 of the License, or @@ -22,101 +24,268 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Written by Per Bothner <bo...@cy...>. -# The master version of this file is at the FSF in /home/gd/gnu/lib. -# Please send patches to <aut...@gn...>. +# Originally written by Per Bothner <pe...@bo...>. +# Please send patches to <con...@gn...>. Submit a context +# diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# +# don't specify an explicit build system type. -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - CC_FOR_BUILD=cc - fi - fi +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <con...@gn...>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 fi +trap 'exit 1' 1 2 15 +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (gh...@no... 8/24/94.) +# (gh...@no... 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <<EOF >$dummy.s - .globl main - .ent main -main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - fi - rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; + Alpha*:OpenVMS:*:*) + echo alpha-hp-vms + exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -127,45 +296,21 @@ echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 + echo m68k-unknown-sysv4 exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) @@ -179,6 +324,13 @@ NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; @@ -207,7 +359,7 @@ echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) @@ -221,15 +373,9 @@ aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor + # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not @@ -253,30 +399,9 @@ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${UNAME_RELEASE} - exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; @@ -290,8 +415,10 @@ echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { @@ -310,12 +437,20 @@ exit (-1); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; @@ -331,7 +466,7 @@ AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110] + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] @@ -363,11 +498,20 @@ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i?86:AIX:*:*) + i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include <sys/systemcfg.h> @@ -379,8 +523,7 @@ exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -388,9 +531,9 @@ echo rs6000-ibm-aix3.2 fi exit 0 ;; - *:AIX:*:4) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -398,7 +541,7 @@ if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=4.${UNAME_RELEASE} + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; @@ -408,7 +551,7 @@ ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) @@ -424,11 +567,30 @@ echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - sed 's/^ //' << EOF >$dummy.c + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE #include <stdlib.h> #include <unistd.h> @@ -459,13 +621,29 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - rm -f $dummy.c $dummy + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; 3050*:HI-UX:*:*) + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include <unistd.h> int @@ -491,8 +669,7 @@ exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -501,7 +678,7 @@ 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; - *9??*:MPE/iX:*:*) + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) @@ -510,7 +687,7 @@ hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; - i?86:OSF1:*:*) + i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else @@ -520,9 +697,6 @@ parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; - hppa*:OpenBSD:*:*) - echo hppa-unknown-openbsd - exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -541,41 +715,34 @@ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - F300:UNIX_System_V:*:*) + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i?86:BSD/386:*:* | i?86:BSD/OS:*:*) + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) @@ -584,32 +751,43 @@ *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; - *:FreeBSD:*:*) - if test -x /usr/bin/objformat; then - if test "elf" = "`/usr/bin/objformat`"; then - echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - exit 0 - fi - fi - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + # GNU/FreeBSD systems have a "k" prefix to indicate we are using + # FreeBSD's kernel, but not the complete OS. + case ${LIBC} in gnu) kernel_only='k' ;; esac + echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix + echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin @@ -623,201 +801,168 @@ *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; - *:Linux:*:*) - + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. - ld_help_string=`cd /; ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g - s/.*supported emulations: *// + s/.*supported targets: *// s/ .*// p'` - case "$ld_supported_emulations" in - *ia64) - echo "${UNAME_MACHINE}-unknown-linux" - exit 0 + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; - i?86linux) + a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 - ;; - i?86coff) + exit 0 ;; + coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 - ;; - sparclinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - armlinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32arm*) - echo "${UNAME_MACHINE}-unknown-linux-gnu" - exit 0 - ;; - armelf_linux*) - echo "${UNAME_MACHINE}-unknown-linux-gnu" - exit 0 - ;; - m68klinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32ppc) - # Determine Lib Version - cat >$dummy.c <<EOF -#include <features.h> -#if defined(__GLIBC__) -extern char __libc_version[]; -extern char __libc_release[]; -#endif -main(argc, argv) - int argc; - char *argv[]; -{ -#if defined(__GLIBC__) - printf("%s %s\n", __libc_version, __libc_release); -#else - printf("unkown\n"); -#endif - return 0; -} -EOF - LIBC="" - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.c $dummy - echo powerpc-unknown-linux-gnu${LIBC} - exit 0 - ;; + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <<EOF >$dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c <<EOF -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >$dummy.c <<EOF -#include <features.h> -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i?86:DYNIX/ptx:4*:*) + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; - i?86:UNIX_SV:4.2MP:2.*) + i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, @@ -825,7 +970,24 @@ # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; - i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} @@ -833,27 +995,26 @@ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; - i?86:*:5:7*) - # Fixed at (any) Pentium or better - UNAME_MACHINE=i586 - if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then - echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} - fi + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; - i?86:*:3.2:*) + i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` echo ${UNAME_MACHINE}-pc-isc$UNAME_REL elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else @@ -861,6 +1022,7 @@ fi exit 0 ;; pc:*:*:*) + # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp @@ -882,9 +1044,15 @@ # "miniframe" echo m68010-convergent-sysv exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -895,21 +1063,21 @@ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; @@ -927,8 +1095,8 @@ echo ns32k-sni-sysv fi exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Ric...@cc...> + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Ric...@cc...> echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) @@ -940,10 +1108,14 @@ # From se...@sw.... echo i860-stratus-sysv4 exit 0 ;; + *:VOS:*:*) + # From Pau...@st.... + echo hppa1.1-stratus-vos + exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - news*:NEWS-OS:*:6*) + news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) @@ -968,20 +1140,83 @@ SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; + *:Darwin:*:*) + case `uname -p` in + *86) UNAME_PROCESSOR=i686 ;; + powerpc) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; *:QNX:*:4*) - echo i386-qnx-qnx${UNAME_VERSION} + echo i386-pc-qnx exit 0 ;; + NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +eval $set_cc_for_build cat >$dummy.c <<EOF #ifdef _SEQUENT_ # include <sys/types.h> @@ -1068,12 +1303,25 @@ #endif #if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif #endif -#endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); @@ -1083,8 +1331,7 @@ } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. @@ -1116,6 +1363,48 @@ esac fi -#echo '(Unable to guess system type)' 1>&2 +cat >&2 <<EOF +$0: unable to guess system type +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <con...@gn...> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: Modified: trunk/imap_proxy/config.sub =================================================================== --- trunk/imap_proxy/config.sub 2010-07-25 08:29:19 UTC (rev 14015) +++ trunk/imap_proxy/config.sub 2010-07-25 08:33:05 UTC (rev 14016) @@ -1,6 +1,10 @@ #! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-08-18' + # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. @@ -25,6 +29,9 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +# Please send patches to <con...@gn...>. Submit a context +# diff and a properly formatted ChangeLog entry. +# # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. @@ -45,30 +52,73 @@ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi +me=`echo "$0" | sed -e 's,.*/,,'` -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <con...@gn...>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - linux-gnu*) + nto-qnx* | linux-gnu* | linux-dietlibc | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -94,7 +144,7 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) + -apple | -axis) os= basic_machine=$1 ;; @@ -108,6 +158,14 @@ os=-vxworks basic_machine=$1 ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; @@ -166,27 +224,64 @@ case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ - | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ - | mips64orion | mips64orionel | mipstx39 | mipstx39el \ - | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | miprs64vr5000el | mcore \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v | fr30) + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) basic_machine=$basic_machine-unknown ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) + i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -195,24 +290,61 @@ exit 1 ;; # Recognize the basic CPU types with company name. - # FIXME: clean up the formatting here. - vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ - | xmp-* | ymp-* \ - | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ - | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \ - | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ - | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ - | mipstx39-* | mipstx39el-* | mcore-* \ - | f301-* | armv*-* | t3e-* \ - | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ - | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* ) + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | spar... [truncated message content] |
From: <pdo...@us...> - 2010-07-25 08:37:01
|
Revision: 14018 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14018&view=rev Author: pdontthink Date: 2010-07-25 08:36:55 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.4 RC 2 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/README trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/pkginfo trunk/imap_proxy/scripts/imapproxy.conf trunk/imap_proxy/src/config.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/request.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 08:34:10 UTC (rev 14017) +++ trunk/imap_proxy/ChangeLog 2010-07-25 08:36:55 UTC (rev 14018) @@ -1,3 +1,18 @@ +2005-07-05 Dave McMurtrie <dav...@gm...> + + * main.c: Add logging of enable_admin_commands config setting. + + * imapproxy.h: Add enable_admin_commands to struct ProxyConfig. + + * config.c: Add enable_admin_commands to ConfigTable. + + * request.c: Added support for enable_admin_commands config option. + +2005-06-22 Dave McMurtrie <dav...@gm...> + + * main.c: Made initial imap server connection and DNS lookup + more robust. + 2005-06-14 Dave McMurtrie <dav...@gm...> * imapproxy.spec: Patch by William Hooper to remove obsolete Copyright Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 08:34:10 UTC (rev 14017) +++ trunk/imap_proxy/README 2010-07-25 08:36:55 UTC (rev 14018) @@ -175,6 +175,15 @@ If this value is set to anything, it implicitly causes imapproxy to run in a chroot jail. +enable_admin_commands +--------------------- +The internal admin commands that imapproxy provides (p_dumpicc, p_trace, +etc) are a security vulnerability if you do not restrict access to the +listen_port using tcp wrappers, iptables, ipchains, ipfilter, an external +firewall, or some other mechanism. Because of this, the internal admin +commands are disabled by default. + + ############################################################################## ADDITIONAL COMMANDS: ############################################################################## @@ -186,7 +195,9 @@ regular protocol transaction. At our site, we've severely limited access to the proxy port such that only our webmail machines and one internal admin machine can access it. The proxy server software offers no way to limit the -usage of these commands by username. +usage of these commands by username so they're not implemented by default. +If you secure the listen_port, you can then set the enable_admin_commands +option in imapproxy.conf to enable the use of these commands. P_NEWLOG -------- Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 08:34:10 UTC (rev 14017) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 08:36:55 UTC (rev 14018) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.3 +%define ver 1.2.4rc2 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 08:34:10 UTC (rev 14017) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 08:36:55 UTC (rev 14018) @@ -34,11 +34,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.23 2005/06/15 12:13:40 dgm Exp $ +** $Id: imapproxy.h,v 1.24 2005/07/06 11:51:25 dgm Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.24 2005/07/06 11:51:25 dgm +** Added enable_admin_commands to struct ProxyConfig +** ** Revision 1.23 2005/06/15 12:13:40 dgm ** Changed all long int values to int. Changed logouttime in ** IMAPConnectionContext to time_t. Added atoui function @@ -276,6 +279,7 @@ char *tls_cert_file; /* file with client cert */ char *tls_key_file; /* file with client priv key */ unsigned int force_tls; /* flag to force TLS */ + unsigned int enable_admin_commands; /* flag to enable admin cmds */ unsigned char support_unselect; /* unselect support flag */ unsigned char support_starttls; /* starttls support flag */ unsigned char login_disabled; /* login disabled flag */ Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 08:34:10 UTC (rev 14017) +++ trunk/imap_proxy/pkginfo 2010-07-25 08:36:55 UTC (rev 14018) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.3 +VERSION=1.2.4rc2 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections Modified: trunk/imap_proxy/scripts/imapproxy.conf =================================================================== --- trunk/imap_proxy/scripts/imapproxy.conf 2010-07-25 08:34:10 UTC (rev 14017) +++ trunk/imap_proxy/scripts/imapproxy.conf 2010-07-25 08:36:55 UTC (rev 14018) @@ -168,6 +168,14 @@ # +## enable_admin_commands +## +## Used to enable or disable the internal imapproxy administrative commands. +# +enable_admin_commands no + + +# ## Various path options for SSL CA certificates/directories # #tls_ca_file /usr/share/ssl/certs/ca-bundle.crt Modified: trunk/imap_proxy/src/config.c =================================================================== --- trunk/imap_proxy/src/config.c 2010-07-25 08:34:10 UTC (rev 14017) +++ trunk/imap_proxy/src/config.c 2010-07-25 08:36:55 UTC (rev 14018) @@ -35,11 +35,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/config.c,v $ -** $Id: config.c,v 1.14 2005/06/15 12:12:26 dgm Exp $ +** $Id: config.c,v 1.15 2005/07/06 12:17:44 dgm Exp $ ** ** Modification History: ** ** $Log: config.c,v $ +** Revision 1.15 2005/07/06 12:17:44 dgm +** Add enable_admin_commands to ConfigTable. +** ** Revision 1.14 2005/06/15 12:12:26 dgm ** Patch by Dave Steinberg and Jarno Huuskonen to add chroot_directory ** config option. @@ -416,6 +419,9 @@ ADD_TO_TABLE( "force_tls", SetBooleanValue, &PC_Struct.force_tls, index ); + + ADD_TO_TABLE( "enable_admin_commands", SetBooleanValue, + &PC_Struct.enable_admin_commands, index ); ConfigTable[index].Keyword[0] = '\0'; Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 08:34:10 UTC (rev 14017) +++ trunk/imap_proxy/src/main.c 2010-07-25 08:36:55 UTC (rev 14018) @@ -36,11 +36,17 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.25 2005/06/15 12:05:25 dgm Exp $ +** $Id: main.c,v 1.27 2005/07/06 11:49:40 dgm Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.27 2005/07/06 11:49:40 dgm +** Add support for enable_admin_commands config option. +** +** Revision 1.26 2005/06/22 14:39:04 dgm +** Made initial imap server connection and DNS lookup more robust. +** ** Revision 1.25 2005/06/15 12:05:25 dgm ** Included config.h. ** @@ -151,7 +157,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.25 2005/06/15 12:05:25 dgm Exp $"; +static char *rcsId = "$Id: main.c,v 1.27 2005/07/06 11:49:40 dgm Exp $"; static char *rcsSource = "$Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dgm $"; @@ -322,6 +328,15 @@ else syslog( LOG_INFO, "%s: SELECT caching is disabled", fn ); + /* + * Just for logging purposes, are the admin commands enabled or not? + */ + if ( PC_Struct.enable_admin_commands ) + syslog( LOG_INFO, "%s: Internal admin commands are enabled", fn ); + else + syslog( LOG_INFO, "%s: Internal admin commands are disabled", fn ); + + #ifdef HAVE_LIBWRAP /* * Set our tcpd service name @@ -751,12 +766,19 @@ syslog( LOG_INFO, "%s: proxying to IMAP server '%s'.", fn, PC_Struct.server_hostname ); - hp = gethostbyname( PC_Struct.server_hostname ); - - if ( !hp ) + for( ;; ) { - syslog(LOG_ERR, "%s: gethostbyname() failed to resolve hostname of remote IMAP server: %s", fn, strerror(errno) ); - exit(1); + hp = gethostbyname( PC_Struct.server_hostname ); + + if ( !hp ) + { + syslog(LOG_ERR, "%s: gethostbyname() failed to resolve hostname of remote IMAP server: %s -- retrying", fn, strerror(errno) ); + sleep( 15 ); + } + else + { + break; + } } memcpy( &ISD.host, hp, sizeof(struct hostent) ); @@ -947,23 +969,18 @@ exit( 1 ); } + if ( connect( sd, (struct sockaddr *)&ISD.srv, sizeof(ISD.srv) ) == -1 ) { - syslog(LOG_ERR, "%s: connect() to imap server on socket [%d] failed: %s", fn, sd, strerror(errno)); + syslog(LOG_ERR, "%s: connect() to imap server on socket [%d] failed: %s -- retrying", fn, sd, strerror(errno)); close( sd ); - if ( errno == ECONNREFUSED && ++NumRef < 10 ) - { - sleep( 60 ); /* IMAP server may not be started yet. */ - continue; - } - syslog( LOG_ERR, "%s: unable to connect() to imap server and retry limit exceeded -- exiting.", fn ); - exit( 1 ); + sleep( 15 ); /* IMAP server may not be started yet. */ } break; /* Success */ } - + memset( &conn, 0, sizeof ( ICD_Struct ) ); itd.conn = &conn; itd.conn->sd = sd; Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 08:34:10 UTC (rev 14017) +++ trunk/imap_proxy/src/request.c 2010-07-25 08:36:55 UTC (rev 14018) @@ -39,11 +39,14 @@ ** RCS: ** ** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.20 2005/06/15 12:07:12 dgm Exp $ +** $Id: request.c,v 1.21 2005/07/06 11:53:19 dgm Exp $ ** ** Modification History: ** ** $Log: request.c,v $ +** Revision 1.21 2005/07/06 11:53:19 dgm +** Added support for enable_admin_commands config option. +** ** Revision 1.20 2005/06/15 12:07:12 dgm ** Remove unused variables. Fixed snprintf argument lists. ** Include missing config.h directive. @@ -211,6 +214,18 @@ int rc; SendBuf[BUFSIZE - 1] = '\0'; + + if ( ! PC_Struct.enable_admin_commands ) + { + snprintf( SendBuf, BufLen, "%s BAD Unrecognized command\r\n", Tag ); + if ( IMAP_Write( itd->conn, SendBuf, strlen( SendBuf ) ) == -1 ) + { + syslog( LOG_WARNING, "%s: IMAP_Write() failed: %s", fn, strerror( errno ) ); + return( -1 ); + } + return( 0 ); + } + rc = ftruncate( Tracefd, 0 ); @@ -287,6 +302,17 @@ SendBuf[BufLen] = '\0'; + if ( ! PC_Struct.enable_admin_commands ) + { + snprintf( SendBuf, BufLen, "%s BAD Unrecognized command\r\n", Tag ); + if ( IMAP_Write( itd->conn, SendBuf, strlen( SendBuf ) ) == -1 ) + { + syslog( LOG_WARNING, "%s: IMAP_Write() failed: %s", fn, strerror( errno ) ); + return( -1 ); + } + return( 0 ); + } + /* * Bugfix by Geoffrey Hort <g....@un...> -- I forgot to zero * out TotalClientLogins... @@ -336,6 +362,17 @@ unsigned int BufLen = BUFSIZE - 1; SendBuf[BUFSIZE - 1] = '\0'; + + if ( ! PC_Struct.enable_admin_commands ) + { + snprintf( SendBuf, BufLen, "%s BAD Unrecognized command\r\n", Tag ); + if ( IMAP_Write( itd->conn, SendBuf, strlen( SendBuf ) ) == -1 ) + { + syslog( LOG_WARNING, "%s: IMAP_Write() failed: %s", fn, strerror( errno ) ); + return( -1 ); + } + return( 0 ); + } LockMutex( &mp ); @@ -395,6 +432,17 @@ unsigned int BufLen = BUFSIZE - 1; SendBuf[BUFSIZE - 1] = '\0'; + + if ( ! PC_Struct.enable_admin_commands ) + { + snprintf( SendBuf, BufLen, "%s BAD Unrecognized command\r\n", Tag ); + if ( IMAP_Write( itd->conn, SendBuf, strlen( SendBuf ) ) == -1 ) + { + syslog( LOG_WARNING, "%s: IMAP_Write() failed: %s", fn, strerror( errno ) ); + return( -1 ); + } + return( 0 ); + } /* * Here are the tracing semantics: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 08:40:22
|
Revision: 14020 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14020&view=rev Author: pdontthink Date: 2010-07-25 08:40:16 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.4 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/pkginfo Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 08:37:39 UTC (rev 14019) +++ trunk/imap_proxy/ChangeLog 2010-07-25 08:40:16 UTC (rev 14020) @@ -1,3 +1,7 @@ +2005-08-31 Dave McMurtrie <dav...@gm...> + + * Version 1.2.4 released. + 2005-07-05 Dave McMurtrie <dav...@gm...> * main.c: Add logging of enable_admin_commands config setting. Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 08:37:39 UTC (rev 14019) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 08:40:16 UTC (rev 14020) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.4rc2 +%define ver 1.2.4 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 08:37:39 UTC (rev 14019) +++ trunk/imap_proxy/pkginfo 2010-07-25 08:40:16 UTC (rev 14020) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.4rc2 +VERSION=1.2.4 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 08:52:11
|
Revision: 14022 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14022&view=rev Author: pdontthink Date: 2010-07-25 08:52:02 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.5 RC 1 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/README trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/common.h trunk/imap_proxy/pkginfo trunk/imap_proxy/src/main.c trunk/imap_proxy/src/pimpstat.c trunk/imap_proxy/src/request.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 08:42:34 UTC (rev 14021) +++ trunk/imap_proxy/ChangeLog 2010-07-25 08:52:02 UTC (rev 14022) @@ -1,3 +1,17 @@ +2006-02-16 Dave McMurtrie <dav...@gm...> + + * pimpstat.c: Patch by Matt Selsky to fix spelling error. + + * main.c: Fixed string format bug (Debian DSA 852-1) found by + Steve Kemp. Added version string to startup log message. + + * common.h: Patch by Matt Selsky to add a version string. + + * request.c: Patch by Matt Selsky to add cmd_version function. + + * README: Patch by Matt Selsky to add info about p_version command. + Updated the imapproxy-info mailing list URL. + 2005-08-31 Dave McMurtrie <dav...@gm...> * Version 1.2.4 released. Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 08:42:34 UTC (rev 14021) +++ trunk/imap_proxy/README 2010-07-25 08:52:02 UTC (rev 14022) @@ -8,7 +8,7 @@ If you want to subscribe to the imapproxy-info mailing list, visit: -http://lists.pitt.edu/mailman/listinfo/imapproxy-info +http://lists.andrew.cmu.edu/mailman/listinfo/imapproxy-info For some Debian specific issues that have come up, read the file README.debian. @@ -226,7 +226,11 @@ without having to restart the server. These are the counters that are mmap()ed to the file configured as "stat_filename" in the configuration file. +P_VERSION +------- +This is used to show the version number of the IMAP proxy. + Happy proxying, Dave <dav...@gm...> Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 08:42:34 UTC (rev 14021) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 08:52:02 UTC (rev 14022) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.4 +%define ver 1.2.5rc1 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/common.h =================================================================== --- trunk/imap_proxy/include/common.h 2010-07-25 08:42:34 UTC (rev 14021) +++ trunk/imap_proxy/include/common.h 2010-07-25 08:52:02 UTC (rev 14022) @@ -34,12 +34,15 @@ ** ** RCS: ** -** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/common.h,v $ -** $Id: common.h,v 1.3 2003/05/20 19:14:10 dgm Exp $ +** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/include/RCS/common.h,v $ +** $Id: common.h,v 1.4 2006/02/16 18:32:30 dave64 Exp $ ** ** Modification History: ** ** $Log: common.h,v $ +** Revision 1.4 2006/02/16 18:32:30 dave64 +** Added IMAP_PROXY_VERSION patch by Matt Selsky. +** ** Revision 1.3 2003/05/20 19:14:10 dgm ** Comment changes only. ** @@ -57,6 +60,7 @@ #define HASH_TABLE_SIZE 1024 +#define IMAP_PROXY_VERSION "1.2.5rc1" /* * Misc. function prototypes. Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 08:42:34 UTC (rev 14021) +++ trunk/imap_proxy/pkginfo 2010-07-25 08:52:02 UTC (rev 14022) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.4 +VERSION=1.2.5rc1 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 08:42:34 UTC (rev 14021) +++ trunk/imap_proxy/src/main.c 2010-07-25 08:52:02 UTC (rev 14022) @@ -35,12 +35,18 @@ ** ** RCS: ** -** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.27 2005/07/06 11:49:40 dgm Exp $ +** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/main.c,v $ +** $Id: main.c,v 1.29 2006/02/16 18:43:42 dave64 Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.29 2006/02/16 18:43:42 dave64 +** Added IMAP_PROXY_VERSION string to startup log message. +** +** Revision 1.28 2006/02/16 18:30:14 dave64 +** Fixed string format bug (Debian DSA 852-1) found by Steve Kemp. +** ** Revision 1.27 2005/07/06 11:49:40 dgm ** Add support for enable_admin_commands config option. ** @@ -157,9 +163,9 @@ */ -static char *rcsId = "$Id: main.c,v 1.27 2005/07/06 11:49:40 dgm Exp $"; -static char *rcsSource = "$Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/main.c,v $"; -static char *rcsAuthor = "$Author: dgm $"; +static char *rcsId = "$Id: main.c,v 1.29 2006/02/16 18:43:42 dave64 Exp $"; +static char *rcsSource = "$Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/main.c,v $"; +static char *rcsAuthor = "$Author: dave64 $"; #define _REENTRANT @@ -615,7 +621,7 @@ exit( 1 ); } - syslog( LOG_INFO, "%s: Normal server startup.", fn ); + syslog( LOG_INFO, "%s: imapproxy version %s normal server startup.", fn, IMAP_PROXY_VERSION ); /* * Main server loop @@ -849,7 +855,7 @@ exit( 1 ); } - sprintf( DestBuf, CP ); + sprintf( DestBuf, "%s", CP ); /* * initially assume that the server doesn't support UNSELECT. Modified: trunk/imap_proxy/src/pimpstat.c =================================================================== --- trunk/imap_proxy/src/pimpstat.c 2010-07-25 08:42:34 UTC (rev 14021) +++ trunk/imap_proxy/src/pimpstat.c 2010-07-25 08:52:02 UTC (rev 14022) @@ -33,12 +33,15 @@ ** ** RCS: ** -** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/pimpstat.c,v $ -** $Id: pimpstat.c,v 1.8 2005/06/15 12:11:36 dgm Exp $ +** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/pimpstat.c,v $ +** $Id: pimpstat.c,v 1.9 2006/02/17 01:42:37 dave64 Exp $ ** ** Modification History: ** ** $Log: pimpstat.c,v $ +** Revision 1.9 2006/02/17 01:42:37 dave64 +** Spelling correction (Connectsions) by Matt Selsky. +** ** Revision 1.8 2005/06/15 12:11:36 dgm ** Patch by Mathew Anderson to add -c flag and behavior. ** @@ -359,7 +362,7 @@ /* * We only get here if command is non-zero. */ - printf( " %d Current Client Connections\n %d Peak Client Connections\n %d In Use Connections\n %d Peak In Use Connections\n %d Retained Server Connections\n %d Peak Retained Server Connections\n %d Total Client Connectsions\n %d Total Client Logins\n %d Total Reused Connections\n %d Total Created Connections\n %d Cache Hits\n %d Cache Misses\n", IMAPCount->CurrentClientConnections, + printf( " %d Current Client Connections\n %d Peak Client Connections\n %d In Use Connections\n %d Peak In Use Connections\n %d Retained Server Connections\n %d Peak Retained Server Connections\n %d Total Client Connections\n %d Total Client Logins\n %d Total Reused Connections\n %d Total Created Connections\n %d Cache Hits\n %d Cache Misses\n", IMAPCount->CurrentClientConnections, IMAPCount->PeakClientConnections, IMAPCount->InUseServerConnections, IMAPCount->PeakInUseServerConnections, Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 08:42:34 UTC (rev 14021) +++ trunk/imap_proxy/src/request.c 2010-07-25 08:52:02 UTC (rev 14022) @@ -38,12 +38,15 @@ ** ** RCS: ** -** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.21 2005/07/06 11:53:19 dgm Exp $ +** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/request.c,v $ +** $Id: request.c,v 1.22 2006/02/16 18:38:36 dave64 Exp $ ** ** Modification History: ** ** $Log: request.c,v $ +** Revision 1.22 2006/02/16 18:38:36 dave64 +** Patch to add internal version command by Matt Selsky. +** ** Revision 1.21 2005/07/06 11:53:19 dgm ** Added support for enable_admin_commands config option. ** @@ -184,6 +187,7 @@ static int cmd_dumpicc( ITD_Struct *, char * ); static int cmd_newlog( ITD_Struct *, char * ); static int cmd_resetcounters( ITD_Struct *, char * ); +static int cmd_version( ITD_Struct *, char * ); static int Raw_Proxy( ITD_Struct *, ITD_Struct *, ISC_Struct * ); @@ -410,6 +414,58 @@ /*++ + * Function: cmd_version + * + * Purpose: Show the IMAP Proxy version string. + * + * Parameters: ptr to ITD_Struct for client connection. + * char ptr to Tag sent with this command. + * + * Returns: 0 on success + * -1 on failure + * + * Authors: Matt Selsky <se...@co...> + *-- + */ +static int cmd_version( ITD_Struct *itd, char *Tag ) +{ + char *fn = "cmd_version"; + char SendBuf[BUFSIZE]; + unsigned int BufLen = BUFSIZE - 1; + + SendBuf[BUFSIZE - 1] = '\0'; + + if ( ! PC_Struct.enable_admin_commands ) + { + snprintf( SendBuf, BufLen, "%s BAD Unrecognized command\r\n", Tag ); + if ( IMAP_Write( itd->conn, SendBuf, strlen( SendBuf ) ) == -1 ) + { + syslog( LOG_WARNING, "%s: IMAP_Write() failed: %s", fn, strerror( errno ) ); + return( -1 ); + } + return( 0 ); + } + + snprintf( SendBuf, BufLen, "* %s\r\n", IMAP_PROXY_VERSION ); + if ( IMAP_Write( itd->conn, SendBuf, strlen(SendBuf) ) == -1 ) + { + syslog(LOG_WARNING, "%s: IMAP_Write() failed: %s", fn, strerror(errno) ); + return( -1 ); + } + + snprintf( SendBuf, BufLen, "%s OK Completed\r\n", Tag ); + if ( IMAP_Write( itd->conn, SendBuf, strlen(SendBuf) ) == -1 ) + { + syslog(LOG_WARNING, "%s: IMAP_Write() failed: %s", fn, strerror(errno) ); + return( -1 ); + } + + return( 0 ); +} + + + +/*++ * Function: cmd_trace * * Purpose: turn on per-user tracing in the proxy server. @@ -1430,7 +1486,7 @@ * of the following IMAP commands (rfc 2060): NOOP, CAPABILITY, * AUTHENTICATE, LOGIN, and LOGOUT. Also, it handles the * commands that are internal to the proxy server such as - * P_TRACE, P_NEWLOG, P_DUMPICC and P_RESETCOUNTERS. + * P_TRACE, P_NEWLOG, P_DUMPICC, P_RESETCOUNTERS and P_VERSION. * * None of these commands should ever have the need to send * a boatload of data, so we avoid some error checking and @@ -1755,6 +1811,18 @@ cmd_newlog( &Client, S_Tag ); continue; } + else if ( ! strcasecmp( (const char *)Command, "P_VERSION" ) ) + { + if ( Client.LiteralBytesRemaining ) + { + syslog( LOG_ERR, "%s: Unexpected literal specifier read from client on socket %d as part of P_VERSION command -- disconnecting client", fn, Client.conn->sd ); + IMAPCount->CurrentClientConnections--; + close( Client.conn->sd ); + return; + } + cmd_version( &Client, S_Tag ); + continue; + } else if ( ! strcasecmp( (const char *)Command, "LOGIN" ) ) { /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 08:59:58
|
Revision: 14024 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14024&view=rev Author: pdontthink Date: 2010-07-25 08:59:51 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.5 RC 2 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/Makefile.in trunk/imap_proxy/README trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/common.h trunk/imap_proxy/pkginfo trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/main.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 08:56:34 UTC (rev 14023) +++ trunk/imap_proxy/ChangeLog 2010-07-25 08:59:51 UTC (rev 14024) @@ -1,3 +1,18 @@ +2006-10-03 Dave McMurtrie <dav...@gm...> + + * common.h: Updated version string to 1.2.5rc2. + + * main.c: Patch by Matt Selsky to log ssl peer verify at Debug + level instead of err level. + + * Makefile.in: Patch by Matt Selsky to set the permissions on + the configuration files to 755 instead of 644. + +2006-08-15 Dave McMurtrie <dav...@gm...> + + * imapcommon.c: No longer exit() from IMAP_Line_Read() on + failed sanity check. + 2006-02-16 Dave McMurtrie <dav...@gm...> * pimpstat.c: Patch by Matt Selsky to fix spelling error. Modified: trunk/imap_proxy/Makefile.in =================================================================== --- trunk/imap_proxy/Makefile.in 2010-07-25 08:56:34 UTC (rev 14023) +++ trunk/imap_proxy/Makefile.in 2010-07-25 08:59:51 UTC (rev 14024) @@ -88,10 +88,10 @@ ln -s ../init.d/imapproxy /etc/rc0.d/K10imapproxy install-conf: - $(INSTALL) -o root -g bin -m 0755 ./scripts/imapproxy.conf $(ETC) + $(INSTALL) -o root -g bin -m 0644 ./scripts/imapproxy.conf $(ETC) rpm-install: install - $(INSTALL) -o root -g sys -m 0755 ./scripts/imapproxy.conf $(rpm_prefix)/etc + $(INSTALL) -o root -g sys -m 0644 ./scripts/imapproxy.conf $(rpm_prefix)/etc $(INSTALL) -o root -g sys -m 0755 ./scripts/imapproxy.init $(rpm_prefix)/etc/init.d/imapproxy pkg: Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 08:56:34 UTC (rev 14023) +++ trunk/imap_proxy/README 2010-07-25 08:59:51 UTC (rev 14024) @@ -8,7 +8,7 @@ If you want to subscribe to the imapproxy-info mailing list, visit: -http://lists.andrew.cmu.edu/mailman/listinfo/imapproxy-info +http://lists.pitt.edu/mailman/listinfo/imapproxy-info For some Debian specific issues that have come up, read the file README.debian. Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 08:56:34 UTC (rev 14023) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 08:59:51 UTC (rev 14024) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.5rc1 +%define ver 1.2.5rc2 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/common.h =================================================================== --- trunk/imap_proxy/include/common.h 2010-07-25 08:56:34 UTC (rev 14023) +++ trunk/imap_proxy/include/common.h 2010-07-25 08:59:51 UTC (rev 14024) @@ -35,11 +35,14 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/include/RCS/common.h,v $ -** $Id: common.h,v 1.4 2006/02/16 18:32:30 dave64 Exp $ +** $Id: common.h,v 1.5 2006/10/03 12:21:54 dave64 Exp $ ** ** Modification History: ** ** $Log: common.h,v $ +** Revision 1.5 2006/10/03 12:21:54 dave64 +** Updated version string to 1.2.5rc2. +** ** Revision 1.4 2006/02/16 18:32:30 dave64 ** Added IMAP_PROXY_VERSION patch by Matt Selsky. ** @@ -60,7 +63,7 @@ #define HASH_TABLE_SIZE 1024 -#define IMAP_PROXY_VERSION "1.2.5rc1" +#define IMAP_PROXY_VERSION "1.2.5rc2" /* * Misc. function prototypes. Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 08:56:34 UTC (rev 14023) +++ trunk/imap_proxy/pkginfo 2010-07-25 08:59:51 UTC (rev 14024) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.5rc1 +VERSION=1.2.5rc2 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections Modified: trunk/imap_proxy/src/imapcommon.c =================================================================== --- trunk/imap_proxy/src/imapcommon.c 2010-07-25 08:56:34 UTC (rev 14023) +++ trunk/imap_proxy/src/imapcommon.c 2010-07-25 08:59:51 UTC (rev 14024) @@ -34,12 +34,15 @@ ** ** RCS: ** -** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/imapcommon.c,v $ -** $Id: imapcommon.c,v 1.21 2005/06/15 12:06:31 dgm Exp $ +** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/imapcommon.c,v $ +** $Id: imapcommon.c,v 1.22 2006/08/15 13:13:08 dave64 Exp $ ** ** Modification History: ** ** $Log: imapcommon.c,v $ +** Revision 1.22 2006/08/15 13:13:08 dave64 +** No longer exit() from IMAP_Line_Read. Just return failure. +** ** Revision 1.21 2005/06/15 12:06:31 dgm ** Added missing include directive for openssl/err.h. ** atoui function added to replace calls to atoi. @@ -1197,11 +1200,6 @@ * Notes: caller must be certain that the IMAPTransactionDescriptor * is initialized to zero on the first call. * - * - * Callers must check RemainingLiteralBytes after calling this - * function. If this is set and a caller ignores it, it will - * play havoc... Actually, it will exit() and kill the entire - * process. *-- */ extern int IMAP_Line_Read( ITD_Struct *ITD ) @@ -1219,8 +1217,14 @@ */ if ( ITD->LiteralBytesRemaining ) { - syslog(LOG_ERR, "%s: Sanity check failed! Literal bytestream has not been fully processed (%d bytes remain) and line-oriented read function was called again. Exiting!", fn, ITD->LiteralBytesRemaining); - exit(1); + syslog(LOG_ERR, "%s: Sanity check failed! Literal bytestream has not been fully processed (%d bytes remain) and line-oriented read function was called again.", fn, ITD->LiteralBytesRemaining ); + /* + * Previous behavior was to exit, but that was wrong. This sanity + * check only affects a single connection and should not kill the entire + * process. + * Just return failure and let the caller deal with it. + */ + return( -1 ); } Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 08:56:34 UTC (rev 14023) +++ trunk/imap_proxy/src/main.c 2010-07-25 08:59:51 UTC (rev 14024) @@ -36,11 +36,19 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.29 2006/02/16 18:43:42 dave64 Exp $ +** $Id: main.c,v 1.31 2006/10/03 12:13:09 dave64 Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.31 2006/10/03 12:13:09 dave64 +** Patch by Matt Selsky to log ssl peer verify at debug level instead +** of err level. +** +** Revision 1.30 2006/04/13 12:39:15 dave64 +** Patch by Ramiro Morales to prevent bad file descriptor error +** on startup. +** ** Revision 1.29 2006/02/16 18:43:42 dave64 ** Added IMAP_PROXY_VERSION string to startup log message. ** @@ -163,7 +171,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.29 2006/02/16 18:43:42 dave64 Exp $"; +static char *rcsId = "$Id: main.c,v 1.31 2006/10/03 12:13:09 dave64 Exp $"; static char *rcsSource = "$Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dave64 $"; @@ -983,7 +991,10 @@ sleep( 15 ); /* IMAP server may not be started yet. */ } - break; /* Success */ + else + { + break; /* Success */ + } } @@ -1121,7 +1132,7 @@ int err; int depth; - syslog(LOG_ERR,"Doing a peer verify"); + syslog(LOG_DEBUG,"Doing a peer verify"); err_cert = X509_STORE_CTX_get_current_cert(ctx); err = X509_STORE_CTX_get_error(ctx); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 09:06:34
|
Revision: 14026 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14026&view=rev Author: pdontthink Date: 2010-07-25 09:06:25 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.5 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/common.h trunk/imap_proxy/pkginfo Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 09:00:51 UTC (rev 14025) +++ trunk/imap_proxy/ChangeLog 2010-07-25 09:06:25 UTC (rev 14026) @@ -1,3 +1,11 @@ +2007-01-30 Dave McMurtrie <dav...@gm...> + + * Version 1.2.5 released. + +2007-01-30 Dave McMurtrie <dav...@gm...> + + * common.h: Updated version string to 1.2.5. + 2006-10-03 Dave McMurtrie <dav...@gm...> * common.h: Updated version string to 1.2.5rc2. Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 09:00:51 UTC (rev 14025) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 09:06:25 UTC (rev 14026) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.5rc2 +%define ver 1.2.5 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/common.h =================================================================== --- trunk/imap_proxy/include/common.h 2010-07-25 09:00:51 UTC (rev 14025) +++ trunk/imap_proxy/include/common.h 2010-07-25 09:06:25 UTC (rev 14026) @@ -35,11 +35,14 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/include/RCS/common.h,v $ -** $Id: common.h,v 1.5 2006/10/03 12:21:54 dave64 Exp $ +** $Id: common.h,v 1.6 2007/01/30 15:19:29 dave64 Exp $ ** ** Modification History: ** ** $Log: common.h,v $ +** Revision 1.6 2007/01/30 15:19:29 dave64 +** Updated version string to 1.2.5. +** ** Revision 1.5 2006/10/03 12:21:54 dave64 ** Updated version string to 1.2.5rc2. ** @@ -63,7 +66,7 @@ #define HASH_TABLE_SIZE 1024 -#define IMAP_PROXY_VERSION "1.2.5rc2" +#define IMAP_PROXY_VERSION "1.2.5" /* * Misc. function prototypes. Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 09:00:51 UTC (rev 14025) +++ trunk/imap_proxy/pkginfo 2010-07-25 09:06:25 UTC (rev 14026) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.5rc2 +VERSION=1.2.5 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 09:11:45
|
Revision: 14028 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14028&view=rev Author: pdontthink Date: 2010-07-25 09:11:36 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.6 RC 1 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/Makefile.in trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/common.h trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/pkginfo trunk/imap_proxy/src/config.c trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/request.c Added Paths: ----------- trunk/imap_proxy/src/threads.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 09:07:08 UTC (rev 14027) +++ trunk/imap_proxy/ChangeLog 2010-07-25 09:11:36 UTC (rev 14028) @@ -1,3 +1,24 @@ +2007-05-31 Dave McMurtrie <dav...@gm...> + * main.c: Applied OpenSSL threads patch by Jan Grant. Applied ipv6 + patch by Antonio Querubin. + + * imapproxy.h: Applied OpenSSL threads patch by Jan Grant. Applied + ipv6 patch by Antonio Querubin. + + * threads.c: New file, from OpenSSL threads patch by Jan Grant. + + * Makefile.in: Applied OpenSSL threads patch by Jan Grant. + + * imapcommon.c: Applied patch by Matt Selsky to prevent compilation + errors due to missing md5.h include directive. Applied ipv6 patch + by Antonio Querubin. + + * config.c: Applied ipv6 patch by Antonio Querubin. + + * request.c: Applied ipv6 patch by Antonio Querubin. + + * common.h: Updated version string to 1.2.6rc1 + 2007-01-30 Dave McMurtrie <dav...@gm...> * Version 1.2.5 released. Modified: trunk/imap_proxy/Makefile.in =================================================================== --- trunk/imap_proxy/Makefile.in 2010-07-25 09:07:08 UTC (rev 14027) +++ trunk/imap_proxy/Makefile.in 2010-07-25 09:11:36 UTC (rev 14028) @@ -48,6 +48,7 @@ XYD_OBJ = ./src/icc.o ./src/main.o ./src/imapcommon.o ./src/request.o \ ./src/hash.o ./src/becomenonroot.o ./src/config.o ./src/logging.o \ + ./src/threads.o \ ./src/select.o TAT_OBJ = ./src/pimpstat.o ./src/config.o Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 09:07:08 UTC (rev 14027) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 09:11:36 UTC (rev 14028) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.5 +%define ver 1.2.6rc1 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/common.h =================================================================== --- trunk/imap_proxy/include/common.h 2010-07-25 09:07:08 UTC (rev 14027) +++ trunk/imap_proxy/include/common.h 2010-07-25 09:11:36 UTC (rev 14028) @@ -35,11 +35,14 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/include/RCS/common.h,v $ -** $Id: common.h,v 1.6 2007/01/30 15:19:29 dave64 Exp $ +** $Id: common.h,v 1.7 2007/05/31 12:13:30 dave64 Exp $ ** ** Modification History: ** ** $Log: common.h,v $ +** Revision 1.7 2007/05/31 12:13:30 dave64 +** Updated version string to 1.2.6rc1 +** ** Revision 1.6 2007/01/30 15:19:29 dave64 ** Updated version string to 1.2.5. ** @@ -66,7 +69,7 @@ #define HASH_TABLE_SIZE 1024 -#define IMAP_PROXY_VERSION "1.2.5" +#define IMAP_PROXY_VERSION "1.2.6rc1" /* * Misc. function prototypes. Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 09:07:08 UTC (rev 14027) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 09:11:36 UTC (rev 14028) @@ -33,12 +33,18 @@ ** ** RCS: ** -** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.24 2005/07/06 11:51:25 dgm Exp $ +** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ +** $Id: imapproxy.h,v 1.26 2007/05/31 12:07:41 dave64 Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.26 2007/05/31 12:07:41 dave64 +** Applied ipv6 patch by Antonio Querubin. +** +** Revision 1.25 2007/05/31 11:46:00 dave64 +** Applied OpenSSL threads patch by Jan Grant. +** ** Revision 1.24 2005/07/06 11:51:25 dgm ** Added enable_admin_commands to struct ProxyConfig ** @@ -184,13 +190,13 @@ /* * One IMAPServerDescriptor will be globally allocated such that each thread * can save the time of doing host lookups, service lookups, and filling - * in the sockaddr_in struct. + * in the sockaddr_storage struct. */ struct IMAPServerDescriptor { - struct hostent host; /* IMAP host entry */ - struct servent serv; /* IMAP service entry */ - struct sockaddr_in srv; /* IMAP socket address */ + struct addrinfo *airesults; /* IMAP server info (top of addrinfo + list from getaddrinfo() */ + struct addrinfo *srv; /* IMAP server active socket info */ }; @@ -259,10 +265,10 @@ */ struct ProxyConfig { - unsigned int listen_port; /* port we bind to */ + char *listen_port; /* port we bind to */ char *listen_addr; /* address we bind to */ char *server_hostname; /* server we proxy to */ - unsigned int server_port; /* port we proxy to */ + char *server_port; /* port we proxy to */ unsigned int cache_size; /* number of cache slots */ unsigned int cache_expiration_time; /* cache exp time in seconds */ unsigned int send_tcp_keepalives; /* flag to send keepalives */ @@ -337,7 +343,7 @@ extern void HandleRequest( int ); extern char *memtok( char *, char *, char ** ); extern int imparse_isatom( const char * ); -extern ICD_Struct *Get_Server_conn( char *, char *, const char *, in_port_t, unsigned char ); +extern ICD_Struct *Get_Server_conn( char *, char *, const char *, const char *, unsigned char ); extern void ICC_Logout( char *, ICD_Struct * ); extern void ICC_Recycle( unsigned int ); extern void ICC_Recycle_Loop( void ); @@ -350,5 +356,12 @@ extern void Invalidate_Cache_Entry( ISC_Struct * ); extern int atoui( const char *, unsigned int * ); + +#ifndef MD5_DIGEST_LENGTH +#define MD5_DIGEST_LENGTH 16 /* When would it ever be different? */ +#endif +extern void ssl_thread_setup(const char * fn); + + #endif /* __IMAPPROXY_H */ Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 09:07:08 UTC (rev 14027) +++ trunk/imap_proxy/pkginfo 2010-07-25 09:11:36 UTC (rev 14028) @@ -1,10 +1,10 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.5 +VERSION=1.2.6rc1 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections -EMAIL=dav...@ho... +EMAIL=dav...@gm... BASEDIR=/usr/local CLASSES=none Modified: trunk/imap_proxy/src/config.c =================================================================== --- trunk/imap_proxy/src/config.c 2010-07-25 09:07:08 UTC (rev 14027) +++ trunk/imap_proxy/src/config.c 2010-07-25 09:11:36 UTC (rev 14028) @@ -34,12 +34,15 @@ ** ** RCS: ** -** $Source: /afs/pitt.edu/usr12/dgm/work/IMAP_Proxy/src/RCS/config.c,v $ -** $Id: config.c,v 1.15 2005/07/06 12:17:44 dgm Exp $ +** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/config.c,v $ +** $Id: config.c,v 1.16 2007/05/31 12:08:32 dave64 Exp $ ** ** Modification History: ** ** $Log: config.c,v $ +** Revision 1.16 2007/05/31 12:08:32 dave64 +** Applied ipv6 patch by Antonio Querubin. +** ** Revision 1.15 2005/07/06 12:17:44 dgm ** Add enable_admin_commands to ConfigTable. ** @@ -360,13 +363,13 @@ ADD_TO_TABLE( "server_hostname", SetStringValue, &PC_Struct.server_hostname, index ); - ADD_TO_TABLE( "listen_port", SetNumericValue, + ADD_TO_TABLE( "listen_port", SetStringValue, &PC_Struct.listen_port, index ); ADD_TO_TABLE( "listen_address", SetStringValue, &PC_Struct.listen_addr, index ); - ADD_TO_TABLE( "server_port", SetNumericValue, + ADD_TO_TABLE( "server_port", SetStringValue, &PC_Struct.server_port, index ); ADD_TO_TABLE( "cache_size", SetNumericValue, Modified: trunk/imap_proxy/src/imapcommon.c =================================================================== --- trunk/imap_proxy/src/imapcommon.c 2010-07-25 09:07:08 UTC (rev 14027) +++ trunk/imap_proxy/src/imapcommon.c 2010-07-25 09:11:36 UTC (rev 14028) @@ -35,11 +35,18 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/imapcommon.c,v $ -** $Id: imapcommon.c,v 1.22 2006/08/15 13:13:08 dave64 Exp $ +** $Id: imapcommon.c,v 1.24 2007/05/31 12:09:46 dave64 Exp $ ** ** Modification History: ** ** $Log: imapcommon.c,v $ +** Revision 1.24 2007/05/31 12:09:46 dave64 +** Applied ipv6 patch by Antonio Querubin. +** +** Revision 1.23 2007/05/31 11:50:49 dave64 +** Patch by Matt Selsky (include openssl/md5.h) to prevent compilation +** failure with newer OpenSSL versions. +** ** Revision 1.22 2006/08/15 13:13:08 dave64 ** No longer exit() from IMAP_Line_Read. Just return failure. ** @@ -139,6 +146,7 @@ #include <openssl/evp.h> #include <openssl/err.h> +#include <openssl/md5.h> #include <pthread.h> #include <sys/types.h> @@ -353,7 +361,7 @@ * Parameters: ptr to username string * ptr to password string * const ptr to client hostname or IP string (for logging only) - * in_port_t, client port number (for logging only) + * ptr to client port string (for logging only) * unsigned char - flag to indicate that the client sent the * password as a string literal. * @@ -369,7 +377,7 @@ extern ICD_Struct *Get_Server_conn( char *Username, char *Password, const char *ClientAddr, - in_port_t sin_port, + const char *portstr, unsigned char LiteralPasswd ) { char *fn = "Get_Server_conn()"; @@ -422,7 +430,10 @@ */ if ( memcmp( md5pw, ICC_Active->hashedpw, sizeof md5pw ) ) { - syslog( LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s:%d) because password doesn't match.", fn, ICC_Active->server_conn->sd, Username, ClientAddr, sin_port ); + syslog( LOG_NOTICE, + "%s: Unable to reuse server sd [%d] for user '%s' (%s:%s) because password doesn't match.", + fn, ICC_Active->server_conn->sd, Username, + ClientAddr, portstr ); ICC_Active->logouttime = 1; } else @@ -454,14 +465,20 @@ if ( !rc ) { - syslog(LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s:%d). Connection closed by server.", fn, ICC_Active->server_conn->sd, Username, ClientAddr, sin_port ); + syslog( LOG_NOTICE, + "%s: Unable to reuse server sd [%d] for user '%s' (%s:%s). Connection closed by server.", + fn, ICC_Active->server_conn->sd, Username, + ClientAddr, portstr ); ICC_Active->logouttime = 1; continue; } if ( errno != EWOULDBLOCK ) { - syslog(LOG_NOTICE, "%s: Unable to reuse server sd [%d] for user '%s' (%s:%d). IMAP_read() error: %s", fn, ICC_Active->server_conn->sd, Username, ClientAddr, sin_port, strerror( errno ) ); + syslog( LOG_NOTICE, + "%s: Unable to reuse server sd [%d] for user '%s' (%s:%s). IMAP_read() error: %s", + fn, ICC_Active->server_conn->sd, Username, + ClientAddr, portstr, strerror( errno ) ); ICC_Active->logouttime = 1; continue; } @@ -484,7 +501,10 @@ IMAPCount->PeakInUseServerConnections ) IMAPCount->PeakInUseServerConnections = IMAPCount->InUseServerConnections; - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) on existing sd [%d]", Username, ClientAddr, sin_port, ICC_Active->server_conn->sd ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) on existing sd [%d]", + Username, ClientAddr, portstr, + ICC_Active->server_conn->sd ); return( ICC_Active->server_conn ); } } @@ -500,10 +520,13 @@ */ Server.conn = ( ICD_Struct * ) malloc( sizeof ( ICD_Struct ) ); memset( Server.conn, 0, sizeof ( ICD_Struct ) ); - Server.conn->sd = socket( PF_INET, SOCK_STREAM, IPPROTO_TCP ); + Server.conn->sd = socket( ISD.srv->ai_family, ISD.srv->ai_socktype, + ISD.srv->ai_protocol ); if ( Server.conn->sd == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Unable to open server socket: %s", Username, ClientAddr, sin_port, strerror( errno ) ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: Unable to open server socket: %s", + Username, ClientAddr, portstr, strerror( errno ) ); goto fail; } @@ -513,10 +536,12 @@ setsockopt( Server.conn->sd, SOL_SOCKET, SO_KEEPALIVE, &onoff, sizeof onoff ); } - if ( connect( Server.conn->sd, (struct sockaddr *)&ISD.srv, - sizeof(ISD.srv) ) == -1 ) + if ( connect( Server.conn->sd, (struct sockaddr *)ISD.srv->ai_addr, + ISD.srv->ai_addrlen ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Unable to connect to IMAP server: %s", Username, ClientAddr, sin_port, strerror( errno ) ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: Unable to connect to IMAP server: %s", + Username, ClientAddr, portstr, strerror( errno ) ); goto fail; } @@ -525,7 +550,9 @@ if ( IMAP_Line_Read( &Server ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: No banner line received from IMAP server", Username, ClientAddr, sin_port ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: No banner line received from IMAP server", + Username, ClientAddr, portstr ); goto fail; } @@ -662,7 +689,9 @@ Username, strlen( Password ) ); if ( IMAP_Write( Server.conn, SendBuf, strlen(SendBuf) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: IMAP_Write() failed attempting to send LOGIN command to IMAP server: %s", Username, ClientAddr, sin_port, strerror( errno ) ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: IMAP_Write() failed attempting to send LOGIN command to IMAP server: %s", + Username, ClientAddr, portstr, strerror( errno ) ); goto fail; } @@ -671,7 +700,9 @@ */ if ( ( rc = IMAP_Line_Read( &Server ) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Failed to receive go-ahead from IMAP server after sending LOGIN command", Username, ClientAddr, sin_port ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: Failed to receive go-ahead from IMAP server after sending LOGIN command", + Username, ClientAddr, portstr ); goto fail; } @@ -684,7 +715,9 @@ if ( Server.ReadBuf[0] != '+' ) { - syslog( LOG_INFO, "LOGIN: '%s' (%s:%d) failed: bad response from server after sending string literal specifier", Username, ClientAddr, sin_port ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: bad response from server after sending string literal specifier", + Username, ClientAddr, portstr ); goto fail; } @@ -695,7 +728,9 @@ if ( IMAP_Write( Server.conn, SendBuf, strlen( SendBuf ) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: IMAP_Write() failed attempting to send literal password to IMAP server: %s", Username, ClientAddr, sin_port, strerror( errno ) ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: IMAP_Write() failed attempting to send literal password to IMAP server: %s", + Username, ClientAddr, portstr, strerror( errno ) ); goto fail; } } @@ -709,7 +744,9 @@ if ( IMAP_Write( Server.conn, SendBuf, strlen(SendBuf) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: IMAP_Write() failed attempting to send LOGIN command to IMAP server: %s", Username, ClientAddr, sin_port, strerror( errno ) ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: IMAP_Write() failed attempting to send LOGIN command to IMAP server: %s", + Username, ClientAddr, portstr, strerror( errno ) ); goto fail; } } @@ -734,7 +771,9 @@ { if ( ( rc = IMAP_Line_Read( &Server ) ) == -1 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: No response from IMAP server after sending LOGIN command", Username, ClientAddr, sin_port ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: No response from IMAP server after sending LOGIN command", + Username, ClientAddr, portstr ); goto fail; } @@ -763,7 +802,9 @@ * no tokens found in server response? Not likely, but we still * have to check. */ - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: server response to LOGIN command contained no tokens.", Username, ClientAddr, sin_port ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: server response to LOGIN command contained no tokens.", + Username, ClientAddr, portstr ); goto fail; } @@ -774,7 +815,9 @@ * non-matching tag read back from the server... Lord knows what this * is, so we'll fail. */ - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: server response to LOGIN command contained non-matching tag.", Username, ClientAddr, sin_port ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: server response to LOGIN command contained non-matching tag.", + Username, ClientAddr, portstr ); goto fail; } @@ -787,7 +830,9 @@ if ( !tokenptr ) { /* again, not likely but we still have to check... */ - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Malformed server response to LOGIN command", Username, ClientAddr, sin_port ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: Malformed server response to LOGIN command", + Username, ClientAddr, portstr ); goto fail; } @@ -798,7 +843,9 @@ * server logs to figure out why. We don't have to break our ass here * putting the string back together just for the sake of logging. */ - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: non-OK server response to LOGIN command", Username, ClientAddr, sin_port ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: non-OK server response to LOGIN command", + Username, ClientAddr, portstr ); goto fail; } @@ -848,7 +895,9 @@ if ( IMAPCount->InUseServerConnections > IMAPCount->PeakInUseServerConnections ) IMAPCount->PeakInUseServerConnections = IMAPCount->InUseServerConnections; - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) on new sd [%d]", Username, ClientAddr, sin_port, Server.conn->sd ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) on new sd [%d]", + Username, ClientAddr, portstr, Server.conn->sd ); return( Server.conn ); } @@ -865,7 +914,9 @@ */ if ( Expiration <= 2 ) { - syslog(LOG_INFO, "LOGIN: '%s' (%s:%d) failed: Out of free ICC structs.", Username, ClientAddr, sin_port ); + syslog( LOG_INFO, + "LOGIN: '%s' (%s:%s) failed: Out of free ICC structs.", + Username, ClientAddr, portstr ); goto fail; } Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 09:07:08 UTC (rev 14027) +++ trunk/imap_proxy/src/main.c 2010-07-25 09:11:36 UTC (rev 14028) @@ -36,11 +36,17 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.31 2006/10/03 12:13:09 dave64 Exp $ +** $Id: main.c,v 1.33 2007/05/31 12:10:59 dave64 Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.33 2007/05/31 12:10:59 dave64 +** Applied ipv6 patch by Antonio Querubin. +** +** Revision 1.32 2007/05/31 11:46:42 dave64 +** Applied OpenSSL threads patch by Jan Grant. +** ** Revision 1.31 2006/10/03 12:13:09 dave64 ** Patch by Matt Selsky to log ssl peer verify at debug level instead ** of err level. @@ -171,7 +177,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.31 2006/10/03 12:13:09 dave64 Exp $"; +static char *rcsId = "$Id: main.c,v 1.33 2007/05/31 12:10:59 dave64 Exp $"; static char *rcsSource = "$Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dave64 $"; @@ -266,9 +272,9 @@ char f_randfile[ PATH_MAX ]; int listensd; /* socket descriptor we'll bind to */ int clientsd; /* incoming socket descriptor */ - int addrlen; - struct sockaddr_in srvaddr; - struct sockaddr_in cliaddr; + int sockaddrlen; + struct sockaddr_storage srvaddr; + struct sockaddr_storage cliaddr; pthread_t ThreadId; /* thread id of each incoming conn */ pthread_t RecycleThread; /* used just for the recycle thread */ pthread_attr_t attr; /* generic thread attribute struct */ @@ -284,6 +290,8 @@ #ifdef HAVE_LIBWRAP struct request_info r; /* request struct for libwrap */ #endif + struct addrinfo aihints, *ai; + int gaierrnum; flag = 1; ConfigFile[0] = '\0'; @@ -459,6 +467,9 @@ { /* Initialize SSL_CTX */ SSL_library_init(); + + /* Set up OpenSSL thread protection */ + ssl_thread_setup(fn); /* Need to seed PRNG, too! */ if ( RAND_egd( ( RAND_file_name( f_randfile, sizeof( f_randfile ) ) == f_randfile ) ? f_randfile : "/.rnd" ) ) @@ -507,32 +518,30 @@ } } - memset( (char *) &srvaddr, 0, sizeof srvaddr ); - srvaddr.sin_family = PF_INET; - if ( !PC_Struct.listen_addr ) - { - srvaddr.sin_addr.s_addr = htonl(INADDR_ANY); - } - else - { - srvaddr.sin_addr.s_addr = inet_addr( PC_Struct.listen_addr ); - if ( srvaddr.sin_addr.s_addr == -1 ) + memset( &aihints, 0, sizeof aihints ); + aihints.ai_family = AF_UNSPEC; + aihints.ai_socktype = SOCK_STREAM; + aihints.ai_flags = AI_PASSIVE; + + if ( ( gaierrnum = getaddrinfo( PC_Struct.listen_addr, + PC_Struct.listen_port, + &aihints, &ai ) ) ) { syslog( LOG_ERR, "%s: bad bind address: '%s' specified in config file. Exiting.", fn, PC_Struct.listen_addr ); exit( 1 ); } - } - - syslog(LOG_INFO, "%s: Binding to tcp %s:%d", fn, PC_Struct.listen_addr ? - PC_Struct.listen_addr : "*", PC_Struct.listen_port ); - srvaddr.sin_port = htons(PC_Struct.listen_port); + syslog( LOG_INFO, "%s: Binding to tcp %s:%s", fn, + PC_Struct.listen_addr ? PC_Struct.listen_addr : "*", + PC_Struct.listen_port ); - listensd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + for ( ; ai != NULL; ai = ai->ai_next ) + { + listensd = socket( ai->ai_family, ai->ai_socktype, ai->ai_protocol ); if ( listensd == -1 ) { - syslog(LOG_ERR, "%s: socket() failed: %s", fn, strerror(errno)); - exit( 1 ); + syslog(LOG_WARNING, "%s: socket() failed: %s", fn, strerror(errno)); + continue; } setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (void *)&flag, @@ -549,12 +558,19 @@ setsockopt( listensd, SOL_SOCKET, SO_KEEPALIVE, (void *)&lingerstruct.l_onoff, sizeof lingerstruct.l_onoff ); } - - if ( bind(listensd, (struct sockaddr *)&srvaddr, sizeof( srvaddr ) ) < 0 ) + memcpy( &srvaddr, ai->ai_addr, ai->ai_addrlen ); + if ( bind( listensd, (struct sockaddr *)&srvaddr, ai->ai_addrlen ) < 0 ) { - syslog(LOG_ERR, "%s: bind() failed: %s", fn, strerror(errno) ); - exit( 1 ); + syslog(LOG_WARNING, "%s: bind() failed: %s", fn, strerror(errno) ); + continue; + } + else break; } + if ( ai == NULL ) + { + syslog( LOG_ERR, "%s: no useable addresses to bind to", fn ); + exit( EXIT_FAILURE); + } /* * Create and mmap() our stat file while we're still root. Since it's @@ -638,10 +654,11 @@ { /* * Bug fixed by Gary Mills <mi...@cc...>. I forgot - * to initialize addrlen. + * to initialize sockaddrlen. */ - addrlen = sizeof cliaddr; - clientsd = accept( listensd, (struct sockaddr *)&cliaddr, &addrlen ); + sockaddrlen = sizeof cliaddr; + clientsd = accept( listensd, (struct sockaddr *)&cliaddr, + &sockaddrlen ); if ( clientsd == -1 ) { syslog(LOG_WARNING, "%s: accept() failed: %s -- retrying", @@ -724,10 +741,11 @@ static void ServerInit( void ) { char *fn = "ServerInit()"; - struct hostent *hp; struct rlimit rl; int rc; struct passwd *pw; + struct addrinfo aihints, *ai; + int gaierrnum, sd; /* open the global trace file and make proc_username own it */ @@ -780,13 +798,19 @@ syslog( LOG_INFO, "%s: proxying to IMAP server '%s'.", fn, PC_Struct.server_hostname ); + memset( &aihints, 0, sizeof aihints ); + aihints.ai_family = AF_UNSPEC; + aihints.ai_socktype = SOCK_STREAM; + for( ;; ) { - hp = gethostbyname( PC_Struct.server_hostname ); - - if ( !hp ) + if ( ( gaierrnum = getaddrinfo( PC_Struct.server_hostname, + PC_Struct.server_port, + &aihints, &ai ) ) ) { - syslog(LOG_ERR, "%s: gethostbyname() failed to resolve hostname of remote IMAP server: %s -- retrying", fn, strerror(errno) ); + syslog( LOG_ERR, + "%s: getaddrinfo() failed to resolve hostname of remote IMAP server: %s -- retrying", + fn, gai_strerror( gaierrnum ) ); sleep( 15 ); } else @@ -795,19 +819,30 @@ } } - memcpy( &ISD.host, hp, sizeof(struct hostent) ); - - syslog(LOG_INFO, "%s: Proxying to IMAP port %d", + syslog(LOG_INFO, "%s: Proxying to IMAP port %s", fn, PC_Struct.server_port ); - ISD.serv.s_port = htons(PC_Struct.server_port); /* * fill in the address family, the host address, and the * service port of our global socket address structure */ - ISD.srv.sin_family = PF_INET; - memcpy( &ISD.srv.sin_addr.s_addr, ISD.host.h_addr, ISD.host.h_length ); - ISD.srv.sin_port = ISD.serv.s_port; + ISD.airesults = ai; + ISD.srv = NULL; + for ( ; ai != NULL; ai = ai->ai_next ) + { + if ( ( sd = socket( ai->ai_family, ai->ai_socktype, ai->ai_protocol ) ) + < 0 ) continue; + if ( connect( sd, (struct sockaddr *)ai->ai_addr, ai->ai_addrlen ) ) + continue; + close( sd ); + ISD.srv = ai; + break; + } + if ( ai == NULL ) + { + syslog( LOG_ERR, "%s: %s -- exiting", fn, strerror( errno ) ); + exit( EXIT_FAILURE ); + } } @@ -975,7 +1010,8 @@ for ( ;; ) { - sd = socket( PF_INET, SOCK_STREAM, IPPROTO_TCP ); + sd = socket( ISD.srv->ai_family, ISD.srv->ai_socktype, + ISD.srv->ai_protocol ); if ( sd == -1 ) { syslog(LOG_ERR, "%s: socket() failed: %s -- exiting", fn, @@ -983,9 +1019,8 @@ exit( 1 ); } - - if ( connect( sd, (struct sockaddr *)&ISD.srv, sizeof(ISD.srv) ) == -1 ) - { + if ( connect( sd, (struct sockaddr *)ISD.srv->ai_addr, + ISD.srv->ai_addrlen ) == -1 ) { syslog(LOG_ERR, "%s: connect() to imap server on socket [%d] failed: %s -- retrying", fn, sd, strerror(errno)); close( sd ); Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 09:07:08 UTC (rev 14027) +++ trunk/imap_proxy/src/request.c 2010-07-25 09:11:36 UTC (rev 14028) @@ -39,11 +39,14 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.22 2006/02/16 18:38:36 dave64 Exp $ +** $Id: request.c,v 1.23 2007/05/31 12:11:24 dave64 Exp $ ** ** Modification History: ** ** $Log: request.c,v $ +** Revision 1.23 2007/05/31 12:11:24 dave64 +** Applied ipv6 patch by Antonio Querubin. +** ** Revision 1.22 2006/02/16 18:38:36 dave64 ** Patch to add internal version command by Matt Selsky. ** @@ -697,14 +700,13 @@ int rc; ITD_Struct Server; int BytesRead; - struct sockaddr_in cli_addr; - int addrlen; - char *hostaddr; - in_port_t sin_port; + struct sockaddr_storage cli_addr; + int sockaddrlen; + char hostaddr[INET6_ADDRSTRLEN], portstr[NI_MAXSERV]; unsigned int BufLen = BUFSIZE - 1; memset ( &Server, 0, sizeof Server ); - addrlen = sizeof( struct sockaddr_in ); + sockaddrlen = sizeof( struct sockaddr_storage ); /* * send a base64 encoded username prompt to the client. Note that we're @@ -807,18 +809,20 @@ rc = EVP_DecodeBlock( Password, EncodedPassword, BytesRead - 2 ); Password[rc] = '\0'; - if ( getpeername( Client->conn->sd, (struct sockaddr *)&cli_addr, &addrlen ) < 0 ) + if ( getpeername( Client->conn->sd, (struct sockaddr *)&cli_addr, + &sockaddrlen ) < 0 ) { syslog( LOG_WARNING, "AUTH_LOGIN: failed: getpeername() failed for client sd: %s", Username, strerror( errno ) ); return( -1 ); } - hostaddr = inet_ntoa( ( ( struct sockaddr_in *)&cli_addr )->sin_addr ); - sin_port = ntohs( cli_addr.sin_port ); - - if ( !hostaddr ) + if ( getnameinfo( (struct sockaddr *) &cli_addr, sockaddrlen, + hostaddr, sizeof hostaddr, portstr, sizeof portstr, + NI_NUMERICHOST | NI_NUMERICSERV ) ) { - syslog(LOG_WARNING, "AUTH_LOGIN: '%s' failed: inet_ntoa() failed for client sd: %s", Username, strerror( errno ) ); + syslog( LOG_WARNING, + "AUTH_LOGIN: '%s' failed: getnameinfo() failed for client sd: %s", + Username, strerror( errno ) ); return( -1 ); } @@ -828,7 +832,7 @@ * he needs to login. This is just in case there are any special * characters in the password that we decoded. */ - conn = Get_Server_conn( Username, Password, hostaddr, sin_port, LITERAL_PASSWORD ); + conn = Get_Server_conn( Username, Password, hostaddr, portstr, LITERAL_PASSWORD ); /* * all the code from here to the end is basically identical to that @@ -930,31 +934,32 @@ ITD_Struct Server; int rc; ICD_Struct *conn; - struct sockaddr_in cli_addr; - int addrlen; - char *hostaddr; - in_port_t sin_port; + struct sockaddr_storage cli_addr; + int sockaddrlen; + char hostaddr[INET6_ADDRSTRLEN], portstr[NI_MAXSERV]; memset( &Server, 0, sizeof Server ); - addrlen = sizeof( struct sockaddr_in ); + sockaddrlen = sizeof( struct sockaddr_storage ); - if ( getpeername( Client->conn->sd, (struct sockaddr *)&cli_addr, &addrlen ) < 0 ) + if ( getpeername( Client->conn->sd, (struct sockaddr *)&cli_addr, + &sockaddrlen ) < 0 ) { syslog(LOG_INFO, "LOGIN: '%s' failed: getpeername() failed for client sd: %s", Username, strerror( errno ) ); return( -1 ); } - hostaddr = inet_ntoa( ( ( struct sockaddr_in *)&cli_addr )->sin_addr ); - sin_port = ntohs( cli_addr.sin_port ); - - if ( !hostaddr ) + if ( getnameinfo( (struct sockaddr *) &cli_addr, sockaddrlen, + hostaddr, sizeof hostaddr, portstr, sizeof portstr, + NI_NUMERICHOST | NI_NUMERICSERV ) ) { - syslog(LOG_INFO, "LOGIN: '%s' failed: inet_ntoa() failed for client sd: %s", Username, strerror( errno ) ); + syslog( LOG_INFO, + "LOGIN: '%s' failed: getnameinfo() failed for client sd: %s", + Username, strerror( errno ) ); return( -1 ); } - conn = Get_Server_conn( Username, Password, hostaddr, sin_port, LiteralLogin ); + conn = Get_Server_conn( Username, Password, hostaddr, portstr, LiteralLogin ); /* * wipe out the passwd so we don't have it sitting in memory somewhere. Added: trunk/imap_proxy/src/threads.c =================================================================== --- trunk/imap_proxy/src/threads.c (rev 0) +++ trunk/imap_proxy/src/threads.c 2010-07-25 09:11:36 UTC (rev 14028) @@ -0,0 +1,126 @@ +/* +** +** Copyright (c) 2002-2007 Dave McMurtrie +** +** This file is part of imapproxy. +** +** imapproxy 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 2 of the License, or +** (at your option) any later version. +** +** imapproxy 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 imapproxy; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +** +** +** Facility: +** +** threads.c +** +** Abstract: +** +** Routines to provide threadsafe interaction with OpenSSL libraries. +** +** Authors: +** +** Jan Grant, based on http://www.openssl.org/docs/crypto/threads.html +** +** RCS: +** +** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/threads.c,v $ +** $Id: threads.c,v 1.2 2007/05/31 11:58:17 dave64 Exp $ +** +** Modification History: +** +** $Log: threads.c,v $ +** Revision 1.2 2007/05/31 11:58:17 dave64 +** Added license information and updated comment block. +** +** +*/ + +#define _REENTRANT + +#include <config.h> + +#define OPENSSL_THREAD_DEFINES +#include <openssl/opensslconf.h> +#if defined(OPENSSL_THREADS) + + +#include <stdio.h> +#include <syslog.h> +#include <pthread.h> + +#include <openssl/crypto.h> + +#include "common.h" +#include "imapproxy.h" + +static void locking_function(int mode, int n, const char *file, int line); +static unsigned long id_function(void); + +static pthread_mutex_t *locks; + +/* We use pthreads, since the rest of imapproxy does. */ + +void ssl_thread_setup(const char *fn) { + int i, rc; + + syslog(LOG_NOTICE, "Initialising %d pthread_mutexes", CRYPTO_num_locks() ); + locks = malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); + if (locks == NULL) { + syslog(LOG_ERR, "Cannot allocate space for SSL mutexes"); + exit(1); + } + + for (i = 0; i < CRYPTO_num_locks(); i++) { + rc = pthread_mutex_init(&locks[i], NULL); + if ( rc ) { + syslog(LOG_ERR, "%s: pthread_mutex_init() returned error [%d] initializing OpenSSL mutexes. Exiting.", fn, rc ); + exit( 1 ); + } + } + + CRYPTO_set_id_callback(id_function); + CRYPTO_set_locking_callback(locking_function); +} + +void locking_function(int mode, int n, const char *file, int line) { + if (mode & CRYPTO_LOCK) + pthread_mutex_lock(&locks[n]); + else + pthread_mutex_unlock(&locks[n]); +} + +unsigned long id_function(void) { + return (unsigned long) pthread_self(); +} + + +#else /* defined(OPENSSL_THREADS) */ + #error OpenSSL compiled without thread support +#endif /* defined(OPENSSL_THREADS) */ + +/* + * _________ + * / | + * / | + * / ______| + * / / ________ + * | | | / + * | | |_____/ + * | | ______ + * | | | \ + * | | |______\ + * \ \_______ + * \ | + * \ | + * \_________| + */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 09:18:35
|
Revision: 14030 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14030&view=rev Author: pdontthink Date: 2010-07-25 09:18:29 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.6 RC 2 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/README trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/common.h trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/pkginfo trunk/imap_proxy/src/main.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 09:13:09 UTC (rev 14029) +++ trunk/imap_proxy/ChangeLog 2010-07-25 09:18:29 UTC (rev 14030) @@ -1,3 +1,11 @@ +2007-11-15 Dave McMurtrie <dav...@gm...> + * main.c: Applied pidfile support and daemon enhancement patch + by Jose Luis Tallon. + + * imapproxy.h: Applied pidfile support patch by Jose Luis Tallon. + + * common.h: Updated version string to 1.2.6rc2 + 2007-05-31 Dave McMurtrie <dav...@gm...> * main.c: Applied OpenSSL threads patch by Jan Grant. Applied ipv6 patch by Antonio Querubin. Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 09:13:09 UTC (rev 14029) +++ trunk/imap_proxy/README 2010-07-25 09:18:29 UTC (rev 14030) @@ -8,7 +8,7 @@ If you want to subscribe to the imapproxy-info mailing list, visit: -http://lists.pitt.edu/mailman/listinfo/imapproxy-info +http://lists.andrew.cmu.edu/mailman/listinfo/imapproxy-info For some Debian specific issues that have come up, read the file README.debian. Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 09:13:09 UTC (rev 14029) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 09:18:29 UTC (rev 14030) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.6rc1 +%define ver 1.2.6rc2 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/common.h =================================================================== --- trunk/imap_proxy/include/common.h 2010-07-25 09:13:09 UTC (rev 14029) +++ trunk/imap_proxy/include/common.h 2010-07-25 09:18:29 UTC (rev 14030) @@ -35,13 +35,16 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/include/RCS/common.h,v $ -** $Id: common.h,v 1.7 2007/05/31 12:13:30 dave64 Exp $ +** $Id: common.h,v 1.8 2007/11/15 11:13:13 dave64 Exp $ ** ** Modification History: ** ** $Log: common.h,v $ +** Revision 1.8 2007/11/15 11:13:13 dave64 +** updated version to 1.2.6rc2. +** ** Revision 1.7 2007/05/31 12:13:30 dave64 -** Updated version string to 1.2.6rc1 +** Updated version string to 1.2.6rc1 ** ** Revision 1.6 2007/01/30 15:19:29 dave64 ** Updated version string to 1.2.5. @@ -69,7 +72,7 @@ #define HASH_TABLE_SIZE 1024 -#define IMAP_PROXY_VERSION "1.2.6rc1" +#define IMAP_PROXY_VERSION "1.2.6rc2" /* * Misc. function prototypes. Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 09:13:09 UTC (rev 14029) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-25 09:18:29 UTC (rev 14030) @@ -34,11 +34,14 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.26 2007/05/31 12:07:41 dave64 Exp $ +** $Id: imapproxy.h,v 1.27 2007/11/15 11:11:46 dave64 Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.27 2007/11/15 11:11:46 dave64 +** Added pidfile support patch by Jose Luis Tallón. +** ** Revision 1.26 2007/05/31 12:07:41 dave64 ** Applied ipv6 patch by Antonio Querubin. ** @@ -177,6 +180,9 @@ #ifndef DEFAULT_CONFIG_FILE #define DEFAULT_CONFIG_FILE "/etc/imapproxy.conf" #endif +#ifndef DEFAULT_PID_FILE +#define DEFAULT_PID_FILE "/var/run/imapproxy.pid" +#endif #define LITERAL_PASSWORD 1 #define NON_LITERAL_PASSWORD 0 Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 09:13:09 UTC (rev 14029) +++ trunk/imap_proxy/pkginfo 2010-07-25 09:18:29 UTC (rev 14030) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.6rc1 +VERSION=1.2.6rc2 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 09:13:09 UTC (rev 14029) +++ trunk/imap_proxy/src/main.c 2010-07-25 09:18:29 UTC (rev 14030) @@ -36,11 +36,15 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.33 2007/05/31 12:10:59 dave64 Exp $ +** $Id: main.c,v 1.34 2007/11/15 11:14:16 dave64 Exp $ ** ** Modification History: ** ** $Log: main.c,v $ +** Revision 1.34 2007/11/15 11:14:16 dave64 +** Patch by Jose Luis Tallón to add pidfile support and +** enhance daemon behavior. +** ** Revision 1.33 2007/05/31 12:10:59 dave64 ** Applied ipv6 patch by Antonio Querubin. ** @@ -177,7 +181,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.33 2007/05/31 12:10:59 dave64 Exp $"; +static char *rcsId = "$Id: main.c,v 1.34 2007/11/15 11:14:16 dave64 Exp $"; static char *rcsSource = "$Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dave64 $"; @@ -262,13 +266,14 @@ static int ParseBannerAndCapability( char *, unsigned int, char *, unsigned int ); static void ServerInit( void ); +static void Daemonize( const char* ); static void Usage( void ); int main( int argc, char *argv[] ) { - char *fn = "main()"; + const char *fn = "main()"; char f_randfile[ PATH_MAX ]; int listensd; /* socket descriptor we'll bind to */ int clientsd; /* incoming socket descriptor */ @@ -280,13 +285,13 @@ pthread_attr_t attr; /* generic thread attribute struct */ int rc, i, fd; unsigned int ui; - pid_t pid; /* used just for a fork call */ struct linger lingerstruct; /* for the socket reuse stuff */ int flag; /* for the socket reuse stuff */ ICC_Struct *ICC_tptr; extern char *optarg; extern int optind; char ConfigFile[ MAXPATHLEN ]; /* path to our config file */ + char PidFile[ MAXPATHLEN ]; /* path to our pidfile */ #ifdef HAVE_LIBWRAP struct request_info r; /* request struct for libwrap */ #endif @@ -295,6 +300,7 @@ flag = 1; ConfigFile[0] = '\0'; + strncpy( PidFile, DEFAULT_PID_FILE, sizeof PidFile -1 ); /* * Ignore signals we don't want to die from but we don't care enough @@ -304,7 +310,7 @@ signal( SIGHUP, SIG_IGN ); - while (( i = getopt( argc, argv, "f:h" ) ) != EOF ) + while (( i = getopt( argc, argv, "f:p:h" ) ) != EOF ) { switch( i ) { @@ -315,7 +321,15 @@ syslog( LOG_INFO, "%s: Using configuration file '%s'", fn, ConfigFile ); break; - + + case 'p': + /* user specified a pidfile */ + strncpy( PidFile, optarg, sizeof PidFile -1 ); + PidFile[ sizeof PidFile - 1 ] = '\0'; + syslog( LOG_INFO, "%s: Using pidfile '%s'", + fn, PidFile ); + break; + case 'h': Usage(); exit( 0 ); @@ -419,43 +433,8 @@ memset( ICC_HashTable, 0, sizeof ICC_HashTable ); ServerInit(); - - /* detach from our parent if necessary */ - if (! (getppid() == 1) && ( ! PC_Struct.foreground_mode ) ) - { - syslog( LOG_INFO, "%s: Configured to run in background mode.", fn ); - - if ( (pid = fork()) < 0) - { - syslog(LOG_ERR, "%s: initial call to fork() failed: %s", fn, strerror(errno)); - exit( 1 ); - } - else if ( pid > 0) - { - exit( 0 ); - } - - if (setsid() == -1) - { - syslog(LOG_WARNING, "%s: setsid() failed: %s", - fn, strerror(errno)); - } - if ( (pid = fork()) < 0) - { - syslog(LOG_ERR, "%s: secondary call to fork() failed: %s", fn, - strerror(errno)); - exit( 1 ); - } - else if ( pid > 0) - { - exit( 0 ); - } - } - else - { - syslog( LOG_INFO, "%s: Configured to run in foreground mode.", fn ); - } + /* Daemonize() would go here */ SetBannerAndCapability(); @@ -610,6 +589,12 @@ IMAPCount->StartTime = time( 0 ); IMAPCount->CountTime = time( 0 ); + /* + * Daemonize as late as possible, so that connection failures can be caught + * and startup aborted before dettaching from parent + */ + Daemonize( PidFile ); + if ( BecomeNonRoot() ) exit( 1 ); @@ -718,7 +703,7 @@ */ void Usage( void ) { - printf("Usage: %s [-f config filename] [-h]\n", PGM ); + printf("Usage: %s [-f config filename] [-p pidfile] [-h]\n", PGM ); return; } @@ -846,8 +831,95 @@ } +/*++ + * Function: Daemonize + * + * Purpose: Daemonize, closing all unneeded descriptors. + * Write the daemon's PID into 'pidfile' + * + * Parameters: pidfile -- where to write our PID. + * + * Returns: nada -- exits on error + * + * Authors: Jose Luis Tallon <jlt...@ad...> + * + * Notes: + *-- + */ +void Daemonize( const char* pidfile ) +{ + const char* fn="Daemonize()"; + FILE* fp=NULL; + pid_t pid; /* used just for a fork call */ + int i; + /* detach from our parent if necessary */ + if (! (getppid() == 1) && ( ! PC_Struct.foreground_mode ) ) + { + syslog( LOG_INFO, "%s: Configured to run in background mode.", fn ); + if ( (pid = fork()) < 0) + { + syslog(LOG_ERR, "%s: initial call to fork() failed: %s", + fn, strerror(errno)); + exit( 1 ); + } + else if ( pid > 0) + { + exit( 0 ); + } + + if (setsid() == -1) + { + syslog(LOG_WARNING, "%s: setsid() failed: %s", + fn, strerror(errno)); + } + if ( (pid = fork()) < 0) + { + syslog(LOG_ERR, "%s: secondary call to fork() failed: %s", + fn, strerror(errno)); + exit( 1 ); + } + else if ( pid > 0) + { + exit( 0 ); + } + if ( (fp=fopen(pidfile,"wt")) == NULL ) + { + syslog(LOG_ERR, "%s: creating pidfile '%s' failed: %s", fn, + pidfile, strerror(errno)); + exit(1); + } + if( fprintf(fp, "%u\n", (unsigned)getpid()) < 0 ) + { + syslog(LOG_ERR, "%s: fprintf on pidfile failed: %s", fn, + strerror(errno)); + exit(1); + } + fclose(fp); + if( chdir("/") < 0 ) + { + syslog(LOG_ERR, "%s: chdir(\"/\") failed: %s", fn, + strerror(errno)); + exit( 1 ); + } + if( (i=open("/dev/null",O_RDWR)) < 0 ) + { + syslog(LOG_ERR, "%s: open(\"/dev/null\") failed: %s", fn, + strerror(errno)); + exit( 1 ); + } + close(2); dup(i); + close(1); dup(i); + close(0); dup(i); + close(i); + } + else + { + syslog( LOG_INFO, "%s: Configured to run in foreground mode.", fn ); + } +} + /*++ * Function: ParseBannerAndCapability * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-25 09:26:45
|
Revision: 14032 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14032&view=rev Author: pdontthink Date: 2010-07-25 09:26:38 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.6 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/common.h trunk/imap_proxy/pkginfo Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 09:20:00 UTC (rev 14031) +++ trunk/imap_proxy/ChangeLog 2010-07-25 09:26:38 UTC (rev 14032) @@ -1,4 +1,11 @@ +2008-01-28 Dave McMurtrie <dav...@gm...> + + * Version 1.2.6 released. + + * common.h: Updated version to 1.2.6 + 2007-11-15 Dave McMurtrie <dav...@gm...> + * main.c: Applied pidfile support and daemon enhancement patch by Jose Luis Tallon. @@ -7,6 +14,7 @@ * common.h: Updated version string to 1.2.6rc2 2007-05-31 Dave McMurtrie <dav...@gm...> + * main.c: Applied OpenSSL threads patch by Jan Grant. Applied ipv6 patch by Antonio Querubin. Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 09:20:00 UTC (rev 14031) +++ trunk/imap_proxy/imapproxy.spec 2010-07-25 09:26:38 UTC (rev 14032) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.6rc2 +%define ver 1.2.6 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/common.h =================================================================== --- trunk/imap_proxy/include/common.h 2010-07-25 09:20:00 UTC (rev 14031) +++ trunk/imap_proxy/include/common.h 2010-07-25 09:26:38 UTC (rev 14032) @@ -35,11 +35,14 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/include/RCS/common.h,v $ -** $Id: common.h,v 1.8 2007/11/15 11:13:13 dave64 Exp $ +** $Id: common.h,v 1.9 2008/01/28 13:11:55 dave64 Exp $ ** ** Modification History: ** ** $Log: common.h,v $ +** Revision 1.9 2008/01/28 13:11:55 dave64 +** updated version to 1.2.6 +** ** Revision 1.8 2007/11/15 11:13:13 dave64 ** updated version to 1.2.6rc2. ** @@ -72,7 +75,7 @@ #define HASH_TABLE_SIZE 1024 -#define IMAP_PROXY_VERSION "1.2.6rc2" +#define IMAP_PROXY_VERSION "1.2.6" /* * Misc. function prototypes. Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 09:20:00 UTC (rev 14031) +++ trunk/imap_proxy/pkginfo 2010-07-25 09:26:38 UTC (rev 14032) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.6rc2 +VERSION=1.2.6 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pdo...@us...> - 2010-07-26 07:08:57
|
Revision: 14036 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14036&view=rev Author: pdontthink Date: 2010-07-26 07:08:47 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Committing differences to IMAP Proxy version 1.2.7 RC 1 Modified Paths: -------------- trunk/imap_proxy/ChangeLog trunk/imap_proxy/README trunk/imap_proxy/imapproxy.spec trunk/imap_proxy/include/common.h trunk/imap_proxy/include/imapproxy.h trunk/imap_proxy/pkginfo trunk/imap_proxy/src/imapcommon.c trunk/imap_proxy/src/main.c trunk/imap_proxy/src/request.c Modified: trunk/imap_proxy/ChangeLog =================================================================== --- trunk/imap_proxy/ChangeLog 2010-07-25 19:41:21 UTC (rev 14035) +++ trunk/imap_proxy/ChangeLog 2010-07-26 07:08:47 UTC (rev 14036) @@ -1,3 +1,27 @@ +2008-10-20 Dave McMurtrie <dav...@gm...> + * request.c: Fixed buffer overflow condition when doing AUTH LOGIN. + Applied patch by Michael M. Slusarz to make internal + commands RFC compliant (prepend with X instead of P_). Added + support for XPROXYREUSE response. + + * README: Applied patch by Michael M. Slusarz to describe new + internal command names (prepended with X instead of P_). + + * imapcommon.c: Applied patch by Michael M. Slusarz to support + XPROXYREUSE. + + * main.c: Applied patch by Michael M. Slusarz to add XIMAPPROXY + to capability string returned by imapproxy to clients. + + * imapproxy.h: Applied patch by Michael M. Slusarz to support + XPROXYREUSE. + + * common.h: Updated version to 1.2.7rc1 + +2008-03-05 Dave McMurtrie <dav...@gm...> + + * main.c: Applied patch by Noel B to disable IDLE capability. + 2008-01-28 Dave McMurtrie <dav...@gm...> * Version 1.2.6 released. Modified: trunk/imap_proxy/README =================================================================== --- trunk/imap_proxy/README 2010-07-25 19:41:21 UTC (rev 14035) +++ trunk/imap_proxy/README 2010-07-26 07:08:47 UTC (rev 14036) @@ -185,6 +185,31 @@ ############################################################################## +NEW STATUS RESPONSE: +############################################################################## + +Upon a successful LOGIN or AUTHENTICATION, if imapproxy reused an existing +connection an untagged IMAP response with the status response XPROXYREUSE +will be issued. This status response indicates to a client that any previous +initialization does not need to be performed again. + +Examples: +--------- +1. Login without an active cached connection. + +C: a001 LOGIN user password +S: [... untagged response(s) from remote IMAP server ...] +S: a001 OK User logged in + +2. Login with an active cached connection. + +C: a001 LOGIN user password +S: [... untagged response(s) from remote IMAP server ...] +S: * OK [XPROXYREUSE] IMAP connection reused by imapproxy +S: a001 OK User logged in + + +############################################################################## ADDITIONAL COMMANDS: ############################################################################## @@ -199,38 +224,106 @@ If you secure the listen_port, you can then set the enable_admin_commands option in imapproxy.conf to enable the use of these commands. -P_NEWLOG --------- +These commands are available only until you log into the remote IMAP server. + +If these commands are available, the string 'XIMAPPROXY' will be listed in +the CAPABILITY string before login/authentication (see RFC 3501 [6.1.1]). + +These commands are prefixed with 'X' to comply with RFC 3501 [6.5.1]. + + +XPROXY_NEWLOG +------------- Since the protocol log file is held open as long as the server is running, it's difficult to clear the logfile. This command was added to take care of -that for you. It doesn't accept any arguments. +that for you. -P_DUMPICC ---------- +Usage: + <tag> XPROXY_NEWLOG + +Example: +C: a001 XPROXY_NEWLOG +S: a001 OK Logfile cleared + + +XPROXY_DUMPICC +-------------- The Dump ICC command allows you to display the internal data structures of the proxy server. It can tell you how many connections you currently have open, what users they're for, and the status of the connections (active or cached). Use this sparingly if the proxy server is extremely busy. -P_TRACE -------- +Usage: + <tag> XPROXY_DUMPICC + +Untagged response(s) (1 for each cached connection): + * XPROXY_DUMPICC <#> <user> <status> + + <#> = socket descriptor of IMAP connection to backend server + <user> = Username of connection + <status> = Either 'Active' or 'Cached' + +Example: +C: a001 XPROXY_DUMPICC +S: * XPROXY_DUMPICC 1 foo Cached +S: * XPROXY_DUMPICC 2 foo2 Active +S: a001 OK Completed + + +XPROXY_TRACE +------------ This is used to turn on or off protocol logging. If issued without any arguments, it will disable protocol logging. If issued with a username argument, it will turn on logging for that particular user. Protocol log output will show up in the file configured as "protocol_log_filename" in the configuration file. -P_RESETCOUNTERS ---------------- +Usage: + <tag> XPROXY_TRACE [user] + + [user] = (OPTIONAL) Username to log + +Examples: +C: a001 XPROXY_TRACE +S: a001 OK Tracing disabled + +C: a001 XPROXY_TRACE foo +S: a001 OK Tracing enabled for user foo + + +XPROXY_RESETCOUNTERS +-------------------- This allows you to reset the internal counters that pimpstat reports on without having to restart the server. These are the counters that are mmap()ed to the file configured as "stat_filename" in the configuration file. -P_VERSION -------- +Usage: + <tag> XPROXY_RESETCOUNTERS + +Example: +C: a001 XPROXY_RESETCOUNTERS +S: a001 OK Counters reset + + +XPROXY_VERSION +-------------- This is used to show the version number of the IMAP proxy. +Usage: + <tag> XPROXY_VERSION +Untagged response(s) (1 for each cached connection): + * XPROXY_VERSION <version> + + <version> = Current version number of imapproxy. + +Example: +C: a001 XPROXY_VERSION +S: * XPROXY_VERSION 1.2.6 +S: a001 OK Completed + + + Happy proxying, Dave <dav...@gm...> Modified: trunk/imap_proxy/imapproxy.spec =================================================================== --- trunk/imap_proxy/imapproxy.spec 2010-07-25 19:41:21 UTC (rev 14035) +++ trunk/imap_proxy/imapproxy.spec 2010-07-26 07:08:47 UTC (rev 14036) @@ -1,6 +1,6 @@ #This is imapproxy rpm spec file -%define ver 1.2.6 +%define ver 1.2.7rc1 %define rel 1 %define prefix /usr/local Modified: trunk/imap_proxy/include/common.h =================================================================== --- trunk/imap_proxy/include/common.h 2010-07-25 19:41:21 UTC (rev 14035) +++ trunk/imap_proxy/include/common.h 2010-07-26 07:08:47 UTC (rev 14036) @@ -35,11 +35,14 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/include/RCS/common.h,v $ -** $Id: common.h,v 1.9 2008/01/28 13:11:55 dave64 Exp $ +** $Id: common.h,v 1.10 2008/10/20 13:21:05 dave64 Exp $ ** ** Modification History: ** ** $Log: common.h,v $ +** Revision 1.10 2008/10/20 13:21:05 dave64 +** updated version to 1.2.7rc1 +** ** Revision 1.9 2008/01/28 13:11:55 dave64 ** updated version to 1.2.6 ** @@ -75,7 +78,7 @@ #define HASH_TABLE_SIZE 1024 -#define IMAP_PROXY_VERSION "1.2.6" +#define IMAP_PROXY_VERSION "1.2.7rc1" /* * Misc. function prototypes. Modified: trunk/imap_proxy/include/imapproxy.h =================================================================== --- trunk/imap_proxy/include/imapproxy.h 2010-07-25 19:41:21 UTC (rev 14035) +++ trunk/imap_proxy/include/imapproxy.h 2010-07-26 07:08:47 UTC (rev 14036) @@ -34,11 +34,14 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/include/RCS/imapproxy.h,v $ -** $Id: imapproxy.h,v 1.27 2007/11/15 11:11:46 dave64 Exp $ +** $Id: imapproxy.h,v 1.28 2008/10/20 13:22:19 dave64 Exp $ ** ** Modification History: ** ** $Log: imapproxy.h,v $ +** Revision 1.28 2008/10/20 13:22:19 dave64 +** Applied patch by Michael M. Slusarz to support XPROXYREUSE. +** ** Revision 1.27 2007/11/15 11:11:46 dave64 ** Added pidfile support patch by Jose Luis Tallón. ** @@ -229,6 +232,7 @@ SSL *tls; /* TLS connection context */ #endif struct IMAPSelectCache ISC; /* Cached SELECT data */ + unsigned int reused; /* Was the connection reused? */ }; Modified: trunk/imap_proxy/pkginfo =================================================================== --- trunk/imap_proxy/pkginfo 2010-07-25 19:41:21 UTC (rev 14035) +++ trunk/imap_proxy/pkginfo 2010-07-26 07:08:47 UTC (rev 14036) @@ -1,7 +1,7 @@ PKG=UPimapproxy NAME=up-imapproxy ARCH=sparc -VERSION=1.2.6 +VERSION=1.2.7rc1 CATEGORY=application VENDOR=www.imapproxy.org DESC=This is a connection caching imapproxy daemon for proxied imap connections Modified: trunk/imap_proxy/src/imapcommon.c =================================================================== --- trunk/imap_proxy/src/imapcommon.c 2010-07-25 19:41:21 UTC (rev 14035) +++ trunk/imap_proxy/src/imapcommon.c 2010-07-26 07:08:47 UTC (rev 14036) @@ -35,11 +35,14 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/imapcommon.c,v $ -** $Id: imapcommon.c,v 1.24 2007/05/31 12:09:46 dave64 Exp $ +** $Id: imapcommon.c,v 1.25 2008/10/20 13:23:04 dave64 Exp $ ** ** Modification History: ** ** $Log: imapcommon.c,v $ +** Revision 1.25 2008/10/20 13:23:04 dave64 +** Applied patch by Michael M. Slusarz to support XPROXYREUSE. +** ** Revision 1.24 2007/05/31 12:09:46 dave64 ** Applied ipv6 patch by Antonio Querubin. ** @@ -505,6 +508,10 @@ "LOGIN: '%s' (%s:%s) on existing sd [%d]", Username, ClientAddr, portstr, ICC_Active->server_conn->sd ); + + /* Set the ICD as 'reused' */ + ICC_Active->server_conn->reused = 1; + return( ICC_Active->server_conn ); } } @@ -520,6 +527,10 @@ */ Server.conn = ( ICD_Struct * ) malloc( sizeof ( ICD_Struct ) ); memset( Server.conn, 0, sizeof ( ICD_Struct ) ); + + /* As a new connection, the ICD is not 'reused' */ + Server.conn->reused = 0; + Server.conn->sd = socket( ISD.srv->ai_family, ISD.srv->ai_socktype, ISD.srv->ai_protocol ); if ( Server.conn->sd == -1 ) Modified: trunk/imap_proxy/src/main.c =================================================================== --- trunk/imap_proxy/src/main.c 2010-07-25 19:41:21 UTC (rev 14035) +++ trunk/imap_proxy/src/main.c 2010-07-26 07:08:47 UTC (rev 14036) @@ -36,11 +36,18 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/main.c,v $ -** $Id: main.c,v 1.34 2007/11/15 11:14:16 dave64 Exp $ +** $Id: main.c,v 1.36 2008/10/20 13:47:49 dave64 Exp $ ** ** Modification History: ** -** $Log: main.c,v $ +** $Log: main.c,v $ +** Revision 1.36 2008/10/20 13:47:49 dave64 +** Applied patch by Michael M. Slusarz to add XIMAPPROXY +** to capability string returned by imapproxy to clients. +** +** Revision 1.35 2008/03/05 13:12:07 dave64 +** Applied patch by Noel B to disable IDLE capability. +** ** Revision 1.34 2007/11/15 11:14:16 dave64 ** Patch by Jose Luis Tallón to add pidfile support and ** enhance daemon behavior. @@ -181,7 +188,7 @@ */ -static char *rcsId = "$Id: main.c,v 1.34 2007/11/15 11:14:16 dave64 Exp $"; +static char *rcsId = "$Id: main.c,v 1.36 2008/10/20 13:47:49 dave64 Exp $"; static char *rcsSource = "$Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/main.c,v $"; static char *rcsAuthor = "$Author: dave64 $"; @@ -264,7 +271,7 @@ */ static void SetBannerAndCapability( void ); static int ParseBannerAndCapability( char *, unsigned int, - char *, unsigned int ); + char *, unsigned int, unsigned int ); static void ServerInit( void ); static void Daemonize( const char* ); static void Usage( void ); @@ -943,10 +950,14 @@ static int ParseBannerAndCapability( char *DestBuf, unsigned int DestBufSize, char *SourceBuf, - unsigned int SourceBufSize ) + unsigned int SourceBufSize, + unsigned int capability ) { char *fn = "ParseBannerAndCapability"; char *CP; + char *bracket; + unsigned int CPlen; + unsigned int inCap = 0; if ( SourceBufSize >= DestBufSize ) { @@ -994,57 +1005,117 @@ if ( !CP ) break; - if ( !strncasecmp( CP, "UNSELECT", strlen( "UNSELECT" ) ) ) - { - PC_Struct.support_unselect = UNSELECT_SUPPORTED; - } - /* - * If this token happens to be an auth mechanism, we want to - * discard it unless it's an auth mechanism we can support. + * Don't parse CAPABILITY extensions until we know we are either in + * a CAPABILITY untagged response or a CAPABILTY status response. */ - if ( ! strncasecmp( CP, "AUTH=", strlen( "AUTH=" ) ) && - ( strncasecmp( CP, "AUTH=LOGIN", strlen( "AUTH=LOGIN" ) ) ) ) + if ( ( capability && + !strncasecmp( CP, "CAPABILITY", strlen( "CAPABILITY" ) ) ) || + ( !capability && + !strncasecmp( CP, "[CAPABILITY", strlen( "[CAPABILITY" ) ) ) ) { - continue; + /* + * Indicate that we are now in CAPABILITY data + */ + inCap = 1; } - - /* - * If this token happens to be SASL-IR, we want to discard it - * since we don't support any auth mechs that can use it. - */ - if ( !strncasecmp( CP, "SASL-IR", strlen( "SASL-IR" ) ) ) + else if ( inCap ) { - continue; - } + /* + * If we are in a CAPABILITY status response, we keep processing + * until we see a ']' character. + */ + if ( capability == 0 ) + { + CPlen = strlen( CP ); + bracket = memchr( CP, ']', CPlen ); - /* - * If this token happens to be STARTTLS, we want to discard it - * since we don't support it on the client-side. - */ - if ( ! strncasecmp( CP, "STARTTLS", strlen( "STARTTLS" ) ) ) - { - PC_Struct.support_starttls = STARTTLS_SUPPORTED; - continue; - } + if ( bracket ) + { + inCap = 0; + + /* + * Add the XIMAPPROXY capability string at the end of the + * CAPABILITY listing. + */ + strcat( DestBuf, " " ); + CP[CPlen - 1] = '\0'; + strcat( DestBuf, CP ); + strcat( DestBuf, " XIMAPPROXY]" ); + + continue; + } + } + + if ( !strncasecmp( CP, "UNSELECT", strlen( "UNSELECT" ) ) ) + { + PC_Struct.support_unselect = UNSELECT_SUPPORTED; + } - /* - * If this token happens to be LOGINDISABLED, we want to discard it - * since we don't support it on the client-side. - */ - if ( ! strncasecmp( CP, "LOGINDISABLED", strlen( "LOGINDISABLED" ) ) ) - { - PC_Struct.login_disabled = LOGIN_DISABLED; - continue; + /* + * If this token happens to be an auth mechanism, we want to + * discard it unless it's an auth mechanism we can support. + */ + if ( ! strncasecmp( CP, "AUTH=", strlen( "AUTH=" ) ) && + ( strncasecmp( CP, "AUTH=LOGIN", strlen( "AUTH=LOGIN" ) ) ) ) + { + continue; + } + + /* + * If this token happens to be SASL-IR, we want to discard it + * since we don't support any auth mechs that can use it. + */ + if ( ! strncasecmp( CP, "SASL-IR", strlen( "SASL-IR" ) ) ) + { + continue; + } + + /* + * If this token is IDLE, discard it. + * + */ + if ( ! strncasecmp( CP, "IDLE", strlen( "IDLE" ) ) ) + { + continue; + } + + /* + * If this token happens to be STARTTLS, we want to discard it + * since we don't support it on the client-side. + */ + if ( ! strncasecmp( CP, "STARTTLS", strlen( "STARTTLS" ) ) ) + { + PC_Struct.support_starttls = STARTTLS_SUPPORTED; + continue; + } + + /* + * If this token happens to be LOGINDISABLED, we want to discard it + * since we don't support it on the client-side. + */ + if ( ! strncasecmp( CP, "LOGINDISABLED", strlen( "LOGINDISABLED" ) ) ) + { + PC_Struct.login_disabled = LOGIN_DISABLED; + continue; + } } strcat( DestBuf, " "); strcat( DestBuf, CP ); } - + /* + * Add a 'XIMAPPROXY' CAPABILITY response to indicate that the + * current connection is handled by imapproxy. + */ + if ( capability == 1 ) + { + strcat( DestBuf, " XIMAPPROXY" ); + } + strcat( DestBuf, "\r\n" ); - + return( strlen( DestBuf ) ); } @@ -1129,7 +1200,7 @@ BannerLen = ParseBannerAndCapability( Banner, sizeof Banner - 1, - itd.ReadBuf, BytesRead ); + itd.ReadBuf, BytesRead, 0 ); /* * See if the string we got back starts with "* OK" by comparing the @@ -1179,9 +1250,8 @@ } CapabilityLen = ParseBannerAndCapability( Capability, sizeof Capability - 1, - itd.ReadBuf, BytesRead ); + itd.ReadBuf, BytesRead, 1 ); - /* Now read the tagged response and make sure it's OK */ BytesRead = IMAP_Line_Read( &itd ); if ( BytesRead == -1 ) Modified: trunk/imap_proxy/src/request.c =================================================================== --- trunk/imap_proxy/src/request.c 2010-07-25 19:41:21 UTC (rev 14035) +++ trunk/imap_proxy/src/request.c 2010-07-26 07:08:47 UTC (rev 14036) @@ -39,11 +39,17 @@ ** RCS: ** ** $Source: /afs/andrew.cmu.edu/usr18/dave64/work/IMAP_Proxy/src/RCS/request.c,v $ -** $Id: request.c,v 1.23 2007/05/31 12:11:24 dave64 Exp $ +** $Id: request.c,v 1.24 2008/10/20 13:48:55 dave64 Exp $ ** ** Modification History: ** ** $Log: request.c,v $ +** Revision 1.24 2008/10/20 13:48:55 dave64 +** Fixed buffer overflow condition when doing AUTH LOGIN. +** Applied patch by Michael M. Slusarz to make internal +** commands RFC compliant (prepend with X instead of P_). +** Added support for XPROXYREUSE response. +** ** Revision 1.23 2007/05/31 12:11:24 dave64 ** Applied ipv6 patch by Antonio Querubin. ** @@ -269,7 +275,7 @@ return( -1 ); } - snprintf( SendBuf, BufLen, "%s OK Completed\r\n", Tag ); + snprintf( SendBuf, BufLen, "%s OK Logfile cleared\r\n", Tag ); if ( IMAP_Write( itd->conn, SendBuf, strlen(SendBuf) ) == -1 ) { @@ -333,7 +339,7 @@ IMAPCount->TotalServerConnectionsReused = 0; IMAPCount->TotalClientLogins = 0; - snprintf( SendBuf, BufLen, "%s OK Completed\r\n", Tag ); + snprintf( SendBuf, BufLen, "%s OK Counters reset\r\n", Tag ); if ( IMAP_Write( itd->conn, SendBuf, strlen(SendBuf) ) == -1 ) { @@ -389,7 +395,7 @@ while ( HashEntry ) { - snprintf( SendBuf, BufLen, "* %d %s %s\r\n", HashEntry->server_conn->sd, + snprintf( SendBuf, BufLen, "* XPROXY_DUMPICC %d %s %s\r\n", HashEntry->server_conn->sd, HashEntry->username, ( ( HashEntry->logouttime ) ? "Cached" : "Active" ) ); if ( IMAP_Write( itd->conn, SendBuf, strlen(SendBuf) ) == -1 ) @@ -449,7 +455,7 @@ return( 0 ); } - snprintf( SendBuf, BufLen, "* %s\r\n", IMAP_PROXY_VERSION ); + snprintf( SendBuf, BufLen, "* XPROXY_VERSION %s\r\n", IMAP_PROXY_VERSION ); if ( IMAP_Write( itd->conn, SendBuf, strlen(SendBuf) ) == -1 ) { syslog(LOG_WARNING, "%s: IMAP_Write() failed: %s", fn, strerror(errno) ); @@ -554,7 +560,8 @@ strncpy( TraceUser, Username, sizeof TraceUser - 1 ); TraceUser[ sizeof TraceUser - 1 ] = '\0'; - snprintf( SendBuf, BufLen, "%s OK Tracing enabled\r\n", Tag ); + snprintf( SendBuf, BufLen, "%s OK Tracing enabled for user %s.\r\n", + Tag, TraceUser ); if ( IMAP_Write( itd->conn, SendBuf, strlen(SendBuf) ) == -1 ) { syslog(LOG_WARNING, "%s: IMAP_Write() failed: %s", fn, strerror(errno) ); @@ -714,7 +721,7 @@ * avoid allocating additional buffers. Keep this in mind for future * code modification... */ - snprintf( Username, BufLen, "Username:" ); + snprintf( Username, MAXUSERNAMELEN - 1, "Username:" ); EVP_EncodeBlock( EncodedUsername, Username, strlen( Username ) ); @@ -751,13 +758,14 @@ * Easy, but not perfect sanity check. If the client sent enough data * to fill our entire buffer, we're not even going to bother looking at it. */ - if ( Client->MoreData || - BytesRead > BufLen ) + if ( ( Client->MoreData ) || + ( BytesRead > BufLen ) || + ( BytesRead > MAXUSERNAMELEN - 1 ) ) { syslog( LOG_NOTICE, "%s: Base64 encoded username sent from client on sd %d is too large.", fn, Client->conn->sd ); return( -1 ); } - + /* * copy BytesRead -2 so we don't include the CRLF. */ @@ -796,8 +804,9 @@ return( -1 ); } - if ( Client->MoreData || - BytesRead > BufLen ) + if ( ( Client->MoreData ) || + ( BytesRead > BufLen ) || + ( BytesRead > MAXPASSWDLEN -1 ) ) { syslog( LOG_NOTICE, "%s: Base64 encoded password sent from client on sd %d is too large.", fn, Client->conn->sd ); return( -1 ); @@ -854,6 +863,20 @@ } Server.conn = conn; + + /* + * If the connection has been reused, send a status response indicating + * this. + */ + if (Server.conn->reused == 1) + { + sprintf( SendBuf, "* OK [XPROXYREUSE] IMAP connection reused by imapproxy\r\n" ); + if ( IMAP_Write( Client->conn, SendBuf, strlen(SendBuf) ) == -1 ) + { + syslog(LOG_ERR, "%s: IMAP_Write() failed: %s", fn, strerror(errno) ); + return( -1 ); + } + } snprintf( SendBuf, BufLen, "%s OK User authenticated\r\n", Tag ); if ( IMAP_Write( Client->conn, SendBuf, strlen( SendBuf ) ) == -1 ) @@ -986,6 +1009,20 @@ Server.conn = conn; /* + * If the connection has been reused, send a status response indicating + * this. + */ + if (Server.conn->reused == 1) + { + sprintf( SendBuf, "* OK [XPROXYREUSE] IMAP connection reused by imapproxy\r\n" ); + if ( IMAP_Write( Client->conn, SendBuf, strlen(SendBuf) ) == -1 ) + { + syslog(LOG_ERR, "%s: IMAP_Write() failed: %s", fn, strerror(errno) ); + return( -1 ); + } + } + + /* * Send a success message back to the client * and go into raw proxy mode. */ @@ -1491,7 +1528,8 @@ * of the following IMAP commands (rfc 2060): NOOP, CAPABILITY, * AUTHENTICATE, LOGIN, and LOGOUT. Also, it handles the * commands that are internal to the proxy server such as - * P_TRACE, P_NEWLOG, P_DUMPICC, P_RESETCOUNTERS and P_VERSION. + * XPROXY_TRACE, XPROXY_NEWLOG, XPROXY_DUMPICC, + * XPROXY_RESETCOUNTERS and XPROXY_VERSION. * * None of these commands should ever have the need to send * a boatload of data, so we avoid some error checking and @@ -1767,7 +1805,7 @@ close( Client.conn->sd ); return; } - else if ( ! strcasecmp( (const char *)Command, "P_TRACE" ) ) + else if ( ! strcasecmp( (const char *)Command, "XPROXY_TRACE" ) ) { if ( Client.LiteralBytesRemaining ) { @@ -1780,7 +1818,7 @@ cmd_trace( &Client, S_Tag, Username ); continue; } - else if ( ! strcasecmp( (const char *)Command, "P_DUMPICC" ) ) + else if ( ! strcasecmp( (const char *)Command, "XPROXY_DUMPICC" ) ) { if ( Client.LiteralBytesRemaining ) { @@ -1792,7 +1830,7 @@ cmd_dumpicc( &Client, S_Tag ); continue; } - else if ( ! strcasecmp( (const char *)Command, "P_RESETCOUNTERS" ) ) + else if ( ! strcasecmp( (const char *)Command, "XPROXY_RESETCOUNTERS" ) ) { if ( Client.LiteralBytesRemaining ) { @@ -1804,7 +1842,7 @@ cmd_resetcounters( &Client, S_Tag ); continue; } - else if ( ! strcasecmp( (const char *)Command, "P_NEWLOG" ) ) + else if ( ! strcasecmp( (const char *)Command, "XPROXY_NEWLOG" ) ) { if ( Client.LiteralBytesRemaining ) { @@ -1816,7 +1854,7 @@ cmd_newlog( &Client, S_Tag ); continue; } - else if ( ! strcasecmp( (const char *)Command, "P_VERSION" ) ) + else if ( ! strcasecmp( (const char *)Command, "XPROXY_VERSION" ) ) { if ( Client.LiteralBytesRemaining ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |