input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
static inline intmax_t getn(const char *s)
{
return atomax10(s);
}
| int getn(unsigned long long a0) {
return atomax10(a0);
}
|
static int mptcp_addr_modify(int argc, char **argv, int cmd)
{
struct { struct nlmsghdr n; struct genlmsghdr g; char buf[( ((0)+4U -1) & ~(4U -1) ) + (4096)]; } req = { .n = { .nlmsg_type = (genl_family), .nlmsg_flags = (0x01), .nlmsg_len = ((( ((sizeof(struct genlmsghdr))+4U -1) & ~(4U -1) ) + (0)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))), }, .g = { .cmd = (cmd), .version = (0x1), }, };
int ret;
ret = mptcp_parse_opt(argc, argv, &req.n, cmd);
if (ret)
return ret;
if (rtnl_talk(&genl_rth, &req.n,
((void *)0)
) < 0)
return -2;
return 0;
}
| void mptcp_addr_modify(unsigned long a0, unsigned int a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
char v2;
unsigned short v3;
unsigned short v4;
char v5;
char v6;
char v7;
unsigned long long v9;
void* v10;
unsigned long v11;
unsigned long long v12;
unsigned long long v14;
void* v15;
v7 = *(&v7);
v0 = a0;
v9 = 514;
for (v10 = &v2; v9; v10 += v11 * 8) {
v9 -= 1;
v2 = 0;
}
*(v10) = 0;
v2 = 20;
v3 = genl_family;
v4 = 1;
v5 = a2;
v6 = 1;
v1 = mptcp_parse_opt(v0, a1, &v2, a2);
if (v1) {
v12 = v1;
} else if (rtnl_talk(&genl_rth, &v2, 0x0) < 0) {
v14 = 4294967294;
} else {
v15 = 0;
}
return;
}
|
static int get_user_id (const char *uid, uid_t *nuid) {
if (
((*__ctype_b_loc ())[(int) ((
uid[0]
))] & (unsigned short int) _ISdigit)
) {
if ((get_uid (uid, nuid) == 0) || (*nuid == (uid_t)-1)) {
fprintf (
stderr
,
gettext ("%s: invalid user ID '%s'\n"),
Prog, uid);
return -1;
}
} else {
if ('\0' != uid[0]) {
const struct passwd *pwd;
pwd = getpwnam (uid);
if (
((void *)0)
== pwd) {
pwd = pw_locate (uid);
}
if (
((void *)0)
!= pwd) {
*nuid = pwd->pw_uid;
} else {
fprintf (
stderr
,
gettext ("%s: user '%s' does not exist\n"),
Prog, uid);
return -1;
}
} else {
if (find_new_uid (rflg, nuid,
((void *)0)
) < 0) {
return -1;
}
}
}
return 0;
}
| int get_user_id(char *a0, unsigned long long a1) {
struct_0 *v0;
unsigned int v3;
unsigned int v4;
v3 = *((*(a0) * 2 + *(__ctype_b_loc()))) & 0x800;
if (v3) {
if (get_uid(a0, a1, a1) && *(a1) != -1) {
v4 = 0;
return v4;
}
fprintf(*(&stderr), gettext("%s: invalid user ID '%s'\n"));
v4 = -1;
return v4;
} else if (*(a0)) {
v0 = &getpwnam(a0)->pw_name;
if (!v0)
v0 = pw_locate(a0);
if (v0) {
*(a1) = v0->field_10;
v4 = 0;
return v4;
}
fprintf(*(&stderr), gettext("%s: user '%s' does not exist\n"));
v4 = -1;
return v4;
} else if (find_new_uid(rflg, a1, 0x0, a1) >= 0) {
v4 = 0;
return v4;
} else {
v4 = -1;
return v4;
}
}
|
static void
chopslash (char *str)
{
char *p = str + strlen (str) - 1;
while (p > str &&
((
*p
) == '/')
)
*p-- = '\0';
}
| unsigned char * chopslash(const char *a1)
{
unsigned char *v1;
unsigned char *result;
unsigned char *i;
for ( i = (unsigned char *)&a1[strlen(a1) - 1]; ; --i )
{
result = i;
if ( i <= (unsigned char *)a1 )
break;
result = (unsigned char *)*i;
if ( (_BYTE)result != 47 )
break;
v1 = i;
*v1 = 0;
}
return result;
}
|
static
_Bool
diversion_is_shared(struct pkgset *set, struct fsys_namenode *namenode)
{
const char *archname;
struct pkginfo *pkg;
struct dpkg_arch *arch;
struct fsys_node_pkgs_iter *iter;
_Bool
shared =
0
;
if (set ==
((void *)0)
)
return
0
;
archname = getenv("DPKG_MAINTSCRIPT_ARCH");
arch = dpkg_arch_find(archname);
if (arch->type == DPKG_ARCH_NONE || arch->type == DPKG_ARCH_EMPTY)
return
0
;
for (pkg = &set->pkg; pkg; pkg = pkg->arch_next)
ensure_packagefiles_available(pkg);
iter = fsys_node_pkgs_iter_new(namenode);
while ((pkg = fsys_node_pkgs_iter_next(iter))) {
if (pkg->set == set && pkg->installed.arch != arch) {
shared =
1
;
break;
}
}
fsys_node_pkgs_iter_free(iter);
return shared;
}
| long diversion_is_shared(long a1, long a2)
{
_QWORD *j;
unsigned char v4;
long i;
char *v6;
long v7;
long v8;
v4 = 0;
if ( !a1 )
return 0LL;
v6 = getenv("DPKG_MAINTSCRIPT_ARCH");
v7 = dpkg_arch_find(v6);
if ( *(_DWORD *)(v7 + 16) <= 1u )
return 0LL;
for ( i = a1 + 16; i; i = *(_QWORD *)(i + 8) )
ensure_packagefiles_available(i);
v8 = fsys_node_pkgs_iter_new(a2);
for ( j = (_QWORD *)fsys_node_pkgs_iter_next(v8); j; j = (_QWORD *)fsys_node_pkgs_iter_next(v8) )
{
if ( a1 == *j && v7 != j[11] )
{
v4 = 1;
break;
}
}
fsys_node_pkgs_iter_free(v8);
return v4;
}
|
int
glob_char_p (s)
const char *s;
{
switch (*s)
{
case '*':
case '[':
case ']':
case '?':
case '\\':
return 1;
case '+':
case '@':
case '!':
if (s[1] == '(')
return 1;
break;
}
return 0;
}
| _BOOL8 glob_char_p(char *a1)
{
int v1;
_BOOL8 result;
v1 = *a1;
if ( v1 > 64 )
return (unsigned int)(v1 - 91) <= 2;
if ( v1 < 33 )
return 0LL;
switch ( *a1 )
{
case '!':
case '+':
case '@':
if ( a1[1] != 40 )
return 0LL;
result = 1LL;
break;
case '*':
case '?':
return 1LL;
default:
return 0LL;
}
return result;
}
|
void
monitor_reinit(struct monitor *mon)
{
monitor_openfds(mon, 0);
}
| long long monitor_reinit(void* a0) {
return monitor_openfds(a0, 0x0);
}
|
int tnl_get_ioctl(const char *basedev, void *p)
{
struct ifreq ifr;
int fd;
int err;
strlcpy(ifr.ifr_ifrn.ifrn_name, basedev, 16);
ifr.ifr_ifru.ifru_data = (void *)p;
fd = socket(preferred_family,
SOCK_DGRAM
, 0);
if (fd < 0) {
fprintf(
stderr
, "create socket failed: %s\n", strerror(
(*__errno_location ())
));
return -1;
}
err = ioctl(fd, (
0x89F0
+ 0), &ifr);
if (err)
fprintf(
stderr
, "get tunnel \"%s\" failed: %s\n", basedev,
strerror(
(*__errno_location ())
));
close(fd);
return err;
}
| int tnl_get_ioctl(unsigned long long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
char v2;
unsigned long v3;
unsigned int v5;
strlcpy(&v2, a0, 0x10, a0);
v3 = a1;
v0 = socket(preferred_family, 0x2, 0x0);
if (v0 < 0) {
fprintf(*(&stderr), "create socket failed: %s\n", strerror(*(__errno_location())));
v5 = -1;
} else {
v1 = ioctl(v0, 0x89f0);
if (v1)
fprintf(*(&stderr), "get tunnel \"%s\" failed: %s\n", a0, strerror(*(__errno_location())));
close(v0);
v5 = v1;
}
return v5;
}
|
int
main(int argc, char **argv)
{
struct sshbuf *b;
Options options;
struct sshkey *keys[5], *key =
((void *)0)
;
struct passwd *pw;
int r, key_fd[5], i, found, version = 2, fd;
u_char *signature, *data, rver;
char *host, *fp, *pkalg;
size_t slen, dlen;
if (pledge("stdio rpath getpw dns id",
((void *)0)
) != 0)
sshfatal("ssh-keysign.c", __func__, 189, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: pledge: %s", __progname, strerror(
(*__errno_location ())
));
if ((fd = open(
"/dev/null"
,
02
)) < 2)
exit(1);
if (fd > 2)
close(fd);
i = 0;
key_fd[i++] = open("/usr/local/etc" "/ssh_host_dsa_key",
00
);
key_fd[i++] = open("/usr/local/etc" "/ssh_host_ecdsa_key",
00
);
key_fd[i++] = open("/usr/local/etc" "/ssh_host_ed25519_key",
00
);
key_fd[i++] = open("/usr/local/etc" "/ssh_host_xmss_key",
00
);
key_fd[i++] = open("/usr/local/etc" "/ssh_host_rsa_key",
00
);
if ((pw = getpwuid(getuid())) ==
((void *)0)
)
sshfatal("ssh-keysign.c", __func__, 207, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "getpwuid failed");
pw = pwcopy(pw);
permanently_set_uid(pw);
seed_rng();
initialize_options(&options);
(void)read_config_file("/usr/local/etc" "/ssh_config", pw, "", "",
&options, 0,
((void *)0)
);
(void)fill_default_options(&options);
if (options.enable_ssh_keysign != 1)
sshfatal("ssh-keysign.c", __func__, 224, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "ssh-keysign not enabled in %s", "/usr/local/etc" "/ssh_config")
;
if (pledge("stdio dns",
((void *)0)
) != 0)
sshfatal("ssh-keysign.c", __func__, 228, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: pledge: %s", __progname, strerror(
(*__errno_location ())
));
for (i = found = 0; i < 5; i++) {
if (key_fd[i] != -1)
found = 1;
}
if (found == 0)
sshfatal("ssh-keysign.c", __func__, 235, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "could not open any host key");
found = 0;
for (i = 0; i < 5; i++) {
keys[i] =
((void *)0)
;
if (key_fd[i] == -1)
continue;
r = sshkey_load_private_type_fd(key_fd[i], KEY_UNSPEC,
((void *)0)
, &key,
((void *)0)
);
close(key_fd[i]);
if (r != 0)
sshlog("ssh-keysign.c", __func__, 246, 0, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "parse key %d", i);
else if (key !=
((void *)0)
) {
keys[i] = key;
found = 1;
}
}
if (!found)
sshfatal("ssh-keysign.c", __func__, 253, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "no hostkey found");
if ((b = sshbuf_new()) ==
((void *)0)
)
sshfatal("ssh-keysign.c", __func__, 256, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: sshbuf_new failed", __progname);
if (ssh_msg_recv(
0
, b) < 0)
sshfatal("ssh-keysign.c", __func__, 258, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: ssh_msg_recv failed", __progname);
if ((r = sshbuf_get_u8(b, &rver)) != 0)
sshfatal("ssh-keysign.c", __func__, 260, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: buffer error", __progname);
if (rver != version)
sshfatal("ssh-keysign.c", __func__, 262, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: bad version: received %d, expected %d", __progname, rver, version)
;
if ((r = sshbuf_get_u32(b, (u_int *)&fd)) != 0)
sshfatal("ssh-keysign.c", __func__, 265, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: buffer error", __progname);
if (fd < 0 || fd ==
0
|| fd ==
1
)
sshfatal("ssh-keysign.c", __func__, 267, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: bad fd = %d", __progname, fd);
if ((host = get_local_name(fd)) ==
((void *)0)
)
sshfatal("ssh-keysign.c", __func__, 269, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: cannot get local name for fd", __progname);
if ((r = sshbuf_get_string(b, &data, &dlen)) != 0)
sshfatal("ssh-keysign.c", __func__, 272, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: buffer error", __progname);
if (valid_request(pw, host, &key, &pkalg, data, dlen) < 0)
sshfatal("ssh-keysign.c", __func__, 274, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: not a valid request", __progname);
free(host);
found = 0;
for (i = 0; i < 5; i++) {
if (keys[i] !=
((void *)0)
&&
sshkey_equal_public(key, keys[i])) {
found = 1;
break;
}
}
if (!found) {
if ((fp = sshkey_fingerprint(key, options.fingerprint_hash,
SSH_FP_DEFAULT)) ==
((void *)0)
)
sshfatal("ssh-keysign.c", __func__, 288, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: sshkey_fingerprint failed", __progname);
sshfatal("ssh-keysign.c", __func__, 289, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: no matching hostkey found for key %s %s", __progname, sshkey_type(key), fp ? fp : "")
;
}
if ((r = sshkey_sign(keys[i], &signature, &slen, data, dlen,
pkalg,
((void *)0)
,
((void *)0)
, 0)) != 0)
sshfatal("ssh-keysign.c", __func__, 295, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: sshkey_sign failed", __progname);
free(data);
sshbuf_reset(b);
if ((r = sshbuf_put_string(b, signature, slen)) != 0)
sshfatal("ssh-keysign.c", __func__, 301, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: buffer error", __progname);
if (ssh_msg_send(
1
, version, b) == -1)
sshfatal("ssh-keysign.c", __func__, 303, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: ssh_msg_send failed", __progname);
return (0);
}
| int main(int argc, const char **argv, const char **envp)
{
int *v3;
char *v4;
__uid_t v5;
long v6;
int *v7;
char *v8;
long v9;
const char *v10;
long v11;
const char *v12;
long v13;
const char *v14;
long v15;
const char *v16;
const char *v17;
const char *v18;
long v19;
const char *v20;
long v21;
unsigned char v23;
int fd;
int i;
int v26;
unsigned int v27;
unsigned int u8;
long v29;
long v30;
void *v31;
void *v32;
long v33;
long v34;
struct passwd *v35;
long v36;
void *ptr;
const char *v38;
int v39[20];
char v40[1848];
int v41;
unsigned int v42;
unsigned long v43;
v43 = __readfsqword(0x28u);
v29 = 0LL;
v27 = 2;
if ( (unsigned int)pledge("stdio rpath getpw dns id", 0LL, envp) )
{
v3 = _errno_location();
v4 = strerror(*v3);
sshfatal("ssh-keysign.c", "main", 189LL, 0LL, 1LL, 0LL, "%s: pledge: %s", _progname, v4);
}
fd = open("/dev/null", 2);
if ( fd <= 1 )
exit(1);
if ( fd > 2 )
close(fd);
v39[0] = open("/usr/local/etc/ssh_host_dsa_key", 0);
v39[1] = open("/usr/local/etc/ssh_host_ecdsa_key", 0);
v39[2] = open("/usr/local/etc/ssh_host_ed25519_key", 0);
v39[3] = open("/usr/local/etc/ssh_host_xmss_key", 0);
i = 5;
v39[4] = open("/usr/local/etc/ssh_host_rsa_key", 0);
v5 = getuid();
v35 = getpwuid(v5);
if ( !v35 )
sshfatal("ssh-keysign.c", "main", 207LL, 0LL, 1LL, 0LL, "getpwuid failed");
v35 = (struct passwd *)pwcopy(v35);
permanently_set_uid(v35);
seed_rng();
initialize_options(v40);
read_config_file("/usr/local/etc/ssh_config", v35, &unk_15B8, &unk_15B8, v40, 0LL, 0LL);
fill_default_options(v40);
if ( v41 != 1 )
sshfatal(
"ssh-keysign.c",
"main",
224LL,
0LL,
1LL,
0LL,
"ssh-keysign not enabled in %s",
"/usr/local/etc/ssh_config");
if ( (unsigned int)pledge("stdio dns", 0LL, v6) )
{
v7 = _errno_location();
v8 = strerror(*v7);
sshfatal("ssh-keysign.c", "main", 228LL, 0LL, 1LL, 0LL, "%s: pledge: %s", _progname, v8);
}
v26 = 0;
for ( i = 0; i <= 4; ++i )
{
if ( v39[i] != -1 )
v26 = 1;
}
if ( !v26 )
sshfatal("ssh-keysign.c", "main", 235LL, 0LL, 1LL, 0LL, "could not open any host key");
v26 = 0;
for ( i = 0; i <= 4; ++i )
{
*(_QWORD *)&v39[2 * i + 8] = 0LL;
if ( v39[i] != -1 )
{
u8 = sshkey_load_private_type_fd((unsigned int)v39[i], 14LL, 0LL, &v29, 0LL);
close(v39[i]);
if ( u8 )
{
v9 = ssh_err(u8);
sshlog("ssh-keysign.c", "main", 246LL, 0LL, 5LL, v9, "parse key %d", (unsigned int)i);
}
else if ( v29 )
{
*(_QWORD *)&v39[2 * i + 8] = v29;
v26 = 1;
}
}
}
if ( !v26 )
sshfatal("ssh-keysign.c", "main", 253LL, 0LL, 1LL, 0LL, "no hostkey found");
v36 = sshbuf_new();
if ( !v36 )
sshfatal("ssh-keysign.c", "main", 256LL, 0LL, 1LL, 0LL, "%s: sshbuf_new failed", _progname);
if ( (int)ssh_msg_recv(0LL, v36) < 0 )
sshfatal("ssh-keysign.c", "main", 258LL, 0LL, 1LL, 0LL, "%s: ssh_msg_recv failed", _progname);
u8 = sshbuf_get_u8(v36, &v23);
if ( u8 )
{
v10 = (const char *)_progname;
v11 = ssh_err(u8);
sshfatal("ssh-keysign.c", "main", 260LL, 0LL, 1LL, v11, "%s: buffer error", v10);
}
if ( v27 != v23 )
sshfatal(
"ssh-keysign.c",
"main",
262LL,
0LL,
1LL,
0LL,
"%s: bad version: received %d, expected %d",
_progname,
v23,
v27);
u8 = sshbuf_get_u32(v36, &fd);
if ( u8 )
{
v12 = (const char *)_progname;
v13 = ssh_err(u8);
sshfatal("ssh-keysign.c", "main", 265LL, 0LL, 1LL, v13, "%s: buffer error", v12);
}
if ( fd <= 1 )
sshfatal("ssh-keysign.c", "main", 267LL, 0LL, 1LL, 0LL, "%s: bad fd = %d", _progname, (unsigned int)fd);
ptr = (void *)get_local_name((unsigned int)fd);
if ( !ptr )
sshfatal("ssh-keysign.c", "main", 269LL, 0LL, 1LL, 0LL, "%s: cannot get local name for fd", _progname);
u8 = sshbuf_get_string(v36, &v31, &v34);
if ( u8 )
{
v14 = (const char *)_progname;
v15 = ssh_err(u8);
sshfatal("ssh-keysign.c", "main", 272LL, 0LL, 1LL, v15, "%s: buffer error", v14);
}
if ( (int)valid_request((const char **)&v35->pw_name, (const char *)ptr, &v29, &v32, (long)v31, v34) < 0 )
sshfatal("ssh-keysign.c", "main", 274LL, 0LL, 1LL, 0LL, "%s: not a valid request", _progname);
free(ptr);
v26 = 0;
for ( i = 0; i <= 4; ++i )
{
if ( *(_QWORD *)&v39[2 * i + 8] && (unsigned int)sshkey_equal_public(v29, *(_QWORD *)&v39[2 * i + 8]) )
{
v26 = 1;
break;
}
}
if ( !v26 )
{
v38 = (const char *)sshkey_fingerprint(v29, v42, 0LL);
if ( !v38 )
sshfatal("ssh-keysign.c", "main", 288LL, 0LL, 1LL, 0LL, "%s: sshkey_fingerprint failed", _progname);
if ( v38 )
v16 = v38;
else
v16 = (const char *)&unk_15B8;
v17 = (const char *)sshkey_type(v29);
sshfatal(
"ssh-keysign.c",
"main",
289LL,
0LL,
1LL,
0LL,
"%s: no matching hostkey found for key %s %s",
_progname,
v17,
v16);
}
u8 = sshkey_sign(*(_QWORD *)&v39[2 * i + 8], &v30, &v33, v31, v34, v32, 0LL, 0LL, 0LL);
if ( u8 )
{
v18 = (const char *)_progname;
v19 = ssh_err(u8);
sshfatal("ssh-keysign.c", "main", 295LL, 0LL, 1LL, v19, "%s: sshkey_sign failed", v18);
}
free(v31);
sshbuf_reset(v36);
u8 = sshbuf_put_string(v36, v30, v33);
if ( u8 )
{
v20 = (const char *)_progname;
v21 = ssh_err(u8);
sshfatal("ssh-keysign.c", "main", 301LL, 0LL, 1LL, v21, "%s: buffer error", v20);
}
if ( (unsigned int)ssh_msg_send(1LL, (unsigned char)v27, v36) == -1 )
sshfatal("ssh-keysign.c", "main", 303LL, 0LL, 1LL, 0LL, "%s: ssh_msg_send failed", _progname);
return 0;
}
|
static void
mux_client_request_stop_listening(int fd)
{
struct sshbuf *m;
char *e;
u_int type, rid;
int r;
sshlog("mux.c", __func__, 2195, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "entering");
if ((m = sshbuf_new()) ==
((void *)0)
)
sshfatal("mux.c", __func__, 2198, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new");
if ((r = sshbuf_put_u32(m, 0x10000009)) != 0 ||
(r = sshbuf_put_u32(m, muxclient_request_id)) != 0)
sshfatal("mux.c", __func__, 2201, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "request");
if (mux_client_write_packet(fd, m) != 0)
sshfatal("mux.c", __func__, 2204, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "write packet: %s", strerror(
(*__errno_location ())
));
sshbuf_reset(m);
if (mux_client_read_packet(fd, m) != 0)
sshfatal("mux.c", __func__, 2210, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "read from master failed: %s", strerror(
(*__errno_location ())
));
if ((r = sshbuf_get_u32(m, &type)) != 0 ||
(r = sshbuf_get_u32(m, &rid)) != 0)
sshfatal("mux.c", __func__, 2214, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse");
if (rid != muxclient_request_id)
sshfatal("mux.c", __func__, 2216, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "out of sequence reply: my id %u theirs %u", muxclient_request_id, rid)
;
switch (type) {
case 0x80000001:
break;
case 0x80000002:
if ((r = sshbuf_get_cstring(m, &e,
((void *)0)
)) != 0)
sshfatal("mux.c", __func__, 2224, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse error message");
sshfatal("mux.c", __func__, 2225, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Master refused stop listening request: %s", e);
case 0x80000003:
if ((r = sshbuf_get_cstring(m, &e,
((void *)0)
)) != 0)
sshfatal("mux.c", __func__, 2228, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse error message");
sshfatal("mux.c", __func__, 2229, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "stop listening request failed: %s", e);
default:
sshfatal("mux.c", __func__, 2231, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "unexpected response from master 0x%08x", type);
}
sshbuf_free(m);
muxclient_request_id++;
}
| void mux_client_request_stop_listening(unsigned long a0) {
char v0;
char v1;
unsigned int v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long v6;
char v7;
unsigned long long v9;
unsigned long long v10;
unsigned int v11;
unsigned long long *v12;
unsigned long long v13;
sshlog("mux.c", "mux_client_request_stop_listening", 0x893, 0x1, 0x7, 0x0, "entering");
v4 = sshbuf_new("mux.c", "mux_client_request_stop_listening", 0x893, 0x1, 0x7, 0x0);
if (!v4)
sshfatal("mux.c", "mux_client_request_stop_listening", 0x896, 0x1, 0x1, 0x0, "sshbuf_new");
v2 = sshbuf_put_u32(v4, 0x10000009);
if (v2 || (v2 = sshbuf_put_u32(v4, muxclient_request_id), v2)) {
v5 = "request";
sshfatal("mux.c", "mux_client_request_stop_listening", 0x899, 0x1, 0x1, ssh_err(v2), *(&v7));
}
if (mux_client_write_packet(a0, v4, v4, 0x1, v9, v10)) {
v6 = strerror(*(__errno_location()));
v5 = "write packet: %s";
sshfatal("mux.c", "mux_client_request_stop_listening", 0x89c, 0x1, 0x1, 0x0, *(&v7));
}
sshbuf_reset(v4);
if (mux_client_read_packet(a0, v4, v4, 0x1, v9, v10)) {
v6 = strerror(*(__errno_location()));
v5 = "read from master failed: %s";
sshfatal("mux.c", "mux_client_request_stop_listening", 0x8a2, 0x1, 0x1, 0x0, *(&v7));
}
v2 = sshbuf_get_u32(v4, &v0, &v0);
if (v2 || (v2 = sshbuf_get_u32(v4, &v1, &v1), v2)) {
v5 = "parse";
sshfatal("mux.c", "mux_client_request_stop_listening", 0x8a6, 0x1, 0x1, ssh_err(v2), *(&v7));
}
if (*(&v1) != muxclient_request_id) {
v5 = *(&v1);
v4 = muxclient_request_id;
v3 = "out of sequence reply: my id %u theirs %u";
sshfatal("mux.c", "mux_client_request_stop_listening", 0x8a8, 0x1, 0x1, 0x0, *(&v7));
}
v11 = *(&v0);
if (*(&v0) == 2147483651) {
LABEL_40866c:
v2 = sshbuf_get_cstring(v4, &v3, 0x0, &v3);
if (v2) {
v5 = "parse error message";
sshfatal("mux.c", "mux_client_request_stop_listening", 0x8b4, 0x1, 0x1, ssh_err(v2), *(&v7));
}
v6 = v3;
v5 = "stop listening request failed: %s";
sshfatal("mux.c", "mux_client_request_stop_listening", 0x8b5, 0x1, 0x1, 0x0, *(&v7));
} else {
if (!(v11 <= 2147483651))
goto LABEL_408709;
switch (v11) {
case 2147483649:
break;
case 2147483650:
v2 = sshbuf_get_cstring(v4, &v3, 0x0, &v3);
if (v2) {
v5 = "parse error message";
sshfatal("mux.c", "mux_client_request_stop_listening", 0x8b0, 0x1, 0x1, ssh_err(v2), *(&v7));
}
v6 = v3;
v5 = "Master refused stop listening request: %s";
sshfatal("mux.c", "mux_client_request_stop_listening", 0x8b1, 0x0, 0x1, 0x0, *(&v7));
goto LABEL_40866c;
default:
LABEL_408709:
v6 = *(&v0);
v5 = "unexpected response from master 0x%08x";
sshfatal("mux.c", "mux_client_request_stop_listening", 0x8b7, 0x1, 0x1, 0x0, *(&v7));
}
}
sshbuf_free(v4);
muxclient_request_id = muxclient_request_id + 1;
v13 = v5 ^ v12[5];
return;
}
|
int deflatePrime(strm, bits, value)
z_streamp strm;
int bits;
int value;
{
deflate_state *s;
int put;
if (deflateStateCheck(strm)) return (-2);
s = strm->state;
if (bits < 0 || bits > 16 ||
s->sym_buf < s->pending_out + ((16 + 7) >> 3))
return (-5);
do {
put = 16 - s->bi_valid;
if (put > bits)
put = bits;
s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
s->bi_valid += put;
_tr_flush_bits(s);
value >>= put;
bits -= put;
} while (bits);
return 0;
}
| long long deflatePrime(struct_0 *a0, unsigned long a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
struct_1 *v3;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
v1 = a1;
v0 = a2;
if (deflateStateCheck(a0)) {
v6 = 4294967294;
} else {
v3 = a0->field_38;
if (v1 >= 0 && v1 <= 16 && v3->field_1700 >= v3->field_20 + 2) {
while (true) {
v2 = 16 - v3->field_1734;
if (v2 > v1)
v2 = v1;
v7 = v3->field_1734;
v8 = ((1 << (v2 & 31)) - 1 & v0) << (v3->field_1734 & 31);
v3->field_1730 = v3->field_1730 | (((1 << (v2 & 31)) - 1 & v0) << (v3->field_1734 & 31));
v9 = v3->field_1734 + v2;
v3->field_1734 = v3->field_1734 + v2;
_tr_flush_bits(v3, v8, v9, v7);
v0 >>= v2 & 31;
v1 -= v2;
if (!v1)
break;
}
v6 = 0;
}
if (v3->field_1700 < v3->field_20 + 2 || v1 < 0 || v1 > 16)
v6 = 4294967291;
}
return v6;
}
|
char *
_getenv (name)
const char *name;
{
return (getenv (name));
}
| long long _getenv(char *a0) {
return getenv(a0);
}
|
static
void pubkey_keyid(common_info_st * cinfo)
{
gnutls_pubkey_t pubkey;
uint8_t fpr[64];
char txt[64*2+1];
int ret;
size_t size, fpr_size;
gnutls_datum_t tmp;
unsigned flags;
pubkey = find_pubkey(
((void *)0)
, cinfo);
if (pubkey == 0) {
fprintf(
stderr
, "find public key error\n");
app_exit(1);
}
if (cinfo->hash == GNUTLS_DIG_SHA1 || cinfo->hash == GNUTLS_DIG_UNKNOWN)
flags = GNUTLS_KEYID_USE_SHA1;
else if (cinfo->hash == GNUTLS_DIG_SHA512)
flags = GNUTLS_KEYID_USE_SHA512;
else if (cinfo->hash == GNUTLS_DIG_SHA256)
flags = GNUTLS_KEYID_USE_SHA256;
else {
fprintf(
stderr
, "Cannot calculate key ID with the provided hash (use sha1, sha256 or sha512)\n");
app_exit(1);
}
fpr_size = sizeof(fpr);
ret = gnutls_pubkey_get_key_id(pubkey, flags, fpr, &fpr_size);
if (ret < 0) {
fprintf(
stderr
,
"get_key_id: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
tmp.data = fpr;
tmp.size = fpr_size;
size = sizeof(txt);
ret = gnutls_hex_encode(&tmp, txt, &size);
if (ret < 0) {
fprintf(
stderr
,
"hex_encode: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
fputs(txt, outfile);
fputs("\n", outfile);
gnutls_pubkey_deinit(pubkey);
return;
}
| void pubkey_keyid(long param_1)
{
int iVar1;
undefined8 uVar2;
long in_FS_OFFSET;
undefined4 local_108;
undefined8 local_100;
undefined8 local_f8;
long local_f0;
undefined *local_e8;
undefined4 local_e0;
undefined local_d8 [64];
char local_98 [136];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_f0 = find_pubkey(0,param_1);
if (local_f0 == 0) {
fprintf(stderr,"find public key error\n");
app_exit(1);
}
if ((*(int *)(param_1 + 0xb0) == 3) || (*(int *)(param_1 + 0xb0) == 0)) {
local_108 = 0;
}
else if (*(int *)(param_1 + 0xb0) == 8) {
local_108 = 2;
}
else {
if (*(int *)(param_1 + 0xb0) != 6) {
fprintf(stderr,"Cannot calculate key ID with the provided hash (use sha1, sha256 or sha512)\n"
);
app_exit(1);
}
local_108 = 1;
}
local_f8 = 0x40;
iVar1 = gnutls_pubkey_get_key_id(local_f0,local_108,local_d8,&local_f8);
if (iVar1 < 0) {
uVar2 = gnutls_strerror(iVar1);
fprintf(stderr,"get_key_id: %s\n",uVar2);
app_exit(1);
}
local_e8 = local_d8;
local_e0 = (undefined4)local_f8;
local_100 = 0x81;
iVar1 = gnutls_hex_encode(&local_e8,local_98,&local_100);
if (iVar1 < 0) {
uVar2 = gnutls_strerror(iVar1);
fprintf(stderr,"hex_encode: %s\n",uVar2);
app_exit(1);
}
fputs(local_98,outfile);
fputs("\n",outfile);
gnutls_pubkey_deinit(local_f0);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
void
rl_check_signals (void)
{
do { if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); } while (0);
}
| long long rl_check_signals(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned long long v1;
v1 = _rl_caught_signal;
if (_rl_caught_signal)
v1 = _rl_signal_handler(_rl_caught_signal, a1, a2, a3, a4, a5);
return v1;
}
|
size_t
strlcat(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
size_t n = siz;
size_t dlen;
;
;
while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return(dlen + strlen(s));
while (*s != '\0') {
if (n != 1) {
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src));
}
| long long strlcat(unsigned long long a0, char *a1, unsigned long long a2) {
char *v0;
char *v1;
unsigned long v2;
unsigned long v3;
unsigned long long v5;
char *v6;
unsigned long long v7;
v0 = a0;
v1 = a1;
v2 = a2;
while (true) {
v5 = v2;
v2 -= 1;
if (!v5)
break;
if (!*(v0))
break;
v0 += 1;
}
v3 = &v0[-1 * a0];
if (!v2) {
v7 = strlen(v1) + v3;
} else {
for (v2 = a2 - v3; *(v1); v1 += 1) {
if (v2 != 1) {
v6 = v0;
v0 += 1;
*(v6) = *(v1);
v2 -= 1;
}
}
*(v0) = 0;
v7 = v3 + v1 - a1;
}
return v7;
}
|
static struct directory *
find_directory (const char *name)
{
if (! directory_table)
return 0;
else
{
char *caname = normalize_filename (chdir_current, name);
struct directory *dir = make_directory (name, caname);
struct directory *ret = hash_lookup (directory_table, dir);
free_directory (dir);
return ret;
}
}
| int find_directory(char *a0) {
unsigned int v0;
void* v1;
unsigned long v2;
unsigned int v4;
if (!directory_table) {
v4 = 0;
} else {
*(&v0) = normalize_filename(chdir_current, a0, a0);
v1 = make_directory(a0, *(&v0));
v2 = hash_lookup(directory_table, v1, v1);
free_directory(v1);
v4 = v2;
}
return v4;
}
|
static int
is_cclass (c, name)
int c;
const char *name;
{
enum char_class char_class;
int result;
char_class = is_valid_cclass (name);
if (char_class == CC_NO_CLASS)
return -1;
result = cclass_test (c, char_class);
return (result);
}
| long is_cclass(int a1, const char *a2)
{
int valid;
valid = is_valid_cclass(a2);
if ( valid )
return (unsigned int)cclass_test(a1, valid);
else
return 0xFFFFFFFFLL;
}
|
_Bool
filter_should_skip(struct tar_entry *ti)
{
struct filter_node *f;
_Bool
skip =
0
;
if (!filter_head)
return
0
;
for (f = filter_head; f !=
((void *)0)
; f = f->next) {
debug(dbg_eachfile, "filter comparing '%s' and '%s'",
&ti->name[1], f->pattern);
if (fnmatch(f->pattern, &ti->name[1], 0) == 0) {
if (f->include) {
skip =
0
;
debug(dbg_eachfile, "filter including %s",
ti->name);
} else {
skip =
1
;
debug(dbg_eachfile, "filter removing %s",
ti->name);
}
}
}
if (skip && (ti->type == TAR_FILETYPE_DIR ||
ti->type == TAR_FILETYPE_SYMLINK)) {
debug(dbg_eachfile,
"filter seeing if '%s' needs to be reincluded",
&ti->name[1]);
for (f = filter_head; f !=
((void *)0)
; f = f->next) {
const char *wildcard;
int path_len;
if (!f->include)
continue;
wildcard = strpbrk(f->pattern, "*?[\\");
if (wildcard)
path_len = wildcard - f->pattern;
else
path_len = strlen(f->pattern);
while (path_len && f->pattern[path_len - 1] == '/')
path_len--;
debug(dbg_eachfiledetail,
"filter subpattern '%.*s'", path_len, f->pattern);
if (strncmp(&ti->name[1], f->pattern, path_len) == 0) {
debug(dbg_eachfile, "filter reincluding %s",
ti->name);
return
0
;
}
}
}
return skip;
}
| long long filter_should_skip(struct_0 *a0) {
char v0;
unsigned int v1;
struct_1 *v2;
unsigned long v3;
void* v5;
unsigned long long v6;
v0 = 0;
if (!filter_head) {
v5 = 0;
} else {
for (v2 = filter_head; v2; v2 = v2->field_0) {
debug(0x8, "filter comparing '%s' and '%s'", a0->field_8 + 1, v2->field_8);
if (!fnmatch(v2->field_8, a0->field_8 + 1, 0x0)) {
if (v2->field_10) {
v0 = 0;
debug(0x8, "filter including %s", a0->field_8, v6);
} else {
v0 = 1;
debug(0x8, "filter removing %s", a0->field_8, v6);
}
}
}
if (v0) {
if (a0->field_4 != 53 && !(a0->field_4 == 50))
goto LABEL_40030c;
debug(0x8, "filter seeing if '%s' needs to be reincluded", a0->field_8 + 1, v2->field_8);
v2 = filter_head;
while (true) {
if (!v2)
break;
if (!(v2->field_10 ^ 1)) {
v3 = strpbrk(v2->field_8, "*?[\\");
if (v3)
v1 = v3 - v2->field_8;
else
v1 = strlen(v2->field_8);
while (true) {
if (!v1)
break;
if (*((v2->field_8 + v1 - 1)) != 47)
break;
v1 -= 1;
}
debug(0x40, "filter subpattern '%.*s'", v1, v2->field_8);
if (!strncmp(a0->field_8 + 1, v2->field_8, v1)) {
debug(0x8, "filter reincluding %s", a0->field_8, v6);
v5 = 0;
goto LABEL_400310;
}
}
v2 = v2->field_0;
}
}
LABEL_40030c:
v5 = v0;
}
LABEL_400310:
return v5;
}
|
static int
ct_conv_cbuff_resize(ct_buffer_t *conv, size_t csize)
{
void *p;
if (csize <= conv->csize)
return 0;
conv->csize = csize;
p = realloc(conv->cbuff, conv->csize * sizeof(*conv->cbuff));
if (p ==
((void *)0)
) {
conv->csize = 0;
free(conv->cbuff);
conv->cbuff =
((void *)0)
;
return -1;
}
conv->cbuff = p;
return 0;
}
| int ct_conv_cbuff_resize(unsigned long long a0[2], unsigned long a1) {
unsigned long v0;
unsigned int v2;
if (a1 <= a0[1]) {
v2 = 0;
} else {
a0[1] = a1;
v0 = realloc(a0[0], a0[1]);
if (!v0) {
a0[1] = 0;
free(a0[0]);
a0[0] = 0;
v2 = -1;
} else {
a0[0] = v0;
v2 = 0;
}
}
return v2;
}
|
void
usage(void)
{
(void) fprintf(
stderr
,
"usage: scp [-346ABCOpqRrsTv] [-c cipher] [-D sftp_server_path] [-F ssh_config]\n"
" [-i identity_file] [-J destination] [-l limit]\n"
" [-o ssh_option] [-P port] [-S program] source ... target\n");
exit(1);
}
| void usage() {
fprintf(stderr, "usage: scp [-346ABCOpqRrsTv] [-c cipher] [-D sftp_server_path] [-F ssh_config]\n [-i identity_file] [-J destination] [-l limit]\n [-o ssh_option] [-P port] [-S program] source ... target\n");
exit(0x1);
}
|
int do_multiroute(int argc, char **argv)
{
if (argc < 1)
return mroute_list(0,
((void *)0)
);
if (matches(*argv, "list") == 0 || matches(*argv, "show") == 0
|| matches(*argv, "lst") == 0)
return mroute_list(argc-1, argv+1);
if (matches(*argv, "help") == 0)
usage();
fprintf(
stderr
, "Command \"%s\" is unknown, try \"ip mroute help\".\n", *argv);
exit(-1);
}
| long long do_multiroute(unsigned long a0, unsigned long long *a1) {
unsigned long long v1;
if (a0 <= 0) {
v1 = mroute_list(0x0, 0x0);
} else {
if (!(matches(*(a1), "list") ^ 1) && !(matches(*(a1), "show") ^ 1) && !(matches(*(a1), "lst") ^ 1)) {
if ((matches(*(a1), "help") ^ 1))
usage();
fprintf(stderr, "Command \"%s\" is unknown, try \"ip mroute help\".\n", *(a1));
exit(0xffffffff);
}
v1 = mroute_list(a0 - 1, a1 + 1);
}
return v1;
}
|
test_code_t test_gost_cnt(gnutls_session_t session)
{
int ret;
if (gnutls_fips140_mode_enabled())
return TEST_IGNORE;
sprintf(prio_str,
"NONE:" "+GOST28147-TC26Z-CNT:" "+COMP-NULL" ":%s:"
"+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%s", protocol_str, rest);
{ int _ret; if ((_ret=__gnutls_priority_set_direct(session, prio_str, 987)) != TEST_SUCCEED) { return _ret; } };
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
return ret;
}
| long test_gost_cnt(long a1)
{
unsigned int v2;
if ( (unsigned int)gnutls_fips140_mode_enabled() )
return 3LL;
sprintf(
prio_str,
"NONE:+GOST28147-TC26Z-CNT:+COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+E"
"CDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s",
protocol_str,
rest);
v2 = _gnutls_priority_set_direct(a1, prio_str, 0x3DBu);
if ( v2 )
return v2;
gnutls_credentials_set(a1, 1LL, xcred);
return (unsigned int)test_do_handshake(a1);
}
|
void
urandom_close ()
{
if (urandfd >= 0)
close (urandfd);
urandfd = -1;
}
| long long urandom_close() {
unsigned long long v1;
v1 = urandfd;
if (urandfd >= 0)
v1 = close(urandfd);
urandfd = -1;
return v1;
}
|
static void usage(void)
{
fprintf(
stderr
,
"Usage: ip addrlabel { add | del } prefix PREFIX [ dev DEV ] [ label LABEL ]\n"
" ip addrlabel [ list | flush | help ]\n");
exit(-1);
}
| void usage() {
fprintf(stderr, "Usage: ip addrlabel { add | del } prefix PREFIX [ dev DEV ] [ label LABEL ]\n ip addrlabel [ list | flush | help ]\n");
exit(0xffffffff);
}
|
char **
strvec_mcreate (n)
int n;
{
return ((char **)sh_malloc(((n) * sizeof (char *)), "stringvec.c", 48));
}
| long long strvec_mcreate(unsigned long a0) {
return sh_malloc(a0 * 8, "stringvec.c", 0x30);
}
|
static
void compress ( Char *name )
{
FILE *inStr;
FILE *outStr;
Int32 n, i;
struct stat statBuf;
deleteOutputOnInterrupt = ((Bool)0);
if (name ==
((void *)0)
&& srcMode != 1)
panic ( "compress: bad modes\n" );
switch (srcMode) {
case 1:
copyFileName ( inName, (Char*)"(stdin)" );
copyFileName ( outName, (Char*)"(stdout)" );
break;
case 3:
copyFileName ( inName, name );
copyFileName ( outName, name );
strcat ( outName, ".bz2" );
break;
case 2:
copyFileName ( inName, name );
copyFileName ( outName, (Char*)"(stdout)" );
break;
}
if ( srcMode != 1 && containsDubiousChars ( inName ) ) {
if (noisy)
fprintf (
stderr
, "%s: There are no files matching `%s'.\n",
progName, inName );
setExit(1);
return;
}
if ( srcMode != 1 && !fileExists ( inName ) ) {
fprintf (
stderr
, "%s: Can't open input file %s: %s.\n",
progName, inName, strerror(
(*__errno_location ())
) );
setExit(1);
return;
}
for (i = 0; i < 4; i++) {
if (hasSuffix(inName, zSuffix[i])) {
if (noisy)
fprintf (
stderr
,
"%s: Input file %s already has %s suffix.\n",
progName, inName, zSuffix[i] );
setExit(1);
return;
}
}
if ( srcMode == 3 || srcMode == 2 ) {
stat(inName, &statBuf);
if (
((((
statBuf.st_mode
)) & 0170000) == (0040000))
) {
fprintf(
stderr
,
"%s: Input file %s is a directory.\n",
progName,inName);
setExit(1);
return;
}
}
if ( srcMode == 3 && !forceOverwrite && notAStandardFile ( inName )) {
if (noisy)
fprintf (
stderr
, "%s: Input file %s is not a normal file.\n",
progName, inName );
setExit(1);
return;
}
if ( srcMode == 3 && fileExists ( outName ) ) {
if (forceOverwrite) {
remove(outName);
} else {
fprintf (
stderr
, "%s: Output file %s already exists.\n",
progName, outName );
setExit(1);
return;
}
}
if ( srcMode == 3 && !forceOverwrite &&
(n=countHardLinks ( inName )) > 0) {
fprintf (
stderr
, "%s: Input file %s has %d other link%s.\n",
progName, inName, n, n > 1 ? "s" : "" );
setExit(1);
return;
}
if ( srcMode == 3 ) {
saveInputFileMetaInfo ( inName );
}
switch ( srcMode ) {
case 1:
inStr =
stdin
;
outStr =
stdout
;
if ( isatty ( fileno (
stdout
) ) ) {
fprintf (
stderr
,
"%s: I won't write compressed data to a terminal.\n",
progName );
fprintf (
stderr
, "%s: For help, type: `%s --help'.\n",
progName, progName );
setExit(1);
return;
};
break;
case 2:
inStr = fopen ( inName, "rb" );
outStr =
stdout
;
if ( isatty ( fileno (
stdout
) ) ) {
fprintf (
stderr
,
"%s: I won't write compressed data to a terminal.\n",
progName );
fprintf (
stderr
, "%s: For help, type: `%s --help'.\n",
progName, progName );
if ( inStr !=
((void *)0)
) fclose ( inStr );
setExit(1);
return;
};
if ( inStr ==
((void *)0)
) {
fprintf (
stderr
, "%s: Can't open input file %s: %s.\n",
progName, inName, strerror(
(*__errno_location ())
) );
setExit(1);
return;
};
break;
case 3:
inStr = fopen ( inName, "rb" );
outStr = fopen_output_safely ( outName, "wb" );
if ( outStr ==
((void *)0)
) {
fprintf (
stderr
, "%s: Can't create output file %s: %s.\n",
progName, outName, strerror(
(*__errno_location ())
) );
if ( inStr !=
((void *)0)
) fclose ( inStr );
setExit(1);
return;
}
if ( inStr ==
((void *)0)
) {
fprintf (
stderr
, "%s: Can't open input file %s: %s.\n",
progName, inName, strerror(
(*__errno_location ())
) );
if ( outStr !=
((void *)0)
) fclose ( outStr );
setExit(1);
return;
};
break;
default:
panic ( "compress: bad srcMode" );
break;
}
if (verbosity >= 1) {
fprintf (
stderr
, " %s: ", inName );
pad ( inName );
fflush (
stderr
);
}
outputHandleJustInCase = outStr;
deleteOutputOnInterrupt = ((Bool)1);
compressStream ( inStr, outStr );
outputHandleJustInCase =
((void *)0)
;
if ( srcMode == 3 ) {
applySavedTimeInfoToOutputFile ( outName );
deleteOutputOnInterrupt = ((Bool)0);
if ( !keepInputFiles ) {
IntNative retVal = remove ( inName );
{ if ((retVal) != 0) ioError(); };
}
}
deleteOutputOnInterrupt = ((Bool)0);
}
| void compress(long param_1)
{
char cVar1;
uint uVar2;
int iVar3;
int *piVar4;
char *pcVar5;
undefined *puVar6;
long in_FS_OFFSET;
int local_c4;
FILE *local_b8;
FILE *local_b0;
stat local_a8;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
deleteOutputOnInterrupt = 0;
if ((param_1 == 0) && (srcMode != 1)) {
panic("compress: bad modes\n");
}
if (srcMode == 3) {
copyFileName(inName,param_1);
copyFileName(outName,param_1);
strcat(outName,".bz2");
}
else if (srcMode < 4) {
if (srcMode == 1) {
copyFileName(inName,"(stdin)");
copyFileName(outName,"(stdout)");
}
else if (srcMode == 2) {
copyFileName(inName,param_1);
copyFileName(outName,"(stdout)");
}
}
if ((srcMode == 1) || (cVar1 = containsDubiousChars(inName), cVar1 == '\0')) {
if ((srcMode == 1) || (cVar1 = fileExists(), cVar1 != '\0')) {
for (local_c4 = 0; local_c4 < 4; local_c4 = local_c4 + 1) {
cVar1 = hasSuffix(inName,*(undefined8 *)(zSuffix + (long)local_c4 * 8));
if (cVar1 != '\0') {
if (noisy != '\0') {
fprintf(stderr,"%s: Input file %s already has %s suffix.\n",progName,inName,
*(undefined8 *)(zSuffix + (long)local_c4 * 8));
}
setExit(1);
goto LAB_00102426;
}
}
if (((srcMode == 3) || (srcMode == 2)) &&
(stat(inName,&local_a8), (local_a8.st_mode & 0xf000) == 0x4000)) {
fprintf(stderr,"%s: Input file %s is a directory.\n",progName,inName);
setExit(1);
}
else if (((srcMode == 3) && (forceOverwrite == '\0')) &&
(cVar1 = notAStandardFile(inName), cVar1 != '\0')) {
if (noisy != '\0') {
fprintf(stderr,"%s: Input file %s is not a normal file.\n",progName,inName);
}
setExit(1);
}
else {
if ((srcMode == 3) && (cVar1 = fileExists(outName), cVar1 != '\0')) {
if (forceOverwrite == '\0') {
fprintf(stderr,"%s: Output file %s already exists.\n",progName,outName);
setExit(1);
goto LAB_00102426;
}
remove(outName);
}
if (((srcMode == 3) && (forceOverwrite == '\0')) &&
(uVar2 = countHardLinks(inName), 0 < (int)uVar2)) {
if ((int)uVar2 < 2) {
puVar6 = &DAT_0010623f;
}
else {
puVar6 = &DAT_0010636c;
}
fprintf(stderr,"%s: Input file %s has %d other link%s.\n",progName,inName,(ulong)uVar2,
puVar6);
setExit(1);
}
else {
if (srcMode == 3) {
saveInputFileMetaInfo(inName);
}
if (srcMode == 3) {
local_b8 = fopen(inName,"rb");
local_b0 = (FILE *)fopen_output_safely(outName,&DAT_001063f2);
if (local_b0 == (FILE *)0x0) {
piVar4 = __errno_location();
pcVar5 = strerror(*piVar4);
fprintf(stderr,"%s: Can\'t create output file %s: %s.\n",progName,outName,pcVar5);
if (local_b8 != (FILE *)0x0) {
fclose(local_b8);
}
setExit(1);
goto LAB_00102426;
}
if (local_b8 == (FILE *)0x0) {
piVar4 = __errno_location();
pcVar5 = strerror(*piVar4);
fprintf(stderr,"%s: Can\'t open input file %s: %s.\n",progName,inName,pcVar5);
if (local_b0 != (FILE *)0x0) {
fclose(local_b0);
}
setExit(1);
goto LAB_00102426;
}
}
else {
if (3 < srcMode) {
LAB_00102334:
panic("compress: bad srcMode");
}
if (srcMode == 1) {
local_b8 = stdin;
local_b0 = stdout;
iVar3 = fileno(stdout);
iVar3 = isatty(iVar3);
if (iVar3 != 0) {
fprintf(stderr,"%s: I won\'t write compressed data to a terminal.\n",progName);
fprintf(stderr,"%s: For help, type: `%s --help\'.\n",progName,progName);
setExit(1);
goto LAB_00102426;
}
}
else {
if (srcMode != 2) goto LAB_00102334;
local_b8 = fopen(inName,"rb");
local_b0 = stdout;
iVar3 = fileno(stdout);
iVar3 = isatty(iVar3);
if (iVar3 != 0) {
fprintf(stderr,"%s: I won\'t write compressed data to a terminal.\n",progName);
fprintf(stderr,"%s: For help, type: `%s --help\'.\n",progName,progName);
if (local_b8 != (FILE *)0x0) {
fclose(local_b8);
}
setExit(1);
goto LAB_00102426;
}
if (local_b8 == (FILE *)0x0) {
piVar4 = __errno_location();
pcVar5 = strerror(*piVar4);
fprintf(stderr,"%s: Can\'t open input file %s: %s.\n",progName,inName,pcVar5);
setExit(1);
goto LAB_00102426;
}
}
}
if (0 < verbosity) {
fprintf(stderr," %s: ",inName);
pad(inName);
fflush(stderr);
}
outputHandleJustInCase = local_b0;
deleteOutputOnInterrupt = 1;
compressStream(local_b8,local_b0);
outputHandleJustInCase = (FILE *)0x0;
if (srcMode == 3) {
applySavedTimeInfoToOutputFile(outName);
deleteOutputOnInterrupt = 0;
if ((keepInputFiles == '\0') && (iVar3 = remove(inName), iVar3 != 0)) {
ioError();
}
}
deleteOutputOnInterrupt = 0;
}
}
}
else {
piVar4 = __errno_location();
pcVar5 = strerror(*piVar4);
fprintf(stderr,"%s: Can\'t open input file %s: %s.\n",progName,inName,pcVar5);
setExit(1);
}
}
else {
if (noisy != '\0') {
fprintf(stderr,"%s: There are no files matching `%s\'.\n",progName,inName);
}
setExit(1);
}
LAB_00102426:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
}
|
static void
fatal (char const *msgid)
{
((!!sizeof (struct { _Static_assert (2, "verify_expr (" "2" ", " "(error (2, 0, \"%s\", gettext (msgid)), assume (false))" ")"); int _gl_dummy; })) ? ((error (2, 0, "%s", gettext (msgid)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (2, 0, "%s", gettext (msgid)), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
}
| void fatal(char *a0) {
gettext(a0);
error(0x2, 0x0, "%s");
}
|
static void
fatal (char const *msgid)
{
((!!sizeof (struct { _Static_assert (2, "verify_expr (" "2" ", " "(error (2, 0, \"%s\", gettext (msgid)), assume (false))" ")"); int _gl_dummy; })) ? ((error (2, 0, "%s", gettext (msgid)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (2, 0, "%s", gettext (msgid)), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
}
| void fatal(undefined8 param_1)
{
undefined8 uVar1;
uVar1 = gettext(param_1);
error(2,0,&DAT_001035db,uVar1);
}
|
int read_yesno(const char *input_str, int def)
{
char input[512];
restart:
fputs(input_str,
stderr
);
if (fgets(input, sizeof(input),
stdin
) ==
((void *)0)
)
return def;
if (((input[0] == '\n') || (input[0] == '\r')))
return def;
if (input[0] == 'y' || input[0] == 'Y')
return 1;
else if (input[0] == 'n' || input[0] == 'N')
return 0;
else
goto restart;
}
| long read_yesno(const char *a1, unsigned int a2)
{
char v3[520];
unsigned long v4;
v4 = __readfsqword(0x28u);
do
{
fputs(a1, stderr);
if ( !fgets(v3, 512, stdin) )
return a2;
if ( v3[0] == 10 || v3[0] == 13 )
return a2;
if ( v3[0] == 121 || v3[0] == 89 )
return 1LL;
}
while ( v3[0] != 110 && v3[0] != 78 );
return 0LL;
}
|
void
assoc_remove (hash, string)
HASH_TABLE *hash;
char *string;
{
BUCKET_CONTENTS *b;
b = hash_remove (string, hash, 0);
if (b)
{
sh_xfree(((char *)b->data), "assoc.c", 123);
sh_xfree((b->key), "assoc.c", 124);
sh_xfree((b), "assoc.c", 125);
}
}
| long long assoc_remove(unsigned long long a0, unsigned long long a1) {
unsigned long long v0[3];
unsigned long long v2;
v2 = hash_remove(a1, a0, 0x0, a0);
v0[0] = v2;
if (v0) {
sh_xfree(v0[2], "assoc.c", 0x7b);
sh_xfree(v0[1], "assoc.c", 0x7c);
v2 = sh_xfree(v0, "assoc.c", 0x7d);
}
return v2;
}
|
void link_user(cron_db * db, user * u) {
if (db->head ==
((void *)0)
)
db->head = u;
if (db->tail)
db->tail->next = u;
u->prev = db->tail;
u->next =
((void *)0)
;
db->tail = u;
}
| void link_user(struct_0 *a0, unsigned long long a1[2]) {
unsigned long long v1[2];
if (!a0->field_0)
a0->field_0 = a1;
if (a0->field_8)
a0->field_8->field_0 = a1;
a1[1] = a0->field_8;
a1[0] = 0;
v1 = a0;
a0->field_8 = &a1[0];
return;
}
|
static inline void
emit_ancillary_info (char const *program)
{
struct infomap { char const *program; char const *node; } const infomap[] = {
{ "[", "test invocation" },
{ "coreutils", "Multi-call invocation" },
{ "sha224sum", "sha2 utilities" },
{ "sha256sum", "sha2 utilities" },
{ "sha384sum", "sha2 utilities" },
{ "sha512sum", "sha2 utilities" },
{
((void *)0)
,
((void *)0)
}
};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && ! (strcmp (program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
}
| void emit_ancillary_info(char *a0) {
unsigned long v0;
unsigned long long v1[2];
char *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void* v16;
void* v17;
char v18;
unsigned long long v23;
unsigned long long *v24;
unsigned long long v25;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
for (v1[0] = &v4; v1[0]; v1[0] = v1 + 1) {
if (!strcmp(a0, v1[0]))
break;
}
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
if (strcmp(a0, "["))
v23 = a0;
else
v23 = "test";
v3 = v23;
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v25 = *(&v18) ^ v24[5];
return;
}
|
ulg updcrc(s, n)
const uch *s;
unsigned n;
{
register ulg c;
if (s ==
((void *)0)
) {
c = 0xffffffffL;
} else {
c = crc;
if (n) do {
c = crc_32_tab[((int)c ^ (*s++)) & 0xff] ^ (c >> 8);
} while (--n);
}
crc = c;
return c ^ 0xffffffffL;
}
| void updcrc(unsigned long a0, unsigned long a1) {
unsigned int v0;
int tmp_33;
char *v1;
unsigned long long v3;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
v1 = a0;
v0 = a1;
if (!v1) {
v3 = 4294967295;
} else {
v3 = crc;
if (v0) {
do {
tmp_33 = v1;
v1 += 1;
v5 = *(tmp_33) ^ v3;
v6 = (&crc_32_tab)[v5] ^ v3 / 0x100;
v3 = v6;
v0 -= 1;
} while (v0);
}
}
crc = v3;
v7 = 4294967295 ^ v3;
return;
}
|
int main(int argc, char **argv)
{
char buf[4096];
char line[80 + 3];
int i, f, ch;
int len = 0;
int remote = 0;
char *p;
char *whoami;
struct passwd *pwd;
buf[0] = 0;
if ((pwd = getpwuid(getuid())) ==
((void *)0)
) {
if (getuid() == 0)
whoami = "root";
else {
fprintf(
stderr
, "You don't exist. Go away.\n");
exit(1);
}
} else
whoami = pwd->pw_name;
while((ch = getopt(argc, argv, "n")) !=
(-1)
)
switch(ch) {
case 'n':
if (geteuid() != 0 && getgid() != getegid()) {
fprintf(
stderr
, "wall -n: not privileged\n");
exit(1);
}
remote = 1;
break;
default:
fprintf(
stderr
, "usage: wall [message]\n");
return 1;
break;
}
if ((argc - optind) > 0) {
for(f = optind; f < argc; f++) {
len += strlen(argv[f]) + 1;
if (len >= 4096 -4) break;
strcat(buf, argv[f]);
if (f < argc-1) strcat(buf, " ");
}
strcat(buf, "\r\n");
} else {
while(fgets(line, 80,
stdin
)) {
for(p = line; *p && *p != '\r' && *p != '\n'; p++)
;
strcpy(p, "\r\n");
len += strlen(line);
if (len >= 4096) break;
strcat(buf, line);
}
}
i = 0;
for (p = buf; *p; p++) {
if (*p == '\n' && ++i >= 20) {
*++p = 0;
break;
}
}
openlog("wall",
0x01
,
(1<<3)
);
syslog(
6
, "wall: user %s broadcasted %d lines (%zu chars)",
whoami, i, strlen(buf));
closelog();
unsetenv("TZ");
wall(buf, remote);
return 0;
}
| int main(unsigned long a0, unsigned long long *a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
char *v5;
unsigned long v6;
unsigned long long *v7;
char v8;
char v9;
unsigned long long v10;
unsigned int v12;
unsigned int v13;
v10 = *(&v10);
v2 = 0;
v3 = 0;
v9 = 0;
v7 = &getpwuid(getuid())->pw_name;
if (!v7) {
v12 = getuid();
if (!v12) {
v6 = "root";
} else {
fprintf(*(&stderr), "You don't exist. Go away.\n");
exit(0x1);
}
} else {
v6 = *(v7);
}
if (!v12 || v7) {
while (true) {
v4 = getopt(a0, a1, "n");
if (v4 == -1) {
if (a0 - optind > 0) {
for (v1 = optind; v1 < a0; v1 += 1) {
v12 = v2 + strlen(a1[v1]) + 1;
v2 = v12;
if (v2 > 4091)
break;
if (v2 <= 4091) {
strcat(&v9, a1[v1]);
if (v1 < a0 - 1)
strcat(&v9, " ");
}
}
strcat(&v9, "\r\n");
} else {
while (true) {
v12 = fgets(&v8, 0x50, stdin);
if (!v12)
break;
for (v5 = &v8; *(v5); v5 += 1) {
if (*(v5) == 13)
break;
if (*(v5) != 13) {
if (*(v5) == 10)
break;
}
}
strcpy(v5, "\r\n");
*(&v12) = v2 + strlen(&v8);
v2 = v12;
if (v2 > 4095)
break;
strcat(&v9, &v8);
}
}
v0 = 0;
for (v5 = &v9; *(v5); v5 += 1) {
if (*(v5) == 10) {
v0 += 1;
if (v0 > 19) {
v5 += 1;
*(v5) = 0;
break;
}
}
}
openlog("wall", 0x1, 0x8);
strlen(&v9);
syslog(0x6, "wall: user %s broadcasted %d lines (%zu chars)");
closelog();
unsetenv("TZ");
wall(&v9, v3, v3);
v12 = 0;
break;
} else if (v4 == 110) {
v12 = geteuid();
if (v12) {
v13 = getgid();
v12 = getegid();
if (v13 != v12) {
fprintf(*(&stderr), "wall -n: not privileged\n");
exit(0x1);
}
}
if (v13 == v12 || !v12)
v3 = 1;
} else {
fprintf(*(&stderr), "usage: wall [message]\n");
v12 = 1;
break;
}
}
return v12;
}
}
|
static SHELL_VAR *
get_comp_wordbreaks (var)
SHELL_VAR *var;
{
if (rl_completer_word_break_characters == 0 && bash_readline_initialized == 0)
enable_hostname_completion (perform_hostname_completion);
return (set_string_value (var, rl_completer_word_break_characters, 0));
}
| long long get_comp_wordbreaks(void* a0) {
if (!rl_completer_word_break_characters && !bash_readline_initialized)
enable_hostname_completion(perform_hostname_completion);
return set_string_value(a0, rl_completer_word_break_characters, 0x0);
}
|
static void
delete_all_files (
_Bool
in_signal_handler)
{
if (! remove_files)
return;
for (int i = files_created; 0 <= --i; )
{
char const *name = make_filename (i);
if (unlink (name) != 0 &&
(*__errno_location ())
!=
2
&& !in_signal_handler)
error (0,
(*__errno_location ())
, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, name));
}
files_created = 0;
}
| void delete_all_files(unsigned long a0) {
unsigned int v0;
char *v1;
unsigned long long v3;
unsigned long long v4;
unsigned long v7;
unsigned long long v8;
unsigned long long v9;
v3 = remove_files ^ 1;
if (!(remove_files ^ 1)) {
v4 = files_created;
v0 = files_created;
while (true) {
v0 -= 1;
if (v0 >= 0) {
v1 = make_filename(v0);
if (!unlink(v1))
continue;
if (*(__errno_location()) == 2)
continue;
v7 = a0 ^ 1;
if (!(a0 ^ 1))
continue;
v8 = quotearg_n_style_colon(0x0, 0x3, v1);
v9 = error(0x0, *(__errno_location()), "%s");
} else {
files_created = 0;
break;
}
}
}
return;
}
|
static int
confirm_sk_overwrite(const char *application, const char *user)
{
char yesno[3];
printf("A resident key scoped to '%s' with user id '%s' already "
"exists.\n", application ==
((void *)0)
? "ssh:" : application,
user ==
((void *)0)
? "null" : user);
printf("Overwrite key in token (y/n)? ");
fflush(
stdout
);
if (fgets(yesno, sizeof(yesno),
stdin
) ==
((void *)0)
)
return 0;
if (yesno[0] != 'y' && yesno[0] != 'Y')
return 0;
return 1;
}
| int confirm_sk_overwrite(unsigned long a0, unsigned long a1) {
char v0;
unsigned int v3;
unsigned int v4;
if (!a0)
v3 = &g_412bfc;
else
v3 = a0;
printf("A resident key scoped to '%s' with user id '%s' already exists.\n", v3, (!a1 ? a1 : &g_412e10));
printf("Overwrite key in token (y/n)? ");
fflush(stdout);
if (!fgets(&v0, 0x3, stdin)) {
v4 = 0;
return v4;
}
switch (v0) {
case 89: case 121:
v4 = 1;
return v4;
default:
v4 = 0;
return v4;
}
}
|
int
sh_mbsnlen(src, srclen, maxlen)
const char *src;
size_t srclen;
int maxlen;
{
int count;
int sind;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
for (sind = count = 0; src[sind]; )
{
count++;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((src)[sind]); if (_f) mblength = 1; else if (locale_utf8locale && (((src)[sind] & 0x80) == 0)) mblength = (src)[sind] != 0; else { state_bak = state; mblength = mbrlen ((src) + (sind), (srclen) - (sind), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (sind)++; } else if (mblength == 0) (sind)++; else (sind) += mblength; } else (sind)++; } while (0);
if (sind > maxlen)
break;
}
return count;
}
| long long sh_mbsnlen(char *a0, unsigned long a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
memset(&v4, 0x0, 0x8);
v0 = 0;
v1 = v0;
while (true) {
if (!a0[v1])
goto LABEL_400392;
v0 += 1;
if (locale_mb_cur_max > 1)
break;
v1 += 1;
LABEL_40036f:
if (v1 > a2)
goto LABEL_400392;
}
v2 = is_basic(a0[v1]);
if (v2) {
v3 = 1;
goto LABEL_400332;
}
if (locale_utf8locale && a0[v1] >= 0) {
v3 = a0[v1];
goto LABEL_400332;
}
v5 = v4;
v3 = mbrlen(&a0[v1], a1 - v1, &v4, &a0[v1]);
LABEL_400332:
if (v3 != -2 && v3 != -1) {
if (v3) {
v1 += v3;
goto LABEL_40036f;
} else {
v1 += 1;
goto LABEL_40036f;
}
}
v4 = v5;
v1 += 1;
LABEL_400392:
return v0;
}
|
void app_exit(int val)
{
if (val != 0) {
if (outfile_name)
(void)remove(outfile_name);
}
exit(val);
}
| void app_exit(unsigned long a0) {
if (a0 && outfile_name)
remove(outfile_name);
exit(a0);
}
|
static int
listpackages(const char *const *argv)
{
struct pkg_array array;
struct pkginfo *pkg;
int i;
int rc = 0;
struct list_format fmt;
struct pager *pager;
if (!opt_loadavail)
modstatdb_open(msdbrw_readonly);
else
modstatdb_open(msdbrw_readonly | msdbrw_available_readonly);
pkg_array_init_from_hash(&array);
pkg_array_sort(&array, pkg_sorter_by_nonambig_name_arch);
memset(&fmt, 0, sizeof(fmt));
pager = pager_spawn(gettext("showing package list on pager"));
if (!*argv) {
for (i = 0; i < array.n_pkgs; i++) {
pkg = array.pkgs[i];
if (pkg->status == PKG_STAT_NOTINSTALLED)
array.pkgs[i] =
((void *)0)
;
}
pkg_array_foreach(&array, pkg_array_list_item, &fmt);
} else {
rc = pkg_array_match_patterns(&array, pkg_array_list_item, &fmt, argv);
}
m_output(
stdout
, gettext("<standard output>"));
m_output(
stderr
, gettext("<standard error>"));
pager_reap(pager);
pkg_array_destroy(&array);
modstatdb_shutdown();
return rc;
}
| undefined4 listpackages(long *param_1)
{
undefined8 uVar1;
undefined8 uVar2;
long in_FS_OFFSET;
int local_50;
undefined4 local_4c;
int local_38 [2];
long local_30;
undefined local_28 [24];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_4c = 0;
if (opt_loadavail == 0) {
modstatdb_open(0);
}
else {
modstatdb_open(0x100);
}
pkg_array_init_from_hash(local_38);
pkg_array_sort(local_38,uRam0000000000100915);
memset(local_28,0,0x14);
uVar1 = gettext("showing package list on pager");
uVar1 = pager_spawn(uVar1);
if (*param_1 == 0) {
for (local_50 = 0; local_50 < local_38[0]; local_50 = local_50 + 1) {
if (*(int *)(*(long *)(local_30 + (long)local_50 * 8) + 0x18) == 0) {
*(undefined8 *)(local_30 + (long)local_50 * 8) = 0;
}
}
pkg_array_foreach(local_38,pkg_array_list_item,local_28);
}
else {
local_4c = pkg_array_match_patterns(local_38,pkg_array_list_item,local_28,param_1);
}
uVar2 = gettext("<standard output>");
m_output(stdout,uVar2);
uVar2 = gettext("<standard error>");
m_output(stderr,uVar2);
pager_reap(uVar1);
pkg_array_destroy(local_38);
modstatdb_shutdown();
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_4c;
}
|
static const struct kexalg *
kex_alg_by_name(const char *name)
{
const struct kexalg *k;
for (k = kexalgs; k->name !=
((void *)0)
; k++) {
if (strcmp(k->name, name) == 0)
return k;
}
return
((void *)0)
;
}
| int kex_alg_by_name(char *a0) {
unsigned long long v0;
unsigned int v2;
v0 = &kexalgs;
while (true) {
if (!*(v0)) {
v2 = 0;
return v2;
} else if (strcmp(*(v0), a0)) {
v0 += 24;
} else {
v2 = v0;
return v2;
}
}
}
|
static inline void
emit_ancillary_info (char const *program)
{
struct infomap { char const *program; char const *node; } const infomap[] = {
{ "[", "test invocation" },
{ "coreutils", "Multi-call invocation" },
{ "sha224sum", "sha2 utilities" },
{ "sha256sum", "sha2 utilities" },
{ "sha384sum", "sha2 utilities" },
{ "sha512sum", "sha2 utilities" },
{
((void *)0)
,
((void *)0)
}
};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && ! (strcmp (program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
}
| void emit_ancillary_info(char *a0) {
unsigned long v0;
unsigned long long v1[2];
char *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void* v16;
void* v17;
char v18;
unsigned long long v20;
unsigned long long *v21;
unsigned long long v22;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
v1[0] = &v4;
while (true) {
if (!v1[0])
break;
if (!strcmp(a0, v1[0]))
break;
v1[0] = v1 + 1;
}
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
if (!strcmp(a0, "["))
v20 = "test";
else
v20 = a0;
v3 = v20;
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v22 = *(&v18) ^ v21[5];
return;
}
|
void
sv_ifs (name)
char *name;
{
SHELL_VAR *v;
v = find_variable ("IFS");
setifs (v);
}
| void sv_ifs(void)
{
undefined8 uVar1;
uVar1 = find_variable(&DAT_0010ba99);
setifs(uVar1);
return;
}
|
static inline __u8 rta_getattr_u8(const struct rtattr *rta)
{
return *(__u8 *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| long rta_getattr_u8(long a1)
{
return *(unsigned char *)(a1 + 4);
}
|
int
launch (struct buildcmd_control *ctl, void *usercontext, int argc, char **argv)
{
pid_t child_pid;
static int first_time = 1;
struct exec_val *execp = usercontext;
(void) ctl;
(void) argc;
if (options.debug_options & DebugExec)
{
int i;
fprintf (
stderr
, "DebugExec: launching process (argc=%"
"l" "u"
"):",
(uintmax_t) execp->state.cmd_argc - 1);
for (i=0; i<execp->state.cmd_argc -1; ++i)
{
fprintf (
stderr
, " %s",
safely_quote_err_filename (0, execp->state.cmd_argv[i]));
}
fprintf (
stderr
, "\n");
}
rpl_fflush
(
stdout
);
rpl_fflush
(
stderr
);
if (first_time)
{
first_time = 0;
signal (
17
,
((__sighandler_t) 0)
);
}
child_pid = fork ();
if (child_pid == -1)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"cannot fork\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, gettext ("cannot fork")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, gettext ("cannot fork")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
if (child_pid == 0)
{
((void) sizeof ((((void *)0)
!= execp->wd_for_exec
) ? 1 : 0), __extension__ ({ if (((void *)0)
!= execp->wd_for_exec
) ; else __assert_fail (
"NULL != execp->wd_for_exec"
, "exec.c", 321, __extension__ __PRETTY_FUNCTION__); }))
;
if (!prep_child_for_exec (execp->close_stdin, execp->wd_for_exec))
{
_exit (1);
}
else
{
if (fd_leak_check_is_enabled ())
{
complain_about_leaky_fds ();
}
}
if (bc_args_exceed_testing_limit (argv))
(*__errno_location ())
=
7
;
else
execvp (argv[0], argv);
error (0,
(*__errno_location ())
, "%s",
safely_quote_err_filename (0, argv[0]));
_exit (1);
}
while (waitpid (child_pid, &(execp->last_child_status), 0) == (pid_t) -1)
{
if (
(*__errno_location ())
!=
4
)
{
error (0,
(*__errno_location ())
, gettext ("error waiting for %s"),
safely_quote_err_filename (0, argv[0]));
state.exit_status =
1
;
return 0;
}
}
if (
(((signed char) (((
execp->last_child_status
) & 0x7f) + 1) >> 1) > 0)
)
{
error (0, 0, gettext ("%s terminated by signal %d"),
quotearg_n_style (0, options.err_quoting_style, argv[0]),
((
execp->last_child_status
) & 0x7f)
);
if (execp->multiple)
{
state.exit_status =
1
;
}
return 1;
}
int ex =
(((
execp->last_child_status
) & 0xff00) >> 8)
;
if (options.debug_options & DebugExec)
{
fprintf (
stderr
,
"DebugExec: process (PID=%ld) terminated with exit status: %d\n",
(long) child_pid, ex);
}
if (0 == ex)
{
return 1;
}
else
{
if (execp->multiple)
{
state.exit_status =
1
;
}
return 1;
}
}
| undefined8 launch(undefined8 param_1,char *param_2,undefined8 param_3,char **param_4)
{
char cVar1;
__pid_t __pid;
__pid_t _Var2;
uint uVar3;
undefined8 uVar4;
int *piVar5;
undefined8 uVar6;
int local_2c;
if ((_fd_leak_check_is_enabled & 0x20) != 0) {
fprintf(stderr,"DebugExec: launching process (argc=%lu):",*(long *)(param_2 + 0x60) + -1);
for (local_2c = 0; (ulong)(long)local_2c < *(long *)(param_2 + 0x60) - 1U;
local_2c = local_2c + 1) {
uVar4 = safely_quote_err_filename
(0,*(undefined8 *)(*(long *)(param_2 + 0x68) + (long)local_2c * 8));
fprintf(stderr," %s",uVar4);
}
fprintf(stderr,"\n");
}
rpl_fflush(stdout);
rpl_fflush();
if (first_time_6332 != 0) {
first_time_6332 = 0;
signal(0x11,(__sighandler_t)0x0);
}
__pid = fork();
if (__pid == -1) {
uVar4 = gettext("cannot fork");
piVar5 = __errno_location();
error(1,*piVar5,uVar4);
}
if (__pid == 0) {
if (*(long *)(param_2 + 0xc0) == 0) {
__assert_fail("NULL != execp->wd_for_exec","exec.c",0x141,"launch");
}
cVar1 = prep_child_for_exec(param_2[0xbc],*(undefined8 *)(param_2 + 0xc0));
if (cVar1 == '\x01') {
cVar1 = fd_leak_check_is_enabled();
if (cVar1 != '\0') {
complain_about_leaky_fds();
}
cVar1 = bc_args_exceed_testing_limit(param_4);
if (cVar1 == '\0') {
execvp(*param_4,param_4);
}
else {
piVar5 = __errno_location();
*piVar5 = 7;
}
uVar4 = safely_quote_err_filename(0,*param_4);
piVar5 = __errno_location();
error(0,*piVar5,&DAT_00100a9b,uVar4);
_exit(1);
}
_exit(1);
}
while (_Var2 = waitpid(__pid,(int *)(param_2 + 200),0), _Var2 == -1) {
piVar5 = __errno_location();
if (*piVar5 != 4) {
uVar4 = safely_quote_err_filename(0,*param_4);
uVar6 = gettext("error waiting for %s");
piVar5 = __errno_location();
error(0,*piVar5,uVar6,uVar4);
_DAT_00101044 = 1;
return 0;
}
}
if ('\0' < (char)(((byte)*(undefined4 *)(param_2 + 200) & 0x7f) + 1) >> 1) {
uVar3 = *(uint *)(param_2 + 200);
uVar4 = quotearg_n_style(0,DAT_0010112c,*param_4);
uVar6 = gettext("%s terminated by signal %d");
error(0,0,uVar6,uVar4,uVar3 & 0x7f);
if (*param_2 != '\0') {
_DAT_00101044 = 1;
}
return 1;
}
uVar3 = *(int *)(param_2 + 200) >> 8 & 0xff;
if ((_fd_leak_check_is_enabled & 0x20) != 0) {
fprintf(stderr,"DebugExec: process (PID=%ld) terminated with exit status: %d\n",(long)__pid,
(ulong)uVar3);
}
if (uVar3 == 0) {
return 1;
}
if (*param_2 != '\0') {
_DAT_00101044 = 1;
}
return 1;
}
|
static
void start_if_needed(void)
{
CHILD *ch;
int delete;
;
for(ch = family; ch; ch = ch->next) {
if (ch->flags & 32) break;
if (ch->flags & 2) continue;
delete = 1;
if (strchr(ch->rlevel, runlevel) ||
((ch->flags & 8) && !strchr("#*Ss", runlevel))) {
startup(ch);
delete = 0;
}
if (delete) {
ch->flags &= ~(2|32);
if (!((ch->action) == 7 || (ch->action) == 6 || (ch->action) == 8 || (ch->action) == 14 || (ch->action) == 9) && ch->action != 15)
ch->flags &= ~128;
ch->pid = 0;
} else
if (ch->flags & 32) break;
}
}
| void start_if_needed(unsigned long a0, unsigned long a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned int a5) {
unsigned int v0;
struct_0 *v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
v3 = family;
for (v1 = family; v1; v1 = v1->field_c0) {
v4 = v1->field_0 & 32;
if ((v1->field_0 & 32))
return;
if (!(v1->field_0 & 2)) {
v0 = 1;
if (strchr(&v1->padding_c[24], runlevel) || (v1->field_0 & 8) && !strchr("#*Ss", runlevel)) {
startup(v1, runlevel, a2, a3, a4, a5);
v0 = 0;
}
if (v0) {
v1->field_0 = v1->field_0 & -35;
switch (v1->field_30) {
case 6: case 7: case 8: case 9: case 14: case 15:
break;
default:
*(&v4) = v1->field_0;
*(&v4) = v1->field_0 & 127;
v1->field_0 = v4;
break;
}
v1->field_8 = 0;
} else {
v5 = v1->field_0 & 32;
if ((v1->field_0 & 32))
return;
}
}
v6 = v1->field_c0;
}
return;
}
|
static void print_channel_bindings(gnutls_session_t session, int print)
{
static const struct channel_binding_request requests[] = {
{ GNUTLS_CB_TLS_UNIQUE, "tls-unique" },
{ GNUTLS_CB_TLS_SERVER_END_POINT, "tls-server-end-point" },
{ GNUTLS_CB_TLS_EXPORTER, "tls-exporter" }
};
size_t i;
if (!print) {
return;
}
log_msg(
stdout
, "- Channel bindings\n");
for (i = 0; i < sizeof(requests) / sizeof(requests[0]); i++) {
gnutls_datum_t cb;
int rc;
rc = gnutls_session_channel_binding(session,
requests[i].type,
&cb);
if (rc == -213) {
log_msg(
stdout
, " - '%s': not available\n",
requests[i].name);
} else if (rc < 0) {
fprintf(
stderr
, " - '%s': error: %s\n",
requests[i].name, gnutls_strerror(rc));
} else {
size_t j;
log_msg(
stdout
, " - '%s': ",
requests[i].name);
for (j = 0; j < cb.size; j++)
log_msg(
stdout
, "%02x", cb.data[j]);
log_msg(
stdout
, "\n");
gnutls_free((void *) (cb.data)), cb.data=
((void *)0)
;
}
}
}
| void print_channel_bindings(unsigned long long a0, unsigned long a1) {
unsigned int v0;
void* v1;
void* v2;
void* v3;
char v4;
char v5;
unsigned long long *v7;
unsigned long long v8;
if (a1) {
log_msg();
for (v1 = 0; v1 <= 2; v1 += 1) {
v0 = gnutls_session_channel_binding(a0, *((0x10 * v1 + &requests.11984)), &v3, *((0x10 * v1 + &requests.11984)));
if (v0 == -213) {
log_msg();
} else if (v0 < 0) {
fprintf(stderr, " - '%s': error: %s\n", *((0x10 * v1 + &g_405248)), gnutls_strerror(v0));
} else {
log_msg();
for (v2 = 0; v2 < *(&v4); v2 += 1) {
log_msg();
}
log_msg();
*(5242960)(*(&v3));
v3 = 0;
}
}
}
v8 = *(&v5) ^ v7[5];
return;
}
|
em_delete_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
{
if (el->el_line.cursor <= el->el_line.buffer)
return 6;
if (el->el_state.doingarg)
c_delbefore(el, el->el_state.argument);
else
c_delbefore1(el);
el->el_line.cursor -= el->el_state.argument;
if (el->el_line.cursor < el->el_line.buffer)
el->el_line.cursor = el->el_line.buffer;
return 4;
}
| long long em_delete_prev_char(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned long long v2;
v0 = a1;
if (a0->field_58 <= a0->field_50) {
v2 = 6;
} else {
if (!a0->field_74)
c_delbefore1(a0);
else
c_delbefore(a0, a0->field_78, a0->field_78);
a0->field_58 = a0->field_58 + -(a0->field_78 << 2);
if (a0->field_58 < a0->field_50)
a0->field_58 = a0->field_50;
v2 = 4;
}
return v2;
}
|
static
_Bool
may_change_field (int field)
{
const char *cp;
if (amroot) {
return
1
;
}
cp = getdef_str ("CHFN_RESTRICT");
if (
((void *)0)
== cp) {
cp = "";
} else if (strcmp (cp, "yes") == 0) {
cp = "rwh";
} else if (strcmp (cp, "no") == 0) {
cp = "frwh";
}
if (strchr (cp, field) !=
((void *)0)
) {
return
1
;
}
return
0
;
}
| _BOOL8 may_change_field(int a1)
{
char *v2;
char *s1;
if ( amroot )
return 1LL;
s1 = (char *)getdef_str("CHFN_RESTRICT");
if ( s1 )
{
if ( !strcmp(s1, "yes") )
{
v2 = strchr("rwh", a1);
}
else
{
if ( !strcmp(s1, "no") )
s1 = "frwh";
v2 = strchr(s1, a1);
}
}
else
{
v2 = strchr(&byte_BA5B, a1);
}
return v2 != 0LL;
}
|
int
ssh_init(struct ssh **sshp, int is_server, struct kex_params *kex_params)
{
char *myproposal[PROPOSAL_MAX] = { "sntrup761x25519-sha512@openssh.com," "curve25519-sha256," "curve25519-sha256@libssh.org," "ecdh-sha2-nistp256," "ecdh-sha2-nistp384," "ecdh-sha2-nistp521," "diffie-hellman-group-exchange-sha256," "diffie-hellman-group16-sha512," "diffie-hellman-group18-sha512," "diffie-hellman-group14-sha256", "ssh-ed25519-cert-v01@openssh.com," "ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "sk-ssh-ed25519-cert-v01@openssh.com," "sk-ecdsa-sha2-nistp256-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-ed25519," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "sk-ssh-ed25519@openssh.com," "sk-ecdsa-sha2-nistp256@openssh.com," "rsa-sha2-512," "rsa-sha2-256", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr," "aes128-gcm@openssh.com,aes256-gcm@openssh.com", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr," "aes128-gcm@openssh.com,aes256-gcm@openssh.com", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "none,zlib@openssh.com", "none,zlib@openssh.com", "", "" };
struct ssh *ssh;
char **proposal;
static int called;
int r;
if (!called) {
seed_rng();
called = 1;
}
if ((ssh = ssh_packet_set_connection(
((void *)0)
, -1, -1)) ==
((void *)0)
)
return -2;
if (is_server)
ssh_packet_set_server(ssh);
proposal = kex_params ? kex_params->proposal : myproposal;
if ((r = kex_ready(ssh, proposal)) != 0) {
ssh_free(ssh);
return r;
}
ssh->kex->server = is_server;
if (is_server) {
ssh->kex->kex[KEX_DH_GRP1_SHA1] = kex_gen_server;
ssh->kex->kex[KEX_DH_GRP14_SHA1] = kex_gen_server;
ssh->kex->kex[KEX_DH_GRP14_SHA256] = kex_gen_server;
ssh->kex->kex[KEX_DH_GRP16_SHA512] = kex_gen_server;
ssh->kex->kex[KEX_DH_GRP18_SHA512] = kex_gen_server;
ssh->kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
ssh->kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
ssh->kex->kex[KEX_ECDH_SHA2] = kex_gen_server;
ssh->kex->kex[KEX_C25519_SHA256] = kex_gen_server;
ssh->kex->kex[KEX_KEM_SNTRUP761X25519_SHA512] = kex_gen_server;
ssh->kex->load_host_public_key=&_ssh_host_public_key;
ssh->kex->load_host_private_key=&_ssh_host_private_key;
ssh->kex->sign=&_ssh_host_key_sign;
} else {
ssh->kex->kex[KEX_DH_GRP1_SHA1] = kex_gen_client;
ssh->kex->kex[KEX_DH_GRP14_SHA1] = kex_gen_client;
ssh->kex->kex[KEX_DH_GRP14_SHA256] = kex_gen_client;
ssh->kex->kex[KEX_DH_GRP16_SHA512] = kex_gen_client;
ssh->kex->kex[KEX_DH_GRP18_SHA512] = kex_gen_client;
ssh->kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;
ssh->kex->kex[KEX_DH_GEX_SHA256] = kexgex_client;
ssh->kex->kex[KEX_ECDH_SHA2] = kex_gen_client;
ssh->kex->kex[KEX_C25519_SHA256] = kex_gen_client;
ssh->kex->kex[KEX_KEM_SNTRUP761X25519_SHA512] = kex_gen_client;
ssh->kex->verify_host_key =&_ssh_verify_host_key;
}
*sshp = ssh;
return 0;
}
| long long ssh_init(unsigned long long *a0, unsigned long a1, unsigned long long a2) {
unsigned int v0;
struct_0 *v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v14;
unsigned long long v15;
v3 = "sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256";
v4 = "ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256";
v5 = "chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com";
v6 = "chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com";
v7 = "umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1";
v8 = "umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1";
v9 = "none,zlib@openssh.com";
v10 = "none,zlib@openssh.com";
v11 = &g_401bac;
v12 = &g_401bac;
if (!called.19160) {
seed_rng();
called.19160 = 1;
}
v1 = ssh_packet_set_connection(0x0, 0xffffffff, 0xffffffff);
if (!v1) {
v14 = 4294967294;
} else {
if (a1)
ssh_packet_set_server(v1);
if (!a2)
v15 = &v3;
else
v15 = a2;
v2 = v15;
v0 = kex_ready(v1, v2, v2);
if (v0) {
ssh_free(v1);
v14 = v0;
} else {
v1->field_8->field_18 = a1;
if (a1) {
v1->field_8->field_c8 = got.kex_gen_server;
v1->field_8->field_d0 = got.kex_gen_server;
v1->field_8->field_d8 = got.kex_gen_server;
v1->field_8->field_e0 = got.kex_gen_server;
v1->field_8->field_e8 = got.kex_gen_server;
v1->field_8->field_f0 = got.kexgex_server;
v1->field_8->field_f8 = got.kexgex_server;
v1->field_8->field_100 = got.kex_gen_server;
v1->field_8->field_108 = got.kex_gen_server;
v1->field_8->field_110 = got.kex_gen_server;
v1->field_8->field_a8 = _ssh_host_public_key;
v1->field_8->field_b0 = _ssh_host_private_key;
v1->field_8->field_c0 = _ssh_host_key_sign;
} else {
v1->field_8->field_c8 = got.kex_gen_client;
v1->field_8->field_d0 = got.kex_gen_client;
v1->field_8->field_d8 = got.kex_gen_client;
v1->field_8->field_e0 = got.kex_gen_client;
v1->field_8->field_e8 = got.kex_gen_client;
v1->field_8->field_f0 = got.kexgex_client;
v1->field_8->field_f8 = got.kexgex_client;
v1->field_8->field_100 = got.kex_gen_client;
v1->field_8->field_108 = got.kex_gen_client;
v1->field_8->field_110 = got.kex_gen_client;
v1->field_8->field_a0 = _ssh_verify_host_key;
}
*(a0) = v1;
v14 = 0;
}
}
return v14;
}
|
static void
describe_change (char const *file, struct change_status const *ch)
{
char perms[12];
char old_perms[12];
char const *fmt;
char const *quoted_file = quotearg_style (shell_escape_always_quoting_style, file);
switch (ch->status)
{
case CH_NOT_APPLIED:
printf (gettext ("neither symbolic link %s nor referent has been changed\n"),
quoted_file);
return;
case CH_NO_STAT:
printf (gettext ("%s could not be accessed\n"), quoted_file);
return;
default:
break;
}
unsigned long int
old_m = ch->old_mode & (
04000
|
02000
|
01000
|
(0400|0200|0100)
|
((0400|0200|0100) >> 3)
|
(((0400|0200|0100) >> 3) >> 3)
),
m = ch->new_mode & (
04000
|
02000
|
01000
|
(0400|0200|0100)
|
((0400|0200|0100) >> 3)
|
(((0400|0200|0100) >> 3) >> 3)
);
strmode (ch->new_mode, perms);
perms[10] = '\0';
strmode (ch->old_mode, old_perms);
old_perms[10] = '\0';
switch (ch->status)
{
case CH_SUCCEEDED:
fmt = gettext ("mode of %s changed from %04lo (%s) to %04lo (%s)\n");
break;
case CH_FAILED:
fmt = gettext ("failed to change mode of %s from %04lo (%s) to %04lo (%s)\n");
break;
case CH_NO_CHANGE_REQUESTED:
fmt = gettext ("mode of %s retained as %04lo (%s)\n");
printf (fmt, quoted_file, m, &perms[1]);
return;
default:
abort ();
}
printf (fmt, quoted_file, old_m, &old_perms[1], m, &perms[1]);
}
| unsigned long describe_change(long a1, unsigned int *a2)
{
char *v2;
char *v3;
unsigned int v4;
const char *format;
const char *formata;
const char *formatb;
long v9;
long v10;
long v11;
char v12;
_BYTE v13[11];
char v14;
_BYTE v15[11];
unsigned long v16;
v16 = __readfsqword(0x28u);
v9 = quotearg_style(4LL, a1);
if ( *a2 )
{
if ( *a2 == 2 )
{
v2 = gettext("neither symbolic link %s nor referent has been changed\n");
printf(v2, v9);
}
else
{
v10 = a2[1] & 0xFFF;
v11 = a2[2] & 0xFFF;
strmode(a2[2], &v12);
v13[9] = 0;
strmode(a2[1], &v14);
v15[9] = 0;
v4 = *a2;
if ( *a2 != 4 )
{
if ( v4 <= 4 )
{
if ( v4 == 1 )
{
formata = gettext("failed to change mode of %s from %04lo (%s) to %04lo (%s)\n");
printf(formata, v9, v10, v15, v11, v13, a2, a1);
return __readfsqword(0x28u) ^ v16;
}
if ( v4 == 3 )
{
formatb = gettext("mode of %s retained as %04lo (%s)\n");
printf(formatb, v9, v11, v13);
return __readfsqword(0x28u) ^ v16;
}
}
abort();
}
format = gettext("mode of %s changed from %04lo (%s) to %04lo (%s)\n");
printf(format, v9, v10, v15, v11, v13, a2, a1);
}
}
else
{
v3 = gettext("%s could not be accessed\n");
printf(v3, v9);
}
return __readfsqword(0x28u) ^ v16;
}
|
static int
get_date_or_file (struct tar_args *args, const char *rpl_option,
const char *str, struct timespec *ts)
{
if (
((void) (
str
), 0)
!= 0
||
((
*str
) == '/')
|| *str == '.')
{
struct stat st;
if (stat (str, &st) != 0)
{
stat_error (str);
do { if (error_hook) error_hook (); error (0, 0, gettext ("Date sample file not found")); usage (2); } while (0);
}
*ts = get_stat_mtime (&st);
}
else
{
if (! parse_datetime (ts, str,
((void *)0)
))
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Substituting %s for unknown date format %s"), tartime (*ts,
0
), quote (str)); } while (0)
;
ts->tv_nsec = 0;
return 1;
}
else
{
struct textual_date *p = xmalloc (sizeof (*p));
p->ts = *ts;
p->rpl_option = rpl_option;
p->date = xstrdup (str);
p->next = args->textual_date;
args->textual_date = p;
}
}
return 0;
}
| undefined8 get_date_or_file(long param_1,undefined8 param_2,char *param_3,undefined8 *param_4)
{
char cVar1;
int iVar2;
undefined8 uVar3;
undefined8 uVar4;
undefined8 uVar5;
undefined8 *puVar6;
long in_FS_OFFSET;
undefined auVar7 [16];
stat local_b8;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
if ((*param_3 == '/') || (*param_3 == '.')) {
iVar2 = stat(param_3,&local_b8);
if (iVar2 != 0) {
stat_error(param_3);
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar3 = gettext("Date sample file not found");
error(0,0,uVar3);
usage(2);
}
auVar7 = get_stat_mtime(&local_b8);
*param_4 = SUB168(auVar7,0);
param_4[1] = SUB168(auVar7 >> 0x40,0);
}
else {
cVar1 = parse_datetime(param_4,param_3,0);
if (cVar1 != '\x01') {
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar3 = quote(param_3);
uVar4 = tartime(*param_4,param_4[1],0);
uVar5 = gettext("Substituting %s for unknown date format %s");
error(0,0,uVar5,uVar4,uVar3);
param_4[1] = 0;
uVar3 = 1;
goto LAB_00100de3;
}
puVar6 = (undefined8 *)xmalloc(0x28);
uVar3 = param_4[1];
puVar6[1] = *param_4;
puVar6[2] = uVar3;
puVar6[3] = param_2;
uVar3 = xstrdup(param_3);
puVar6[4] = uVar3;
*puVar6 = *(undefined8 *)(param_1 + 8);
*(undefined8 **)(param_1 + 8) = puVar6;
}
uVar3 = 0;
LAB_00100de3:
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar3;
}
|
static inline void
initialize_exit_failure (int status)
{
if (status !=
1
)
exit_failure = status;
}
| void initialize_exit_failure(unsigned long long a0) {
unsigned long long v1;
if (a0 != 1) {
v1 = a0;
exit_failure = a0;
}
return;
}
|
static int
cert_parse(struct sshbuf *b, struct sshkey *key, struct sshbuf *certbuf)
{
struct sshbuf *principals =
((void *)0)
, *crit =
((void *)0)
;
struct sshbuf *exts =
((void *)0)
, *ca =
((void *)0)
;
u_char *sig =
((void *)0)
;
size_t signed_len = 0, slen = 0, kidlen = 0;
int ret = -1;
if ((ret = sshbuf_putb(key->cert->certblob, certbuf)) != 0)
return ret;
if ((ret = sshbuf_get_u64(b, &key->cert->serial)) != 0 ||
(ret = sshbuf_get_u32(b, &key->cert->type)) != 0 ||
(ret = sshbuf_get_cstring(b, &key->cert->key_id, &kidlen)) != 0 ||
(ret = sshbuf_froms(b, &principals)) != 0 ||
(ret = sshbuf_get_u64(b, &key->cert->valid_after)) != 0 ||
(ret = sshbuf_get_u64(b, &key->cert->valid_before)) != 0 ||
(ret = sshbuf_froms(b, &crit)) != 0 ||
(ret = sshbuf_froms(b, &exts)) != 0 ||
(ret = sshbuf_get_string_direct(b,
((void *)0)
,
((void *)0)
)) != 0 ||
(ret = sshbuf_froms(b, &ca)) != 0) {
ret = -4;
goto out;
}
signed_len = sshbuf_len(key->cert->certblob) - sshbuf_len(b);
if ((ret = sshbuf_get_string(b, &sig, &slen)) != 0) {
ret = -4;
goto out;
}
if (key->cert->type != 1 &&
key->cert->type != 2) {
ret = -18;
goto out;
}
while (sshbuf_len(principals) > 0) {
char *principal =
((void *)0)
;
char **oprincipals =
((void *)0)
;
if (key->cert->nprincipals >= 256) {
ret = -4;
goto out;
}
if ((ret = sshbuf_get_cstring(principals, &principal,
((void *)0)
)) != 0) {
ret = -4;
goto out;
}
oprincipals = key->cert->principals;
key->cert->principals = recallocarray(key->cert->principals,
key->cert->nprincipals, key->cert->nprincipals + 1,
sizeof(*key->cert->principals));
if (key->cert->principals ==
((void *)0)
) {
free(principal);
key->cert->principals = oprincipals;
ret = -2;
goto out;
}
key->cert->principals[key->cert->nprincipals++] = principal;
}
if ((ret = sshbuf_putb(key->cert->critical, crit)) != 0 ||
(exts !=
((void *)0)
&&
(ret = sshbuf_putb(key->cert->extensions, exts)) != 0))
goto out;
while (sshbuf_len(crit) != 0) {
if ((ret = sshbuf_get_string_direct(crit,
((void *)0)
,
((void *)0)
)) != 0 ||
(ret = sshbuf_get_string_direct(crit,
((void *)0)
,
((void *)0)
)) != 0) {
sshbuf_reset(key->cert->critical);
ret = -4;
goto out;
}
}
while (exts !=
((void *)0)
&& sshbuf_len(exts) != 0) {
if ((ret = sshbuf_get_string_direct(exts,
((void *)0)
,
((void *)0)
)) != 0 ||
(ret = sshbuf_get_string_direct(exts,
((void *)0)
,
((void *)0)
)) != 0) {
sshbuf_reset(key->cert->extensions);
ret = -4;
goto out;
}
}
if (sshkey_from_blob_internal(ca, &key->cert->signature_key, 0) != 0) {
ret = -19;
goto out;
}
if (!sshkey_type_is_valid_ca(key->cert->signature_key->type)) {
ret = -19;
goto out;
}
if ((ret = sshkey_verify(key->cert->signature_key, sig, slen,
sshbuf_ptr(key->cert->certblob), signed_len,
((void *)0)
, 0,
((void *)0)
)) != 0)
goto out;
if ((ret = sshkey_get_sigtype(sig, slen,
&key->cert->signature_type)) != 0)
goto out;
ret = 0;
out:
sshbuf_free(ca);
sshbuf_free(crit);
sshbuf_free(exts);
sshbuf_free(principals);
free(sig);
return ret;
}
| int cert_parse(unsigned long long a0, unsigned long a1, unsigned long long a2) {
struct_0 *v0;
int tmp_35;
unsigned int v1;
void* v2;
void* v3;
void* v4;
void* v5;
void* v6;
void* v7;
void* v8;
void* v9;
void* v10;
void* v11;
unsigned int v13;
unsigned long long *v15;
v0 = a1;
v2 = 0;
v3 = 0;
v4 = 0;
v5 = 0;
v6 = 0;
v10 = 0;
v7 = 0;
v8 = 0;
v1 = -1;
v1 = sshbuf_putb(v0->field_80->field_0, a2, a2);
if (v1) {
v13 = v1;
} else {
v1 = sshbuf_get_u64(a0, &v0->field_80->padding_c[4], &v0->field_80->padding_c[4]);
if (v1) {
LABEL_405321:
v1 = -0x4;
} else {
v1 = sshbuf_get_u32(a0, &v0->field_80->field_8, &v0->field_80->field_8);
if (!(!v1))
goto LABEL_405321;
v1 = sshbuf_get_cstring(a0, &v0->field_80->padding_c[12], &v8, &v0->field_80->padding_c[12]);
if (!(!v1))
goto LABEL_405321;
v1 = sshbuf_froms(a0, &v2, &v2);
if (!(!v1))
goto LABEL_405321;
v1 = sshbuf_get_u64(a0, &v0->field_80->padding_30, &v0->field_80->padding_30);
if (!(!v1))
goto LABEL_405321;
v1 = sshbuf_get_u64(a0, &v0->field_80->padding_30[8], &v0->field_80->padding_30[8]);
if (!(!v1))
goto LABEL_405321;
v1 = sshbuf_froms(a0, &v3, &v3);
if (!(!v1))
goto LABEL_405321;
v1 = sshbuf_froms(a0, &v4, &v4);
if (!(!v1))
goto LABEL_405321;
v1 = sshbuf_get_string_direct(a0, 0x0, 0x0);
if (!(!v1))
goto LABEL_405321;
v1 = sshbuf_froms(a0, &v5, &v5);
if (!(!v1))
goto LABEL_405321;
v10 = sshbuf_len(v0->field_80->field_0) - sshbuf_len(a0);
v1 = sshbuf_get_string(a0, &v6, &v7, &v6);
if (v1) {
v1 = -0x4;
} else {
if (v0->field_80->field_8 != 1 && v0->field_80->field_8 != 2) {
v1 = -18;
goto LABEL_40574c;
}
while (sshbuf_len(v2)) {
v9 = 0;
v11 = 0;
if (v0->field_80->field_20 > 255) {
v1 = -0x4;
goto LABEL_40574c;
} else {
v1 = sshbuf_get_cstring(v2, &v9, 0x0, &v9);
if (v1) {
v1 = -0x4;
goto LABEL_40574c;
} else {
v11 = v0->field_80->field_28;
v0->field_80->field_28 = recallocarray(v0->field_80->field_28, v0->field_80->field_20, v0->field_80->field_20 + 1, 0x8);
if (v0->field_80->field_28) {
v15 = v0->field_80->field_28;
tmp_35 = v0->field_80->field_20;
v0->field_80->field_20 = v0->field_80->field_20 + 1;
v15[tmp_35] = v9;
} else {
free(v9);
v0->field_80->field_28 = v11;
v1 = -2;
goto LABEL_40574c;
}
}
}
}
v1 = sshbuf_putb(v0->field_80->field_40, v3, v3);
if (v1) {
LABEL_405745:
} else {
if (v4) {
v1 = sshbuf_putb(v0->field_80->field_48, v4, v4);
if (!(!v1))
goto LABEL_405745;
}
while (true) {
if (!sshbuf_len(v3)) {
while (true) {
if (!v4) {
LABEL_405660:
if (sshkey_from_blob_internal(v5, &v0->field_80->field_50, 0x0)) {
v1 = -19;
break;
} else if (!sshkey_type_is_valid_ca(*(v0->field_80->field_50))) {
v1 = -19;
break;
} else {
v1 = sshkey_verify(v0->field_80->field_50, v6, v7, sshbuf_ptr(v0->field_80->field_0), v10, 0x0, 0x0, NULL);
if (!v1) {
v1 = sshkey_get_sigtype(v6, v7, v0->field_80 + 1);
if (!v1) {
v1 = 0;
break;
}
}
}
} else {
if (!sshbuf_len(v4))
goto LABEL_405660;
v1 = sshbuf_get_string_direct(v4, 0x0, 0x0);
if (v1) {
LABEL_405623:
sshbuf_reset(v0->field_80->field_48);
v1 = -0x4;
break;
} else {
v1 = sshbuf_get_string_direct(v4, 0x0, 0x0);
if (!(!v1))
goto LABEL_405623;
}
}
}
}
v1 = sshbuf_get_string_direct(v3, 0x0, 0x0);
if (v1) {
LABEL_4055af:
sshbuf_reset(v0->field_80->field_40);
v1 = -0x4;
break;
} else {
v1 = sshbuf_get_string_direct(v3, 0x0, 0x0);
if (!(!v1))
goto LABEL_4055af;
}
}
}
}
}
LABEL_40574c:
sshbuf_free(v5);
sshbuf_free(v3);
sshbuf_free(v4);
sshbuf_free(v2);
free(v6);
v13 = v1;
}
return v13;
}
|
static int ipnetns_have_nsid(void)
{
struct {
struct nlmsghdr n;
struct rtgenmsg g;
char buf[1024];
} req = {
.n.nlmsg_len = ((sizeof(struct rtgenmsg)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))),
.n.nlmsg_flags = 0x01,
.n.nlmsg_type = RTM_GETNSID,
.g.rtgen_family =
0
,
};
int fd;
if (have_rtnl_getnsid >= 0) {
fd = open("/proc/self/ns/net",
00
);
if (fd < 0) {
fprintf(
stderr
,
"/proc/self/ns/net: %s. Continuing anyway.\n",
strerror(
(*__errno_location ())
));
have_rtnl_getnsid = 0;
return 0;
}
addattr32(&req.n, 1024, NETNSA_FD, fd);
if (rtnl_send(&rth, &req.n, req.n.nlmsg_len) < 0) {
fprintf(
stderr
,
"rtnl_send(RTM_GETNSID): %s. Continuing anyway.\n",
strerror(
(*__errno_location ())
));
have_rtnl_getnsid = 0;
close(fd);
return 0;
}
rtnl_listen(&rth, ipnetns_accept_msg,
((void *)0)
);
close(fd);
}
return have_rtnl_getnsid;
}
| int ipnetns_have_nsid() {
unsigned int v0;
char v1;
unsigned short v2;
unsigned short v3;
unsigned long long v5;
void* v6;
unsigned long v7;
unsigned int v8;
v5 = 130;
for (v6 = &v1; v5; v6 += v7 * 8) {
v5 -= 1;
v1 = 0;
}
*(v6) = 0;
v1 = 17;
v2 = 90;
v3 = 1;
if (have_rtnl_getnsid >= 0) {
v0 = open64("/proc/self/ns/net", 0x0, v6 + 4);
if (v0 < 0) {
fprintf(*(&stderr), "/proc/self/ns/net: %s. Continuing anyway.\n", strerror(*(__errno_location())));
have_rtnl_getnsid = 0;
v8 = 0;
goto LABEL_400357;
}
addattr32(&v1, 0x400, 0x3, v0);
if (rtnl_send(0x500050, &v1, v1) >= 0) {
rtnl_listen(0x500050, ipnetns_accept_msg, 0x0);
close(v0);
} else {
fprintf(*(&stderr), "rtnl_send(RTM_GETNSID): %s. Continuing anyway.\n", strerror(*(__errno_location())));
have_rtnl_getnsid = 0;
close(v0);
v8 = 0;
goto LABEL_400357;
}
}
v8 = have_rtnl_getnsid;
LABEL_400357:
return v8;
}
|
int
sftp_server_main(int argc, char **argv, struct passwd *user_pw)
{
int i, r, in, out, ch, skipargs = 0, log_stderr = 0;
ssize_t len, olen;
SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
char *cp, *homedir =
((void *)0)
, uidstr[32], buf[4*4096];
long mask;
__progname = ssh_get_progname(argv[0]);
log_init(__progname, log_level, log_facility, log_stderr);
pw = pwcopy(user_pw);
while (!skipargs && (ch = BSDgetopt(argc, argv, "d:f:l:P:p:Q:u:cehR")
) != -1) {
switch (ch) {
case 'Q':
if (strcasecmp(BSDoptarg, "requests") != 0) {
fprintf(
stderr
, "Invalid query type\n");
exit(1);
}
for (i = 0; handlers[i].handler !=
((void *)0)
; i++)
printf("%s\n", handlers[i].name);
for (i = 0; extended_handlers[i].handler !=
((void *)0)
; i++)
printf("%s\n", extended_handlers[i].name);
exit(0);
break;
case 'R':
readonly = 1;
break;
case 'c':
skipargs = 1;
break;
case 'e':
log_stderr = 1;
break;
case 'l':
log_level = log_level_number(BSDoptarg);
if (log_level == SYSLOG_LEVEL_NOT_SET)
sshlog("sftp-server.c", __func__, 1948, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Invalid log level \"%s\"", BSDoptarg);
break;
case 'f':
log_facility = log_facility_number(BSDoptarg);
if (log_facility == SYSLOG_FACILITY_NOT_SET)
sshlog("sftp-server.c", __func__, 1953, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Invalid log facility \"%s\"", BSDoptarg);
break;
case 'd':
cp = tilde_expand_filename(BSDoptarg, user_pw->pw_uid);
snprintf(uidstr, sizeof(uidstr), "%llu",
(unsigned long long)pw->pw_uid);
homedir = percent_expand(cp, "d", user_pw->pw_dir,
"u", user_pw->pw_name, "U", uidstr, (char *)
((void *)0)
);
free(cp);
break;
case 'p':
if (request_allowlist !=
((void *)0)
)
sshfatal("sftp-server.c", __func__, 1965, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Permitted requests already set");
request_allowlist = xstrdup(BSDoptarg);
break;
case 'P':
if (request_denylist !=
((void *)0)
)
sshfatal("sftp-server.c", __func__, 1970, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Refused requests already set");
request_denylist = xstrdup(BSDoptarg);
break;
case 'u':
(*__errno_location ())
= 0;
mask = strtol(BSDoptarg, &cp, 8);
if (mask < 0 || mask > 0777 || *cp != '\0' ||
cp == BSDoptarg || (mask == 0 &&
(*__errno_location ())
!= 0))
sshfatal("sftp-server.c", __func__, 1978, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Invalid umask \"%s\"", BSDoptarg);
(void)umask((mode_t)mask);
break;
case 'h':
default:
sftp_server_usage();
}
}
log_init(__progname, log_level, log_facility, log_stderr);
platform_disable_tracing(1);
platform_pledge_sftp_server();
if ((cp = getenv("SSH_CONNECTION")) !=
((void *)0)
) {
client_addr = xstrdup(cp);
if ((cp = strchr(client_addr, ' ')) ==
((void *)0)
) {
sshlog("sftp-server.c", __func__, 2003, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Malformed SSH_CONNECTION variable: \"%s\"", getenv("SSH_CONNECTION"))
;
sftp_server_cleanup_exit(255);
}
*cp = '\0';
} else
client_addr = xstrdup("UNKNOWN");
sshlog("sftp-server.c", __func__, 2011, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "session opened for local user %s from [%s]", pw->pw_name, client_addr)
;
in =
0
;
out =
1
;
if ((iqueue = sshbuf_new()) ==
((void *)0)
)
sshfatal("sftp-server.c", __func__, 2023, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
if ((oqueue = sshbuf_new()) ==
((void *)0)
)
sshfatal("sftp-server.c", __func__, 2025, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
if (homedir !=
((void *)0)
) {
if (chdir(homedir) != 0) {
sshlog("sftp-server.c", __func__, 2029, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "chdir to \"%s\" failed: %s", homedir, strerror(
(*__errno_location ())
))
;
}
}
for (;;) {
struct pollfd pfd[2];
memset(pfd, 0, sizeof pfd);
pfd[0].fd = pfd[1].fd = -1;
if ((r = sshbuf_check_reserve(iqueue, sizeof(buf))) == 0 &&
(r = sshbuf_check_reserve(oqueue,
(256 * 1024))) == 0) {
pfd[0].fd = in;
pfd[0].events =
0x001
;
}
else if (r != -9)
sshfatal("sftp-server.c", __func__, 2052, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "reserve");
olen = sshbuf_len(oqueue);
if (olen > 0) {
pfd[1].fd = out;
pfd[1].events =
0x004
;
}
if (poll(pfd, 2, -1) == -1) {
if (
(*__errno_location ())
==
4
)
continue;
sshlog("sftp-server.c", __func__, 2063, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "poll: %s", strerror(
(*__errno_location ())
));
sftp_server_cleanup_exit(2);
}
if (pfd[0].revents & (
0x001
|
0x010
)) {
len = read(in, buf, sizeof buf);
if (len == 0) {
sshlog("sftp-server.c", __func__, 2071, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "read eof");
sftp_server_cleanup_exit(0);
} else if (len == -1) {
if (
(*__errno_location ())
!=
11
&&
(*__errno_location ())
!=
4
) {
sshlog("sftp-server.c", __func__, 2075, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "read: %s", strerror(
(*__errno_location ())
));
sftp_server_cleanup_exit(1);
}
} else if ((r = sshbuf_put(iqueue, buf, len)) != 0)
sshfatal("sftp-server.c", __func__, 2079, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_put");
}
if (pfd[1].revents & (
0x004
|
0x010
)) {
len = write(out, sshbuf_ptr(oqueue), olen);
if (len == 0 || (len == -1 &&
(*__errno_location ())
==
32
)) {
sshlog("sftp-server.c", __func__, 2085, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "write eof");
sftp_server_cleanup_exit(0);
} else if (len == -1) {
sftp_server_cleanup_exit(1);
if (
(*__errno_location ())
!=
11
&&
(*__errno_location ())
!=
4
) {
sshlog("sftp-server.c", __func__, 2090, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "write: %s", strerror(
(*__errno_location ())
));
sftp_server_cleanup_exit(1);
}
} else if ((r = sshbuf_consume(oqueue, len)) != 0)
sshfatal("sftp-server.c", __func__, 2094, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "consume");
}
r = sshbuf_check_reserve(oqueue, (256 * 1024));
if (r == 0)
process();
else if (r != -9)
sshfatal("sftp-server.c", __func__, 2106, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "reserve");
}
}
| void sftp_server_main(unsigned int a1, _QWORD *a2, long a3)
{
long v3;
char *v4;
int *v5;
char *v6;
long v7;
int *v8;
char *v9;
int *v10;
char *v11;
long v12;
size_t v13;
const void *v14;
long v15;
long v16;
unsigned int v19;
int v20;
unsigned int v21;
int i;
int j;
unsigned int v24;
unsigned int v25;
unsigned int v26;
unsigned int v27;
int v28;
void *ptr;
char *path;
__mode_t mask[2];
size_t n;
ssize_t v33;
struct pollfd fds[2];
char s[32];
char buf[24];
char v37;
long v38[513];
while ( v38 != (long *)&v37 )
;
v38[510] = __readfsqword(0x28u);
v20 = 0;
v21 = 0;
v19 = 2;
path = 0LL;
_progname = ssh_get_progname(*a2);
log_init(_progname, (unsigned int)log_level, 2LL, 0LL);
pw = pwcopy(a3);
while ( !v20 )
{
v28 = BSDgetopt(a1, a2, "d:f:l:P:p:Q:u:cehR");
if ( v28 == -1 )
break;
HIDWORD(v3) = 0;
switch ( v28 )
{
case 'P':
if ( request_denylist )
sshfatal("sftp-server.c", "sftp_server_main", 1970LL, 0LL, 1LL, 0LL, "Refused requests already set");
request_denylist = xstrdup(BSDoptarg);
break;
case 'Q':
if ( strcasecmp(BSDoptarg, "requests") )
{
fprintf(stderr, "Invalid query type\n");
exit(1);
}
for ( i = 0; funcs_6CC2[5 * i]; ++i )
printf("%s\n", (&handlers)[5 * i]);
for ( j = 0; *(&off_9598 + 5 * j); ++j )
printf("%s\n", extended_handlers[5 * j]);
exit(0);
case 'R':
readonly = 1;
break;
case 'c':
v20 = 1;
break;
case 'd':
ptr = (void *)tilde_expand_filename(BSDoptarg, *(unsigned int *)(a3 + 16));
snprintf(s, 0x20uLL, "%llu", *(unsigned int *)(pw + 16));
path = (char *)percent_expand(ptr, L"d", *(_QWORD *)(a3 + 32), L"ud", *(_QWORD *)a3, L"Uud", s, 0LL);
free(ptr);
break;
case 'e':
v21 = 1;
break;
case 'f':
v19 = log_facility_number(BSDoptarg, v3);
if ( v19 == -1 )
sshlog("sftp-server.c", "sftp_server_main", 1953LL, 0LL, 2LL, 0LL, "Invalid log facility \"%s\"", BSDoptarg);
break;
case 'l':
log_level = log_level_number(BSDoptarg, v3);
if ( log_level == -1 )
sshlog("sftp-server.c", "sftp_server_main", 1948LL, 0LL, 2LL, 0LL, "Invalid log level \"%s\"", BSDoptarg);
break;
case 'p':
if ( request_allowlist )
sshfatal("sftp-server.c", "sftp_server_main", 1965LL, 0LL, 1LL, 0LL, "Permitted requests already set");
request_allowlist = xstrdup(BSDoptarg);
break;
case 'u':
*_errno_location() = 0;
*(_QWORD *)mask = strtol(BSDoptarg, (char **)&ptr, 8);
if ( *(_QWORD *)mask > 0x1FFuLL || *(_BYTE *)ptr || ptr == BSDoptarg || !*(_QWORD *)mask && *_errno_location() )
sshfatal("sftp-server.c", "sftp_server_main", 1978LL, 0LL, 1LL, 0LL, "Invalid umask \"%s\"", BSDoptarg);
umask(mask[0]);
break;
default:
sftp_server_usage();
}
}
log_init(_progname, (unsigned int)log_level, v19, v21);
platform_disable_tracing(1LL);
platform_pledge_sftp_server();
ptr = getenv("SSH_CONNECTION");
if ( ptr )
{
client_addr = (char *)xstrdup(ptr);
ptr = strchr(client_addr, 32);
if ( !ptr )
{
v4 = getenv("SSH_CONNECTION");
sshlog(
"sftp-server.c",
"sftp_server_main",
2003LL,
0LL,
2LL,
0LL,
"Malformed SSH_CONNECTION variable: \"%s\"",
v4);
sftp_server_cleanup_exit(255);
}
*(_BYTE *)ptr = 0;
}
else
{
client_addr = (char *)xstrdup("UNKNOWN");
}
sshlog(
"sftp-server.c",
"sftp_server_main",
2011LL,
0LL,
3LL,
0LL,
"session opened for local user %s from [%s]",
*(const char **)pw,
client_addr);
iqueue = sshbuf_new();
if ( !iqueue )
sshfatal("sftp-server.c", "sftp_server_main", 2023LL, 1LL, 1LL, 0LL, "sshbuf_new failed");
oqueue = sshbuf_new();
if ( !oqueue )
sshfatal("sftp-server.c", "sftp_server_main", 2025LL, 1LL, 1LL, 0LL, "sshbuf_new failed");
if ( path && chdir(path) )
{
v5 = _errno_location();
v6 = strerror(*v5);
sshlog("sftp-server.c", "sftp_server_main", 2029LL, 0LL, 2LL, 0LL, "chdir to \"%s\" failed: %s", path, v6);
}
while ( 1 )
{
memset(fds, 0, sizeof(fds));
fds[1].fd = -1;
fds[0].fd = -1;
v24 = sshbuf_check_reserve(iqueue, 0x4000LL);
if ( v24 || (v24 = sshbuf_check_reserve(oqueue, 0x40000LL)) != 0 )
{
if ( v24 != -9 )
{
v7 = ssh_err(v24);
sshfatal("sftp-server.c", "sftp_server_main", 2052LL, 1LL, 1LL, v7, "reserve");
}
}
else
{
fds[0].fd = 0;
fds[0].events = 1;
}
n = sshbuf_len(oqueue);
if ( (long)n > 0 )
{
fds[1].fd = 1;
fds[1].events = 4;
}
if ( poll(fds, 2uLL, -1) == -1 )
{
if ( *_errno_location() != 4 )
{
v8 = _errno_location();
v9 = strerror(*v8);
sshlog("sftp-server.c", "sftp_server_main", 2063LL, 0LL, 2LL, 0LL, "poll: %s", v9);
sftp_server_cleanup_exit(2);
}
}
else
{
if ( (fds[0].revents & 0x11) != 0 )
{
v33 = read(0, buf, 0x4000uLL);
if ( !v33 )
{
sshlog("sftp-server.c", "sftp_server_main", 2071LL, 0LL, 5LL, 0LL, "read eof");
sftp_server_cleanup_exit(0);
}
if ( v33 == -1 )
{
if ( *_errno_location() != 11 && *_errno_location() != 4 )
{
v10 = _errno_location();
v11 = strerror(*v10);
sshlog("sftp-server.c", "sftp_server_main", 2075LL, 0LL, 2LL, 0LL, "read: %s", v11);
sftp_server_cleanup_exit(1);
}
}
else
{
v25 = sshbuf_put(iqueue, buf, v33);
if ( v25 )
{
v12 = ssh_err(v25);
sshfatal("sftp-server.c", "sftp_server_main", 2079LL, 1LL, 1LL, v12, "sshbuf_put");
}
}
}
if ( (fds[1].revents & 0x14) != 0 )
{
v13 = n;
v14 = (const void *)sshbuf_ptr(oqueue);
v33 = write(1, v14, v13);
if ( !v33 || v33 == -1 && *_errno_location() == 32 )
{
sshlog("sftp-server.c", "sftp_server_main", 2085LL, 0LL, 5LL, 0LL, "write eof");
sftp_server_cleanup_exit(0);
}
if ( v33 == -1 )
sftp_server_cleanup_exit(1);
v26 = sshbuf_consume(oqueue, v33);
if ( v26 )
{
v15 = ssh_err(v26);
sshfatal("sftp-server.c", "sftp_server_main", 2094LL, 1LL, 1LL, v15, "consume");
}
}
v27 = sshbuf_check_reserve(oqueue, 0x40000LL);
if ( v27 )
{
if ( v27 != -9 )
{
v16 = ssh_err(v27);
sshfatal("sftp-server.c", "sftp_server_main", 2106LL, 1LL, 1LL, v16, "reserve");
}
}
else
{
process();
}
}
}
}
|
static void
undo_glob_escape(char *s)
{
size_t i, j;
for (i = j = 0;;) {
if (s[i] == '\0') {
s[j] = '\0';
return;
}
if (s[i] != '\\') {
s[j++] = s[i++];
continue;
}
++i;
switch (s[i]) {
case '?':
case '[':
case '*':
case '\\':
s[j++] = s[i++];
break;
case '\0':
s[j++] = '\\';
s[j] = '\0';
return;
default:
s[j++] = '\\';
s[j++] = s[i++];
break;
}
}
}
| void undo_glob_escape(void* a0) {
unsigned long v0;
int tmp_16;
int tmp_24;
int tmp_35;
int tmp_50;
int tmp_31;
void* v1;
unsigned long long v6;
unsigned long long v7;
v1 = 0;
v0 = v1;
while (true) {
switch (*((v0 + a0))) {
case 0:
v6 = v1 + a0;
*((v1 + a0)) = 0;
return;
case 92:
v0 += 1;
if (!*((v0 + a0))) {
tmp_16 = v1;
v1 += 1;
*(tmp_16 + a0) = 92;
v7 = v1 + a0;
*((v1 + a0)) = 0;
return;
}
if (*((v0 + a0)) < 0 || *((v0 + a0)) > 92 || *((v0 + a0)) < 42 || !(1688849862361089 & 1 << (*((v0 + a0)) - 42 & 63))) {
tmp_24 = v1;
v1 += 1;
*(tmp_24 + a0) = 92;
tmp_35 = v0;
v0 += 1;
tmp_50 = v1;
v1 += 1;
*(a0 + tmp_50) = *(tmp_35 + a0);
break;
} else {
tmp_16 = v0;
v0 += 1;
tmp_31 = v1;
v1 += 1;
*(a0 + tmp_31) = *(tmp_16 + a0);
break;
}
default:
tmp_16 = v0;
v0 += 1;
tmp_31 = v1;
v1 += 1;
*(a0 + tmp_31) = *(tmp_16 + a0);
break;
}
}
}
|
void crypto_sign_ed25519_ref_fe25519_pack(unsigned char r[32], const crypto_sign_ed25519_ref_fe25519 *x)
{
int i;
crypto_sign_ed25519_ref_fe25519 y = *x;
crypto_sign_ed25519_ref_fe25519_freeze(&y);
for(i=0;i<32;i++)
r[i] = y.v[i];
}
| unsigned long crypto_sign_ed25519_ref_fe25519_pack(long a1, long *a2)
{
long v2;
long v3;
long v4;
long v5;
long v6;
long v7;
long v8;
long v9;
int i;
long v12[17];
unsigned long v13;
v13 = __readfsqword(0x28u);
v2 = a2[1];
v12[0] = *a2;
v12[1] = v2;
v3 = a2[3];
v12[2] = a2[2];
v12[3] = v3;
v4 = a2[5];
v12[4] = a2[4];
v12[5] = v4;
v5 = a2[7];
v12[6] = a2[6];
v12[7] = v5;
v6 = a2[9];
v12[8] = a2[8];
v12[9] = v6;
v7 = a2[11];
v12[10] = a2[10];
v12[11] = v7;
v8 = a2[13];
v12[12] = a2[12];
v12[13] = v8;
v9 = a2[15];
v12[14] = a2[14];
v12[15] = v9;
crypto_sign_ed25519_ref_fe25519_freeze((long)v12);
for ( i = 0; i <= 31; ++i )
*(_BYTE *)(i + a1) = *((_DWORD *)v12 + i);
return __readfsqword(0x28u) ^ v13;
}
|
static void
idname_free(struct idname *idname)
{
if (idname ==
((void *)0)
)
return;
free(idname->name);
free(idname);
}
| void idname_free(struct_0 *a0) {
unsigned long long v1;
if (a0) {
free(a0->field_8);
v1 = free(a0);
}
return;
}
|
void
ssh_packet_set_rekey_limits(struct ssh *ssh, u_int64_t bytes, u_int32_t seconds)
{
sshlog("packet.c", __func__, 2145, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "rekey after %llu bytes, %u seconds", (unsigned long long)bytes, (unsigned int)seconds)
;
ssh->state->rekey_limit = bytes;
ssh->state->rekey_interval = seconds;
}
| long long ssh_packet_set_rekey_limits(struct struct_0 **a0, unsigned long a1, unsigned long a2) {
unsigned long long v0;
unsigned long v1;
unsigned long v2;
struct_0 *v4;
v2 = a2;
v1 = a1;
v0 = "rekey after %llu bytes, %u seconds";
sshlog("packet.c", "ssh_packet_set_rekey_limits", 0x861, 0x0, 0x7, 0x0);
*(a0)->field_1a8 = a1;
v4 = *(a0);
*(a0)->field_1b0 = a2;
return v4;
}
|
_Bool
pred_fstype (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) pathname;
if (strcmp (filesystem_type (stat_buf, pathname), pred_ptr->args.str) == 0)
return
1
;
else
return
0
;
}
| _BOOL8 pred_fstype(long a1, long a2, long a3)
{
const char *v3;
const char *v4;
v3 = *(const char **)(a3 + 56);
v4 = (const char *)filesystem_type(a2, a1);
return strcmp(v4, v3) == 0;
}
|
_Bool
pred_fprint0 (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
FILE * fp = pred_ptr->args.printf_vec.stream;
(void) &stat_buf;
fputs (pathname, fp);
putc (0, fp);
return
1
;
}
| void pred_fprint0(char *a0, unsigned long a1, struct_0 *a2) {
unsigned long v0;
void* v1;
unsigned long long v3;
v0 = a1;
v1 = a2->field_40;
fputs(a0, v1);
putc(0x0, v1);
v3 = 1;
return;
}
|
void
session_close(struct ssh *ssh, Session *s)
{
u_int i;
sshlog("session.c", __func__, 2426, 0, SYSLOG_LEVEL_VERBOSE,
((void *)0)
, "Close session: user %s from %.200s port %d id %d", s->pw->pw_name, ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), s->self)
;
if (s->ttyfd != -1)
session_pty_cleanup(s);
free(s->term);
free(s->display);
free(s->x11_chanids);
free(s->auth_display);
free(s->auth_data);
free(s->auth_proto);
free(s->subsys);
if (s->env !=
((void *)0)
) {
for (i = 0; i < s->num_env; i++) {
free(s->env[i].name);
free(s->env[i].val);
}
free(s->env);
}
session_proctitle(s);
session_unused(s->self);
}
| long session_close(long a1, long a2)
{
long v2;
long v3;
const char *v4;
unsigned int i;
v2 = *(unsigned int *)(a2 + 4);
v3 = (unsigned int)ssh_remote_port(a1);
v4 = (const char *)ssh_remote_ipaddr(a1);
sshlog(
"session.c",
"session_close",
2426LL,
0LL,
4LL,
0LL,
"Close session: user %s from %.200s port %d id %d",
**(const char ***)(a2 + 16),
v4,
v3,
v2);
if ( *(_DWORD *)(a2 + 52) != -1 )
session_pty_cleanup(a2);
free(*(void **)(a2 + 40));
free(*(void **)(a2 + 144));
free(*(void **)(a2 + 192));
free(*(void **)(a2 + 160));
free(*(void **)(a2 + 176));
free(*(void **)(a2 + 168));
free(*(void **)(a2 + 208));
if ( *(_QWORD *)(a2 + 224) )
{
for ( i = 0; i < *(_DWORD *)(a2 + 216); ++i )
{
free(*(void **)(16LL * i + *(_QWORD *)(a2 + 224)));
free(*(void **)(16LL * i + *(_QWORD *)(a2 + 224) + 8));
}
free(*(void **)(a2 + 224));
}
session_proctitle(a2);
return session_unused(*(_DWORD *)(a2 + 4));
}
|
test_code_t test_ext_master_secret(gnutls_session_t session)
{
int ret;
if (tls_ext_ok == 0)
return TEST_IGNORE;
sprintf(prio_str, "NONE:"
"+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT"
":%s:" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12", rest, protocol_str);
{ int _ret; if ((_ret=__gnutls_priority_set_direct(session, prio_str, 470)) != TEST_SUCCEED) { return _ret; } };
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret < 0)
return TEST_FAILED;
if (gnutls_session_ext_master_secret_status(session) != 0)
return TEST_SUCCEED;
return TEST_FAILED;
}
| long long test_ext_master_secret(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
if (!tls_ext_ok) {
v3 = 3;
} else {
sprintf(&prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:%s:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12", &rest, &protocol_str);
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x1d6);
if (v0) {
v3 = v0;
} else {
gnutls_credentials_set(a0, 0x1, xcred);
v1 = test_do_handshake(a0);
if (v1 < 0) {
v3 = 1;
} else if (gnutls_session_ext_master_secret_status(a0)) {
v3 = 0;
} else {
v3 = 1;
}
}
}
return v3;
}
|
static void
sequential_sort (struct line *__restrict__ lines, size_t nlines,
struct line *__restrict__ temp,
_Bool
to_temp)
{
if (nlines == 2)
{
int swap = (0 < compare (&lines[-1], &lines[-2]));
if (to_temp)
{
temp[-1] = lines[-1 - swap];
temp[-2] = lines[-2 + swap];
}
else if (swap)
{
temp[-1] = lines[-1];
lines[-1] = lines[-2];
lines[-2] = temp[-1];
}
}
else
{
size_t nlo = nlines / 2;
size_t nhi = nlines - nlo;
struct line *lo = lines;
struct line *hi = lines - nlo;
sequential_sort (hi, nhi, temp - (to_temp ? nlo : 0), to_temp);
if (1 < nlo)
sequential_sort (lo, nlo, temp, !to_temp);
else if (!to_temp)
temp[-1] = lo[-1];
struct line *dest;
struct line const *sorted_lo;
if (to_temp)
{
dest = temp;
sorted_lo = lines;
}
else
{
dest = lines;
sorted_lo = temp;
}
mergelines (dest, nlines, sorted_lo);
}
}
| void sequential_sort(unsigned long long a0[2305843009213693952], unsigned int a1, unsigned long a2, unsigned long a3) {
char v0;
int tmp_24;
int tmp_80;
int tmp_90;
int tmp_134;
int tmp_46;
int tmp_56;
int tmp_76;
int tmp_86;
int tmp_106;
unsigned long long v1[2305843009213693952];
unsigned long long v2[2305843009213693952];
unsigned int v3;
unsigned long long v4[2305843009213693952];
unsigned long long v5[2305843009213693952];
unsigned long long v6;
unsigned long long v7;
unsigned long long v8[2305843009213693952];
unsigned long long v9;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
unsigned long long v16;
unsigned long long v17;
unsigned long long v18;
v2[0] = a0;
v1[0] = a2;
v0 = a3;
if (a1 != 2) {
v6 = a1 / 2;
v7 = a1 - v6;
v8[0] = a0;
v9 = a0 + -(v6 << 5);
sequential_sort(v9, v7, (!v0 ? -(v6 << 5) : 0) + v1, v0);
if (v6 > 1) {
sequential_sort(v8, v6, v1, !(v0));
} else if ((v0 ^ 1)) {
tmp_24 = v8[3];
v1[4] = v8[4];
v1[3] = tmp_24;
v17 = v8[1];
v1[2] = v8[2];
v1[1] = v17;
}
if (v0) {
v4[0] = v1;
v5[0] = a0;
} else {
v4[0] = a0;
v5[0] = v1;
}
v18 = mergelines(v4, a1, v5);
return;
} else {
v3 = compare(&a0[4], &a0[8]) > 0;
if (v0) {
tmp_80 = a0[1 + 4 * !(v3)];
v1[4] = a0[4 * !(v3)];
v1[3] = tmp_80;
tmp_90 = a0[3 + 4 * !(v3)];
v1[2] = a0[2 + 4 * !(v3)];
v1[1] = tmp_90;
tmp_134 = a0[7 + 4 * v3];
v1[8] = a0[8 + 4 * v3];
v1[7] = tmp_134;
v13 = a0[6 + 4 * v3];
v14 = a0[5 + 4 * v3];
v1[6] = a0[6 + 4 * v3];
v1[5] = v14;
return;
}
if (v3) {
tmp_46 = a0[3];
v1[4] = a0[4];
v1[3] = tmp_46;
tmp_56 = a0[1];
v1[2] = a0[2];
v1[1] = tmp_56;
tmp_76 = a0[7];
a0[4] = a0[8];
a0[3] = tmp_76;
tmp_86 = a0[5];
a0[2] = a0[6];
a0[1] = tmp_86;
tmp_106 = v1[3];
a0[8] = v1[4];
a0[7] = tmp_106;
v15 = v1[2];
v16 = v1[1];
a0[6] = v1[2];
a0[5] = v16;
}
return;
}
}
|
static void
initialize_dynamic_variables ()
{
SHELL_VAR *v;
v = init_seconds_var ();
do { v = bind_variable ("BASH_ARGV0", ((char *)
((void *)0)
), 0); v->dynamic_value = get_bash_argv0; v->assign_func = assign_bash_argv0; } while (0);
do { v = bind_variable ("BASH_COMMAND", ((char *)
((void *)0)
), 0); v->dynamic_value = get_bash_command; v->assign_func = (sh_var_assign_func_t *)
((void *)0)
; } while (0);
do { v = bind_variable ("BASH_SUBSHELL", ((char *)
((void *)0)
), 0); v->dynamic_value = get_subshell; v->assign_func = assign_subshell; } while (0);
do { v = bind_variable ("RANDOM", ((char *)
((void *)0)
), 0); v->dynamic_value = get_random; v->assign_func = assign_random; } while (0);
((v)->attributes |= (0x0000010));
do { v = bind_variable ("SRANDOM", ((char *)
((void *)0)
), 0); v->dynamic_value = get_urandom; v->assign_func = (sh_var_assign_func_t *)
((void *)0)
; } while (0);
((v)->attributes |= (0x0000010));
do { v = bind_variable ("LINENO", ((char *)
((void *)0)
), 0); v->dynamic_value = get_lineno; v->assign_func = assign_lineno; } while (0);
((v)->attributes |= (0x0040000));
do { v = bind_variable ("BASHPID", ((char *)
((void *)0)
), 0); v->dynamic_value = get_bashpid; v->assign_func = null_assign; } while (0);
((v)->attributes |= (0x0000010));
do { v = bind_variable ("EPOCHSECONDS", ((char *)
((void *)0)
), 0); v->dynamic_value = get_epochseconds; v->assign_func = null_assign; } while (0);
((v)->attributes |= (0x0040000));
do { v = bind_variable ("EPOCHREALTIME", ((char *)
((void *)0)
), 0); v->dynamic_value = get_epochrealtime; v->assign_func = null_assign; } while (0);
((v)->attributes |= (0x0040000));
do { v = bind_variable ("HISTCMD", ((char *)
((void *)0)
), 0); v->dynamic_value = get_histcmd; v->assign_func = (sh_var_assign_func_t *)
((void *)0)
; } while (0);
((v)->attributes |= (0x0000010));
do { v = bind_variable ("COMP_WORDBREAKS", ((char *)
((void *)0)
), 0); v->dynamic_value = get_comp_wordbreaks; v->assign_func = assign_comp_wordbreaks; } while (0);
v = init_dynamic_array_var ("DIRSTACK", get_dirstack, assign_dirstack, 0);
v = init_dynamic_array_var ("GROUPS", get_groupset, null_array_assign, 0x0004000);
v = init_dynamic_array_var ("BASH_ARGC", get_bashargcv, null_array_assign, 0x0004000|0x0002000);
v = init_dynamic_array_var ("BASH_ARGV", get_bashargcv, null_array_assign, 0x0004000|0x0002000);
v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, 0x0004000|0x0002000);
v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, 0x0004000|0x0002000);
v = init_dynamic_assoc_var ("BASH_CMDS", get_hashcmd, assign_hashcmd, 0x0020000);
v = init_dynamic_assoc_var ("BASH_ALIASES", get_aliasvar, assign_aliasvar, 0x0020000);
v = init_funcname_var ();
}
| void initialize_dynamic_variables(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned long v0;
v0 = init_seconds_var(a0, a1, a2);
v0[0] = bind_variable("BASH_ARGV0", 0x0, 0x0);
v0[3] = get_bash_argv0;
v0[4] = assign_bash_argv0;
v0[0] = bind_variable("BASH_COMMAND", 0x0, 0x0);
v0[3] = get_bash_command;
v0[4] = 0;
v0[0] = bind_variable("BASH_SUBSHELL", 0x0, 0x0);
v0[3] = get_subshell;
v0[4] = assign_subshell;
v0 = bind_variable("RANDOM", 0x0, 0x0);
v0[3] = get_random;
v0[4] = assign_random;
v0->field_28 = v0->field_28 | 16;
v0 = bind_variable("SRANDOM", 0x0, 0x0);
v0[3] = get_urandom;
v0[4] = 0;
v0->field_28 = v0->field_28 | 16;
v0 = bind_variable("LINENO", 0x0, 0x0);
v0[3] = get_lineno;
v0[4] = assign_lineno;
v0->field_28 = v0->field_28 | 0x40000;
v0 = bind_variable("BASHPID", 0x0, 0x0);
v0[3] = get_bashpid;
v0[4] = null_assign;
v0->field_28 = v0->field_28 | 16;
v0 = bind_variable("EPOCHSECONDS", 0x0, 0x0);
v0[3] = get_epochseconds;
v0[4] = null_assign;
v0->field_28 = v0->field_28 | 0x40000;
v0 = bind_variable("EPOCHREALTIME", 0x0, 0x0);
v0[3] = get_epochrealtime;
v0[4] = null_assign;
v0->field_28 = v0->field_28 | 0x40000;
v0 = bind_variable("HISTCMD", 0x0, 0x0);
v0[3] = get_histcmd;
v0[4] = 0;
v0->field_28 = v0->field_28 | 16;
v0[0] = bind_variable("COMP_WORDBREAKS", 0x0, 0x0);
v0[3] = get_comp_wordbreaks;
v0[4] = assign_comp_wordbreaks;
v0 = init_dynamic_array_var("DIRSTACK", get_dirstack, assign_dirstack, 0x0, a4, a5);
v0 = init_dynamic_array_var("GROUPS", get_groupset, null_array_assign, 0x4000, a4, a5);
v0 = init_dynamic_array_var("BASH_ARGC", get_bashargcv, null_array_assign, 0x6000, a4, a5);
v0 = init_dynamic_array_var("BASH_ARGV", get_bashargcv, null_array_assign, 0x6000, a4, a5);
v0 = init_dynamic_array_var("BASH_SOURCE", get_self, null_array_assign, 0x6000, a4, a5);
v0 = init_dynamic_array_var("BASH_LINENO", get_self, null_array_assign, 0x6000, a4, a5);
v0 = init_dynamic_assoc_var("BASH_CMDS", get_hashcmd, assign_hashcmd, 0x20000);
v0 = init_dynamic_assoc_var("BASH_ALIASES", get_aliasvar, assign_aliasvar, 0x20000);
*(&v0) = init_funcname_var("BASH_ALIASES", get_aliasvar, assign_aliasvar, 0x20000, a4, a5);
return;
}
|
BZFILE * BZ2_bzdopen
( int fd,
const char *mode )
{
return bzopen_or_bzdopen(
((void *)0)
,fd,mode, 1);
}
| long long BZ2_bzdopen(unsigned long a0, unsigned int a1) {
return bzopen_or_bzdopen(NULL, a0, a1, 0x1);
}
|
static void
xsplit (mp, nu)
union mhead *mp;
int nu;
{
union mhead *nh;
int nbuck, nblks, split_max;
unsigned long siz;
nbuck = nu - 1;
while (nbuck >= 1 && busy[nbuck])
nbuck--;
if (nbuck < 1)
return;
siz = binsizes[(nu)];
nblks = siz / binsizes[(nbuck)];
siz = binsizes[(nbuck)];
nh = mp;
while (1)
{
mp->minfo.mi_alloc = ((char) 0x54);
mp->minfo.mi_index = nbuck;
if (--nblks <= 0) break;
(*(union mhead **) (sizeof (char *) + (char *) (mp))) = (union mhead *)((char *)mp + siz);
mp = (union mhead *)((char *)mp + siz);
}
busy[nbuck] = 1;
(*(union mhead **) (sizeof (char *) + (char *) (mp))) = nextf[nbuck];
nextf[nbuck] = nh;
busy[nbuck] = 0;
}
| void xsplit(undefined *param_1,int param_2)
{
long lVar1;
undefined *local_30;
int local_20;
int local_1c;
for (local_20 = param_2 + -1; (0 < local_20 && (busy[local_20] != '\0')); local_20 = local_20 + -1
) {
}
if (0 < local_20) {
local_1c = (int)(*(ulong *)(binsizes + (long)param_2 * 8) /
*(ulong *)(binsizes + (long)local_20 * 8));
lVar1 = *(long *)(binsizes + (long)local_20 * 8);
local_30 = param_1;
while( true ) {
*local_30 = 0x54;
local_30[1] = (char)local_20;
local_1c = local_1c + -1;
if (local_1c < 1) break;
*(undefined **)(local_30 + 8) = local_30 + lVar1;
local_30 = local_30 + lVar1;
}
busy[local_20] = 1;
*(undefined8 *)(local_30 + 8) = *(undefined8 *)(nextf + (long)local_20 * 8);
*(undefined **)(nextf + (long)local_20 * 8) = param_1;
busy[local_20] = 0;
}
return;
}
|
int
acl_delete_def_file(const char *path_p)
{
int error;
error = removexattr(path_p, "system.posix_acl_default");
if (error < 0 &&
(*__errno_location ())
!=
61
&&
(*__errno_location ())
!=
61
)
return -1;
return 0;
}
| long long acl_delete_def_file(unsigned long long a0) {
unsigned int v0;
unsigned int v2;
unsigned int v3;
unsigned long long v4;
v0 = removexattr(a0, "system.posix_acl_default");
if (v0 < 0) {
v2 = *(__errno_location());
if (v2 != 61) {
v3 = *(__errno_location());
if (v3 != 61)
v4 = 4294967295;
}
}
if (v2 == 61 || v3 == 61 || v0 >= 0)
v4 = 0;
return v4;
}
|
void print_cert_info2(gnutls_session_t session, int verbose, FILE *out, int print_cert)
{
int flag, print_crt_status = 0;
if (verbose)
flag = GNUTLS_CRT_PRINT_FULL;
else
flag = GNUTLS_CRT_PRINT_COMPACT;
if (gnutls_certificate_client_get_request_status(session) != 0) {
log_msg(
stdout
, "- Server has requested a certificate.\n");
print_crt_status = 1;
}
switch (gnutls_certificate_type_get2(session, GNUTLS_CTYPE_PEERS)) {
case GNUTLS_CRT_X509:
print_x509_info(session, out, flag, print_cert, print_crt_status);
break;
case GNUTLS_CRT_RAWPK:
print_rawpk_info(session, out, flag, print_cert, print_crt_status);
break;
default:
break;
}
}
| void print_cert_info2(unsigned long long a0, unsigned long a1, unsigned long long a2, unsigned long a3) {
unsigned int v0;
unsigned int v1;
unsigned long long v4;
unsigned long long v5;
v1 = 0;
if (a1)
v0 = 0;
else
v0 = 3;
if (gnutls_certificate_client_get_request_status(a0)) {
log_msg();
v1 = 1;
}
switch (gnutls_certificate_type_get2(a0, 0x3)) {
case 1:
v4 = print_x509_info(a0, a2, v0, a3, v1);
return;
case 3:
v5 = print_rawpk_info(a0, a2, v0, a3, v1);
return;
default:
return;
}
}
|
int
getentropy(void *buf, size_t len)
{
int ret = -1;
if (len > 256) {
(*__errno_location ())
=
5
;
return (-1);
}
ret = getentropy_getrandom(buf, len);
if (ret != -1)
return (ret);
ret = getentropy_urandom(buf, len);
if (ret != -1)
return (ret);
ret = getentropy_sysctl(buf, len);
if (ret != -1)
return (ret);
ret = getentropy_fallback(buf, len);
if (ret != -1)
return (ret);
(*__errno_location ())
=
5
;
return (ret);
}
| long long getentropy(unsigned long long a0, unsigned long long a1) {
unsigned int v0;
unsigned long long v2;
v0 = -1;
if (a1 > 0x100) {
*(__errno_location()) = 5;
v2 = 4294967295;
} else {
v0 = getentropy_getrandom(a0, a1);
if (v0 != -1) {
v2 = v0;
} else {
v0 = getentropy_urandom(a0, a1);
if (v0 != -1) {
v2 = v0;
} else {
v0 = getentropy_sysctl(a0, a1);
if (v0 != -1) {
v2 = v0;
} else {
v0 = getentropy_fallback(a0, a1);
if (v0 != -1) {
v2 = v0;
} else {
*(__errno_location()) = 5;
v2 = v0;
}
}
}
}
}
return v2;
}
|
static void
decode(char *s)
{
const char *src;
char *dest;
src = s;
dest = s;
while (*src != '\0') {
if (*src != '\\')
*dest = *src++;
else {
static const struct repl {
char orig[4];
size_t len;
char new;
} repls[] = {
{ "\\", sizeof("\\") - 1, '\\' },
{ "011", sizeof("011") - 1, '\t' },
{ "012", sizeof("012") - 1, '\n' },
{ "040", sizeof("040") - 1, ' ' },
{ "134", sizeof("134") - 1, '\\' }
};
size_t i;
for (i = 0; i < sizeof (repls) / sizeof (repls[0]);
i++) {
if (memcmp(src + 1, repls[i].orig,
repls[i].len) == 0) {
*dest = repls[i].new;
src += 1 + repls[i].len;
goto found;
}
}
*dest = *src++;
found:
;
}
dest++;
}
*dest = '\0';
}
| _BYTE * decode(_BYTE *a1)
{
_BYTE *v1;
_BYTE *v2;
_BYTE *result;
_BYTE *v4;
_BYTE *v5;
unsigned long i;
v4 = a1;
v5 = a1;
while ( *v4 )
{
if ( *v4 == 92 )
{
for ( i = 0LL; i <= 4; ++i )
{
if ( !memcmp(v4 + 1, &repls_3454[24 * i], *((_QWORD *)&unk_288 + 3 * i)) )
{
*v5 = byte_290[24 * i];
v4 += *((_QWORD *)&unk_288 + 3 * i) + 1;
goto LABEL_10;
}
}
v2 = v4++;
*v5 = *v2;
}
else
{
v1 = v4++;
*v5 = *v1;
}
LABEL_10:
++v5;
}
result = v5;
*v5 = 0;
return result;
}
|
static const char *
fmt_intarg(OpCodes code, int val)
{
if (val == -1)
return "unset";
switch (code) {
case oAddressFamily:
return fmt_multistate_int(val, multistate_addressfamily);
case oVerifyHostKeyDNS:
case oUpdateHostkeys:
return fmt_multistate_int(val, multistate_yesnoask);
case oStrictHostKeyChecking:
return fmt_multistate_int(val, multistate_strict_hostkey);
case oControlMaster:
return fmt_multistate_int(val, multistate_controlmaster);
case oTunnel:
return fmt_multistate_int(val, multistate_tunnel);
case oRequestTTY:
return fmt_multistate_int(val, multistate_requesttty);
case oSessionType:
return fmt_multistate_int(val, multistate_sessiontype);
case oCanonicalizeHostname:
return fmt_multistate_int(val, multistate_canonicalizehostname);
case oAddKeysToAgent:
return fmt_multistate_int(val, multistate_yesnoaskconfirm);
case oPubkeyAuthentication:
return fmt_multistate_int(val, multistate_pubkey_auth);
case oFingerprintHash:
return ssh_digest_alg_name(val);
default:
switch (val) {
case 0:
return "no";
case 1:
return "yes";
default:
return "UNKNOWN";
}
}
}
| int fmt_intarg(unsigned long a0, unsigned long a1) {
unsigned int v1;
if (a1 == -1) {
v1 = &g_40c972;
} else {
switch (a0) {
case 19:
v1 = fmt_multistate_int(a1, &multistate_yesnoaskconfirm);
break;
case 29:
v1 = fmt_multistate_int(a1, &multistate_strict_hostkey);
break;
case 38:
v1 = fmt_multistate_int(a1, &multistate_pubkey_auth);
break;
case 53: case 90:
v1 = fmt_multistate_int(a1, &multistate_yesnoask);
break;
case 55:
v1 = fmt_multistate_int(a1, &multistate_addressfamily);
break;
case 64:
v1 = fmt_multistate_int(a1, &multistate_controlmaster);
break;
case 67:
v1 = fmt_multistate_int(a1, &multistate_tunnel);
break;
case 75:
v1 = fmt_multistate_int(a1, &multistate_requesttty);
break;
case 76:
v1 = fmt_multistate_int(a1, &multistate_sessiontype);
break;
case 82:
v1 = fmt_multistate_int(a1, &multistate_canonicalizehostname);
break;
case 89:
v1 = ssh_digest_alg_name(a1);
break;
default:
if (!a1) {
v1 = &g_40b7b9;
break;
} else if (a1 == 1) {
v1 = &g_40b7b5;
break;
} else {
v1 = &g_40c96a;
break;
}
}
}
return v1;
}
|
inline int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
| void ext2fs_test_inode_bitmap(void)
{
halt_baddata();
}
|
static void
set_verify_format(const struct cmdinfo *cip, const char *value)
{
if (!verify_set_output(value))
badusage(gettext("unknown verify output format '%s'"), value);
}
| long long set_verify_format(unsigned long a0, unsigned long long a1) {
unsigned long v0;
unsigned long long v2;
v0 = a0;
v2 = verify_set_output(a1) ^ 1;
if (v2)
v2 = badusage(gettext("unknown verify output format '%s'"), a1);
return v2;
}
|
test_code_t test_certificate(gnutls_session_t session)
{
int ret;
FILE *fp;
(void)remove("debug-certs.out");
if (verbose == 0)
return TEST_IGNORE;
sprintf(prio_str,
"NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:"
"+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%s", protocol_str, rest);
{ int _ret; if ((_ret=__gnutls_priority_set_direct(session, prio_str, 1537)) != TEST_SUCCEED) { return _ret; } };
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret == TEST_FAILED)
return ret;
fp = fopen("debug-certs.out", "w");
if (fp !=
((void *)0)
) {
fprintf(fp, "\n");
print_cert_info2(session, GNUTLS_CRT_PRINT_FULL, fp, verbose);
fclose(fp);
ext_text = "saved in debug-certs.out";
return TEST_SUCCEED;
}
return TEST_FAILED;
}
| long long test_certificate(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
void* v2;
unsigned long long v4;
remove("debug-certs.out");
if (!verbose) {
v4 = 3;
} else {
sprintf(&prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s", &protocol_str, &rest);
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x601);
if (v0) {
v4 = v0;
} else {
gnutls_credentials_set(a0, 0x1, xcred);
v1 = test_do_handshake(a0);
if (v1 == 1) {
v4 = v1;
} else {
v2 = fopen("debug-certs.out", "w");
if (v2) {
fprintf(v2, "\n");
print_cert_info2(a0, 0x0, v2, verbose);
fclose(v2);
ext_text = "saved in debug-certs.out";
v4 = 0;
} else {
v4 = 1;
}
}
}
}
return v4;
}
|
void
hash_clear (Hash_table *table)
{
struct hash_entry *bucket;
for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
{
if (bucket->data)
{
struct hash_entry *cursor;
struct hash_entry *next;
for (cursor = bucket->next; cursor; cursor = next)
{
if (table->data_freer)
table->data_freer (cursor->data);
cursor->data =
((void *)0)
;
next = cursor->next;
cursor->next = table->free_entry_list;
table->free_entry_list = cursor;
}
if (table->data_freer)
table->data_freer (bucket->data);
bucket->data =
((void *)0)
;
bucket->next =
((void *)0)
;
}
}
table->n_buckets_used = 0;
table->n_entries = 0;
}
| long long hash_clear(unsigned long long a0[10]) {
unsigned long long v0[2];
unsigned long long v1[2];
unsigned long v2;
for (v0[0] = a0[0]; v0 < a0[1]; v0[0] = v0 + 1) {
if (v0[0]) {
for (v1[0] = v0[1]; v1; v1[0] = v2) {
if (a0[8])
a0[8](v1[0]);
v1[0] = 0;
v2 = v1[1];
v1[1] = a0[9];
a0[9] = v1;
}
if (a0[8])
a0[8](v0[0]);
v0[0] = 0;
v0[1] = 0;
}
}
a0[3] = 0;
a0[4] = 0;
return a0;
}
|
static inline
_Bool
is_empty_dir (int fd_cwd, char const *dir)
{
DIR *dirp;
struct dirent const *dp;
int saved_errno;
int fd = openat (fd_cwd, dir,
(
00
|
0200000
|
0400
|
0400000
|
04000
));
if (fd < 0)
return
0
;
dirp = fdopendir (fd);
if (dirp ==
((void *)0)
)
{
close (fd);
return
0
;
}
(*__errno_location ())
= 0;
dp = readdir_ignoring_dot_and_dotdot (dirp);
saved_errno =
(*__errno_location ())
;
closedir (dirp);
(*__errno_location ())
= saved_errno;
if (dp !=
((void *)0)
)
return
0
;
return saved_errno == 0 ?
1
:
0
;
}
| int is_empty_dir(unsigned long a0, unsigned long long a1) {
unsigned int v0;
unsigned int v1;
unsigned long long v2;
unsigned long v3;
unsigned long v5;
v0 = openat(a0, a1, 0x30900, a1);
if (v0 < 0) {
v5 = 0;
} else {
v2 = fdopendir(v0);
if (!v2) {
close(v0);
v5 = 0;
} else {
*(__errno_location()) = 0;
v3 = readdir_ignoring_dot_and_dotdot(v2);
v1 = *(__errno_location());
closedir(v2);
v5 = __errno_location();
*(v5) = v1;
if (v3)
*(&v5) = 0;
else
*(&v5) = !v1;
}
}
return v5;
}
|
static int
cost_table_comparison (const void *p1, const void *p2)
{
const struct pred_cost_lookup *pc1 = p1;
const struct pred_cost_lookup *pc2 = p2;
union {
PRED_FUNC pfn;
char mem[sizeof (PRED_FUNC)];
} u1, u2;
u1.pfn = pc1->fn;
u2.pfn = pc2->fn;
return memcmp (u1.mem, u2.mem, sizeof(u1.pfn));
}
| void cost_table_comparison(undefined8 *param_1,undefined8 *param_2)
{
long in_FS_OFFSET;
undefined8 local_20;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_20 = *param_1;
local_18 = *param_2;
memcmp(&local_20,&local_18,8);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
static void
free_dollar_vars ()
{
int i;
for (i = 1; i < 10; i++)
{
do { if (dollar_vars[i]) sh_xfree((dollar_vars[i]), "variables.c", 5602); } while (0);
dollar_vars[i] = (char *)
((void *)0)
;
}
}
| void free_dollar_vars(void)
{
int local_c;
for (local_c = 1; local_c < 10; local_c = local_c + 1) {
if (*(long *)(dollar_vars + (long)local_c * 8) != 0) {
sh_xfree(*(undefined8 *)(dollar_vars + (long)local_c * 8),"variables.c",0x15e2);
}
*(undefined8 *)(dollar_vars + (long)local_c * 8) = 0;
}
return;
}
|
static int
execute_arith_command (arith_command)
ARITH_COM *arith_command;
{
int expok, save_line_number, retval, eflag;
intmax_t expresult;
WORD_LIST *new;
char *exp, *t;
expresult = 0;
save_line_number = line_number;
this_command_name = "((";
do { line_number = arith_command->line; if (signal_in_progress (
(64 + 1)
+1) == 0 && running_trap != (
(64 + 1)
+1 + 1)) line_number_for_err_trap = line_number; } while (0);
if (variable_context && interactive_shell && sourcelevel == 0)
{
line_number -= function_line_number - 1;
if (line_number <= 0)
line_number = 1;
}
command_string_index = 0;
print_arith_command (arith_command->exp);
if (signal_in_progress (
(64 + 1)
) == 0 && running_trap == 0)
{
do { if (the_printed_command_except_trap) sh_xfree((the_printed_command_except_trap), "execute_cmd.c", 3807); } while (0);
the_printed_command_except_trap = (char *)strcpy (sh_xmalloc((1 + strlen (the_printed_command)), "execute_cmd.c", 3808), (the_printed_command));
}
retval = run_debug_trap ();
if (debugging_mode && retval != 0)
{
line_number = save_line_number;
return (0);
}
this_command_name = "((";
t = (char *)
((void *)0)
;
new = arith_command->exp;
exp = (new->next) ? (t = string_list (new)) : new->word->word;
exp = expand_arith_string (exp, 0x001|0x100);
do { if (t) sh_xfree((t), "execute_cmd.c", 3831); } while (0);
if (echo_command_at_execute)
{
new = make_word_list (make_word (exp ? exp : ""), (WORD_LIST *)
((void *)0)
);
xtrace_print_arith_cmd (new);
dispose_words (new);
}
if (exp)
{
eflag = (shell_compatibility_level > 51) ? 0 : 0x01;
expresult = evalexp (exp, eflag, &expok);
line_number = save_line_number;
sh_xfree((exp), "execute_cmd.c", 3848);
}
else
{
expresult = 0;
expok = 1;
}
if (expok == 0)
return (1);
return (expresult == 0 ? 1 : 0);
}
| bool execute_arith_command(long param_1)
{
char *__src;
int iVar1;
size_t sVar2;
char *__dest;
undefined *puVar3;
undefined8 uVar4;
long in_FS_OFFSET;
bool bVar5;
int local_50;
int local_4c;
int local_48;
uint local_44;
long local_40;
long local_38;
long *local_30;
undefined *local_28;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_40 = 0;
local_4c = line_number;
this_command_name = &DAT_0010b34f;
line_number = *(int *)(param_1 + 4);
iVar1 = signal_in_progress(0x42);
if ((iVar1 == 0) && (running_trap != 0x43)) {
line_number_for_err_trap = line_number;
}
if ((((variable_context != 0) && (interactive_shell != 0)) && (sourcelevel == 0)) &&
(line_number = line_number - (function_line_number + -1), line_number < 1)) {
line_number = 1;
}
_command_string_index = 0;
print_arith_command(*(undefined8 *)(param_1 + 8));
iVar1 = signal_in_progress(0x41);
if ((iVar1 == 0) && (running_trap == 0)) {
if (the_printed_command_except_trap != 0) {
sh_xfree(the_printed_command_except_trap,"execute_cmd.c",0xedf);
}
__src = the_printed_command;
sVar2 = strlen(the_printed_command);
__dest = (char *)sh_xmalloc(sVar2 + 1,"execute_cmd.c",0xee0);
strcpy(__dest,__src);
}
local_48 = run_debug_trap();
if ((debugging_mode == 0) || (local_48 == 0)) {
this_command_name = &DAT_0010b34f;
local_38 = 0;
local_30 = *(long **)(param_1 + 8);
if (*local_30 == 0) {
local_28 = *(undefined **)local_30[1];
}
else {
local_28 = (undefined *)string_list(local_30);
local_38 = (long)local_28;
}
local_28 = (undefined *)expand_arith_string(local_28,0x101);
if (local_38 != 0) {
sh_xfree(local_38,"execute_cmd.c",0xef7);
}
if (echo_command_at_execute != 0) {
puVar3 = local_28;
if (local_28 == (undefined *)0x0) {
puVar3 = &DAT_0010b366;
}
uVar4 = make_word(puVar3);
local_30 = (long *)make_word_list(uVar4,0);
xtrace_print_arith_cmd(local_30);
dispose_words(local_30);
}
if (local_28 == (undefined *)0x0) {
local_40 = 0;
local_50 = 1;
}
else {
local_44 = (uint)(shell_compatibility_level < 0x34);
local_40 = evalexp(local_28,local_44,&local_50);
line_number = local_4c;
sh_xfree(local_28,"execute_cmd.c",0xf08);
}
if (local_50 == 0) {
bVar5 = true;
}
else {
bVar5 = local_40 == 0;
}
}
else {
line_number = local_4c;
bVar5 = false;
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return bVar5;
}
__stack_chk_fail();
}
|
static inline __u32 rta_getattr_u32(const struct rtattr *rta)
{
return *(__u32 *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| int rta_getattr_u32(struct_0 *a0) {
return a0->field_4;
}
|
gl_linked_iterator (gl_list_t list)
{
gl_list_iterator_t result;
result.vtable = list->base.vtable;
result.list = list;
result.p = list->root.next;
result.q = &list->root;
return result;
}
| undefined8 * gl_linked_iterator(undefined8 *param_1,undefined8 *param_2)
{
undefined8 uVar1;
undefined8 local_40;
undefined8 local_28;
undefined8 local_20;
uVar1 = param_2[5];
*param_1 = *param_2;
param_1[1] = param_2;
param_1[2] = local_40;
param_1[3] = uVar1;
param_1[4] = param_2 + 5;
param_1[5] = local_28;
param_1[6] = local_20;
return param_1;
}
|
static long
parse_number (const char *arg)
{
char *endptr =
((void *)0)
;
(*__errno_location ())
= 0;
long result;
if (strncmp (arg, "0x", 2) == 0)
result = strtol (arg + 2, &endptr, 16);
else if (strncmp (arg, "0", 1) == 0
&& strspn (arg, "012345678") == strlen (optarg))
result = strtol (arg + 1, &endptr, 8);
else
result = strtol (arg, &endptr, 10);
if (
(*__errno_location ())
!= 0 || (endptr && *endptr != '\0'))
error (
1
,
(*__errno_location ())
, "'%s' is not a recognizable number.",
arg);
return result;
}
| long parse_number(char *param_1)
{
int iVar1;
int *piVar2;
size_t sVar3;
size_t sVar4;
long in_FS_OFFSET;
char *local_30;
long local_28;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_30 = (char *)0x0;
piVar2 = __errno_location();
*piVar2 = 0;
iVar1 = strncmp(param_1,"0x",2);
if (iVar1 == 0) {
local_28 = strtol(param_1 + 2,&local_30,0x10);
}
else {
iVar1 = strncmp(param_1,"0",1);
if (iVar1 == 0) {
sVar3 = strspn(param_1,"012345678");
sVar4 = strlen(*ppcRam00000000001000ad);
if (sVar3 == sVar4) {
local_28 = strtol(param_1 + 1,&local_30,8);
goto LAB_001000fb;
}
}
local_28 = strtol(param_1,&local_30,10);
}
LAB_001000fb:
piVar2 = __errno_location();
if ((*piVar2 == 0) && ((local_30 == (char *)0x0 || (*local_30 == '\0')))) {
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_28;
}
piVar2 = __errno_location();
error(1,*piVar2,"\'%s\' is not a recognizable number.",param_1);
}
|
static int
server_input_global_request(int type, u_int32_t seq, struct ssh *ssh)
{
char *rtype =
((void *)0)
;
u_char want_reply = 0;
int r, success = 0, allocated_listen_port = 0;
u_int port = 0;
struct sshbuf *resp =
((void *)0)
;
struct passwd *pw = the_authctxt->pw;
struct Forward fwd;
memset(&fwd, 0, sizeof(fwd));
if (pw ==
((void *)0)
|| !the_authctxt->valid)
sshfatal("serverloop.c", __func__, 777, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "no/invalid user");
if ((r = sshpkt_get_cstring(ssh, &rtype,
((void *)0)
)) != 0 ||
(r = sshpkt_get_u8(ssh, &want_reply)) != 0)
sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
sshlog("serverloop.c", __func__, 782, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "rtype %s want_reply %d", rtype, want_reply);
if (strcmp(rtype, "tcpip-forward") == 0) {
if ((r = sshpkt_get_cstring(ssh, &fwd.listen_host,
((void *)0)
)) != 0 ||
(r = sshpkt_get_u32(ssh, &port)) != 0)
sshpkt_fatal(ssh, r, "%s: parse tcpip-forward", __func__);
sshlog("serverloop.c", __func__, 789, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "tcpip-forward listen %s port %u", fwd.listen_host, port)
;
if (port <= 0x7fffffff)
fwd.listen_port = (int)port;
if (port > 0x7fffffff ||
(options.allow_tcp_forwarding & (1)) == 0 ||
!auth_opts->permit_port_forwarding_flag ||
options.disable_forwarding ||
(!want_reply && fwd.listen_port == 0) ||
(fwd.listen_port != 0 &&
!bind_permitted(fwd.listen_port, pw->pw_uid))) {
success = 0;
ssh_packet_send_debug(ssh, "Server has disabled port forwarding.");
} else {
success = channel_setup_remote_fwd_listener(ssh, &fwd,
&allocated_listen_port, &options.fwd_opts);
}
if ((resp = sshbuf_new()) ==
((void *)0)
)
sshfatal("serverloop.c", __func__, 809, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new");
if (allocated_listen_port != 0 &&
(r = sshbuf_put_u32(resp, allocated_listen_port)) != 0)
sshfatal("serverloop.c", __func__, 812, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_put_u32");
} else if (strcmp(rtype, "cancel-tcpip-forward") == 0) {
if ((r = sshpkt_get_cstring(ssh, &fwd.listen_host,
((void *)0)
)) != 0 ||
(r = sshpkt_get_u32(ssh, &port)) != 0)
sshpkt_fatal(ssh, r, "%s: parse cancel-tcpip-forward", __func__);
sshlog("serverloop.c", __func__, 818, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "cancel-tcpip-forward addr %s port %d", fwd.listen_host, port)
;
if (port <= 0x7fffffff) {
fwd.listen_port = (int)port;
success = channel_cancel_rport_listener(ssh, &fwd);
}
} else if (strcmp(rtype, "streamlocal-forward@openssh.com") == 0) {
if ((r = sshpkt_get_cstring(ssh, &fwd.listen_path,
((void *)0)
)) != 0)
sshpkt_fatal(ssh, r, "%s: parse streamlocal-forward@openssh.com", __func__);
sshlog("serverloop.c", __func__, 827, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "streamlocal-forward listen path %s", fwd.listen_path)
;
if ((options.allow_streamlocal_forwarding & (1)) == 0
|| !auth_opts->permit_port_forwarding_flag ||
options.disable_forwarding ||
(pw->pw_uid != 0 && !use_privsep)) {
success = 0;
ssh_packet_send_debug(ssh, "Server has disabled "
"streamlocal forwarding.");
} else {
success = channel_setup_remote_fwd_listener(ssh,
&fwd,
((void *)0)
, &options.fwd_opts);
}
} else if (strcmp(rtype, "cancel-streamlocal-forward@openssh.com") == 0) {
if ((r = sshpkt_get_cstring(ssh, &fwd.listen_path,
((void *)0)
)) != 0)
sshpkt_fatal(ssh, r, "%s: parse cancel-streamlocal-forward@openssh.com", __func__);
sshlog("serverloop.c", __func__, 846, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "cancel-streamlocal-forward path %s", fwd.listen_path)
;
success = channel_cancel_rport_listener(ssh, &fwd);
} else if (strcmp(rtype, "no-more-sessions@openssh.com") == 0) {
no_more_sessions = 1;
success = 1;
} else if (strcmp(rtype, "hostkeys-prove-00@openssh.com") == 0) {
success = server_input_hostkeys_prove(ssh, &resp);
}
if (want_reply) {
if ((r = sshpkt_start(ssh, success ?
81 : 82)) != 0 ||
(success && resp !=
((void *)0)
&& (r = sshpkt_putb(ssh, resp)) != 0) ||
(r = sshpkt_send(ssh)) != 0 ||
(r = ssh_packet_write_wait(ssh)) != 0)
sshpkt_fatal(ssh, r, "%s: send reply", __func__);
}
free(fwd.listen_host);
free(fwd.listen_path);
free(rtype);
sshbuf_free(resp);
return 0;
}
| undefined8 server_input_global_request(undefined4 param_1,undefined4 param_2,undefined8 param_3)
{
undefined4 uVar1;
int iVar2;
undefined8 uVar3;
undefined8 uVar4;
char **ppcVar5;
undefined *puVar6;
long in_FS_OFFSET;
char *apcStack224 [2];
void *pvStack208;
char *pcStack200;
void *pvStack192;
char *apcStack184 [7];
undefined4 local_80;
undefined4 local_7c;
byte local_71;
int local_70;
uint local_6c;
int local_68;
int local_64;
char *local_60;
long local_58;
long local_50;
void *local_48;
uint local_40;
void *local_38 [5];
long local_10;
ppcVar5 = apcStack184 + 6;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_60 = (char *)0x0;
local_71 = 0;
local_64 = 0;
local_70 = 0;
local_6c = 0;
local_58 = 0;
local_50 = *(long *)(the_authctxt + 0x30);
apcStack184[5] = (char *)0x1022ff;
apcStack184[6] = (char *)param_3;
local_80 = param_2;
local_7c = param_1;
memset(&local_48,0,0x38);
if ((local_50 == 0) || (*(int *)(the_authctxt + 0xc) == 0)) {
ppcVar5 = apcStack184 + 4;
apcStack184[4] = "no/invalid user";
sshfatal("serverloop.c","server_input_global_request",0x309,1,1,0);
}
uVar3 = apcStack184[6];
*(undefined8 *)((long)ppcVar5 + -8) = 0x102366;
local_68 = sshpkt_get_cstring(uVar3,&local_60,0);
uVar3 = apcStack184[6];
if (local_68 == 0) {
*(undefined8 *)((long)ppcVar5 + -8) = 0x102382;
local_68 = sshpkt_get_u8(uVar3,&local_71);
if (local_68 != 0) goto LAB_0010238b;
}
else {
LAB_0010238b:
uVar3 = apcStack184[6];
*(undefined8 *)((long)ppcVar5 + -8) = 0x1023ad;
sshpkt_fatal(uVar3,local_68,"%s: parse packet","server_input_global_request");
}
*(ulong *)((long)ppcVar5 + -0x10) = (ulong)local_71;
*(char **)((long)ppcVar5 + -0x18) = local_60;
*(char **)((long)ppcVar5 + -0x20) = "rtype %s want_reply %d";
*(undefined8 *)((long)ppcVar5 + -0x28) = 0x1023f4;
sshlog("serverloop.c","server_input_global_request",0x30e,1,5,0);
*(undefined8 *)((long)ppcVar5 + -8) = 0x10240b;
iVar2 = strcmp(local_60,"tcpip-forward");
uVar3 = apcStack184[6];
puVar6 = (undefined *)ppcVar5;
if (iVar2 == 0) {
*(undefined8 *)((long)ppcVar5 + -8) = 0x10242b;
local_68 = sshpkt_get_cstring(uVar3,&local_48,0);
uVar3 = apcStack184[6];
if (local_68 == 0) {
*(undefined8 *)((long)ppcVar5 + -8) = 0x102447;
local_68 = sshpkt_get_u32(uVar3,&local_6c);
if (local_68 != 0) goto LAB_00102450;
}
else {
LAB_00102450:
uVar3 = apcStack184[6];
*(undefined8 *)((long)ppcVar5 + -8) = 0x102472;
sshpkt_fatal(uVar3,local_68,"%s: parse tcpip-forward","server_input_global_request");
}
*(ulong *)((long)ppcVar5 + -0x10) = (ulong)local_6c;
*(void **)((long)ppcVar5 + -0x18) = local_48;
*(char **)((long)ppcVar5 + -0x20) = "tcpip-forward listen %s port %u";
*(undefined8 *)((long)ppcVar5 + -0x28) = 0x1024b5;
sshlog("serverloop.c","server_input_global_request",0x315,1,5,0);
if (-1 < (int)local_6c) {
local_40 = local_6c;
}
if ((((((int)local_6c < 0) || ((_DAT_00104564 & 1) == 0)) || (*auth_opts == 0)) ||
(_DAT_00104570 != 0)) || ((local_71 == 0 && (local_40 == 0)))) {
LAB_0010251e:
uVar3 = apcStack184[6];
local_64 = 0;
*(undefined8 *)((long)ppcVar5 + -8) = 0x10253d;
ssh_packet_send_debug(uVar3,"Server has disabled port forwarding.");
}
else {
if (local_40 != 0) {
uVar1 = *(undefined4 *)(local_50 + 0x10);
*(undefined8 *)((long)ppcVar5 + -8) = 0x10251a;
iVar2 = bind_permitted(local_40,uVar1);
if (iVar2 == 0) goto LAB_0010251e;
}
uVar3 = apcStack184[6];
*(undefined8 *)((long)ppcVar5 + -8) = 0x10255a;
local_64 = channel_setup_remote_fwd_listener(uVar3,&local_48,&local_70,0x1044d8);
}
*(undefined8 *)((long)ppcVar5 + -8) = 0x102562;
local_58 = sshbuf_new();
if (local_58 == 0) {
puVar6 = (undefined *)((long)ppcVar5 + -0x10);
*(char **)((long)ppcVar5 + -0x10) = "sshbuf_new";
*(undefined8 *)((long)ppcVar5 + -0x18) = 0x1025a9;
sshfatal("serverloop.c","server_input_global_request",0x329,1,1,0);
}
if (local_70 != 0) {
*(undefined8 *)(puVar6 + -8) = 0x1025c7;
local_68 = sshbuf_put_u32(local_58,local_70);
if (local_68 != 0) {
*(undefined8 *)(puVar6 + -8) = 0x1025de;
uVar3 = ssh_err(local_68);
*(char **)(puVar6 + -0x10) = "sshbuf_put_u32";
*(undefined8 *)(puVar6 + -0x18) = 0x102615;
sshfatal("serverloop.c","server_input_global_request",0x32c,1,1,uVar3);
puVar6 = puVar6 + -0x10;
goto LAB_00102615;
}
}
}
else {
LAB_00102615:
*(undefined8 *)(puVar6 + -8) = 0x102628;
iVar2 = strcmp(local_60,"cancel-tcpip-forward");
uVar3 = apcStack184[6];
if (iVar2 == 0) {
*(undefined8 *)(puVar6 + -8) = 0x102648;
local_68 = sshpkt_get_cstring(uVar3,&local_48,0);
uVar3 = apcStack184[6];
if (local_68 == 0) {
*(undefined8 *)(puVar6 + -8) = 0x102664;
local_68 = sshpkt_get_u32(uVar3,&local_6c);
if (local_68 != 0) goto LAB_0010266d;
}
else {
LAB_0010266d:
uVar3 = apcStack184[6];
*(undefined8 *)(puVar6 + -8) = 0x10268f;
sshpkt_fatal(uVar3,local_68,"%s: parse cancel-tcpip-forward","server_input_global_request");
}
*(ulong *)(puVar6 + -0x10) = (ulong)local_6c;
*(void **)(puVar6 + -0x18) = local_48;
*(char **)(puVar6 + -0x20) = "cancel-tcpip-forward addr %s port %d";
*(undefined8 *)(puVar6 + -0x28) = 0x1026d2;
sshlog("serverloop.c","server_input_global_request",0x332,1,5,0);
uVar3 = apcStack184[6];
if (-1 < (int)local_6c) {
local_40 = local_6c;
*(undefined8 *)(puVar6 + -8) = 0x1026fa;
local_64 = channel_cancel_rport_listener(uVar3,&local_48);
}
}
else {
*(undefined8 *)(puVar6 + -8) = 0x102715;
iVar2 = strcmp(local_60,"streamlocal-forward@openssh.com");
uVar3 = apcStack184[6];
if (iVar2 == 0) {
*(undefined8 *)(puVar6 + -8) = 0x102739;
local_68 = sshpkt_get_cstring(uVar3,local_38,0);
uVar3 = apcStack184[6];
if (local_68 != 0) {
*(undefined8 *)(puVar6 + -8) = 0x102764;
sshpkt_fatal(uVar3,local_68,"%s: parse streamlocal-forward@openssh.com",
"server_input_global_request");
}
*(void **)(puVar6 + -8) = local_38[0];
*(char **)(puVar6 + -0x10) = "streamlocal-forward listen path %s";
*(undefined8 *)(puVar6 + -0x18) = 0x10279f;
sshlog("serverloop.c","server_input_global_request",0x33b,1,5,0);
uVar3 = apcStack184[6];
if ((((_DAT_00104568 & 1) == 0) || (*auth_opts == 0)) ||
((_DAT_00104570 != 0 || ((*(int *)(local_50 + 0x10) != 0 && (use_privsep == 0)))))) {
local_64 = 0;
*(undefined8 *)(puVar6 + -8) = 0x1027fb;
ssh_packet_send_debug(uVar3,"Server has disabled streamlocal forwarding.");
}
else {
*(undefined8 *)(puVar6 + -8) = 0x10281c;
local_64 = channel_setup_remote_fwd_listener(uVar3,&local_48,0,0x1044d8);
}
}
else {
*(undefined8 *)(puVar6 + -8) = 0x102837;
iVar2 = strcmp(local_60,"cancel-streamlocal-forward@openssh.com");
uVar3 = apcStack184[6];
if (iVar2 == 0) {
*(undefined8 *)(puVar6 + -8) = 0x10285b;
local_68 = sshpkt_get_cstring(uVar3,local_38,0);
uVar3 = apcStack184[6];
if (local_68 != 0) {
*(undefined8 *)(puVar6 + -8) = 0x102886;
sshpkt_fatal(uVar3,local_68,"%s: parse cancel-streamlocal-forward@openssh.com",
"server_input_global_request");
}
*(void **)(puVar6 + -8) = local_38[0];
*(char **)(puVar6 + -0x10) = "cancel-streamlocal-forward path %s";
*(undefined8 *)(puVar6 + -0x18) = 0x1028c1;
sshlog("serverloop.c","server_input_global_request",0x34e,1,5,0);
uVar3 = apcStack184[6];
*(undefined8 *)(puVar6 + -8) = 0x1028d8;
local_64 = channel_cancel_rport_listener(uVar3,&local_48);
}
else {
*(undefined8 *)(puVar6 + -8) = 0x1028f0;
iVar2 = strcmp(local_60,"no-more-sessions@openssh.com");
if (iVar2 == 0) {
no_more_sessions = 1;
local_64 = 1;
}
else {
*(undefined8 *)(puVar6 + -8) = 0x10291a;
iVar2 = strcmp(local_60,"hostkeys-prove-00@openssh.com");
uVar3 = apcStack184[6];
if (iVar2 == 0) {
*(undefined8 *)(puVar6 + -8) = 0x102931;
local_64 = server_input_hostkeys_prove(uVar3,&local_58);
}
}
}
}
}
}
uVar3 = apcStack184[6];
if (local_71 == 0) goto LAB_001029e0;
if (local_64 == 0) {
uVar4 = 0x52;
}
else {
uVar4 = 0x51;
}
*(undefined8 *)(puVar6 + -8) = 0x102960;
local_68 = sshpkt_start(uVar3,uVar4);
uVar3 = apcStack184[6];
if (local_68 == 0) {
if ((local_64 != 0) && (local_58 != 0)) {
*(undefined8 *)(puVar6 + -8) = 0x10298b;
local_68 = sshpkt_putb(uVar3,local_58);
if (local_68 != 0) goto LAB_001029be;
}
uVar3 = apcStack184[6];
*(undefined8 *)(puVar6 + -8) = 0x1029a0;
local_68 = sshpkt_send(uVar3);
uVar3 = apcStack184[6];
if (local_68 == 0) {
*(undefined8 *)(puVar6 + -8) = 0x1029b5;
local_68 = ssh_packet_write_wait(uVar3);
if (local_68 == 0) goto LAB_001029e0;
}
}
LAB_001029be:
uVar3 = apcStack184[6];
*(undefined8 *)(puVar6 + -8) = 0x1029e0;
sshpkt_fatal(uVar3,local_68,"%s: send reply","server_input_global_request");
LAB_001029e0:
*(undefined8 *)(puVar6 + -8) = 0x1029ec;
free(local_48);
*(undefined8 *)(puVar6 + -8) = 0x1029f8;
free(local_38[0]);
*(undefined8 *)(puVar6 + -8) = 0x102a04;
free(local_60);
*(undefined8 *)(puVar6 + -8) = 0x102a10;
sshbuf_free(local_58);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)(puVar6 + -8) = 0x102a29;
__stack_chk_fail();
}
return 0;
}
|
int
sshbuf_put_eckey(struct sshbuf *buf, const EC_KEY *v)
{
return sshbuf_put_ec(buf, EC_KEY_get0_public_key(v),
EC_KEY_get0_group(v));
}
| long long sshbuf_put_eckey(unsigned long long a0, unsigned long long a1) {
return sshbuf_put_ec(a0, EC_KEY_get0_public_key(a1), EC_KEY_get0_group(a1));
}
|
void
extract_info (filename, structfile, externfile)
char *filename;
FILE *structfile, *externfile;
{
register int i;
DEF_FILE *defs;
struct stat finfo;
size_t file_size;
char *buffer, *line;
int fd, nr;
if (stat (filename, &finfo) == -1)
file_error (filename);
fd = open (filename,
00
, 0666);
if (fd == -1)
file_error (filename);
file_size = (size_t)finfo.st_size;
buffer = xmalloc (1 + file_size);
if ((nr = read (fd, buffer, file_size)) < 0)
file_error (filename);
if (nr < file_size)
file_size = nr;
close (fd);
if (nr == 0)
{
fprintf (
stderr
, "mkbuiltins: %s: skipping zero-length file\n", filename);
free (buffer);
return;
}
defs = (DEF_FILE *)xmalloc (sizeof (DEF_FILE));
defs->filename = filename;
defs->lines = array_create (sizeof (char *));
defs->line_number = 0;
defs->production = (char *)
((void *)0)
;
defs->output = (FILE *)
((void *)0)
;
defs->builtins = (ARRAY *)
((void *)0)
;
i = 0;
while (i < file_size)
{
array_add (&buffer[i], defs->lines);
while (i < file_size && buffer[i] != '\n')
i++;
buffer[i++] = '\0';
}
output_cpp_line_info = 1;
for (i = 0; line = defs->lines->array[i]; i++)
{
defs->line_number = i;
if (*line == '$')
{
register int j;
char *directive;
HANDLER_ENTRY *handler;
for (j = 0; line[j] && !(((line[j]) == ' ') || ((line[j]) == '\t')); j++);
directive = xmalloc (j);
strncpy (directive, line + 1, j - 1);
directive[j -1] = '\0';
handler = find_directive (directive);
if (!handler)
{
line_error (defs, "Unknown directive `%s'", directive);
free (directive);
continue;
}
else
{
while ((((line[j]) == ' ') || ((line[j]) == '\t')))
j++;
(*(handler->function)) (directive, defs, line + j);
}
free (directive);
}
else
{
if (building_builtin)
add_documentation (defs, line);
else if (defs->output)
{
if (output_cpp_line_info)
{
if (defs->filename[0] == '/')
fprintf (defs->output, "#line %d \"%s\"\n",
defs->line_number + 1, defs->filename);
else
fprintf (defs->output, "#line %d \"%s%s\"\n",
defs->line_number + 1,
error_directory ? error_directory : "./",
defs->filename);
output_cpp_line_info = 0;
}
fprintf (defs->output, "%s\n", line);
}
}
}
if (defs->output)
fclose (defs->output);
write_builtins (defs, structfile, externfile);
free (buffer);
free_defs (defs);
}
| void extract_info(char *param_1,undefined8 param_2,undefined8 param_3)
{
int iVar1;
void *__buf;
ssize_t sVar2;
char **ppcVar3;
char *pcVar4;
char *__dest;
long lVar5;
undefined *puVar6;
int iVar7;
long in_FS_OFFSET;
ulong local_e8;
stat local_b8;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = stat(param_1,&local_b8);
if (iVar1 == -1) {
file_error(param_1);
}
iVar1 = open(param_1,0,0x1b6);
if (iVar1 == -1) {
file_error(param_1);
}
local_e8 = local_b8.st_size;
__buf = (void *)xmalloc();
sVar2 = read(iVar1,__buf,local_b8.st_size);
iVar7 = (int)sVar2;
if (iVar7 < 0) {
file_error();
}
if ((ulong)(long)iVar7 < (ulong)local_b8.st_size) {
local_e8 = (ulong)iVar7;
}
close(iVar1);
if (iVar7 == 0) {
fprintf(stderr,"mkbuiltins: %s: skipping zero-length file\n",param_1);
free(__buf);
}
else {
ppcVar3 = (char **)xmalloc(0x30);
*ppcVar3 = param_1;
pcVar4 = (char *)array_create(8);
ppcVar3[1] = pcVar4;
*(undefined4 *)(ppcVar3 + 2) = 0;
ppcVar3[3] = (char *)0x0;
ppcVar3[4] = (char *)0x0;
ppcVar3[5] = (char *)0x0;
for (iVar1 = 0; (ulong)(long)iVar1 < local_e8; iVar1 = iVar1 + 1) {
array_add((long)__buf + (long)iVar1,ppcVar3[1]);
for (; ((ulong)(long)iVar1 < local_e8 && (*(char *)((long)__buf + (long)iVar1) != '\n'));
iVar1 = iVar1 + 1) {
}
*(undefined *)((long)__buf + (long)iVar1) = 0;
}
output_cpp_line_info = 1;
iVar1 = 0;
while (pcVar4 = *(char **)(*(long *)(ppcVar3[1] + 0x10) + (long)iVar1 * 8),
pcVar4 != (char *)0x0) {
*(int *)(ppcVar3 + 2) = iVar1;
if (*pcVar4 == '$') {
for (iVar7 = 0;
((pcVar4[iVar7] != '\0' && (pcVar4[iVar7] != ' ')) && (pcVar4[iVar7] != '\t'));
iVar7 = iVar7 + 1) {
}
__dest = (char *)xmalloc(iVar7);
strncpy(__dest,pcVar4 + 1,(long)(iVar7 + -1));
__dest[(long)iVar7 + -1] = '\0';
lVar5 = find_directive(__dest);
if (lVar5 == 0) {
line_error(ppcVar3,"Unknown directive `%s\'",__dest);
free(__dest);
}
else {
for (; (pcVar4[iVar7] == ' ' || (pcVar4[iVar7] == '\t')); iVar7 = iVar7 + 1) {
}
(**(code **)(lVar5 + 8))(__dest,ppcVar3,pcVar4 + iVar7);
free(__dest);
}
}
else if (building_builtin == 0) {
if (ppcVar3[4] != (char *)0x0) {
if (output_cpp_line_info != 0) {
if (**ppcVar3 == '/') {
fprintf((FILE *)ppcVar3[4],"#line %d \"%s\"\n",(ulong)(*(int *)(ppcVar3 + 2) + 1),
*ppcVar3);
}
else {
puVar6 = error_directory;
if (error_directory == (undefined *)0x0) {
puVar6 = &DAT_001030b1;
}
fprintf((FILE *)ppcVar3[4],"#line %d \"%s%s\"\n",(ulong)(*(int *)(ppcVar3 + 2) + 1),
puVar6,*ppcVar3);
}
output_cpp_line_info = 0;
}
fprintf((FILE *)ppcVar3[4],"%s\n",pcVar4);
}
}
else {
add_documentation(ppcVar3);
}
iVar1 = iVar1 + 1;
}
if (ppcVar3[4] != (char *)0x0) {
fclose((FILE *)ppcVar3[4]);
}
write_builtins(ppcVar3,param_2,param_3);
free(__buf);
free_defs(ppcVar3);
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
}
|
static void listener_free(const void *elt)
{
listener_item *j = (listener_item *)elt;
free(j->http_request);
free(j->http_response);
if (j->fd >= 0) {
if (j->close_ok)
gnutls_bye(j->tls_session, GNUTLS_SHUT_WR);
shutdown(j->fd, 2);
close(j->fd);
gnutls_deinit(j->tls_session);
}
}
| long long listener_free(struct_0 *a0) {
unsigned long long v1;
free(a0->field_0);
free(a0->field_8);
v1 = a0->field_24;
if (a0->field_24 < 0)
return v1;
if (a0->field_34)
gnutls_bye(a0->field_28, 0x1);
shutdown(a0->field_24, 0x2);
close(a0->field_24);
v1 = gnutls_deinit(a0->field_28);
return v1;
}
|
static void
pkg_array_list_item(struct pkg_array *array, struct pkginfo *pkg, void *pkg_data)
{
struct list_format *fmt = pkg_data;
int l;
const char *pdesc;
list_format_init(fmt, array);
list_format_print_header(fmt);
pdesc = pkg_synopsis(pkg, &l);
l = ((l) < (fmt->dw) ? (l) : (fmt->dw));
list_format_print(fmt,
pkg_abbrev_want(pkg),
pkg_abbrev_status(pkg),
pkg_abbrev_eflag(pkg),
pkg_name(pkg, pnaw_nonambig),
versiondescribe(&pkg->installed.version, vdew_nonambig),
dpkg_arch_describe(pkg->installed.arch),
pdesc, l);
}
| void pkg_array_list_item(undefined8 param_1,long param_2,long param_3)
{
int iVar1;
undefined4 uVar2;
undefined4 uVar3;
undefined4 uVar4;
undefined8 uVar5;
undefined8 uVar6;
undefined8 uVar7;
long in_FS_OFFSET;
undefined8 uVar8;
int local_54;
long local_50;
undefined8 local_48;
long local_40;
local_40 = *(long *)(in_FS_OFFSET + 0x28);
local_50 = param_3;
list_format_init(param_3,param_1);
list_format_print_header(local_50);
local_48 = pkg_synopsis(param_2,&local_54);
iVar1 = local_54;
if (*(int *)(local_50 + 0x10) <= local_54) {
iVar1 = *(int *)(local_50 + 0x10);
}
local_54 = iVar1;
uVar5 = dpkg_arch_describe(*(undefined8 *)(param_2 + 0x58));
uVar6 = versiondescribe(param_2 + 0x98,1);
uVar7 = pkg_name(param_2,1);
uVar2 = pkg_abbrev_eflag(param_2);
uVar3 = pkg_abbrev_status(param_2);
uVar8 = 0x10086b;
uVar4 = pkg_abbrev_want(param_2);
list_format_print(local_50,uVar4,uVar3,uVar2,uVar7,uVar6,uVar5,local_48,iVar1,uVar8);
if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
static int session_nlmsg(struct nlmsghdr *n, void *arg)
{
int ret = get_response(n, arg);
if (ret == 0)
print_session(arg);
return ret;
}
| long session_nlmsg(long a1, long a2)
{
unsigned int response;
response = get_response(a1, a2);
if ( !response )
print_session(a2);
return response;
}
|
static void
sigchld_handler(int sig)
{
child_terminated = 1;
}
| long long sigchld_handler(unsigned long a0) {
unsigned int v0;
unsigned long v2;
v0 = a0;
child_terminated = 1;
return v2;
}
|
void
stat_diag (char const *name)
{
if (ignore_failed_read_option)
{
if ((warning_option & (0x00800000)))
stat_warn (name);
}
else
stat_error (name);
}
| long stat_diag(long a1)
{
long result;
if ( !ignore_failed_read_option )
return stat_error(a1);
result = warning_option & 0x800000;
if ( (_DWORD)result )
return stat_warn(a1);
return result;
}
|
static void
simple_flush_write (size_t level __attribute__((unused)))
{
ssize_t status;
status = _flush_write ();
if (status != record_size)
archive_write_error (status);
else
{
records_written++;
bytes_written += status;
}
}
| long simple_flush_write()
{
long result;
long v1;
v1 = flush_write();
if ( v1 != record_size )
archive_write_error(v1);
result = ++records_written;
*(double *)&bytes_written = *(double *)&bytes_written + (double)(int)v1;
return result;
}
|
static void ifb_print_help(struct link_util *lu,
int argc, char **argv, FILE *f)
{
fprintf(f, "Usage: ... ifb\n");
}
| int ifb_print_help(long a1, long a2, long a3, FILE *a4)
{
return fprintf(a4, "Usage: ... ifb\n");
}
|
BUILTIN_DESC *
copy_builtin (builtin)
BUILTIN_DESC *builtin;
{
BUILTIN_DESC *new;
new = (BUILTIN_DESC *)xmalloc (sizeof (BUILTIN_DESC));
new->name = strcpy (xmalloc (1 + strlen (builtin->name)), (builtin->name));
new->shortdoc = strcpy (xmalloc (1 + strlen (builtin->shortdoc)), (builtin->shortdoc));
new->longdoc = copy_string_array (builtin->longdoc);
new->dependencies = copy_string_array (builtin->dependencies);
new->function =
builtin->function ? strcpy (xmalloc (1 + strlen (builtin->function)), (builtin->function)) : (char *)
((void *)0)
;
new->docname =
builtin->docname ? strcpy (xmalloc (1 + strlen (builtin->docname)), (builtin->docname)) : (char *)
((void *)0)
;
return (new);
}
| int copy_builtin(unsigned long long a0[6]) {
unsigned long long v0[6];
void* v2;
void* v3;
v0[0] = xmalloc(0x38);
v0[0] = strcpy(xmalloc(strlen(a0[0]) + 1), a0[0]);
v0[2] = strcpy(xmalloc(strlen(a0[2]) + 1), a0[2]);
v0[4] = copy_string_array(a0[4]);
v0[5] = copy_string_array(a0[5]);
if (!a0[1])
v2 = 0;
else
v2 = strcpy(xmalloc(strlen(a0[1]) + 1), a0[1]);
v0[1] = v2;
if (!a0[3])
v3 = 0;
else
v3 = strcpy(xmalloc(strlen(a0[3]) + 1), a0[3]);
v0[3] = v3;
return v0;
}
|
static char const *
scan_char_literal (char const *lit, char *valptr)
{
register char const *p = lit;
char value;
ptrdiff_t digits;
char c = *p++;
switch (c)
{
case 0:
case '\'':
return
((void *)0)
;
case '\\':
value = 0;
while ((c = *p++) != '\'')
{
unsigned int digit = c - '0';
if (8 <= digit)
return
((void *)0)
;
value = 8 * value + digit;
}
digits = p - lit - 2;
if (! (1 <= digits && digits <= 3))
return
((void *)0)
;
break;
default:
value = c;
if (*p++ != '\'')
return
((void *)0)
;
break;
}
*valptr = value;
return p;
}
| char * scan_char_literal(char *a1, _BYTE *a2)
{
char *v2;
int v3;
char *v5;
char i;
unsigned int v7;
v2 = a1 + 1;
v3 = *a1;
if ( v3 == 92 )
{
for ( i = 0; ; i = v7 + 8 * i )
{
v5 = v2++;
if ( *v5 == 39 )
break;
v7 = *v5 - 48;
if ( v7 > 7 )
return 0LL;
}
if ( v2 - a1 - 2 <= 0 || v2 - a1 - 2 > 3 )
return 0LL;
}
else
{
if ( v3 <= 92 && (!*a1 || v3 == 39) )
return 0LL;
i = *a1;
v2 = a1 + 2;
if ( a1[1] != 39 )
return 0LL;
}
*a2 = i;
return v2;
}
|
char **init_buildenv(int child)
{
char i_lvl[] = "RUNLEVEL=x";
char i_prev[] = "PREVLEVEL=x";
char i_cons[128];
char i_shell[] = "SHELL=" "/bin/sh";
char **e;
int n, i;
for (n = 0; environ[n]; n++)
;
n += 16 + 1;
if (child)
n += 8;
while ((e = (char**)calloc(n, sizeof(char *))) ==
((void *)0)
) {
initlog((1|2), "out of memory");
do_msleep(5000);
}
for (n = 0; environ[n]; n++)
e[n] = istrdup(environ[n]);
for (i = 0; i < 16; i++) {
if (extra_env[i] ==
((void *)0)
|| *extra_env[i] == '\0')
continue;
n = addnewenv(extra_env[i], e, n);
}
if (child) {
snprintf(i_cons, sizeof(i_cons), "CONSOLE=%s", console_dev);
i_lvl[9] = thislevel;
i_prev[10] = prevlevel;
n = addnewenv(i_shell, e, n);
n = addnewenv(i_lvl, e, n);
n = addnewenv(i_prev, e, n);
n = addnewenv(i_cons, e, n);
n = addnewenv("INIT_VERSION=sysvinit-" "3.05", e, n);
}
e[n++] =
((void *)0)
;
return e;
}
| _QWORD * init_buildenv(int a1)
{
signed int v1;
signed int v2;
signed int v3;
signed int v4;
int i;
int v7;
signed int j;
int k;
_QWORD *v10;
char v11[11];
int v12[3];
char v13[150];
unsigned long v14;
v14 = __readfsqword(0x28u);
strcpy(v11, "RUNLEVEL=x");
strcpy((char *)v12, "PREVLEVEL=x");
strcpy(v13, "SHELL=/bin/sh");
for ( i = 0; environ[i]; ++i )
;
v7 = i + 17;
if ( a1 )
v7 += 8;
while ( 1 )
{
v10 = calloc(v7, 8uLL);
if ( v10 )
break;
initlog(3, "out of memory");
do_msleep(5000);
}
for ( j = 0; environ[j]; ++j )
v10[j] = istrdup(environ[j]);
for ( k = 0; k <= 15; ++k )
{
if ( *(_QWORD *)&extra_env[8 * k] && **(_BYTE **)&extra_env[8 * k] )
j = addnewenv(*(const char **)&extra_env[8 * k], (long)v10, j);
}
if ( a1 )
{
snprintf(&v13[14], 0x80uLL, "CONSOLE=%s", console_dev);
v11[9] = thislevel;
BYTE2(v12[2]) = prevlevel;
v1 = addnewenv(v13, (long)v10, j);
v2 = addnewenv(v11, (long)v10, v1);
v3 = addnewenv((const char *)v12, (long)v10, v2);
v4 = addnewenv(&v13[14], (long)v10, v3);
j = addnewenv("INIT_VERSION=sysvinit-3.05", (long)v10, v4);
}
v10[j] = 0LL;
return v10;
}
|
static uintmax_t
gcd2_odd (uintmax_t *r1, uintmax_t a1, uintmax_t a0, uintmax_t b1, uintmax_t b0)
{
((void) sizeof ((
b0 & 1
) ? 1 : 0), __extension__ ({ if (
b0 & 1
) ; else __assert_fail (
"b0 & 1"
, "src/factor.c", 476, __extension__ __PRETTY_FUNCTION__); }))
;
if ((a0 | a1) == 0)
{
*r1 = b1;
return b0;
}
while ((a0 & 1) == 0)
do { (a0) = ((a1) << (64 - (1))) | ((a0) >> (1)); (a1) = (a1) >> (1); } while (0);
for (;;)
{
if ((b1 | a1) == 0)
{
*r1 = 0;
return gcd_odd (b0, a0);
}
if (((a1) > (b1) || ((a1) == (b1) && (a0) > (b0))))
{
__asm__ ("subq %5,%q1\n\tsbbq %3,%q0" : "=r" (a1), "=&r" (a0) : "0" ((UDItype)(a1)), "rme" ((UDItype)(b1)), "1" ((UDItype)(a0)), "rme" ((UDItype)(b0)));
do
do { (a0) = ((a1) << (64 - (1))) | ((a0) >> (1)); (a1) = (a1) >> (1); } while (0);
while ((a0 & 1) == 0);
}
else if (((b1) > (a1) || ((b1) == (a1) && (b0) > (a0))))
{
__asm__ ("subq %5,%q1\n\tsbbq %3,%q0" : "=r" (b1), "=&r" (b0) : "0" ((UDItype)(b1)), "rme" ((UDItype)(a1)), "1" ((UDItype)(b0)), "rme" ((UDItype)(a0)));
do
do { (b0) = ((b1) << (64 - (1))) | ((b0) >> (1)); (b1) = (b1) >> (1); } while (0);
while ((b0 & 1) == 0);
}
else
break;
}
*r1 = a1;
return a0;
}
| long long gcd2_odd(unsigned long long *a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4) {
unsigned long v0;
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v5;
v3 = a1;
v2 = a2;
v1 = a3;
if (!(v0 & 1))
__assert_fail();
if (!v3 && !v2) {
*(a0) = v1;
v5 = v0;
} else {
for (v0 = a4; !(v2 & 1); v3 >>= 1) {
v2 = v2 >> 1 | v3 * 0x8000000000000000;
}
while (true) {
if (!v1 && !v3) {
*(a0) = 0;
v5 = gcd_odd(v0, v2);
break;
} else {
if (v3 <= v1 && (v2 <= v0 || v3 != v1)) {
if (v1 <= v3 && (v0 <= v2 || v1 != v3)) {
*(a0) = v3;
v5 = v2;
break;
}
if ((v1 == v3 || v1 > v3) && (v0 > v2 || v1 > v3)) {
v1 = v1 - v3 - (v0 < v2);
v0 -= v2;
do {
v0 = v0 >> 1 | v1 * 0x8000000000000000;
v1 >>= 1;
} while (!(v0 & 1));
}
}
if (v3 > v1 || v3 == v1 && v2 > v0) {
v3 = v3 - v1 - (v2 < v0);
v2 -= v0;
do {
v2 = v2 >> 1 | v3 * 0x8000000000000000;
v3 >>= 1;
} while (!(v2 & 1));
}
}
}
}
return v5;
}
|
static void
install_signal_handlers ()
{
int nsigs = sizeof handled_sig / sizeof handled_sig[0];
int i;
struct sigaction act;
sigemptyset (&caught_signals);
for (i = 0; i < nsigs; i++)
{
sigaction (handled_sig[i],
((void *)0)
, &act);
if (act.
__sigaction_handler.sa_handler
!=
((__sighandler_t) 1)
)
sigaddset (&caught_signals, handled_sig[i]);
}
act.
__sigaction_handler.sa_handler
= abort_gzip_signal;
act.sa_mask = caught_signals;
act.sa_flags = 0;
for (i = 0; i < nsigs; i++)
if (sigismember (&caught_signals, handled_sig[i]))
{
if (i == 0)
foreground = 1;
sigaction (handled_sig[i], &act,
((void *)0)
);
}
}
| void install_signal_handlers() {
unsigned int v0;
unsigned int v1;
char v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
unsigned long v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
unsigned long v10;
unsigned long v11;
unsigned long v12;
unsigned long v13;
unsigned long v14;
unsigned long v15;
unsigned long v16;
unsigned long v17;
unsigned long v18;
unsigned int v19;
char v20;
unsigned long long *v22;
unsigned long long v23;
v1 = 6;
sigemptyset(&caught_signals);
for (v0 = 0; v0 < v1; v0 += 1) {
sigaction(handled_sig[v0], 0x0, &v2);
if (*(&v2) != 1)
sigaddset(&caught_signals, handled_sig[v0]);
}
v2 = abort_gzip_signal;
v3 = caught_signals;
v4 = g_403ea8;
v5 = g_403eb0;
v6 = g_403eb8;
v7 = g_403ec0;
v8 = g_403ec8;
v9 = g_403ed0;
v10 = g_403ed8;
v11 = g_403ee0;
v12 = g_403ee8;
v13 = g_403ef0;
v14 = g_403ef8;
v15 = g_403f00;
v16 = g_403f08;
v17 = g_403f10;
v18 = g_403f18;
v19 = 0;
for (v0 = 0; v0 < v1; v0 += 1) {
if (sigismember(&caught_signals, handled_sig[v0])) {
if (!v0)
foreground = 1;
sigaction(handled_sig[v0], &v2, 0x0);
}
}
v23 = *(&v20) ^ v22[5];
return;
}
|
static void
print_ifdef_hunk (struct change *hunk)
{
lin first0, last0, first1, last1;
enum changes changes = analyze_hunk (hunk, &first0, &last0, &first1, &last1);
if (!changes)
return;
begin_output ();
if (next_line0 < first0 || next_line1 < first1)
format_ifdef (group_format[UNCHANGED],
next_line0, first0,
next_line1, first1);
next_line0 = last0 + 1;
next_line1 = last1 + 1;
format_ifdef (group_format[changes],
first0, next_line0,
first1, next_line1);
}
| long long print_ifdef_hunk(unsigned long long a0) {
unsigned int v0;
char v1;
char v2;
char v3;
char v4;
v0 = analyze_hunk(a0, &v1, &v2, &v3, &v4);
if (v0) {
begin_output();
if (next_line1 < *(&v3) || next_line0 < *(&v1))
format_ifdef(group_format, next_line0, *(&v1), next_line1, *(&v3));
next_line0 = *(&v2) + 1;
next_line1 = *(&v4) + 1;
format_ifdef((&group_format)[v0], *(&v1), next_line0, *(&v3), next_line1);
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.