diff options
36 files changed, 859 insertions, 296 deletions
@@ -1,4 +1,30 @@ Changes with APR 0.9.2 + *) Add DougM's apr_rename.pl script into helpers, and update for the new batch of updates [Thom May] + + *) Renames done (deprecated functions wrapped): + apr_filename_of_pathname -> apr_filepath_name_get + apr_get_groupid -> apr_gid_get + apr_get_groupname -> apr_gid_name_get + apr_compare_groups -> apr_gid_compare + apr_parse_addr_port -> apr_port_addr_parse + apr_shutdown -> apr_socket_shutdown + apr_bind -> apr_socket_bind + apr_listen -> apr_socket_listen + apr_accept -> apr_socket_accept + apr_connect -> apr_socket_connect + apr_send -> apr_socket_send + apr_sendv -> apr_socket_sendv + apr_sendto -> apr_socket_sendto + apr_implode_gmt -> apr_time_exp_gmt_get + apr_get_home_directory -> apr_uid_homepath_get + apr_get_userid -> apr_uid_get + apr_current_userid -> apr_uid_current + apr_compare_users -> apr_uid_compare + apr_get_username -> apr_uid_name_get + apr_recvfrom -> apr_socket_recvfrom + apr_sendfile -> apr_socket_sendfile + apr_recv -> apr_socket_recv + [Thom May] *) Add APR_IPV6_V6ONLY socket option. [Jeff Trawick] diff --git a/file_io/win32/filepath.c b/file_io/win32/filepath.c index f66df5a3e..63eef19e9 100644 --- a/file_io/win32/filepath.c +++ b/file_io/win32/filepath.c @@ -870,8 +870,9 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, } /* Null term for stat! */ path[keptlen + seglen] = '\0'; - if ((rv = apr_lstat(&finfo, path, APR_FINFO_TYPE | APR_FINFO_NAME, p)) - == APR_SUCCESS) { + if ((rv = apr_lstat(&finfo, path, + APR_FINFO_TYPE | APR_FINFO_NAME, p)) + == APR_SUCCESS) { apr_size_t namelen = strlen(finfo.name); #if defined(OS2) || defined(NETWARE) /* only has case folding, never aliases that change the length */ diff --git a/include/apr_lib.h b/include/apr_lib.h index b4c67c24c..2e4e1ae30 100644 --- a/include/apr_lib.h +++ b/include/apr_lib.h @@ -113,6 +113,9 @@ struct apr_vformatter_buff_t { * "wi\\n32\\stuff" -> "stuff" * </PRE> */ +APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname); + +/** @deprecated @see apr_filepath_name_get */ APR_DECLARE(const char *) apr_filename_of_pathname(const char *pathname); /** diff --git a/include/apr_network_io.h b/include/apr_network_io.h index 30eaa9786..cd4ff2585 100644 --- a/include/apr_network_io.h +++ b/include/apr_network_io.h @@ -119,8 +119,8 @@ extern "C" { #define APR_INCOMPLETE_READ 4096 /**< Set on non-blocking sockets * (timeout != 0) on which the * previous read() did not fill a buffer - * completely. the next apr_recv() will - * first call select()/poll() rather than + * completely. the next apr_socket_recv() + * will first call select()/poll() rather than * going straight into read(). (Can also * be set by an application to force a * select()/poll() call before the next @@ -209,7 +209,7 @@ typedef enum { /** A structure to represent sockets */ typedef struct apr_socket_t apr_socket_t; /** - * A structure to encapsulate headers and trailers for apr_sendfile + * A structure to encapsulate headers and trailers for apr_socket_sendfile */ typedef struct apr_hdtr_t apr_hdtr_t; /** A structure to represent in_addr */ @@ -263,11 +263,11 @@ struct apr_sockaddr_t { }; #if APR_HAS_SENDFILE -/* Define flags passed in on apr_sendfile() */ +/* Define flags passed in on apr_socket_sendfile() */ #define APR_SENDFILE_DISCONNECT_SOCKET 1 #endif -/** A structure to encapsulate headers and trailers for apr_sendfile */ +/** A structure to encapsulate headers and trailers for apr_socket_sendfile */ struct apr_hdtr_t { /** An iovec to store the headers sent before the file. * @defvar iovec *headers */ @@ -322,6 +322,10 @@ APR_DECLARE(apr_status_t) apr_socket_create_ex(apr_socket_t **new_sock, * @remark This does not actually close the socket descriptor, it just * controls which calls are still valid on the socket. */ +APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how); + +/** @deprecated @see apr_socket_shutdown */ APR_DECLARE(apr_status_t) apr_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how); @@ -338,6 +342,10 @@ APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket); * @remark This may be where we will find out if there is any other process * using the selected port. */ +APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, + apr_sockaddr_t *sa); + +/* @deprecated @see apr_socket_bind */ APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa); /** @@ -347,6 +355,10 @@ APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa); * listen queue. If this value is less than zero, the listen * queue size is set to zero. */ +APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, + apr_int32_t backlog); + +/** @deprecated @see apr_socket_listen */ APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog); /** @@ -357,6 +369,11 @@ APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog); * @param sock The socket we are listening on. * @param connection_pool The pool for the new socket. */ +APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new_sock, + apr_socket_t *sock, + apr_pool_t *connection_pool); + +/** @deprecated @see apr_socket_accept */ APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new_sock, apr_socket_t *sock, apr_pool_t *connection_pool); @@ -369,6 +386,10 @@ APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new_sock, * APR assumes that the sockaddr_in in the apr_socket is * completely filled out. */ +APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, + apr_sockaddr_t *sa); + +/** @deprecated @see apr_socket_connect */ APR_DECLARE(apr_status_t) apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa); /** @@ -410,7 +431,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa, APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, apr_sockaddr_t *sa, apr_int32_t flags); - + /** * Parse hostname/IP address with scope id and port. * @@ -493,6 +514,10 @@ APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, void *data, * APR_EINTR is never returned. * </PRE> */ +APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, + apr_size_t *len); + +/** @deprecated @see apr_socket_send */ APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len); @@ -513,6 +538,11 @@ APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, * APR_EINTR is never returned. * </PRE> */ +APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len); + +/** @deprecated @see apr_socket_sendv */ APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, const struct iovec *vec, apr_int32_t nvec, apr_size_t *len); @@ -524,6 +554,12 @@ APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, * @param buf The data to send * @param len The length of the data to send */ +APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, + apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len); + +/** @deprecated @see apr_socket_sendto */ APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, apr_int32_t flags, const char *buf, apr_size_t *len); @@ -536,10 +572,16 @@ APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, * @param len The length of the available buffer */ +APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, + apr_socket_t *sock, + apr_int32_t flags, char *buf, + apr_size_t *len); + +/** @deprecated @see apr_socket_recvfrom */ APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, apr_int32_t flags, char *buf, apr_size_t *len); - + #if APR_HAS_SENDFILE || defined(DOXYGEN) /** @@ -557,6 +599,14 @@ APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, * this behavior, use apr_socket_timeout_set(). * The number of bytes actually sent is stored in argument 5. */ +APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, + apr_file_t *file, + apr_hdtr_t *hdtr, + apr_off_t *offset, + apr_size_t *len, + apr_int32_t flags); + +/** @deprecated @see apr_socket_sendfile */ APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, apr_int32_t flags); @@ -581,6 +631,10 @@ APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, * APR_EINTR is never returned. * </PRE> */ +APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, + char *buf, apr_size_t *len); + +/** @deprecated @see apr_socket_recv */ APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len); @@ -732,7 +786,6 @@ APR_DECLARE(apr_status_t) apr_socket_from_file(apr_socket_t **newsock, */ APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr, const char *servname); - /** * Build an ip-subnet representation from an IP address and optional netmask or * number-of-bits. diff --git a/include/apr_time.h b/include/apr_time.h index 050d7a3e4..fc5f2ca27 100644 --- a/include/apr_time.h +++ b/include/apr_time.h @@ -211,6 +211,10 @@ APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *result, * @param result the resulting imploded time * @param input the input exploded time */ +APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *result, + apr_time_exp_t *input); + +/** @deprecated @see apr_time_exp_gmt_get */ APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *result, apr_time_exp_t *input); diff --git a/include/apr_user.h b/include/apr_user.h index e54411043..d31505cab 100644 --- a/include/apr_user.h +++ b/include/apr_user.h @@ -100,10 +100,14 @@ typedef gid_t apr_gid_t; * @param p The pool from which to allocate working space * @remark This function is available only if APR_HAS_USER is defined. */ +APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *userid, + apr_gid_t *groupid, + apr_pool_t *p); + +/** @deprecated @see apr_uid_current */ APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *userid, apr_gid_t *groupid, apr_pool_t *p); - /** * Get the user name for a specified userid * @param username Pointer to new string containing user name (on output) @@ -111,8 +115,12 @@ APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *userid, * @param p The pool from which to allocate the string * @remark This function is available only if APR_HAS_USER is defined. */ -APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, apr_pool_t *p); +APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, + apr_pool_t *p); +/** @deprecated @see apr_uid_name_get */ +APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, + apr_pool_t *p); /** * Get the userid (and groupid) for the specified username * @param userid Returns the user id @@ -121,6 +129,10 @@ APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, ap * @param p The pool from which to allocate working space * @remark This function is available only if APR_HAS_USER is defined. */ +APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *userid, apr_gid_t *groupid, + const char *username, apr_pool_t *p); + +/** @deprecated @see apr_uid_get */ APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *userid, apr_gid_t *groupid, const char *username, apr_pool_t *p); @@ -131,7 +143,14 @@ APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *userid, apr_gid_t *groupid, * @param p The pool from which to allocate the string * @remark This function is available only if APR_HAS_USER is defined. */ -APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char *username, apr_pool_t *p); +APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, + const char *username, + apr_pool_t *p); + +/** @deprecated @see apr_uid_homepath_get */ +APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, + const char *username, + apr_pool_t *p); /** * Compare two user identifiers for equality. @@ -142,8 +161,13 @@ APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char *use * @remark This function is available only if APR_HAS_USER is defined. */ #if defined(WIN32) +APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right); + +/** @deprecated @see apr_uid_compare */ APR_DECLARE(apr_status_t) apr_compare_users(apr_uid_t left, apr_uid_t right); #else +#define apr_uid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH) +/** @deprecated @see apr_uid_compare */ #define apr_compare_users(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH) #endif @@ -154,10 +178,14 @@ APR_DECLARE(apr_status_t) apr_compare_users(apr_uid_t left, apr_uid_t right); * @param p The pool from which to allocate the string * @remark This function is available only if APR_HAS_USER is defined. */ +APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, + apr_gid_t groupid, apr_pool_t *p); + +/** @deprecated @see apr_gid_name_get */ APR_DECLARE(apr_status_t) apr_group_name_get(char **groupname, apr_gid_t groupid, apr_pool_t *p); -/** @deprecated @see apr_group_name_get */ +/** @deprecated @see apr_gid_name_get */ APR_DECLARE(apr_status_t) apr_get_groupname(char **groupname, apr_gid_t groupid, apr_pool_t *p); @@ -168,7 +196,12 @@ APR_DECLARE(apr_status_t) apr_get_groupname(char **groupname, * @param p The pool from which to allocate the string * @remark This function is available only if APR_HAS_USER is defined. */ -APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, const char *groupname, apr_pool_t *p); +APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid, + const char *groupname, apr_pool_t *p); + +/** @deprecated @see apr_gid_get */ +APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, + const char *groupname, apr_pool_t *p); /** * Compare two group identifiers for equality. @@ -179,8 +212,12 @@ APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, const char *groupn * @remark This function is available only if APR_HAS_USER is defined. */ #if defined(WIN32) +APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right); +/** @deprecated @see apr_gid_compare */ APR_DECLARE(apr_status_t) apr_compare_groups(apr_gid_t left, apr_gid_t right); #else +#define apr_gid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH) +/** @deprecated @see apr_gid_compare */ #define apr_compare_groups(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH) #endif diff --git a/misc/unix/getopt.c b/misc/unix/getopt.c index 2a8b7d1a4..1e0911710 100644 --- a/misc/unix/getopt.c +++ b/misc/unix/getopt.c @@ -101,7 +101,7 @@ APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, ++os->ind; if (os->errfn && *opts != ':') { (os->errfn)(os->errarg, "%s: illegal option -- %c\n", - apr_filename_of_pathname(*os->argv), os->opt); + apr_filepath_name_get(*os->argv), os->opt); } *optch = os->opt; return (APR_BADCH); @@ -123,7 +123,7 @@ APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, if (os->errfn) { (os->errfn)(os->errarg, "%s: option requires an argument -- %c\n", - apr_filename_of_pathname(*os->argv), os->opt); + apr_filepath_name_get(*os->argv), os->opt); } *optch = os->opt; return (APR_BADCH); @@ -183,7 +183,7 @@ static apr_status_t serr(apr_getopt_t *os, const char *err, const char *str, { if (os->errfn) (os->errfn)(os->errarg, "%s: %s: %s\n", - apr_filename_of_pathname(*os->argv), err, str); + apr_filepath_name_get(*os->argv), err, str); return status; } @@ -193,7 +193,7 @@ static apr_status_t cerr(apr_getopt_t *os, const char *err, int ch, { if (os->errfn) (os->errfn)(os->errarg, "%s: %s: %c\n", - apr_filename_of_pathname(*os->argv), err, ch); + apr_filepath_name_get(*os->argv), err, ch); return status; } diff --git a/network_io/beos/sendrecv.c b/network_io/beos/sendrecv.c index 3762befbb..19dc63d90 100644 --- a/network_io/beos/sendrecv.c +++ b/network_io/beos/sendrecv.c @@ -95,7 +95,8 @@ apr_status_t apr_wait_for_io_or_timeout(apr_socket_t *sock, int for_read) #define SEND_WAIT APR_USEC_PER_SEC / 10 -APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -128,7 +129,8 @@ APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, apr_size return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -160,15 +162,18 @@ APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, apr_size_t *le /* BeOS doesn't have writev for sockets so we use the following instead... */ -APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t * sock, const struct iovec *vec, - apr_int32_t nvec, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t * sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) { *len = vec[0].iov_len; - return apr_send(sock, vec[0].iov_base, len); + return apr_socket_send(sock, vec[0].iov_base, len); } -APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, + apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -200,9 +205,10 @@ APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, - apr_int32_t flags, char *buf, - apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, + apr_socket_t *sock, + apr_int32_t flags, char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -243,4 +249,42 @@ APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, return APR_SUCCESS; } +/* deprecated */ +APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) +{ + return apr_socket_send(sock, buf, len); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t * sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) +{ + return apr_socket_sendv(sock, vec, nvec, len); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) +{ + return apr_socket_sendto(sock, where, flags, buf, len); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, + apr_int32_t flags, char *buf, + apr_size_t *len) +{ + return apr_socket_recvfrom(from, sock, flags, buf, len); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) +{ + return apr_socket_recv(sock, buf, len); +} + #endif diff --git a/network_io/os2/sendrecv.c b/network_io/os2/sendrecv.c index e3631dadf..6a28e9c52 100644 --- a/network_io/os2/sendrecv.c +++ b/network_io/os2/sendrecv.c @@ -59,7 +59,8 @@ #include "apr_lib.h" #include <sys/time.h> -APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) { apr_ssize_t rv; int fds, err = 0; @@ -98,7 +99,8 @@ APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, apr_size -APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) { apr_ssize_t rv; int fds, err = 0; @@ -137,7 +139,9 @@ APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, apr_size_t *le -APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, const struct iovec *vec, apr_int32_t nvec, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) { apr_status_t rv; struct iovec *tmpvec; @@ -183,3 +187,25 @@ APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, const struct iovec *vec, *len = rv; return APR_SUCCESS; } + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) +{ + return apr_socket_send(sock, buf, len); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) +{ + return apr_socket_sendv(sock, vec, nvec, len); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) +{ + return apr_socket_recv(sock, buf, len); +} diff --git a/network_io/os2/sendrecv_udp.c b/network_io/os2/sendrecv_udp.c index 4010a083a..4667b9278 100644 --- a/network_io/os2/sendrecv_udp.c +++ b/network_io/os2/sendrecv_udp.c @@ -61,8 +61,10 @@ #include <sys/time.h> -APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, + apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) { apr_ssize_t rv; int serrno; @@ -137,3 +139,11 @@ APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, return APR_SUCCESS; } + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) +{ + return apr_socket_sendto(sock, where, flags, buf, len); +} diff --git a/network_io/os2/sockets.c b/network_io/os2/sockets.c index 9a704b8f4..90eda2bd4 100644 --- a/network_io/os2/sockets.c +++ b/network_io/os2/sockets.c @@ -151,7 +151,8 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, int return apr_socket_create_ex(new, family, type, 0, cont); } -APR_DECLARE(apr_status_t) apr_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) +APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how) { if (shutdown(thesocket->socketdes, how) == 0) { return APR_SUCCESS; @@ -167,7 +168,8 @@ APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket) return socket_cleanup(thesocket); } -APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, + apr_sockaddr_t *sa) { if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, @@ -179,7 +181,8 @@ APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) } } -APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) +APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, + apr_int32_t backlog) { if (listen(sock->socketdes, backlog) == -1) return APR_OS2_STATUS(sock_errno()); @@ -187,7 +190,9 @@ APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *connection_context) +APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, + apr_socket_t *sock, + apr_pool_t *connection_context) { alloc_socket(new, connection_context); set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol); @@ -217,7 +222,8 @@ APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, apr return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, + apr_sockaddr_t *sa) { if ((connect(sock->socketdes, (struct sockaddr *)&sa->sa.sin, sa->salen) < 0) && @@ -313,3 +319,35 @@ APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *th APR_IMPLEMENT_INHERIT_SET(socket, inherit, cntxt, socket_cleanup) APR_IMPLEMENT_INHERIT_UNSET(socket, inherit, cntxt, socket_cleanup) + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how) +{ + return apr_socket_shutdown(thesocket, how); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_bind(sock, sa); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) +{ + return apr_socket_listen(sock, backlog); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, + apr_pool_t *connection_context) +{ + return apr_socket_accept(new, sock, connection_context); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_connect(sock, sa); +} diff --git a/network_io/os2/sockopt.c b/network_io/os2/sockopt.c index 3ecc1aa02..0623e6ce7 100644 --- a/network_io/os2/sockopt.c +++ b/network_io/os2/sockopt.c @@ -170,7 +170,8 @@ APR_DECLARE(apr_status_t) apr_getsocketopt(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len, apr_pool_t *cont) +APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len, + apr_pool_t *cont) { if (gethostname(buf, len) == -1) { buf[0] = '\0'; @@ -182,4 +183,3 @@ APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len, apr_pool_t } return APR_SUCCESS; } - diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c index 521ab533a..ac6e19714 100644 --- a/network_io/unix/sendrecv.c +++ b/network_io/unix/sendrecv.c @@ -65,7 +65,8 @@ #include <sys/sysctl.h> #endif -apr_status_t apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) +apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -98,20 +99,20 @@ do_select: return errno; } if (sock->timeout && rv < *len) { - sock->netmask |= APR_INCOMPLETE_WRITE; + sock->netmask |= APR_INCOMPLETE_WRITE; } (*len) = rv; return APR_SUCCESS; } -apr_status_t apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) +apr_status_t apr_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len) { apr_ssize_t rv; apr_status_t arv; if (sock->netmask & APR_INCOMPLETE_READ) { - sock->netmask &= ~APR_INCOMPLETE_READ; - goto do_select; + sock->netmask &= ~APR_INCOMPLETE_READ; + goto do_select; } do { @@ -121,7 +122,7 @@ apr_status_t apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && sock->timeout != 0) { do_select: - arv = apr_wait_for_io_or_timeout(NULL, sock, 1); + arv = apr_wait_for_io_or_timeout(NULL, sock, 1); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -137,7 +138,7 @@ do_select: return errno; } if (sock->timeout && rv < *len) { - sock->netmask |= APR_INCOMPLETE_READ; + sock->netmask |= APR_INCOMPLETE_READ; } (*len) = rv; if (rv == 0) { @@ -146,8 +147,9 @@ do_select: return APR_SUCCESS; } -apr_status_t apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, apr_size_t *len) +apr_status_t apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -179,9 +181,9 @@ apr_status_t apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, return APR_SUCCESS; } -apr_status_t apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, - apr_int32_t flags, char *buf, - apr_size_t *len) +apr_status_t apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, + apr_int32_t flags, char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -216,8 +218,8 @@ apr_status_t apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, } #ifdef HAVE_WRITEV -apr_status_t apr_sendv(apr_socket_t * sock, const struct iovec *vec, - apr_int32_t nvec, apr_size_t *len) +apr_status_t apr_socket_sendv(apr_socket_t * sock, const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) { apr_ssize_t rv; apr_size_t requested_len = 0; @@ -256,7 +258,7 @@ do_select: return errno; } if (sock->timeout && rv < requested_len) { - sock->netmask |= APR_INCOMPLETE_WRITE; + sock->netmask |= APR_INCOMPLETE_WRITE; } (*len) = rv; return APR_SUCCESS; @@ -275,9 +277,9 @@ static apr_hdtr_t no_hdtr; #if defined(__linux__) && defined(HAVE_WRITEV) -apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, - apr_int32_t flags) +apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags) { off_t off = *offset; int rv, nbytes = 0, total_hdrbytes, i; @@ -300,9 +302,10 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, } /* Now write the headers */ - arv = apr_sendv(sock, hdtr->headers, hdtr->numheaders, &hdrbytes); + arv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, + &hdrbytes); if (arv != APR_SUCCESS) { - *len = 0; + *len = 0; return errno; } nbytes += hdrbytes; @@ -327,10 +330,10 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, } do { - rv = sendfile(sock->socketdes, /* socket */ - file->filedes, /* open file descriptor of the file to be sent */ - &off, /* where in the file to start */ - *len /* number of bytes to send */ + rv = sendfile(sock->socketdes, /* socket */ + file->filedes, /* open file descriptor of the file to be sent */ + &off, /* where in the file to start */ + *len /* number of bytes to send */ ); } while (rv == -1 && errno == EINTR); @@ -338,23 +341,23 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, (errno == EAGAIN || errno == EWOULDBLOCK) && sock->timeout > 0) { do_select: - arv = apr_wait_for_io_or_timeout(NULL, sock, 0); - if (arv != APR_SUCCESS) { - *len = 0; - return arv; - } + arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + if (arv != APR_SUCCESS) { + *len = 0; + return arv; + } else { do { - rv = sendfile(sock->socketdes, /* socket */ - file->filedes, /* open file descriptor of the file to be sent */ - &off, /* where in the file to start */ - *len); /* number of bytes to send */ + rv = sendfile(sock->socketdes, /* socket */ + file->filedes, /* open file descriptor of the file to be sent */ + &off, /* where in the file to start */ + *len); /* number of bytes to send */ } while (rv == -1 && errno == EINTR); } } if (rv == -1) { - *len = nbytes; + *len = nbytes; rv = errno; apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); return rv; @@ -389,10 +392,11 @@ do_select: /* Now write the footers */ if (hdtr->numtrailers > 0) { apr_size_t trbytes; - arv = apr_sendv(sock, hdtr->trailers, hdtr->numtrailers, &trbytes); + arv = apr_socket_sendv(sock, hdtr->trailers, hdtr->numtrailers, + &trbytes); nbytes += trbytes; if (arv != APR_SUCCESS) { - *len = nbytes; + *len = nbytes; rv = errno; apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); return rv; @@ -455,10 +459,11 @@ static int include_hdrs_in_length(void) return 1; #endif } + /* Release 3.1 or greater */ -apr_status_t apr_sendfile(apr_socket_t * sock, apr_file_t * file, - apr_hdtr_t * hdtr, apr_off_t * offset, apr_size_t * len, - apr_int32_t flags) +apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, + apr_hdtr_t * hdtr, apr_off_t * offset, + apr_size_t * len, apr_int32_t flags) { off_t nbytes = 0; int rv, i; @@ -588,9 +593,9 @@ apr_status_t apr_sendfile(apr_socket_t * sock, apr_file_t * file, * if nbytes == 0, the rest of the file (from offset) is sent */ -apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, - apr_int32_t flags) +apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags) { int i; apr_ssize_t rc; @@ -700,7 +705,7 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, } if (rc == -1) { - *len = 0; + *len = 0; return errno; } @@ -719,9 +724,9 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, * AIX - version 4.3.2 with APAR IX85388, or version 4.3.3 and above * OS/390 - V2R7 and above */ -apr_status_t apr_sendfile(apr_socket_t * sock, apr_file_t * file, - apr_hdtr_t * hdtr, apr_off_t * offset, apr_size_t * len, - apr_int32_t flags) +apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, + apr_hdtr_t * hdtr, apr_off_t * offset, + apr_size_t * len, apr_int32_t flags) { int i, ptr, rv = 0; void * hbuf=NULL, * tbuf=NULL; @@ -865,9 +870,9 @@ do_select: * 111298-01, 108529-09, 109473-06, 109235-04, 108996-02, 111296-01, 109026-04, * 108992-13 */ -apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, - apr_int32_t flags) +apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags) { apr_status_t rv, arv; apr_size_t nbytes; @@ -980,7 +985,7 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, /* Update how much we sent */ *len = nbytes; if (sock->timeout && (*len < requested_len)) { - sock->netmask |= APR_INCOMPLETE_WRITE; + sock->netmask |= APR_INCOMPLETE_WRITE; } return APR_SUCCESS; } @@ -996,14 +1001,59 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, * apr_sendfile() doesn't work on the platform; * this dummy version is just to get exports.c to compile/link */ -apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, - apr_int32_t flags); /* avoid warning for no proto */ +apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags); + /* avoid warning for no proto */ + +apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags) +{ + return APR_ENOTIMPL; +} +#endif +/* deprecated */ +apr_status_t apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) +{ + return apr_socket_send(sock, buf, len); +} + +/* deprecated */ +#ifdef HAVE_WRITEV +apr_status_t apr_sendv(apr_socket_t * sock, const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) +{ + return apr_socket_sendv(sock, vec, nvec, len); +} +#endif + +/* deprecated */ +apr_status_t apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, apr_size_t *len) +{ + return apr_socket_sendto(sock, where, flags, buf, len); +} + +/* deprecated */ +apr_status_t apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, + apr_int32_t flags, char *buf, + apr_size_t *len) +{ + return apr_socket_recvfrom(from, sock, flags, buf, len); +} + +/* deprecated */ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, apr_int32_t flags) { - return APR_ENOTIMPL; + return apr_socket_sendfile(sock, file, hdtr, offset, len, flags); +} + +/* deprecated */ +apr_status_t apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) +{ + return apr_socket_recv(sock, buf, len); } -#endif diff --git a/network_io/unix/sockets.c b/network_io/unix/sockets.c index f442cdabb..2dc1bcd14 100644 --- a/network_io/unix/sockets.c +++ b/network_io/unix/sockets.c @@ -152,7 +152,8 @@ apr_status_t apr_socket_create(apr_socket_t **new, int family, int type, return apr_socket_create_ex(new, family, type, 0, cont); } -apr_status_t apr_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) +apr_status_t apr_socket_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how) { return (shutdown(thesocket->socketdes, how) == -1) ? errno : APR_SUCCESS; } @@ -162,7 +163,7 @@ apr_status_t apr_socket_close(apr_socket_t *thesocket) return apr_pool_cleanup_run(thesocket->cntxt, thesocket, socket_cleanup); } -apr_status_t apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +apr_status_t apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa) { if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, sa->salen) == -1) { @@ -178,7 +179,7 @@ apr_status_t apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) } } -apr_status_t apr_listen(apr_socket_t *sock, apr_int32_t backlog) +apr_status_t apr_socket_listen(apr_socket_t *sock, apr_int32_t backlog) { if (listen(sock->socketdes, backlog) == -1) return errno; @@ -186,7 +187,8 @@ apr_status_t apr_listen(apr_socket_t *sock, apr_int32_t backlog) return APR_SUCCESS; } -apr_status_t apr_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *connection_context) +apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, + apr_pool_t *connection_context) { alloc_socket(new, connection_context); set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol); @@ -256,7 +258,7 @@ apr_status_t apr_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *conn return APR_SUCCESS; } -apr_status_t apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) { int rc; @@ -392,3 +394,34 @@ apr_status_t apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *thesock, APR_IMPLEMENT_INHERIT_SET(socket, inherit, cntxt, socket_cleanup) APR_IMPLEMENT_INHERIT_UNSET(socket, inherit, cntxt, socket_cleanup) + +/* deprecated */ +apr_status_t apr_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) +{ + return apr_socket_shutdown(thesocket, how); +} + +/* deprecated */ +apr_status_t apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_bind(sock, sa); +} + +/* deprecated */ +apr_status_t apr_listen(apr_socket_t *sock, apr_int32_t backlog) +{ + return apr_socket_listen(sock, backlog); +} + +/* deprecated */ +apr_status_t apr_accept(apr_socket_t **new, apr_socket_t *sock, + apr_pool_t *connection_context) +{ + return apr_socket_accept(new, sock, connection_context); +} + +/* deprecated */ +apr_status_t apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_connect(sock, sa); +} diff --git a/network_io/unix/sockopt.c b/network_io/unix/sockopt.c index 31024a8aa..86f7db8dc 100644 --- a/network_io/unix/sockopt.c +++ b/network_io/unix/sockopt.c @@ -396,4 +396,3 @@ apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name, return APR_SUCCESS; } #endif - diff --git a/network_io/win32/sendrecv.c b/network_io/win32/sendrecv.c index a9f8a4189..a32336e4c 100644 --- a/network_io/win32/sendrecv.c +++ b/network_io/win32/sendrecv.c @@ -65,16 +65,17 @@ /* MAX_SEGMENT_SIZE is the maximum amount of data that will be sent to a client * in one call of TransmitFile. This number must be small enough to give the * slowest client time to receive the data before the socket timeout triggers. - * The same problem can exist with apr_send(). In that case, we rely on the - * application to adjust socket timeouts and max send segment sizes appropriately. - * For example, Apache will in most cases call apr_send() with less than 8193 - * bytes. + * The same problem can exist with apr_socket_send(). In that case, we rely on + * the application to adjust socket timeouts and max send segment + * sizes appropriately. + * For example, Apache will in most cases call apr_socket_send() with less + * than 8193 bytes. */ #define MAX_SEGMENT_SIZE 65536 #define WSABUF_ON_STACK 50 -APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, - apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) { apr_ssize_t rv; WSABUF wsaData; @@ -101,8 +102,8 @@ APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, } -APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, - apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) { apr_ssize_t rv; WSABUF wsaData; @@ -130,9 +131,9 @@ APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, } -APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, - const struct iovec *vec, - apr_int32_t nvec, apr_size_t *nbytes) +APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *nbytes) { apr_status_t rc = APR_SUCCESS; apr_ssize_t rv; @@ -171,9 +172,10 @@ APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, - apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, + apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -190,10 +192,10 @@ APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, } -APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, - apr_socket_t *sock, - apr_int32_t flags, - char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, + apr_socket_t *sock, + apr_int32_t flags, + char *buf, apr_size_t *len) { apr_ssize_t rv; @@ -253,8 +255,8 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len, */ /* - * apr_status_t apr_sendfile(apr_socket_t *, apr_file_t *, apr_hdtr_t *, - * apr_off_t *, apr_size_t *, apr_int32_t flags) + * apr_status_t apr_socket_sendfile(apr_socket_t *, apr_file_t *, apr_hdtr_t *, + * apr_off_t *, apr_size_t *, apr_int32_t flags) * Send a file from an open file descriptor to a socket, along with * optional headers and trailers * arg 1) The socket to which we're writing @@ -264,9 +266,12 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len, * arg 5) Number of bytes to send out of the file * arg 6) APR flags that are mapped to OS specific flags */ -APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, - apr_size_t *len, apr_int32_t flags) +APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, + apr_file_t *file, + apr_hdtr_t *hdtr, + apr_off_t *offset, + apr_size_t *len, + apr_int32_t flags) { apr_status_t status = APR_SUCCESS; apr_ssize_t rv; @@ -293,13 +298,15 @@ APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, /* Handle the goofy case of sending headers/trailers and a zero byte file */ if (!bytes_to_send && hdtr) { if (hdtr->numheaders) { - rv = apr_sendv(sock, hdtr->headers, hdtr->numheaders, &nbytes); + rv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, + &nbytes); if (rv != APR_SUCCESS) return rv; *len += nbytes; } if (hdtr->numtrailers) { - rv = apr_sendv(sock, hdtr->trailers, hdtr->numtrailers, &nbytes); + rv = apr_socket_sendv(sock, hdtr->trailers, hdtr->numtrailers, + &nbytes); if (rv != APR_SUCCESS) return rv; *len += nbytes; @@ -438,7 +445,8 @@ APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, /* Mark the socket as disconnected, but do not close it. * Note: The application must have stored the socket prior to making - * the call to apr_sendfile in order to either reuse it or close it. + * the call to apr_socket_sendfile in order to either reuse it + * or close it. */ if (disconnected) { sock->disconnected = 1; @@ -451,4 +459,52 @@ APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, #endif return status; } + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags) +{ + return apr_socket_sendfile(sock, file, hdtr, offset, len, flags); +} + #endif + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) +{ + return apr_socket_send(sock. buf, len); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *nbytes) +{ + return apr_socket_sendv(sock, vec, nvec, nbytes); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) +{ + return apr_socket_sendto(sock, where, flags, buf, len); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, + apr_socket_t *sock, + apr_int32_t flags, + char *buf, apr_size_t *len) +{ + return apr_socket_recvfrom(from, sock, flags, buf, len); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) +{ + return apr_socket_recv(sock, buf, len); +} diff --git a/network_io/win32/sockets.c b/network_io/win32/sockets.c index 528a408a6..5bd0a133a 100644 --- a/network_io/win32/sockets.c +++ b/network_io/win32/sockets.c @@ -185,8 +185,8 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, return apr_socket_create_ex(new, family, type, 0, cont); } -APR_DECLARE(apr_status_t) apr_shutdown(apr_socket_t *thesocket, - apr_shutdown_how_e how) +APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how) { int winhow = 0; @@ -222,7 +222,8 @@ APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket) return socket_cleanup(thesocket); } -APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, + apr_sockaddr_t *sa) { if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, @@ -238,7 +239,8 @@ APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) } } -APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) +APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, + apr_int32_t backlog) { if (listen(sock->socketdes, backlog) == SOCKET_ERROR) return apr_get_netos_error(); @@ -246,8 +248,8 @@ APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, - apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, + apr_socket_t *sock, apr_pool_t *p) { SOCKET s; struct sockaddr sa; @@ -323,7 +325,8 @@ APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, + apr_sockaddr_t *sa) { apr_status_t rv; @@ -504,3 +507,34 @@ APR_DECLARE(void) apr_socket_unset_inherit(apr_socket_t *socket) { apr_socket_inherit_unset(socket); } +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how) +{ + return apr_socket_shutdown(thesocket, how); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_bind(sock, sa); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) +{ + return apr_socket_listen(sock. backlog); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, + apr_pool_t *p) +{ + return apr_socket_accept(new, sock, p); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_connect(sock, sa); +} diff --git a/network_io/win32/sockopt.c b/network_io/win32/sockopt.c index c326f9dae..a60e01743 100644 --- a/network_io/win32/sockopt.c +++ b/network_io/win32/sockopt.c @@ -290,4 +290,3 @@ APR_DECLARE(apr_status_t) apr_gethostname(char *buf, int len, return APR_SUCCESS; } - diff --git a/renames_pending b/renames_pending index 9ea319f32..ca007a729 100644 --- a/renames_pending +++ b/renames_pending @@ -1,53 +1,39 @@ Pending symbol renames for APR [for some discussion yet] -apr_file_info_t from apr_finfo_t -apr_file_stat from apr_stat -apr_file_lstat from apr_lstat +apr_file_info_t from apr_finfo_t apr_file_attrs_t from apr_fileattrs_t apr_file_seek_where_t from apr_seek_where_t -apr_filepath_name_get from apr_filename_of_pathname +#apr_filepath_name_get from apr_filename_of_pathname -apr_lock_scope_e from apr_lockscope_e -apr_lock_type_e from apr_locktype_e apr_lock_mech_e from apr_lockmech_e -apr_lock_readerwriter_e from apr_readerwriter_e -apr_gid_get from apr_get_groupid -apr_gid_name_get from apr_get_groupname -apr_gid_name_get from apr_group_name_get -apr_gid_compare from apr_compare_groups - -apr_hostname_get from apr_gethostname - -apr_port_addr_parse from apr_parse_addr_port - -apr_socket_shutdown from apr_shutdown -apr_socket_bind from apr_bind -apr_socket_listen from apr_listen -apr_socket_accept from apr_accept -apr_socket_connect from apr_connect -apr_socket_send from apr_send -apr_socket_sendv from apr_sendv -apr_socket_sendto from apr_sendto -apr_socket_recv_from from apr_recvfrom -apr_socket_file_send from apr_sendfile -apr_socket_recv from apr_recv -apr_socket_file_create from apr_socket_from_file -apr_socket_filter_accept from apr_socket_accept_filter -apr_socket_inherit_set from apr_socket_set_inherit -apr_socket_inherit_unset from apr_socket_unset_inherit - -apr_service_byname_get from apr_getservbyname - -apr_sockaddr_name_info_get from apr_getnameinfo - -apr_time_exp_gmt_get from apr_implode_gmt +#apr_gid_get from apr_get_groupid +#apr_gid_name_get from apr_get_groupname +#apr_gid_name_get from apr_group_name_get +#apr_gid_compare from apr_compare_groups + +#apr_socket_shutdown from apr_shutdown +#apr_socket_bind from apr_bind +#apr_socket_listen from apr_listen +#apr_socket_accept from apr_accept +#apr_socket_connect from apr_connect +#apr_socket_send from apr_send +#apr_socket_sendv from apr_sendv +#apr_socket_sendto from apr_sendto +#apr_socket_recvfrom from apr_recvfrom +#apr_socket_sendfile from apr_sendfile +#apr_socket_recv from apr_recv +#apr_socket_inherit_set from apr_socket_set_inherit +#apr_socket_inherit_unset from apr_socket_unset_inherit + + +#apr_time_exp_gmt_get from apr_implode_gmt apr_time_interval_t from apr_interval_time_t apr_time_interval_short_t from apr_short_interval_time_t -apr_uid_homepath_get from apr_get_home_directory -apr_uid_get from apr_get_userid -apr_uid_current from apr_current_userid -apr_uid_compare from apr_compare_users -apr_uid_name_get from apr_get_username +#apr_uid_homepath_get from apr_get_home_directory +#apr_uid_get from apr_get_userid +#apr_uid_current from apr_current_userid +#apr_uid_compare from apr_compare_users +#apr_uid_name_get from apr_get_username diff --git a/shmem/unix/shm.c b/shmem/unix/shm.c index a190ef5ca..be5f3359c 100644 --- a/shmem/unix/shm.c +++ b/shmem/unix/shm.c @@ -240,7 +240,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, if (shmctl(new_m->shmid, IPC_STAT, &shmbuf) == -1) { return errno; } - apr_current_userid(&uid, &gid, pool); + apr_uid_current(&uid, &gid, pool); shmbuf.shm_perm.uid = uid; shmbuf.shm_perm.gid = gid; if (shmctl(new_m->shmid, IPC_SET, &shmbuf) == -1) { @@ -387,7 +387,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, if (shmctl(new_m->shmid, IPC_STAT, &shmbuf) == -1) { return errno; } - apr_current_userid(&uid, &gid, pool); + apr_uid_current(&uid, &gid, pool); shmbuf.shm_perm.uid = uid; shmbuf.shm_perm.gid = gid; if (shmctl(new_m->shmid, IPC_SET, &shmbuf) == -1) { diff --git a/strings/apr_cpystrn.c b/strings/apr_cpystrn.c index f99eb92fc..e9e9575ac 100644 --- a/strings/apr_cpystrn.c +++ b/strings/apr_cpystrn.c @@ -222,7 +222,7 @@ APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str, return APR_SUCCESS; } -/* Filename_of_pathname returns the final element of the pathname. +/* Filepath_name_get returns the final element of the pathname. * Using the current platform's filename syntax. * "/foo/bar/gum" -> "gum" * "/foo/bar/gum/" -> "" @@ -232,7 +232,7 @@ APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str, * Corrected Win32 to accept "a/b\\stuff", "a:stuff" */ -APR_DECLARE(const char *) apr_filename_of_pathname(const char *pathname) +APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname) { const char path_separator = '/'; const char *s = strrchr(pathname, path_separator); @@ -250,6 +250,12 @@ APR_DECLARE(const char *) apr_filename_of_pathname(const char *pathname) return s ? ++s : pathname; } +/* deprecated */ +APR_DECLARE(const char *) apr_filename_of_pathname(const char *pathname) +{ + return apr_filepath_name_get(pathname); +} + /* length of dest assumed >= length of src * collapse in place (src == dest) is legal. * returns terminating null ptr to dest string. diff --git a/test/client.c b/test/client.c index d20e7387d..cf42c50b7 100644 --- a/test/client.c +++ b/test/client.c @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) fprintf(stdout, "\tClient: Connecting to socket......."); - stat = apr_connect(sock, remote_sa); + stat = apr_socket_connect(sock, remote_sa); if (stat != APR_SUCCESS) { apr_socket_close(sock); @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) fprintf(stdout, "\tClient: Trying to send data over socket......."); length = STRLEN; - if ((stat = apr_send(sock, datasend, &length) != APR_SUCCESS)) { + if ((stat = apr_socket_send(sock, datasend, &length) != APR_SUCCESS)) { apr_socket_close(sock); fprintf(stderr, "Problem sending data: %s (%d)\n", apr_strerror(stat, msgbuf, sizeof(msgbuf)), stat); @@ -159,7 +159,7 @@ int main(int argc, char *argv[]) length = STRLEN; fprintf(stdout, "\tClient: Trying to receive data over socket......."); - if ((stat = apr_recv(sock, datarecv, &length)) != APR_SUCCESS) { + if ((stat = apr_socket_recv(sock, datarecv, &length)) != APR_SUCCESS) { apr_socket_close(sock); fprintf(stderr, "Problem receiving data: %s (%d)\n", apr_strerror(stat, msgbuf, sizeof(msgbuf)), stat); @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) fprintf(stdout, "OK\n"); fprintf(stdout, "\tClient: Shutting down socket......."); - if (apr_shutdown(sock, APR_SHUTDOWN_WRITE) != APR_SUCCESS) { + if (apr_socket_shutdown(sock, APR_SHUTDOWN_WRITE) != APR_SUCCESS) { apr_socket_close(sock); fprintf(stderr, "Could not shutdown socket\n"); exit(-1); diff --git a/test/sendfile.c b/test/sendfile.c index 09792f03f..f339f72a2 100644 --- a/test/sendfile.c +++ b/test/sendfile.c @@ -245,9 +245,9 @@ static int client(client_socket_mode_t socket_mode, char *host) exit(1); } - rv = apr_connect(sock, destsa); + rv = apr_socket_connect(sock, destsa); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_connect()->%d/%s\n", + fprintf(stderr, "apr_socket_connect()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -313,25 +313,25 @@ static int client(client_socket_mode_t socket_mode, char *host) if (socket_mode == BLK) { current_file_offset = 0; len = FILE_LENGTH; - rv = apr_sendfile(sock, f, &hdtr, ¤t_file_offset, &len, 0); + rv = apr_socket_sendfile(sock, f, &hdtr, ¤t_file_offset, &len, 0); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_sendfile()->%d/%s\n", + fprintf(stderr, "apr_socket_sendfile()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); } - printf("apr_sendfile() updated offset with %ld\n", + printf("apr_socket_sendfile() updated offset with %ld\n", (long int)current_file_offset); - printf("apr_sendfile() updated len with %ld\n", + printf("apr_socket_sendfile() updated len with %ld\n", (long int)len); printf("bytes really sent: %" APR_SIZE_T_FMT "\n", expected_len); if (len != expected_len) { - fprintf(stderr, "apr_sendfile() didn't report the correct " + fprintf(stderr, "apr_socket_sendfile() didn't report the correct " "number of bytes sent!\n"); exit(1); } @@ -353,7 +353,7 @@ static int client(client_socket_mode_t socket_mode, char *host) apr_size_t tmplen; tmplen = len; /* bytes remaining to send from the file */ - printf("Calling apr_sendfile()...\n"); + printf("Calling apr_socket_sendfile()...\n"); printf("Headers (%d):\n", hdtr.numheaders); for (i = 0; i < hdtr.numheaders; i++) { printf("\t%d bytes (%c)\n", @@ -367,8 +367,8 @@ static int client(client_socket_mode_t socket_mode, char *host) hdtr.trailers[i].iov_len); } - rv = apr_sendfile(sock, f, &hdtr, ¤t_file_offset, &tmplen, 0); - printf("apr_sendfile()->%d, sent %ld bytes\n", rv, (long)tmplen); + rv = apr_socket_sendfile(sock, f, &hdtr, ¤t_file_offset, &tmplen, 0); + printf("apr_socket_sendfile()->%d, sent %ld bytes\n", rv, (long)tmplen); if (rv) { if (APR_STATUS_IS_EAGAIN(rv)) { assert(tmplen == 0); @@ -463,22 +463,22 @@ static int client(client_socket_mode_t socket_mode, char *host) exit(1); } - printf("After apr_sendfile(), the kernel file pointer is " + printf("After apr_socket_sendfile(), the kernel file pointer is " "at offset %ld.\n", (long int)current_file_offset); - rv = apr_shutdown(sock, APR_SHUTDOWN_WRITE); + rv = apr_socket_shutdown(sock, APR_SHUTDOWN_WRITE); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_shutdown()->%d/%s\n", + fprintf(stderr, "apr_socket_shutdown()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); } bytes_read = 1; - rv = apr_recv(sock, buf, &bytes_read); + rv = apr_socket_recv(sock, buf, &bytes_read); if (rv != APR_EOF) { - fprintf(stderr, "apr_recv()->%d/%s (expected APR_EOF)\n", + fprintf(stderr, "apr_socket_recv()->%d/%s (expected APR_EOF)\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -490,7 +490,7 @@ static int client(client_socket_mode_t socket_mode, char *host) exit(1); } - printf("client: apr_sendfile() worked as expected!\n"); + printf("client: apr_socket_sendfile() worked as expected!\n"); rv = apr_file_remove(TESTFILE, p); if (rv != APR_SUCCESS) { @@ -534,17 +534,17 @@ static int server(void) exit(1); } - rv = apr_bind(sock, localsa); + rv = apr_socket_bind(sock, localsa); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_bind()->%d/%s\n", + fprintf(stderr, "apr_socket_bind()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); } - rv = apr_listen(sock, 5); + rv = apr_socket_listen(sock, 5); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_listen()->%d/%s\n", + fprintf(stderr, "apr_socket_listen()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -552,9 +552,9 @@ static int server(void) printf("Waiting for a client to connect...\n"); - rv = apr_accept(&newsock, sock, p); + rv = apr_socket_accept(&newsock, sock, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_accept()->%d/%s\n", + fprintf(stderr, "apr_socket_accept()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -564,9 +564,9 @@ static int server(void) assert(sizeof buf > strlen(HDR1)); bytes_read = strlen(HDR1); - rv = apr_recv(newsock, buf, &bytes_read); + rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_recv()->%d/%s\n", + fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -584,9 +584,9 @@ static int server(void) assert(sizeof buf > strlen(HDR2)); bytes_read = strlen(HDR2); - rv = apr_recv(newsock, buf, &bytes_read); + rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_recv()->%d/%s\n", + fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -604,15 +604,15 @@ static int server(void) for (i = 0; i < HDR3_LEN; i++) { bytes_read = 1; - rv = apr_recv(newsock, buf, &bytes_read); + rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_recv()->%d/%s\n", + fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != 1) { - fprintf(stderr, "apr_recv()->%ld bytes instead of 1\n", + fprintf(stderr, "apr_socket_recv()->%ld bytes instead of 1\n", (long int)bytes_read); exit(1); } @@ -629,15 +629,15 @@ static int server(void) for (i = 0; i < FILE_LENGTH; i++) { bytes_read = 1; - rv = apr_recv(newsock, buf, &bytes_read); + rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_recv()->%d/%s\n", + fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != 1) { - fprintf(stderr, "apr_recv()->%ld bytes instead of 1\n", + fprintf(stderr, "apr_socket_recv()->%ld bytes instead of 1\n", (long int)bytes_read); exit(1); } @@ -654,9 +654,9 @@ static int server(void) assert(sizeof buf > strlen(TRL1)); bytes_read = strlen(TRL1); - rv = apr_recv(newsock, buf, &bytes_read); + rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_recv()->%d/%s\n", + fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -674,9 +674,9 @@ static int server(void) assert(sizeof buf > strlen(TRL2)); bytes_read = strlen(TRL2); - rv = apr_recv(newsock, buf, &bytes_read); + rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_recv()->%d/%s\n", + fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -694,15 +694,15 @@ static int server(void) for (i = 0; i < TRL3_LEN; i++) { bytes_read = 1; - rv = apr_recv(newsock, buf, &bytes_read); + rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_recv()->%d/%s\n", + fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != 1) { - fprintf(stderr, "apr_recv()->%ld bytes instead of 1\n", + fprintf(stderr, "apr_socket_recv()->%ld bytes instead of 1\n", (long int)bytes_read); exit(1); } @@ -718,9 +718,9 @@ static int server(void) } bytes_read = 1; - rv = apr_recv(newsock, buf, &bytes_read); + rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_EOF) { - fprintf(stderr, "apr_recv()->%d/%s (expected APR_EOF)\n", + fprintf(stderr, "apr_socket_recv()->%d/%s (expected APR_EOF)\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -732,7 +732,7 @@ static int server(void) exit(1); } - printf("server: apr_sendfile() worked as expected!\n"); + printf("server: apr_socket_sendfile() worked as expected!\n"); return 0; } diff --git a/test/server.c b/test/server.c index fb298ea3f..ff974cdea 100644 --- a/test/server.c +++ b/test/server.c @@ -128,10 +128,10 @@ int main(int argc, const char * const argv[]) } APR_TEST_SUCCESS(rv, "Binding socket to port", - apr_bind(sock, localsa)) + apr_socket_bind(sock, localsa)) APR_TEST_SUCCESS(rv, "Listening to socket", - apr_listen(sock, 5)) + apr_socket_listen(sock, 5)) APR_TEST_BEGIN(rv, "Setting up for polling", apr_poll_setup(&sdset, 1, context)) @@ -152,7 +152,7 @@ int main(int argc, const char * const argv[]) fprintf(stdout, "OK\n"); APR_TEST_SUCCESS(rv, "Accepting a connection", - apr_accept(&sock2, sock, context)) + apr_socket_accept(&sock2, sock, context)) apr_socket_protocol_get(sock2, &protocol); if (protocol != APR_PROTO_TCP) { @@ -171,7 +171,7 @@ int main(int argc, const char * const argv[]) length = STRLEN; APR_TEST_BEGIN(rv, "Receiving data from socket", - apr_recv(sock2, datasend, &length)) + apr_socket_recv(sock2, datasend, &length)) if (strcmp(datasend, "Send data test")) { fprintf(stdout, "Failed\n"); @@ -186,10 +186,10 @@ int main(int argc, const char * const argv[]) length = STRLEN; APR_TEST_SUCCESS(rv, "Sending data over socket", - apr_send(sock2, datarecv, &length)) + apr_socket_send(sock2, datarecv, &length)) APR_TEST_SUCCESS(rv, "Shutting down accepted socket", - apr_shutdown(sock2, APR_SHUTDOWN_READ)) + apr_socket_shutdown(sock2, APR_SHUTDOWN_READ)) APR_TEST_SUCCESS(rv, "Closing duplicate socket", apr_socket_close(sock2)) diff --git a/test/testpoll.c b/test/testpoll.c index 07f1b0364..b540f8edb 100644 --- a/test/testpoll.c +++ b/test/testpoll.c @@ -78,7 +78,7 @@ static int make_socket(apr_socket_t **sock, apr_sockaddr_t **sa, apr_port_t port printf("couldn't create UDP socket, shutting down"); return 1; } - if (apr_bind((*sock), (*sa)) != APR_SUCCESS){ + if (apr_socket_bind((*sock), (*sa)) != APR_SUCCESS){ printf("couldn't bind UDP socket!"); return 1; } @@ -112,7 +112,7 @@ static void send_msg(apr_socket_t **sockarray, apr_sockaddr_t **sas, int which) char errmsg[120]; printf("\tSending message to socket %d............", which); - if ((rv = apr_sendto(sockarray[which], sas[which], 0, "hello", &len)) != APR_SUCCESS){ + if ((rv = apr_socket_sendto(sockarray[which], sas[which], 0, "hello", &len)) != APR_SUCCESS){ apr_strerror(rv, errmsg, sizeof errmsg); printf("Failed! %s\n", errmsg); exit(-1); @@ -131,7 +131,7 @@ static void recv_msg(apr_socket_t **sockarray, int which, apr_pool_t *p) apr_sockaddr_info_get(&recsa, "127.0.0.1", APR_UNSPEC, 7770, 0, p); printf("\tTrying to get message from socket %d....", which); - if ((rv = apr_recvfrom(recsa, sockarray[which], 0, buffer, &buflen)) + if ((rv = apr_socket_recvfrom(recsa, sockarray[which], 0, buffer, &buflen)) != APR_SUCCESS){ apr_strerror(rv, errmsg, sizeof errmsg); printf("Failed! %s\n", errmsg); diff --git a/test/testsockets.c b/test/testsockets.c index 80cedd201..7d42aa4dd 100644 --- a/test/testsockets.c +++ b/test/testsockets.c @@ -134,16 +134,16 @@ int main(void) apr_sockaddr_info_get(&to, US, APR_UNSPEC, 7772, 0, pool); apr_sockaddr_info_get(&from, US, APR_UNSPEC, 7771, 0, pool); - STD_TEST_NEQ(" Binding socket #1", apr_bind(sock, to)) - STD_TEST_NEQ(" Binding socket #2", apr_bind(sock2, from)) + STD_TEST_NEQ(" Binding socket #1", apr_socket_bind(sock, to)) + STD_TEST_NEQ(" Binding socket #2", apr_socket_bind(sock2, from)) len = STRLEN; STD_TEST_NEQ(" Trying to sendto", - apr_sendto(sock2, to, 0, sendbuf, &len)) + apr_socket_sendto(sock2, to, 0, sendbuf, &len)) len = 80; STD_TEST_NEQ(" Trying to recvfrom", - apr_recvfrom(from, sock, 0, recvbuf, &len)) + apr_socket_recvfrom(from, sock, 0, recvbuf, &len)) printf("\t\tGot back %d bytes [%s] from recvfrom\n", len, recvbuf); apr_sockaddr_ip_get(&ip_addr, from); apr_sockaddr_port_get(&fromport, from); diff --git a/test/testtime.c b/test/testtime.c index 9dbfb18df..09d9cb0c0 100644 --- a/test/testtime.c +++ b/test/testtime.c @@ -179,9 +179,9 @@ static void test_imp_gmt(CuTest *tc) rv = apr_time_exp_gmt(&xt, now); CuAssertTrue(tc, rv == APR_SUCCESS); - rv = apr_implode_gmt(&imp, &xt); + rv = apr_time_exp_gmt_get(&imp, &xt); if (rv == APR_ENOTIMPL) { - CuNotImpl(tc, "apr_implode_gmt"); + CuNotImpl(tc, "apr_time_exp_gmt_get"); } CuAssertTrue(tc, rv == APR_SUCCESS); CuAssertTrue(tc, now == imp); diff --git a/test/testuser.c b/test/testuser.c index cfda620c0..a08719a9a 100644 --- a/test/testuser.c +++ b/test/testuser.c @@ -93,14 +93,14 @@ int main(int argc, char *argv[]) fprintf(stderr, "optional: %s username\n", argv[0]); - if ((rv = apr_current_userid(&userid, &groupid, p)) != APR_SUCCESS) { - fprintf(stderr, "apr_current_userid failed: %s\n", + if ((rv = apr_uid_current(&userid, &groupid, p)) != APR_SUCCESS) { + fprintf(stderr, "apr_uid_current failed: %s\n", apr_strerror(rv, msgbuf, sizeof(msgbuf))); exit(-1); } - apr_get_username(&username, userid, p); + apr_uid_name_get(&username, userid, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_get_username(,,) failed: %s\n", + fprintf(stderr, "apr_uid_name_get(,,) failed: %s\n", apr_strerror(rv, msgbuf, sizeof(msgbuf))); exit(-1); } @@ -108,22 +108,22 @@ int main(int argc, char *argv[]) else { username = argv[1]; - rv = apr_get_userid(&userid, &groupid, username, p); + rv = apr_uid_get(&userid, &groupid, username, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_get_userid(,,%s,) failed: %s\n", + fprintf(stderr, "apr_uid_get(,,%s,) failed: %s\n", username, apr_strerror(rv, msgbuf, sizeof(msgbuf))); exit(-1); } } - rv = apr_group_name_get(&groupname, groupid, p); + rv = apr_gid_name_get(&groupname, groupid, p); if (rv != APR_SUCCESS) groupname = "(none)"; - rv = apr_get_groupid(&newgroupid, groupname, p); + rv = apr_gid_get(&newgroupid, groupname, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_get_groupid(,%s,) failed: %s\n", + fprintf(stderr, "apr_gid_get(,%s,) failed: %s\n", groupname, apr_strerror(rv, msgbuf, sizeof msgbuf)); exit(-1); @@ -143,9 +143,9 @@ int main(int argc, char *argv[]) username, (int)userid, (int)groupid); - rv = apr_get_home_directory(&homedir, username, p); + rv = apr_uid_homepath_get(&homedir, username, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_get_home_directory(,%s,) failed: %s\n", + fprintf(stderr, "apr_uid_homepath_get(,%s,) failed: %s\n", username, apr_strerror(rv, msgbuf, sizeof(msgbuf))); exit(-1); diff --git a/time/unix/time.c b/time/unix/time.c index 2669f30cf..409cc2d15 100644 --- a/time/unix/time.c +++ b/time/unix/time.c @@ -203,7 +203,8 @@ APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t, apr_time_exp_t *xt) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *t, apr_time_exp_t *xt) +APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *t, + apr_time_exp_t *xt) { apr_status_t status = apr_time_exp_get(t, xt); if (status == APR_SUCCESS) @@ -384,3 +385,10 @@ APR_DECLARE(apr_status_t) apr_explode_localtime(apr_time_exp_t *result, { return apr_time_exp_lt(result, input); } + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *t, apr_time_exp_t *xt) +{ + return apr_time_exp_gmt_get(t, xt); +} + diff --git a/time/win32/time.c b/time/win32/time.c index 94d92602e..b79602955 100644 --- a/time/win32/time.c +++ b/time/win32/time.c @@ -223,8 +223,8 @@ APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *t, - apr_time_exp_t *xt) +APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *t, + apr_time_exp_t *xt) { apr_status_t status = apr_time_exp_get(t, xt); if (status == APR_SUCCESS) @@ -319,3 +319,11 @@ APR_DECLARE(apr_status_t) apr_explode_localtime(apr_time_exp_t *result, { return apr_time_exp_lt(result, input); } + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *t, + apr_time_exp_t *xt) +{ + return apr_time_exp_gmt_get(t, xt); +} + diff --git a/user/netware/groupinfo.c b/user/netware/groupinfo.c index 50b45bff6..46002c266 100644 --- a/user/netware/groupinfo.c +++ b/user/netware/groupinfo.c @@ -66,12 +66,14 @@ #include <unistd.h> /* for _POSIX_THREAD_SAFE_FUNCTIONS */ #endif -APR_DECLARE(apr_status_t) apr_group_name_get(char **groupname, apr_gid_t groupid, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, apr_gid_t groupid, + apr_pool_t *p) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, const char *groupname, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid, + const char *groupname, apr_pool_t *p) { return APR_ENOTIMPL; } @@ -80,5 +82,17 @@ APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, const char *groupn APR_DECLARE(apr_status_t) apr_get_groupname(char **groupname, apr_gid_t groupid, apr_pool_t *p) { - return apr_group_name_get(groupname, groupid, p); + return apr_gid_name_get(groupname, groupid, p); +} + +APR_DECLARE(apr_status_t) apr_group_name_get(char **groupname, + apr_gid_t groupid, apr_pool_t *p) +{ + return apr_gid_name_get(groupname, groupid, p); +} + +APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, + const char *groupname, apr_pool_t *p) +{ + return apr_gid_get(groupid, groupname, p); } diff --git a/user/netware/userinfo.c b/user/netware/userinfo.c index 2f88a225d..98ac409d7 100644 --- a/user/netware/userinfo.c +++ b/user/netware/userinfo.c @@ -75,18 +75,18 @@ static apr_status_t getpwnam_safe(const char *username, return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, - const char *username, - apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, + const char *username, + apr_pool_t *p) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *uid, - apr_gid_t *gid, - apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *uid, + apr_gid_t *gid, + apr_pool_t *p) { return APR_ENOTIMPL; } @@ -94,15 +94,43 @@ APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *uid, -APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *uid, apr_gid_t *gid, - const char *username, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, + const char *username, apr_pool_t *p) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, + apr_pool_t *p) { return APR_ENOTIMPL; } - +/* deprecated */ +APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, + const char *username, + apr_pool_t *p) +{ + return apr_uid_homepath_get(dirname, username, p); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *uid, apr_gid_t *gid, + const char *username, apr_pool_t *p) +{ + return apr_uid_get(uid, gid, username, p); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *uid, + apr_gid_t *gid, + apr_pool_t *p) +{ + return apr_uid_current(uid, gid, p); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, apr_pool_t *p) +{ + return apr_uid_name_get(username, uid, p); +} diff --git a/user/unix/groupinfo.c b/user/unix/groupinfo.c index 8519b838f..e0ba9aa90 100644 --- a/user/unix/groupinfo.c +++ b/user/unix/groupinfo.c @@ -66,7 +66,8 @@ #include <unistd.h> /* for _POSIX_THREAD_SAFE_FUNCTIONS */ #endif -APR_DECLARE(apr_status_t) apr_group_name_get(char **groupname, apr_gid_t groupid, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, apr_gid_t groupid, + apr_pool_t *p) { struct group *gr; #ifndef BEOS @@ -86,7 +87,8 @@ APR_DECLARE(apr_status_t) apr_group_name_get(char **groupname, apr_gid_t groupid return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, const char *groupname, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid, + const char *groupname, apr_pool_t *p) { struct group *gr; #ifndef BEOS @@ -110,5 +112,17 @@ APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, const char *groupn APR_DECLARE(apr_status_t) apr_get_groupname(char **groupname, apr_gid_t groupid, apr_pool_t *p) { - return apr_group_name_get(groupname, groupid, p); + return apr_gid_name_get(groupname, groupid, p); +} + +APR_DECLARE(apr_status_t) apr_group_name_get(char **groupname, + apr_gid_t groupid, apr_pool_t *p) +{ + return apr_gid_name_get(groupname, groupid, p); +} + +APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid, + const char *groupname, apr_pool_t *p) +{ + return apr_gid_get(groupid, groupname, p); } diff --git a/user/unix/userinfo.c b/user/unix/userinfo.c index 1455c8f5e..a268f521b 100644 --- a/user/unix/userinfo.c +++ b/user/unix/userinfo.c @@ -94,9 +94,9 @@ static apr_status_t getpwnam_safe(const char *username, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, - const char *username, - apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, + const char *username, + apr_pool_t *p) { struct passwd pw; char pwbuf[PWBUF_SIZE]; @@ -116,9 +116,9 @@ APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, -APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *uid, - apr_gid_t *gid, - apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *uid, + apr_gid_t *gid, + apr_pool_t *p) { *uid = getuid(); *gid = getgid(); @@ -129,8 +129,8 @@ APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *uid, -APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *uid, apr_gid_t *gid, - const char *username, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, + const char *username, apr_pool_t *p) { struct passwd pw; char pwbuf[PWBUF_SIZE]; @@ -145,7 +145,8 @@ APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *uid, apr_gid_t *gid, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, + apr_pool_t *p) { struct passwd *pw; #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWUID_R) @@ -162,4 +163,33 @@ APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, ap return APR_SUCCESS; } - +/* deprecated */ +APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, + const char *username, + apr_pool_t *p) +{ + return apr_uid_homepath_get(dirname, username, p); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *uid, apr_gid_t *gid, + const char *username, apr_pool_t *p) +{ + return apr_uid_get(uid, gid, username, p); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *uid, + apr_gid_t *gid, + apr_pool_t *p) +{ + return apr_uid_current(uid, gid, p); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, + apr_pool_t *p) +{ + return apr_uid_name_get(username, userid, p); +} + diff --git a/user/win32/groupinfo.c b/user/win32/groupinfo.c index c0a2af4a3..457a9063f 100644 --- a/user/win32/groupinfo.c +++ b/user/win32/groupinfo.c @@ -60,8 +60,8 @@ #include <sys/types.h> #endif -APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *gid, - const char *groupname, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *gid, + const char *groupname, apr_pool_t *p) { #ifdef _WIN32_WCE return APR_ENOTIMPL; @@ -104,7 +104,7 @@ APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *gid, #endif } -APR_DECLARE(apr_status_t) apr_group_name_get(char **groupname, apr_gid_t groupid, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, apr_gid_t groupid, apr_pool_t *p) { #ifdef _WIN32_WCE *groupname = apr_pstrdup(p, "Administrators"); @@ -124,7 +124,7 @@ APR_DECLARE(apr_status_t) apr_group_name_get(char **groupname, apr_gid_t groupid return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_compare_groups(apr_gid_t left, apr_gid_t right) +APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right) { if (!left || !right) return APR_EINVAL; @@ -141,5 +141,22 @@ APR_DECLARE(apr_status_t) apr_compare_groups(apr_gid_t left, apr_gid_t right) APR_DECLARE(apr_status_t) apr_get_groupname(char **groupname, apr_gid_t groupid, apr_pool_t *p) { + return apr_gid_name_get(groupname, groupid, p); +} + +APR_DECLARE(apr_status_t) apr_get_groupname(char **groupname, + apr_gid_t groupid, apr_pool_t *p) +{ return apr_group_name_get(groupname, groupid, p); } + +APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *gid, + const char *groupname, apr_pool_t *p) +{ + return apr_gid_get(gid, groupname, p); +} + +APR_DECLARE(apr_status_t) apr_compare_groups(apr_gid_t left, apr_gid_t right) +{ + return apr_gid_compare(left, right); +} diff --git a/user/win32/userinfo.c b/user/win32/userinfo.c index 28ae3ddd2..eb8e5bead 100644 --- a/user/win32/userinfo.c +++ b/user/win32/userinfo.c @@ -102,7 +102,9 @@ void get_sid_string(char *buf, int blen, apr_uid_t id) /* Query the ProfileImagePath from the version-specific branch, where the * regkey uses the user's name on 9x, and user's sid string on NT. */ -APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char *username, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, + const char *username, + apr_pool_t *p) { #ifdef _WIN32_WCE *dirname = apr_pstrdup(p, "/My Documents"); @@ -119,7 +121,7 @@ APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char *use apr_uid_t uid; apr_gid_t gid; - if ((rv = apr_get_userid(&uid, &gid, username, p)) != APR_SUCCESS) + if ((rv = apr_uid_get(&uid, &gid, username, p)) != APR_SUCCESS) return rv; strcpy(regkey, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\" @@ -197,9 +199,9 @@ APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char *use #endif /* _WIN32_WCE */ } -APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *uid, - apr_gid_t *gid, - apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *uid, + apr_gid_t *gid, + apr_pool_t *p) { #ifdef _WIN32_WCE return APR_ENOTIMPL; @@ -234,8 +236,8 @@ APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *uid, #endif } -APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *uid, apr_gid_t *gid, - const char *username, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, + const char *username, apr_pool_t *p) { #ifdef _WIN32_WCE return APR_ENOTIMPL; @@ -281,7 +283,8 @@ APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *uid, apr_gid_t *gid, #endif } -APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, + apr_pool_t *p) { #ifdef _WIN32_WCE *username = apr_pstrdup(p, "Administrator"); @@ -301,7 +304,7 @@ APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, ap #endif } -APR_DECLARE(apr_status_t) apr_compare_users(apr_uid_t left, apr_uid_t right) +APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right) { if (!left || !right) return APR_EINVAL; @@ -313,3 +316,39 @@ APR_DECLARE(apr_status_t) apr_compare_users(apr_uid_t left, apr_uid_t right) #endif return APR_SUCCESS; } + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, + const char *username, + apr_pool_t *p) +{ + return apr_uid_homepath_get(dirname, username, p); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *uid, apr_gid_t *gid, + const char *username, apr_pool_t *p) +{ + return apr_uid_get(uid, gid, username, p); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *uid, + apr_gid_t *gid, + apr_pool_t *p) +{ + return apr_uid_current(uid, gid, p); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_compare_users(apr_uid_t left, apr_uid_t right) +{ + return apr_uid_compare(left, right); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, + apr_pool_t *p) +{ + return apr_uid_name_get(username, userid, p); +} |