Changeset View
Changeset View
Standalone View
Standalone View
misc.h
/* $OpenBSD: misc.h,v 1.79 2019/01/23 21:50:56 dtucker Exp $ */ | /* $OpenBSD: misc.h,v 1.87 2020/05/29 11:17:56 dtucker Exp $ */ | ||||
/* | /* | ||||
* Author: Tatu Ylonen <ylo@cs.hut.fi> | * Author: Tatu Ylonen <ylo@cs.hut.fi> | ||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | ||||
* All rights reserved | * All rights reserved | ||||
* | * | ||||
* As far as I am concerned, the code I have written for this software | * As far as I am concerned, the code I have written for this software | ||||
* can be used freely for any purpose. Any derived versions of this | * can be used freely for any purpose. Any derived versions of this | ||||
Show All 29 Lines | struct ForwardOptions { | ||||
int gateway_ports; /* Allow remote connects to forwarded ports. */ | int gateway_ports; /* Allow remote connects to forwarded ports. */ | ||||
mode_t streamlocal_bind_mask; /* umask for streamlocal binds */ | mode_t streamlocal_bind_mask; /* umask for streamlocal binds */ | ||||
int streamlocal_bind_unlink; /* unlink socket before bind */ | int streamlocal_bind_unlink; /* unlink socket before bind */ | ||||
}; | }; | ||||
/* misc.c */ | /* misc.c */ | ||||
char *chop(char *); | char *chop(char *); | ||||
void skip_space(char **); | |||||
char *strdelim(char **); | char *strdelim(char **); | ||||
char *strdelimw(char **); | char *strdelimw(char **); | ||||
int set_nonblock(int); | int set_nonblock(int); | ||||
int unset_nonblock(int); | int unset_nonblock(int); | ||||
void set_nodelay(int); | void set_nodelay(int); | ||||
int set_reuseaddr(int); | int set_reuseaddr(int); | ||||
char *get_rdomain(int); | char *get_rdomain(int); | ||||
int set_rdomain(int, const char *); | int set_rdomain(int, const char *); | ||||
int waitrfd(int, int *); | int waitrfd(int, int *); | ||||
int timeout_connect(int, const struct sockaddr *, socklen_t, int *); | int timeout_connect(int, const struct sockaddr *, socklen_t, int *); | ||||
int a2port(const char *); | int a2port(const char *); | ||||
int a2tun(const char *, int *); | int a2tun(const char *, int *); | ||||
char *put_host_port(const char *, u_short); | char *put_host_port(const char *, u_short); | ||||
char *hpdelim2(char **, char *); | char *hpdelim2(char **, char *); | ||||
char *hpdelim(char **); | char *hpdelim(char **); | ||||
char *cleanhostname(char *); | char *cleanhostname(char *); | ||||
char *colon(char *); | char *colon(char *); | ||||
int parse_user_host_path(const char *, char **, char **, char **); | int parse_user_host_path(const char *, char **, char **, char **); | ||||
int parse_user_host_port(const char *, char **, char **, int *); | int parse_user_host_port(const char *, char **, char **, int *); | ||||
int parse_uri(const char *, const char *, char **, char **, int *, char **); | int parse_uri(const char *, const char *, char **, char **, int *, char **); | ||||
long convtime(const char *); | long convtime(const char *); | ||||
const char *fmt_timeframe(time_t t); | |||||
char *tilde_expand_filename(const char *, uid_t); | char *tilde_expand_filename(const char *, uid_t); | ||||
char *dollar_expand(int *, const char *string, ...); | |||||
char *percent_expand(const char *, ...) __attribute__((__sentinel__)); | char *percent_expand(const char *, ...) __attribute__((__sentinel__)); | ||||
char *percent_dollar_expand(const char *, ...) __attribute__((__sentinel__)); | |||||
char *tohex(const void *, size_t); | 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 sanitise_stdfd(void); | ||||
void ms_subtract_diff(struct timeval *, int *); | void ms_subtract_diff(struct timeval *, int *); | ||||
void ms_to_timeval(struct timeval *, int); | void ms_to_timeval(struct timeval *, int); | ||||
void monotime_ts(struct timespec *); | void monotime_ts(struct timespec *); | ||||
void monotime_tv(struct timeval *); | void monotime_tv(struct timeval *); | ||||
time_t monotime(void); | time_t monotime(void); | ||||
double monotime_double(void); | double monotime_double(void); | ||||
void lowercase(char *s); | void lowercase(char *s); | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
int exited_cleanly(pid_t, const char *, const char *, int); | int exited_cleanly(pid_t, const char *, const char *, int); | ||||
struct stat; | struct stat; | ||||
int safe_path(const char *, struct stat *, const char *, uid_t, | int safe_path(const char *, struct stat *, const char *, uid_t, | ||||
char *, size_t); | char *, size_t); | ||||
int safe_path_fd(int, const char *, struct passwd *, | int safe_path_fd(int, const char *, struct passwd *, | ||||
char *err, size_t errlen); | 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 */ | /* readpass.c */ | ||||
#define RP_ECHO 0x0001 | #define RP_ECHO 0x0001 | ||||
#define RP_ALLOW_STDIN 0x0002 | #define RP_ALLOW_STDIN 0x0002 | ||||
#define RP_ALLOW_EOF 0x0004 | #define RP_ALLOW_EOF 0x0004 | ||||
#define RP_USE_ASKPASS 0x0008 | #define RP_USE_ASKPASS 0x0008 | ||||
struct notifier_ctx; | |||||
char *read_passphrase(const char *, int); | char *read_passphrase(const char *, int); | ||||
int ask_permission(const char *, ...) __attribute__((format(printf, 1, 2))); | int ask_permission(const char *, ...) __attribute__((format(printf, 1, 2))); | ||||
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 MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) | ||||
#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) | #define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) | ||||
#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y)) | #define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y)) | ||||
typedef void (*sshsig_t)(int); | |||||
sshsig_t ssh_signal(int, sshsig_t); | |||||
#endif /* _MISC_H */ | #endif /* _MISC_H */ |