Index: doc/src/sgml/runtime.sgml =================================================================== RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/runtime.sgml,v retrieving revision 1.251 diff -c -r1.251 runtime.sgml *** doc/src/sgml/runtime.sgml 15 Mar 2004 17:57:51 -0000 1.251 --- doc/src/sgml/runtime.sgml 22 Mar 2004 17:26:36 -0000 *************** *** 571,588 **** - - tcpip_socket (boolean) - - - If this is true, then the server will accept TCP/IP connections.TCP/IP - Otherwise only local Unix domain socket connections are - accepted. It is off by default. This option can only be set at - server start. - - - - max_connections (integer) --- 571,576 ---- *************** *** 702,717 **** ! ! virtual_host (string) ! Specifies the IP address(es) on which the server is ! to listen for connections from client applications. If specified, ! it takes the form of a space-separated list of host names and/or ! numeric IP addresses. If the list is empty, the server listens ! on all available addresses (including ! localhost). --- 690,707 ---- ! ! listen_addresses (string) ! Specifies the IP address(es) on which the server is ! to listen for connections from client applications. ! The default is localhost. ! The item takes the form of a space-separated list of host names and/or ! numeric IP addresses. The special entry * corresponds to all ! available IP interfaces. ! If the list is empty, the server does not ! listen on any IP interface at all. *************** *** 3009,3019 **** ! virtual_host = x ! tcpip_socket = on --- 2999,3009 ---- ! listen_addresses = x ! listen_addresses = '*' Index: src/backend/postmaster/postmaster.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v retrieving revision 1.375 diff -c -r1.375 postmaster.c *** src/backend/postmaster/postmaster.c 15 Mar 2004 16:18:42 -0000 1.375 --- src/backend/postmaster/postmaster.c 22 Mar 2004 17:26:38 -0000 *************** *** 149,155 **** /* The socket number we are listening for connections on */ int PostPortNumber; char *UnixSocketDir; ! char *VirtualHost; /* * MaxBackends is the limit on the number of backends we can start. --- 149,155 ---- /* The socket number we are listening for connections on */ int PostPortNumber; char *UnixSocketDir; ! char *ListenAddresses; /* * MaxBackends is the limit on the number of backends we can start. *************** *** 202,208 **** static int SendStop = false; /* still more option variables */ - bool NetServer = false; /* listen on TCP/IP */ bool EnableSSL = false; bool SilentMode = false; /* silent mode (-S) */ --- 202,207 ---- *************** *** 513,522 **** SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV); break; case 'h': ! SetConfigOption("virtual_host", optarg, PGC_POSTMASTER, PGC_S_ARGV); break; case 'i': ! SetConfigOption("tcpip_socket", "true", PGC_POSTMASTER, PGC_S_ARGV); break; case 'k': SetConfigOption("unix_socket_directory", optarg, PGC_POSTMASTER, PGC_S_ARGV); --- 512,521 ---- SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV); break; case 'h': ! SetConfigOption("listen_addresses", optarg, PGC_POSTMASTER, PGC_S_ARGV); break; case 'i': ! SetConfigOption("listen_addresses", "*", PGC_POSTMASTER, PGC_S_ARGV); break; case 'k': SetConfigOption("unix_socket_directory", optarg, PGC_POSTMASTER, PGC_S_ARGV); *************** *** 704,714 **** * Initialize SSL library, if specified. */ #ifdef USE_SSL - if (EnableSSL && !NetServer) - { - postmaster_error("TCP/IP connections must be enabled for SSL"); - ExitPostmaster(1); - } if (EnableSSL) secure_initialize(); #endif --- 703,708 ---- *************** *** 753,820 **** for (i = 0; i < MAXLISTEN; i++) ListenSocket[i] = -1; ! if (NetServer) { ! if (VirtualHost && VirtualHost[0]) { ! char *curhost, ! *endptr; ! char c = 0; ! ! curhost = VirtualHost; ! for (;;) ! { ! while (*curhost == ' ') /* skip any extra spaces */ ! curhost++; ! if (*curhost == '\0') ! break; ! endptr = strchr(curhost, ' '); ! if (endptr) ! { ! c = *endptr; ! *endptr = '\0'; ! } status = StreamServerPort(AF_UNSPEC, curhost, (unsigned short) PostPortNumber, UnixSocketDir, ListenSocket, MAXLISTEN); - if (status != STATUS_OK) - ereport(FATAL, - (errmsg("could not create listen socket for \"%s\"", - curhost))); - if (endptr) - { - *endptr = c; - curhost = endptr + 1; - } - else - break; - } - } - else - { - status = StreamServerPort(AF_UNSPEC, NULL, - (unsigned short) PostPortNumber, - UnixSocketDir, - ListenSocket, MAXLISTEN); if (status != STATUS_OK) ! ereport(FATAL, ! (errmsg("could not create TCP/IP listen socket"))); } #ifdef USE_RENDEZVOUS ! if (rendezvous_name != NULL) ! { ! DNSServiceRegistrationCreate(rendezvous_name, ! "_postgresql._tcp.", ! "", ! htonl(PostPortNumber), ! "", ! (DNSServiceRegistrationReply) reg_reply, ! NULL); ! } ! #endif } #ifdef HAVE_UNIX_SOCKETS status = StreamServerPort(AF_UNIX, NULL, --- 747,805 ---- for (i = 0; i < MAXLISTEN; i++) ListenSocket[i] = -1; ! if (ListenAddresses) { ! char *curhost, ! *endptr; ! char c = 0; ! ! curhost = ListenAddresses; ! for (;;) { ! while (isspace(*curhost)) /* skip any extra spaces */ ! curhost++; ! if (*curhost == '\0') ! break; ! endptr = curhost; ! while(*endptr != '\0' && !isspace(*endptr)) ! endptr++; ! c = *endptr; ! *endptr = '\0'; ! if (strcmp(curhost,"*") == 0) ! status = StreamServerPort(AF_UNSPEC, NULL, ! (unsigned short) PostPortNumber, ! UnixSocketDir, ! ListenSocket, MAXLISTEN); ! else status = StreamServerPort(AF_UNSPEC, curhost, (unsigned short) PostPortNumber, UnixSocketDir, ListenSocket, MAXLISTEN); if (status != STATUS_OK) ! ereport(WARNING, ! (errmsg("could not create listen socket for \"%s\"", ! curhost))); ! *endptr = c; ! if(c != '\0') ! curhost = endptr+1; ! else ! break; } + } #ifdef USE_RENDEZVOUS ! if (ListenSocket[0] != -1 && rendezvous_name != NULL) ! { ! DNSServiceRegistrationCreate(rendezvous_name, ! "_postgresql._tcp.", ! "", ! htonl(PostPortNumber), ! "", ! (DNSServiceRegistrationReply) reg_reply, ! NULL); } + #endif + #ifdef HAVE_UNIX_SOCKETS status = StreamServerPort(AF_UNIX, NULL, *************** *** 822,830 **** UnixSocketDir, ListenSocket, MAXLISTEN); if (status != STATUS_OK) ! ereport(FATAL, (errmsg("could not create Unix-domain socket"))); #endif XLOGPathInit(); --- 807,823 ---- UnixSocketDir, ListenSocket, MAXLISTEN); if (status != STATUS_OK) ! ereport(WARNING, (errmsg("could not create Unix-domain socket"))); #endif + + /* + * check that we have some socket to talk on + */ + + if (ListenSocket[0] == -1) + ereport(FATAL, + (errmsg("no configured listening socket available"))); XLOGPathInit(); Index: src/backend/utils/misc/guc.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/misc/guc.c,v retrieving revision 1.191 diff -c -r1.191 guc.c *** src/backend/utils/misc/guc.c 22 Mar 2004 03:15:29 -0000 1.191 --- src/backend/utils/misc/guc.c 22 Mar 2004 17:26:39 -0000 *************** *** 444,457 **** false, NULL, NULL }, { - {"tcpip_socket", PGC_POSTMASTER, CONN_AUTH_SETTINGS, - gettext_noop("Makes the server accept TCP/IP connections."), - NULL - }, - &NetServer, - false, NULL, NULL - }, - { {"ssl", PGC_POSTMASTER, CONN_AUTH_SECURITY, gettext_noop("Enables SSL connections."), NULL --- 444,449 ---- *************** *** 1711,1722 **** }, { ! {"virtual_host", PGC_POSTMASTER, CONN_AUTH_SETTINGS, ! gettext_noop("Sets the host name or IP address to listen to."), NULL }, ! &VirtualHost, ! "", NULL, NULL }, { --- 1703,1714 ---- }, { ! {"listen_addresses", PGC_POSTMASTER, CONN_AUTH_SETTINGS, ! gettext_noop("Sets the host name or IP addresses to listen to."), NULL }, ! &ListenAddresses, ! "localhost", NULL, NULL }, { Index: src/backend/utils/misc/postgresql.conf.sample =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/misc/postgresql.conf.sample,v retrieving revision 1.108 diff -c -r1.108 postgresql.conf.sample *** src/backend/utils/misc/postgresql.conf.sample 15 Mar 2004 15:56:26 -0000 1.108 --- src/backend/utils/misc/postgresql.conf.sample 22 Mar 2004 17:26:40 -0000 *************** *** 27,33 **** # - Connection Settings - - #tcpip_socket = false #max_connections = 100 # note: increasing max_connections costs about 500 bytes of shared # memory per connection slot, in addition to costs from shared_buffers --- 27,32 ---- *************** *** 37,43 **** #unix_socket_directory = '' #unix_socket_group = '' #unix_socket_permissions = 0777 # octal ! #virtual_host = '' # what interface to listen on; defaults to any #rendezvous_name = '' # defaults to the computer name # - Security & Authentication - --- 36,43 ---- #unix_socket_directory = '' #unix_socket_group = '' #unix_socket_permissions = 0777 # octal ! #listen_addresses = 'localhost' # what interface to listen on; ! # defaults to localhost, '*' = any #rendezvous_name = '' # defaults to the computer name # - Security & Authentication - Index: src/include/miscadmin.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/include/miscadmin.h,v retrieving revision 1.153 diff -c -r1.153 miscadmin.h *** src/include/miscadmin.h 10 Feb 2004 03:42:45 -0000 1.153 --- src/include/miscadmin.h 22 Mar 2004 17:26:40 -0000 *************** *** 212,218 **** * A few postmaster startup options are exported here so the * configuration file processor can access them. */ - extern bool NetServer; extern bool EnableSSL; extern bool SilentMode; extern int MaxBackends; --- 212,217 ---- *************** *** 222,228 **** extern int Unix_socket_permissions; extern char *Unix_socket_group; extern char *UnixSocketDir; ! extern char *VirtualHost; /***************************************************************************** --- 221,227 ---- extern int Unix_socket_permissions; extern char *Unix_socket_group; extern char *UnixSocketDir; ! extern char *ListenAddresses; /*****************************************************************************