diff options
author | Alistair Delva <adelva@google.com> | 2020-08-21 00:00:13 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-08-21 00:00:13 +0000 |
commit | ed358b3546c776c1c677fd88eb8f716cf6187510 (patch) | |
tree | 3c6134bcb2cda4b9dccc57b4a8b997a945aab62d /misc.h | |
parent | 22246b08952d746a7cc5a292570636cf4277598f (diff) | |
parent | 44a1065de8a58c51a021243a28bfa01e87822e4f (diff) |
Merge changes I934c73d4,I28cdc9a0,I9e734da9,I3c079d86
* changes:
UPSTREAM: depend
UPSTREAM: upstream: avoid possible NULL deref; from Pedro Martelletto
Revert "upstream: fix compilation with DEBUG_KEXDH; bz#3160 ok dtucker@"
Merge upstream-master into master
Diffstat (limited to 'misc.h')
-rw-r--r-- | misc.h | 67 |
1 files changed, 63 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: misc.h,v 1.54 2014/07/15 15:54:14 millert Exp $ */ +/* $OpenBSD: misc.h,v 1.84 2020/01/24 23:54:40 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> @@ -15,6 +15,10 @@ #ifndef _MISC_H #define _MISC_H +#include <sys/time.h> +#include <sys/types.h> +#include <sys/socket.h> + /* Data structure for representing a forwarding request. */ struct Forward { char *listen_host; /* Host (address) to listen on. */ @@ -27,6 +31,9 @@ struct Forward { int handle; /* Handle for dynamic listen ports */ }; +int forward_equals(const struct Forward *, const struct Forward *); +int daemonized(void); + /* Common server and client forwarding options. */ struct ForwardOptions { int gateway_ports; /* Allow remote connects to forwarded ports. */ @@ -37,26 +44,48 @@ struct ForwardOptions { /* misc.c */ char *chop(char *); +void skip_space(char **); char *strdelim(char **); +char *strdelimw(char **); int set_nonblock(int); int unset_nonblock(int); void set_nodelay(int); +int set_reuseaddr(int); +char *get_rdomain(int); +int set_rdomain(int, const char *); +int waitrfd(int, int *); +int timeout_connect(int, const struct sockaddr *, socklen_t, int *); int a2port(const char *); int a2tun(const char *, int *); char *put_host_port(const char *, u_short); +char *hpdelim2(char **, char *); char *hpdelim(char **); char *cleanhostname(char *); char *colon(char *); +int parse_user_host_path(const char *, char **, char **, char **); +int parse_user_host_port(const char *, char **, char **, int *); +int parse_uri(const char *, const char *, char **, char **, int *, char **); long convtime(const char *); char *tilde_expand_filename(const char *, uid_t); char *percent_expand(const char *, ...) __attribute__((__sentinel__)); char *tohex(const void *, size_t); +void xextendf(char **s, const char *sep, const char *fmt, ...) + __attribute__((__format__ (printf, 3, 4))) __attribute__((__nonnull__ (3))); void sanitise_stdfd(void); void ms_subtract_diff(struct timeval *, int *); void ms_to_timeval(struct timeval *, int); +void monotime_ts(struct timespec *); +void monotime_tv(struct timeval *); time_t monotime(void); +double monotime_double(void); void lowercase(char *s); int unix_listener(const char *, int, int); +int valid_domain(char *, int, const char **); +int valid_env_name(const char *); +const char *atoi_err(const char *, int *); +int parse_absolute_time(const char *, uint64_t *); +void format_absolute_time(uint64_t, char *, size_t); +int path_absolute(const char *); void sock_set_v6only(int); @@ -75,7 +104,7 @@ void replacearg(arglist *, u_int, char *, ...) __attribute__((format(printf, 3, 4))); void freeargs(arglist *); -int tun_open(int, int); +int tun_open(int, int, char **); /* Common definitions for ssh tunnel device forwarding */ #define SSH_TUNMODE_NO 0x00 @@ -113,7 +142,9 @@ void put_u32_le(void *, u_int32_t) struct bwlimit { size_t buflen; - u_int64_t rate, thresh, lamt; + u_int64_t rate; /* desired rate in kbit/s */ + u_int64_t thresh; /* threshold after which we'll check timers */ + u_int64_t lamt; /* amount written in last timer interval */ struct timeval bwstart, bwend; }; @@ -124,6 +155,24 @@ int parse_ipqos(const char *); const char *iptos2str(int); void mktemp_proto(char *, size_t); +void child_set_env(char ***envp, u_int *envsizep, const char *name, + const char *value); + +int argv_split(const char *, int *, char ***); +char *argv_assemble(int, char **argv); +int exited_cleanly(pid_t, const char *, const char *, int); + +struct stat; +int safe_path(const char *, struct stat *, const char *, uid_t, + char *, size_t); +int safe_path_fd(int, const char *, struct passwd *, + char *err, size_t errlen); + +/* authorized_key-style options parsing helpers */ +int opt_flag(const char *opt, int allow_negate, const char **optsp); +char *opt_dequote(const char **sp, const char **errstrp); +int opt_match(const char **opts, const char *term); + /* readpass.c */ #define RP_ECHO 0x0001 @@ -131,8 +180,18 @@ void mktemp_proto(char *, size_t); #define RP_ALLOW_EOF 0x0004 #define RP_USE_ASKPASS 0x0008 +struct notifier_ctx; + char *read_passphrase(const char *, int); int ask_permission(const char *, ...) __attribute__((format(printf, 1, 2))); -int read_keyfile_line(FILE *, const char *, char *, size_t, u_long *); +struct notifier_ctx *notify_start(int, const char *, ...) + __attribute__((format(printf, 2, 3))); +void notify_complete(struct notifier_ctx *); + +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) +#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) +#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y)) +typedef void (*sshsig_t)(int); +sshsig_t ssh_signal(int, sshsig_t); #endif /* _MISC_H */ |