From 674c1ef69f302980c6def35911c1ee3c4b68cef2 Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Thu, 20 Aug 2015 16:14:26 +0200 Subject: sync CVS commitid: WDQybNKi4LiEFw8K: Change httpd(8) to use C99-style fixed-width integers (uintN_t instead of u_intN_t) and replace u_int with unsigned int. Mixing both variants is a bad style and most contributors seem to prefer this style; it also helps us to get used to it, portability, and standardization. Theoretically no binary change, except one in practice: httpd.o has a different checksum because gcc with -O2 pads/optimizes "struct privsep" differently when using "unsigned int" instead "u_int" for the affected members. "u_int" is just a typedef of "unsigned int", -O0 doesn't build the difference and clang with -O2 doesn't do it either - it is just another curiosity from gcc-land. OK semarie@ --- httpd/config.c | 32 +++++++------- httpd/httpd.c | 34 +++++++-------- httpd/httpd.h | 123 +++++++++++++++++++++++++++------------------------- httpd/log.c | 9 ++-- httpd/logger.c | 10 ++--- httpd/parse.y | 22 +++++----- httpd/proc.c | 37 ++++++++-------- httpd/server.c | 6 +-- httpd/server_fcgi.c | 6 +-- httpd/server_http.c | 14 +++--- 10 files changed, 149 insertions(+), 144 deletions(-) diff --git a/httpd/config.c b/httpd/config.c index 15560ed..8536028 100644 --- a/httpd/config.c +++ b/httpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.42 2015/07/19 05:17:27 reyk Exp $ */ +/* $OpenBSD: config.c,v 1.43 2015/08/20 13:00:23 reyk Exp $ */ /* * Copyright (c) 2011 - 2015 Reyk Floeter @@ -38,7 +38,7 @@ int config_init(struct httpd *env) { struct privsep *ps = env->sc_ps; - u_int what; + unsigned int what; /* Global configuration */ if (privsep_process == PROC_PARENT) { @@ -78,12 +78,12 @@ config_init(struct httpd *env) } void -config_purge(struct httpd *env, u_int reset) +config_purge(struct httpd *env, unsigned int reset) { struct privsep *ps = env->sc_ps; struct server *srv; struct auth *auth; - u_int what; + unsigned int what; what = ps->ps_what[privsep_process] & reset; @@ -104,7 +104,7 @@ config_purge(struct httpd *env, u_int reset) } int -config_setreset(struct httpd *env, u_int reset) +config_setreset(struct httpd *env, unsigned int reset) { struct privsep *ps = env->sc_ps; int id; @@ -123,7 +123,7 @@ config_setreset(struct httpd *env, u_int reset) int config_getreset(struct httpd *env, struct imsg *imsg) { - u_int mode; + unsigned int mode; IMSG_SIZE_CHECK(imsg, &mode); memcpy(&mode, imsg->data, sizeof(mode)); @@ -138,7 +138,7 @@ config_getcfg(struct httpd *env, struct imsg *imsg) { struct privsep *ps = env->sc_ps; struct ctl_flags cf; - u_int what; + unsigned int what; if (IMSG_DATA_SIZE(imsg) != sizeof(cf)) return (0); /* ignore */ @@ -166,7 +166,7 @@ config_setserver(struct httpd *env, struct server *srv) int fd, n, m; struct iovec iov[6]; size_t c; - u_int what; + unsigned int what; /* opens listening sockets etc. */ if (server_privinit(srv) == -1) @@ -319,8 +319,8 @@ config_getserver_config(struct httpd *env, struct server *srv, struct privsep *ps = env->sc_ps; #endif struct server_config *srv_conf, *parent; - u_int8_t *p = imsg->data; - u_int f; + uint8_t *p = imsg->data; + unsigned int f; size_t s; if ((srv_conf = calloc(1, sizeof(*srv_conf))) == NULL) @@ -485,7 +485,7 @@ config_getserver(struct httpd *env, struct imsg *imsg) #endif struct server *srv = NULL; struct server_config srv_conf; - u_int8_t *p = imsg->data; + uint8_t *p = imsg->data; size_t s; IMSG_SIZE_CHECK(imsg, &srv_conf); @@ -567,7 +567,7 @@ config_gettls(struct httpd *env, struct imsg *imsg) #endif struct server *srv = NULL; struct tls_config tls_conf; - u_int8_t *p = imsg->data; + uint8_t *p = imsg->data; size_t s; IMSG_SIZE_CHECK(imsg, &tls_conf); @@ -617,7 +617,7 @@ config_setmedia(struct httpd *env, struct media_type *media) { struct privsep *ps = env->sc_ps; int id; - u_int what; + unsigned int what; for (id = 0; id < PROC_MAX; id++) { what = ps->ps_what[id]; @@ -642,7 +642,7 @@ config_getmedia(struct httpd *env, struct imsg *imsg) struct privsep *ps = env->sc_ps; #endif struct media_type media; - u_int8_t *p = imsg->data; + uint8_t *p = imsg->data; IMSG_SIZE_CHECK(imsg, &media); memcpy(&media, p, sizeof(media)); @@ -665,7 +665,7 @@ config_setauth(struct httpd *env, struct auth *auth) { struct privsep *ps = env->sc_ps; int id; - u_int what; + unsigned int what; for (id = 0; id < PROC_MAX; id++) { what = ps->ps_what[id]; @@ -690,7 +690,7 @@ config_getauth(struct httpd *env, struct imsg *imsg) struct privsep *ps = env->sc_ps; #endif struct auth auth; - u_int8_t *p = imsg->data; + uint8_t *p = imsg->data; IMSG_SIZE_CHECK(imsg, &auth); memcpy(&auth, p, sizeof(auth)); diff --git a/httpd/httpd.c b/httpd/httpd.c index cc67865..f6decea 100644 --- a/httpd/httpd.c +++ b/httpd/httpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.c,v 1.38 2015/07/18 06:00:43 reyk Exp $ */ +/* $OpenBSD: httpd.c,v 1.39 2015/08/20 13:00:23 reyk Exp $ */ /* * Copyright (c) 2014 Reyk Floeter @@ -49,7 +49,7 @@ __dead void usage(void); int parent_configure(struct httpd *); void parent_configure_done(struct httpd *); -void parent_reload(struct httpd *, u_int, const char *); +void parent_reload(struct httpd *, unsigned int, const char *); void parent_reopen(struct httpd *); void parent_sig_handler(int, short, void *); void parent_shutdown(struct httpd *); @@ -158,7 +158,7 @@ main(int argc, char *argv[]) int c; unsigned int proc; int debug = 0, verbose = 0; - u_int32_t opts = 0; + uint32_t opts = 0; struct httpd *env; struct privsep *ps; const char *conffile = CONF_FILE; @@ -342,7 +342,7 @@ parent_configure(struct httpd *env) } void -parent_reload(struct httpd *env, u_int reset, const char *filename) +parent_reload(struct httpd *env, unsigned int reset, const char *filename) { if (env->sc_reload) { log_debug("%s: already in progress: %d pending", @@ -441,7 +441,7 @@ int parent_dispatch_logger(int fd, struct privsep_proc *p, struct imsg *imsg) { struct httpd *env = p->p_env; - u_int v; + unsigned int v; char *str = NULL; switch (imsg->hdr.type) { @@ -591,9 +591,9 @@ canonicalize_host(const char *host, char *name, size_t len) const char * url_decode(char *url) { - char *p, *q; - char hex[3]; - u_long x; + char *p, *q; + char hex[3]; + unsigned long x; hex[2] = '\0'; p = q = url; @@ -792,7 +792,7 @@ socket_rlimit(int maxfd) char * evbuffer_getline(struct evbuffer *evb) { - u_int8_t *ptr = EVBUFFER_DATA(evb); + uint8_t *ptr = EVBUFFER_DATA(evb); size_t len = EVBUFFER_LENGTH(evb); char *str; size_t i; @@ -824,7 +824,7 @@ evbuffer_getline(struct evbuffer *evb) } char * -get_string(u_int8_t *ptr, size_t len) +get_string(uint8_t *ptr, size_t len) { size_t i; char *str; @@ -841,9 +841,9 @@ get_string(u_int8_t *ptr, size_t len) } void * -get_data(u_int8_t *ptr, size_t len) +get_data(uint8_t *ptr, size_t len) { - u_int8_t *data; + uint8_t *data; if ((data = calloc(1, len)) == NULL) return (NULL); @@ -857,7 +857,7 @@ sockaddr_cmp(struct sockaddr *a, struct sockaddr *b, int prefixlen) { struct sockaddr_in *a4, *b4; struct sockaddr_in6 *a6, *b6; - u_int32_t av[4], bv[4], mv[4]; + uint32_t av[4], bv[4], mv[4]; if (a->sa_family == AF_UNSPEC || b->sa_family == AF_UNSPEC) return (0); @@ -915,8 +915,8 @@ sockaddr_cmp(struct sockaddr *a, struct sockaddr *b, int prefixlen) return (0); } -u_int32_t -prefixlen2mask(u_int8_t prefixlen) +uint32_t +prefixlen2mask(uint8_t prefixlen) { if (prefixlen == 0) return (0); @@ -928,7 +928,7 @@ prefixlen2mask(u_int8_t prefixlen) } struct in6_addr * -prefixlen2mask6(u_int8_t prefixlen, u_int32_t *mask) +prefixlen2mask6(uint8_t prefixlen, uint32_t *mask) { static struct in6_addr s6; int i; @@ -1285,7 +1285,7 @@ auth_add(struct serverauth *serverauth, struct auth *auth) } struct auth * -auth_byid(struct serverauth *serverauth, u_int32_t id) +auth_byid(struct serverauth *serverauth, uint32_t id) { struct auth *auth; diff --git a/httpd/httpd.h b/httpd/httpd.h index 9086baf..f1c6090 100644 --- a/httpd/httpd.h +++ b/httpd/httpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.h,v 1.96 2015/08/03 11:45:17 florian Exp $ */ +/* $OpenBSD: httpd.h,v 1.97 2015/08/20 13:00:23 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter @@ -97,8 +97,8 @@ enum httpchunk { #endif struct ctl_flags { - u_int8_t cf_opts; - u_int32_t cf_flags; + uint8_t cf_opts; + uint32_t cf_flags; }; enum key_type { @@ -122,7 +122,7 @@ struct kv { #define KV_FLAG_INVALID 0x01 #define KV_FLAG_GLOBBING 0x02 - u_int8_t kv_flags; + uint8_t kv_flags; struct kvlist kv_children; struct kv *kv_parent; @@ -133,7 +133,7 @@ struct kv { struct portrange { in_port_t val[2]; - u_int8_t op; + uint8_t op; }; struct address { @@ -186,8 +186,8 @@ struct imsgev { struct ctl_conn { TAILQ_ENTRY(ctl_conn) entry; - u_int8_t flags; - u_int waiting; + uint8_t flags; + unsigned int waiting; #define CTL_CONN_NOTIFY 0x01 struct imsgev iev; @@ -238,11 +238,11 @@ struct privsep { struct imsgev *ps_ievs[PROC_MAX]; const char *ps_title[PROC_MAX]; pid_t ps_pid[PROC_MAX]; - u_int8_t ps_what[PROC_MAX]; + uint8_t ps_what[PROC_MAX]; - u_int ps_instances[PROC_MAX]; - u_int ps_ninstances; - u_int ps_instance; + unsigned int ps_instances[PROC_MAX]; + unsigned int ps_ninstances; + unsigned int ps_instance; struct control_sock ps_csock; struct control_socks ps_rcsocks; @@ -268,7 +268,7 @@ struct privsep_proc { pid_t (*p_init)(struct privsep *, struct privsep_proc *); void (*p_shutdown)(void); - u_int p_instance; + unsigned int p_instance; const char *p_chroot; struct privsep *p_ps; struct httpd *p_env; @@ -281,11 +281,11 @@ enum fcgistate { }; struct client { - u_int32_t clt_id; + uint32_t clt_id; pid_t clt_pid; void *clt_srv; void *clt_srv_conf; - u_int32_t clt_srv_id; + uint32_t clt_srv_id; struct sockaddr_storage clt_srv_ss; struct str_match clt_srv_match; @@ -306,7 +306,7 @@ struct client { off_t clt_toread; size_t clt_headerlen; - u_int clt_persist; + unsigned int clt_persist; int clt_line; int clt_done; int clt_chunk; @@ -389,7 +389,7 @@ enum log_format { struct log_file { char log_name[NAME_MAX]; int log_fd; - u_int32_t log_id; + uint32_t log_id; TAILQ_ENTRY(log_file) log_entry; }; TAILQ_HEAD(log_files, log_file) log_files; @@ -405,14 +405,14 @@ RB_HEAD(mediatypes, media_type); struct auth { char auth_htpasswd[PATH_MAX]; - u_int32_t auth_id; + uint32_t auth_id; TAILQ_ENTRY(auth) auth_entry; }; TAILQ_HEAD(serverauth, auth); struct server_config { - u_int32_t id; - u_int32_t parent_id; + uint32_t id; + uint32_t parent_id; char name[HOST_NAME_MAX+1]; char location[NAME_MAX]; char index[NAME_MAX]; @@ -426,34 +426,34 @@ struct server_config { struct sockaddr_storage ss; int prefixlen; struct timeval timeout; - u_int32_t maxrequests; + uint32_t maxrequests; size_t maxrequestbody; - u_int8_t *tls_cert; + uint8_t *tls_cert; size_t tls_cert_len; char *tls_cert_file; char tls_ciphers[NAME_MAX]; char tls_dhe_params[NAME_MAX]; char tls_ecdhe_curve[NAME_MAX]; - u_int8_t *tls_key; + uint8_t *tls_key; size_t tls_key_len; char *tls_key_file; - u_int32_t tls_protocols; + uint32_t tls_protocols; - u_int32_t flags; + uint32_t flags; int strip; - u_int8_t tcpflags; + uint8_t tcpflags; int tcpbufsiz; int tcpbacklog; - u_int8_t tcpipttl; - u_int8_t tcpipminttl; + uint8_t tcpipttl; + uint8_t tcpipminttl; enum log_format logformat; struct log_file *logaccess; struct log_file *logerror; char auth_realm[NAME_MAX]; - u_int32_t auth_id; + uint32_t auth_id; struct auth *auth; int return_code; @@ -461,14 +461,14 @@ struct server_config { off_t return_uri_len; int hsts_max_age; - u_int8_t hsts_flags; + uint8_t hsts_flags; TAILQ_ENTRY(server_config) entry; }; TAILQ_HEAD(serverhosts, server_config); struct tls_config { - u_int32_t id; + uint32_t id; in_port_t port; struct sockaddr_storage ss; @@ -494,12 +494,12 @@ struct server { TAILQ_HEAD(serverlist, server); struct httpd { - u_int8_t sc_opts; - u_int32_t sc_flags; + uint8_t sc_opts; + uint32_t sc_flags; const char *sc_conffile; struct event sc_ev; - u_int16_t sc_prefork_server; - u_int16_t sc_id; + uint16_t sc_prefork_server; + uint16_t sc_id; int sc_paused; char *sc_chroot; char *sc_logdir; @@ -566,7 +566,7 @@ int server_bufferevent_write(struct client *, void *, size_t); struct server * server_byaddr(struct sockaddr *, in_port_t); struct server_config * - serverconfig_byid(u_int32_t); + serverconfig_byid(uint32_t); int server_foreach(int (*)(struct server *, struct server_config *, void *), void *); @@ -577,19 +577,20 @@ void server_http_init(struct server *); void server_http(struct httpd *); int server_httpdesc_init(struct client *); void server_read_http(struct bufferevent *, void *); -void server_abort_http(struct client *, u_int, const char *); -u_int server_httpmethod_byname(const char *); +void server_abort_http(struct client *, unsigned int, const char *); +unsigned int + server_httpmethod_byname(const char *); const char - *server_httpmethod_byid(u_int); + *server_httpmethod_byid(unsigned int); const char - *server_httperror_byid(u_int); + *server_httperror_byid(unsigned int); void server_read_httpcontent(struct bufferevent *, void *); void server_read_httpchunks(struct bufferevent *, void *); int server_writeheader_http(struct client *clt, struct kv *, void *); int server_headers(struct client *, void *, int (*)(struct client *, struct kv *, void *), void *); int server_writeresponse_http(struct client *); -int server_response_http(struct client *, u_int, struct media_type *, +int server_response_http(struct client *, unsigned int, struct media_type *, off_t, time_t); void server_reset_http(struct client *); void server_close_http(struct client *); @@ -602,7 +603,7 @@ const char * server_http_host(struct sockaddr_storage *, char *, size_t); char *server_http_parsehost(char *, char *, size_t, int *); ssize_t server_http_time(time_t, char *, size_t); -int server_log_http(struct client *, u_int, size_t); +int server_log_http(struct client *, unsigned int, size_t); /* server_file.c */ int server_file(struct httpd *, struct client *); @@ -624,20 +625,22 @@ const char *canonicalize_path(const char *, char *, size_t); size_t path_info(char *); char *escape_html(const char *); void imsg_event_add(struct imsgev *); -int imsg_compose_event(struct imsgev *, u_int16_t, u_int32_t, - pid_t, int, void *, u_int16_t); +int imsg_compose_event(struct imsgev *, uint16_t, uint32_t, + pid_t, int, void *, uint16_t); void socket_rlimit(int); char *evbuffer_getline(struct evbuffer *); -char *get_string(u_int8_t *, size_t); -void *get_data(u_int8_t *, size_t); +char *get_string(uint8_t *, size_t); +void *get_data(uint8_t *, size_t); int sockaddr_cmp(struct sockaddr *, struct sockaddr *, int); -struct in6_addr *prefixlen2mask6(u_int8_t, u_int32_t *); -u_int32_t prefixlen2mask(u_int8_t); +struct in6_addr *prefixlen2mask6(uint8_t, uint32_t *); +uint32_t prefixlen2mask(uint8_t); int accept_reserve(int, struct sockaddr *, socklen_t *, int, volatile int *); struct kv *kv_add(struct kvtree *, char *, char *); -int kv_set(struct kv *, char *, ...) __attribute__((__format__ (printf, 2, 3))); -int kv_setkey(struct kv *, char *, ...) __attribute__((__format__ (printf, 2, 3))); +int kv_set(struct kv *, char *, ...) + __attribute__((__format__ (printf, 2, 3))); +int kv_setkey(struct kv *, char *, ...) + __attribute__((__format__ (printf, 2, 3))); void kv_delete(struct kvtree *, struct kv *); struct kv *kv_extend(struct kvtree *, struct kv *, char *); void kv_purge(struct kvtree *); @@ -659,7 +662,7 @@ int media_cmp(struct media_type *, struct media_type *); RB_PROTOTYPE(kvtree, kv, kv_node, kv_cmp); RB_PROTOTYPE(mediatypes, media_type, media_entry, media_cmp); struct auth *auth_add(struct serverauth *, struct auth *); -struct auth *auth_byid(struct serverauth *, u_int32_t); +struct auth *auth_byid(struct serverauth *, uint32_t); void auth_free(struct serverauth *, struct auth *); /* log.c */ @@ -675,22 +678,22 @@ __dead void fatal(const char *); __dead void fatalx(const char *); const char *print_host(struct sockaddr_storage *, char *, size_t); const char *print_time(struct timeval *, struct timeval *, char *, size_t); -const char *printb_flags(const u_int32_t, const char *); +const char *printb_flags(const uint32_t, const char *); void getmonotime(struct timeval *); /* proc.c */ -void proc_init(struct privsep *, struct privsep_proc *, u_int); +void proc_init(struct privsep *, struct privsep_proc *, unsigned int); void proc_kill(struct privsep *); void proc_listen(struct privsep *, struct privsep_proc *, size_t); void proc_dispatch(int, short event, void *); pid_t proc_run(struct privsep *, struct privsep_proc *, - struct privsep_proc *, u_int, + struct privsep_proc *, unsigned int, void (*)(struct privsep *, struct privsep_proc *, void *), void *); void proc_range(struct privsep *, enum privsep_procid, int *, int *); int proc_compose_imsg(struct privsep *, enum privsep_procid, int, - u_int16_t, int, void *, u_int16_t); + uint16_t, int, void *, uint16_t); int proc_composev_imsg(struct privsep *, enum privsep_procid, int, - u_int16_t, int, const struct iovec *, int); + uint16_t, int, const struct iovec *, int); int proc_forward_imsg(struct privsep *, struct imsg *, enum privsep_procid, int); struct imsgbuf * @@ -698,15 +701,15 @@ struct imsgbuf * struct imsgev * proc_iev(struct privsep *, enum privsep_procid, int); void imsg_event_add(struct imsgev *); -int imsg_compose_event(struct imsgev *, u_int16_t, u_int32_t, - pid_t, int, void *, u_int16_t); -int imsg_composev_event(struct imsgev *, u_int16_t, u_int32_t, +int imsg_compose_event(struct imsgev *, uint16_t, uint32_t, + pid_t, int, void *, uint16_t); +int imsg_composev_event(struct imsgev *, uint16_t, uint32_t, pid_t, int, const struct iovec *, int); /* config.c */ int config_init(struct httpd *); -void config_purge(struct httpd *, u_int); -int config_setreset(struct httpd *, u_int); +void config_purge(struct httpd *, unsigned int); +int config_setreset(struct httpd *, unsigned int); int config_getreset(struct httpd *, struct imsg *); int config_getcfg(struct httpd *, struct imsg *); int config_setserver(struct httpd *, struct server *); diff --git a/httpd/log.c b/httpd/log.c index a5dfc6b..16e57d0 100644 --- a/httpd/log.c +++ b/httpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.5 2015/01/21 22:21:05 reyk Exp $ */ +/* $OpenBSD: log.c,v 1.6 2015/08/20 13:00:23 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -183,7 +183,7 @@ const char * print_time(struct timeval *a, struct timeval *b, char *buf, size_t len) { struct timeval tv; - u_long h, sec, min; + unsigned long h, sec, min; timerclear(&tv); timersub(a, b, &tv); @@ -196,7 +196,7 @@ print_time(struct timeval *a, struct timeval *b, char *buf, size_t len) } const char * -printb_flags(const u_int32_t v, const char *bits) +printb_flags(const uint32_t v, const char *bits) { static char buf[2][BUFSIZ]; static int idx = 0; @@ -219,7 +219,8 @@ printb_flags(const u_int32_t v, const char *bits) if (c == '_') *p++ = ' '; else - *p++ = tolower((u_char)c); + *p++ = + tolower((unsigned char)c); } } else for (; *bits > 32; bits++) diff --git a/httpd/logger.c b/httpd/logger.c index d03d954..4d3b741 100644 --- a/httpd/logger.c +++ b/httpd/logger.c @@ -1,4 +1,4 @@ -/* $OpenBSD: logger.c,v 1.12 2015/04/11 14:52:49 jsing Exp $ */ +/* $OpenBSD: logger.c,v 1.13 2015/08/20 13:00:23 reyk Exp $ */ /* * Copyright (c) 2014 Reyk Floeter @@ -46,7 +46,7 @@ int logger_log(struct imsg *); static struct httpd *env = NULL; int proc_id; -static u_int32_t last_log_id = 0; +static uint32_t last_log_id = 0; static struct privsep_proc procs[] = { { "parent", PROC_PARENT, logger_dispatch_parent }, @@ -138,7 +138,7 @@ int logger_open_fd(struct imsg *imsg) { struct log_file *log; - u_int32_t id; + uint32_t id; IMSG_SIZE_CHECK(imsg, &id); memcpy(&id, imsg->data, sizeof(id)); @@ -160,7 +160,7 @@ logger_open_priv(struct imsg *imsg) { char path[PATH_MAX]; char name[NAME_MAX], *p; - u_int32_t id; + uint32_t id; size_t len; int fd; @@ -244,7 +244,7 @@ int logger_log(struct imsg *imsg) { char *logline; - u_int32_t id; + uint32_t id; struct server_config *srv_conf; struct log_file *log; diff --git a/httpd/parse.y b/httpd/parse.y index cbb1374..0b79585 100644 --- a/httpd/parse.y +++ b/httpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.73 2015/07/19 05:17:27 reyk Exp $ */ +/* $OpenBSD: parse.y,v 1.75 2015/08/20 13:00:23 reyk Exp $ */ /* * Copyright (c) 2007 - 2015 Reyk Floeter @@ -1007,7 +1007,7 @@ mediaoptsl : mediastring medianames_l optsemicolon | include ; -mediastring : STRING '/' STRING { +mediastring : STRING '/' STRING { if (strlcpy(media.media_type, $1, sizeof(media.media_type)) >= sizeof(media.media_type) || @@ -1212,10 +1212,10 @@ lookup(char *s) #define MAXPUSHBACK 128 -u_char *parsebuf; -int parseindex; -u_char pushback_buffer[MAXPUSHBACK]; -int pushback_index = 0; +unsigned char *parsebuf; +int parseindex; +unsigned char pushback_buffer[MAXPUSHBACK]; +int pushback_index = 0; int lgetc(int quotec) @@ -1307,10 +1307,10 @@ findeol(void) int yylex(void) { - u_char buf[8096]; - u_char *p, *val; - int quotec, next, c; - int token; + unsigned char buf[8096]; + unsigned char *p, *val; + int quotec, next, c; + int token; top: p = buf; @@ -2091,7 +2091,7 @@ getservice(char *n) return (s->s_port); } - return (htons((u_short)llval)); + return (htons((unsigned short)llval)); } int diff --git a/httpd/proc.c b/httpd/proc.c index 34d65c0..9ba7bbe 100644 --- a/httpd/proc.c +++ b/httpd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.8 2015/01/21 22:21:05 reyk Exp $ */ +/* $OpenBSD: proc.c,v 1.9 2015/08/20 13:00:23 reyk Exp $ */ /* * Copyright (c) 2010 - 2014 Reyk Floeter @@ -37,15 +37,16 @@ void proc_open(struct privsep *, struct privsep_proc *, struct privsep_proc *, size_t); void proc_close(struct privsep *); -int proc_ispeer(struct privsep_proc *, u_int, enum privsep_procid); +int proc_ispeer(struct privsep_proc *, unsigned int, enum privsep_procid); void proc_shutdown(struct privsep_proc *); void proc_sig_handler(int, short, void *); void proc_range(struct privsep *, enum privsep_procid, int *, int *); int -proc_ispeer(struct privsep_proc *procs, u_int nproc, enum privsep_procid type) +proc_ispeer(struct privsep_proc *procs, unsigned int nproc, + enum privsep_procid type) { - u_int i; + unsigned int i; for (i = 0; i < nproc; i++) if (procs[i].p_id == type) @@ -54,9 +55,9 @@ proc_ispeer(struct privsep_proc *procs, u_int nproc, enum privsep_procid type) } void -proc_init(struct privsep *ps, struct privsep_proc *procs, u_int nproc) +proc_init(struct privsep *ps, struct privsep_proc *procs, unsigned int nproc) { - u_int i, j, src, dst; + unsigned int i, j, src, dst; struct privsep_pipes *pp; /* @@ -122,7 +123,7 @@ void proc_kill(struct privsep *ps) { pid_t pid; - u_int i; + unsigned int i; if (privsep_process != PROC_PARENT) return; @@ -146,7 +147,7 @@ proc_open(struct privsep *ps, struct privsep_proc *p, { struct privsep_pipes *pa, *pb; int fds[2]; - u_int i, j, src, proc; + unsigned int i, j, src, proc; if (p == NULL) src = privsep_process; /* parent */ @@ -187,7 +188,7 @@ proc_open(struct privsep *ps, struct privsep_proc *p, void proc_listen(struct privsep *ps, struct privsep_proc *procs, size_t nproc) { - u_int i, dst, src, n, m; + unsigned int i, dst, src, n, m; struct privsep_pipes *pp; /* @@ -196,7 +197,7 @@ proc_listen(struct privsep *ps, struct privsep_proc *procs, size_t nproc) for (src = 0; src < PROC_MAX; src++) { for (n = 0; n < ps->ps_instances[src]; n++) { /* Ingore current process */ - if (src == (u_int)privsep_process && + if (src == (unsigned int)privsep_process && n == ps->ps_instance) continue; @@ -258,7 +259,7 @@ proc_listen(struct privsep *ps, struct privsep_proc *procs, size_t nproc) void proc_close(struct privsep *ps) { - u_int dst, n; + unsigned int dst, n; struct privsep_pipes *pp; if (ps == NULL) @@ -326,14 +327,14 @@ proc_sig_handler(int sig, short event, void *arg) pid_t proc_run(struct privsep *ps, struct privsep_proc *p, - struct privsep_proc *procs, u_int nproc, + struct privsep_proc *procs, unsigned int nproc, void (*init)(struct privsep *, struct privsep_proc *, void *), void *arg) { pid_t pid; struct passwd *pw; const char *root; struct control_sock *rcs; - u_int n; + unsigned int n; if (ps->ps_noaction) return (0); @@ -526,8 +527,8 @@ imsg_event_add(struct imsgev *iev) } int -imsg_compose_event(struct imsgev *iev, u_int16_t type, u_int32_t peerid, - pid_t pid, int fd, void *data, u_int16_t datalen) +imsg_compose_event(struct imsgev *iev, uint16_t type, uint32_t peerid, + pid_t pid, int fd, void *data, uint16_t datalen) { int ret; @@ -539,7 +540,7 @@ imsg_compose_event(struct imsgev *iev, u_int16_t type, u_int32_t peerid, } int -imsg_composev_event(struct imsgev *iev, u_int16_t type, u_int32_t peerid, +imsg_composev_event(struct imsgev *iev, uint16_t type, uint32_t peerid, pid_t pid, int fd, const struct iovec *iov, int iovcnt) { int ret; @@ -566,7 +567,7 @@ proc_range(struct privsep *ps, enum privsep_procid id, int *n, int *m) int proc_compose_imsg(struct privsep *ps, enum privsep_procid id, int n, - u_int16_t type, int fd, void *data, u_int16_t datalen) + uint16_t type, int fd, void *data, uint16_t datalen) { int m; @@ -582,7 +583,7 @@ proc_compose_imsg(struct privsep *ps, enum privsep_procid id, int n, int proc_composev_imsg(struct privsep *ps, enum privsep_procid id, int n, - u_int16_t type, int fd, const struct iovec *iov, int iovcnt) + uint16_t type, int fd, const struct iovec *iov, int iovcnt) { int m; diff --git a/httpd/server.c b/httpd/server.c index ffd6d30..21593bf 100644 --- a/httpd/server.c +++ b/httpd/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.74 2015/08/03 11:45:17 florian Exp $ */ +/* $OpenBSD: server.c,v 1.75 2015/08/20 13:00:23 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter @@ -74,7 +74,7 @@ extern void bufferevent_read_pressure_cb(struct evbuffer *, size_t, volatile int server_clients; volatile int server_inflight = 0; -u_int32_t server_cltid; +uint32_t server_cltid; static struct httpd *env = NULL; int proc_id; @@ -356,7 +356,7 @@ server_byaddr(struct sockaddr *addr, in_port_t port) } struct server_config * -serverconfig_byid(u_int32_t id) +serverconfig_byid(uint32_t id) { struct server *srv; struct server_config *srv_conf; diff --git a/httpd/server_fcgi.c b/httpd/server_fcgi.c index a5c96b1..e7d9747 100644 --- a/httpd/server_fcgi.c +++ b/httpd/server_fcgi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_fcgi.c,v 1.63 2015/08/03 11:45:17 florian Exp $ */ +/* $OpenBSD: server_fcgi.c,v 1.64 2015/08/20 13:00:23 reyk Exp $ */ /* * Copyright (c) 2014 Florian Obser @@ -76,7 +76,7 @@ struct server_fcgi_param { uint8_t buf[FCGI_RECORD_SIZE]; }; -int server_fcgi_header(struct client *, u_int); +int server_fcgi_header(struct client *, unsigned int); void server_fcgi_read(struct bufferevent *, void *); int server_fcgi_writeheader(struct client *, struct kv *, void *); int server_fcgi_writechunk(struct client *); @@ -588,7 +588,7 @@ server_fcgi_read(struct bufferevent *bev, void *arg) } int -server_fcgi_header(struct client *clt, u_int code) +server_fcgi_header(struct client *clt, unsigned int code) { struct server_config *srv_conf = clt->clt_srv_conf; struct http_descriptor *desc = clt->clt_descreq; diff --git a/httpd/server_http.c b/httpd/server_http.c index bb29358..a31e8ff 100644 --- a/httpd/server_http.c +++ b/httpd/server_http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_http.c,v 1.96 2015/07/31 00:10:51 benno Exp $ */ +/* $OpenBSD: server_http.c,v 1.97 2015/08/20 13:00:23 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter @@ -152,7 +152,7 @@ server_http_authenticate(struct server_config *srv_conf, struct client *clt) if (strncmp(ba->kv_value, "Basic ", strlen("Basic ")) != 0) goto done; - if (b64_pton(strchr(ba->kv_value, ' ') + 1, (u_int8_t *)decoded, + if (b64_pton(strchr(ba->kv_value, ' ') + 1, (uint8_t *)decoded, sizeof(decoded)) <= 0) goto done; @@ -733,7 +733,7 @@ server_http_parsehost(char *host, char *buf, size_t len, int *portval) } void -server_abort_http(struct client *clt, u_int code, const char *msg) +server_abort_http(struct client *clt, unsigned int code, const char *msg) { struct server_config *srv_conf = clt->clt_srv_conf; struct bufferevent *bev = clt->clt_bev; @@ -1226,7 +1226,7 @@ server_getlocation(struct client *clt, const char *path) } int -server_response_http(struct client *clt, u_int code, +server_response_http(struct client *clt, unsigned int code, struct media_type *media, off_t size, time_t mtime) { struct server_config *srv_conf = clt->clt_srv_conf; @@ -1397,7 +1397,7 @@ server_httpmethod_byname(const char *name) } const char * -server_httpmethod_byid(u_int id) +server_httpmethod_byid(unsigned int id) { const char *name = ""; int i; @@ -1426,7 +1426,7 @@ server_httpmethod_cmp(const void *a, const void *b) } const char * -server_httperror_byid(u_int id) +server_httperror_byid(unsigned int id) { struct http_error error, *res; @@ -1450,7 +1450,7 @@ server_httperror_cmp(const void *a, const void *b) } int -server_log_http(struct client *clt, u_int code, size_t len) +server_log_http(struct client *clt, unsigned int code, size_t len) { static char tstamp[64]; static char ip[INET6_ADDRSTRLEN]; -- cgit v1.2.3-54-g00ecf