summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
69d49e1)
address. This is not yet used by anything.
+ Revision 622.2 2004/06/24 15:26:33 ajc
+ * Updated the ig_tcp_server() function to allow binding to a single IP
+ address. This is not yet used by anything.
+
Revision 622.1 2004/06/24 02:34:39 ajc
* serv_imap.c: when an IMAP socket breaks while a folder is selected,
auto-expunge the folder before closing it. Fixes the "mysteriously
Revision 622.1 2004/06/24 02:34:39 ajc
* serv_imap.c: when an IMAP socket breaks while a folder is selected,
auto-expunge the folder before closing it. Fixes the "mysteriously
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
- newfcn->msock = ig_tcp_server(tcp_port, config.c_maxsessions);
+ newfcn->msock = ig_tcp_server(NULL, tcp_port,
+ config.c_maxsessions);
snprintf(message, sizeof message, "TCP port %d: ", tcp_port);
}
snprintf(message, sizeof message, "TCP port %d: ", tcp_port);
}
* log data sent through this function. BE CAREFUL!
*/
void lprintf(enum LogLevel loglevel, const char *format, ...) {
* log data sent through this function. BE CAREFUL!
*/
void lprintf(enum LogLevel loglevel, const char *format, ...) {
- va_start(arg_ptr, format);
- vsnprintf(buf, sizeof(buf), format, arg_ptr);
- va_end(arg_ptr);
+ va_start(arg_ptr, format);
+ vsnprintf(buf, sizeof(buf), format, arg_ptr);
+ va_end(arg_ptr);
if (syslog_facility >= 0) {
if (loglevel <= verbosity) {
if (syslog_facility >= 0) {
if (loglevel <= verbosity) {
* a TCP port. The server shuts down if the bind fails.
*
*/
* a TCP port. The server shuts down if the bind fails.
*
*/
-int ig_tcp_server(int port_number, int queue_len)
+int ig_tcp_server(char *ip_addr, int port_number, int queue_len)
{
struct sockaddr_in sin;
int s, i;
{
struct sockaddr_in sin;
int s, i;
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons((u_short)port_number);
sin.sin_port = htons((u_short)port_number);
+ if (ip_addr == NULL) {
+ sin.sin_addr.s_addr = INADDR_ANY;
+ }
+ else {
+ sin.sin_addr.s_addr = inet_addr(ip_addr);
+ }
+
+ if (sin.sin_addr.s_addr == INADDR_NONE) {
+ sin.sin_addr.s_addr = INADDR_ANY;
+ }
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
/*
* buffer_output() ... tell client_write to buffer all output until
/*
* buffer_output() ... tell client_write to buffer all output until
- * instructed to dump it all out later
+ * instructed to dump it all out later
*/
void buffer_output(void) {
if (CC->buffering == 0) {
*/
void buffer_output(void) {
if (CC->buffering == 0) {
/*
* cprintf() ... Send formatted printable data to the client. It is
/*
* cprintf() ... Send formatted printable data to the client. It is
- * implemented in terms of client_write() but remains in
- * sysdep.c in case we port to somewhere without va_args...
+ * implemented in terms of client_write() but remains in
+ * sysdep.c in case we port to somewhere without va_args...
*/
void cprintf(const char *format, ...) {
*/
void cprintf(const char *format, ...) {
- va_list arg_ptr;
- char buf[SIZ];
+ va_list arg_ptr;
+ char buf[SIZ];
- va_start(arg_ptr, format);
- if (vsnprintf(buf, sizeof buf, format, arg_ptr) == -1)
+ va_start(arg_ptr, format);
+ if (vsnprintf(buf, sizeof buf, format, arg_ptr) == -1)
buf[sizeof buf - 2] = '\n';
client_write(buf, strlen(buf));
va_end(arg_ptr);
buf[sizeof buf - 2] = '\n';
client_write(buf, strlen(buf));
va_end(arg_ptr);
void init_sysdep (void);
void begin_critical_section (int which_one);
void end_critical_section (int which_one);
void init_sysdep (void);
void begin_critical_section (int which_one);
void end_critical_section (int which_one);
-int ig_tcp_server (int port_number, int queue_len);
+int ig_tcp_server (char *ip_addr, int port_number, int queue_len);
int ig_uds_server(char *sockpath, int queue_len);
INLINE struct CitContext *MyContext (void);
struct CitContext *CreateNewContext (void);
int ig_uds_server(char *sockpath, int queue_len);
INLINE struct CitContext *MyContext (void);
struct CitContext *CreateNewContext (void);