input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
static void pdf_init(pdf_ctx *pc, aes_int_key prf_key)
{
UINT8 buf[16];
kdf(buf, prf_key, 0, 16);
AES_set_encrypt_key((const u_char *)(buf),16*8,pc->prf_key);
memset(pc->nonce, 0, sizeof(pc->nonce));
AES_encrypt((u_char *)(pc->nonce),(u_char *)(pc->cache),(AES_KEY *)pc->prf_key);
explicit_bzero(buf, sizeof(buf));
}
| void pdf_init(unsigned long long a0, unsigned long long a1) {
char v0;
char v1;
unsigned long long *v3;
unsigned long long v4;
kdf(&v0, a1, 0x0, 0x10);
AES_set_encrypt_key(&v0, 0x80, a0 + 32);
memset(a0 + 16, 0x0, 0x10);
AES_encrypt(a0 + 16, a0, a0 + 32, a0 + 16);
explicit_bzero(&v0, 0x10);
v4 = *(&v1) ^ v3[5];
return;
}
|
static struct directory *
find_directory_meta (dev_t dev, ino_t ino)
{
if (! directory_meta_table)
return 0;
else
{
struct directory *dir = make_directory ("",
((void *)0)
);
struct directory *ret;
dir->device_number = dev;
dir->inode_number = ino;
ret = hash_lookup (directory_meta_table, dir);
free_directory (dir);
return ret;
}
}
| long find_directory_meta(void *a1, void *a2)
{
void **directory;
long v4;
if ( !directory_meta_table )
return 0LL;
directory = (void **)make_directory(byte_4C14, 0LL);
directory[3] = a1;
directory[4] = a2;
v4 = hash_lookup(directory_meta_table, directory);
free_directory(directory);
return v4;
}
|
_Bool
in_force(int flags)
{
return (flags & force_flags) == flags;
}
| int in_force(unsigned long a0) {
unsigned int v1;
v1 = force_flags & a0;
*(&v1) = a0 == (force_flags & a0);
return v1;
}
|
static void
free_progcomp (data)
void * data;
{
COMPSPEC *cs;
cs = (COMPSPEC *)data;
compspec_dispose (cs);
}
| void free_progcomp(undefined8 param_1)
{
compspec_dispose(param_1);
return;
}
|
static void process_flags (int argc, char **argv)
{
int c;
static struct option long_options[] = {
{"help",
0
,
((void *)0)
, 'h'},
{"root",
1
,
((void *)0)
, 'R'},
{
((void *)0)
, 0,
((void *)0)
, '\0'}
};
while ((c = getopt_long (argc, argv, "hR:",
long_options,
((void *)0)
)) != -1) {
switch (c) {
case 'h':
usage (0);
break;
case 'R':
break;
default:
usage (2);
}
}
if (optind != argc) {
usage (2);
}
}
| void process_flags(unsigned long a0, char **a1) {
unsigned int v0;
unsigned long long v2;
while (true) {
v0 = getopt_long(a0, a1, "hR:", &long_options.5670, NULL);
if (v0 != -1) {
if (v0 == 82)
continue;
if (v0 == 104)
usage(0x0);
usage(0x2);
} else {
v2 = optind;
if (a0 != optind)
usage(0x2);
return;
}
}
}
|
static int file_isatty(const char *fname)
{
struct stat st;
int major;
if (stat(fname, &st) < 0)
return 0;
if (st.st_nlink != 1 || !
((((
st.st_mode
)) & 0170000) == (0020000))
)
return 0;
major =
gnu_dev_major (
st.st_dev
)
;
if (major == 1 || major == 2 || major == 6 || major == 9 ||
major == 12 || major == 16 || major == 21 || major == 27 ||
major == 37 || major == 96 || major == 97 || major == 206 ||
major == 230) return 0;
return 1;
}
| _BOOL8 file_isatty(const char *a1)
{
unsigned int v2;
struct stat dev;
unsigned long v4;
v4 = __readfsqword(0x28u);
if ( stat(a1, &dev) < 0 )
return 0LL;
if ( dev.st_nlink != 1 || (dev.st_mode & 0xF000) != 0x2000 )
return 0LL;
v2 = gnu_dev_major(dev.st_dev);
return v2 != 1
&& v2 != 2
&& v2 != 6
&& v2 != 9
&& v2 != 12
&& v2 != 16
&& v2 != 21
&& v2 != 27
&& v2 != 37
&& v2 != 96
&& v2 != 97
&& v2 != 206
&& v2 != 230;
}
|
char *
svis(char *mbdst, int c, int flags, int nextc, const char *mbextra)
{
char cc[2];
int ret;
cc[0] = c;
cc[1] = nextc;
ret = istrsenvisx(&mbdst,
((void *)0)
, cc, 1, flags, mbextra,
((void *)0)
);
if (ret < 0)
return
((void *)0)
;
return mbdst + ret;
}
| long long svis(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, void* a4) {
char v0;
unsigned int v1;
char v2;
char v3;
void* v5;
v2 = a1;
v3 = a3;
v1 = istrsenvisx(&v0, NULL, &v2, 0x1, a2, a4, NULL);
if (v1 < 0)
v5 = 0;
else
v5 = v1 + a0;
return v5;
}
|
static void print_explain(FILE *f)
{
fprintf(f,
"Usage: ... bridge_slave [ fdb_flush ]\n"
" [ state STATE ]\n"
" [ priority PRIO ]\n"
" [ cost COST ]\n"
" [ guard {on | off} ]\n"
" [ hairpin {on | off} ]\n"
" [ fastleave {on | off} ]\n"
" [ root_block {on | off} ]\n"
" [ learning {on | off} ]\n"
" [ flood {on | off} ]\n"
" [ proxy_arp {on | off} ]\n"
" [ proxy_arp_wifi {on | off} ]\n"
" [ mcast_router MULTICAST_ROUTER ]\n"
" [ mcast_fast_leave {on | off} ]\n"
" [ mcast_flood {on | off} ]\n"
" [ bcast_flood {on | off} ]\n"
" [ mcast_to_unicast {on | off} ]\n"
" [ group_fwd_mask MASK ]\n"
" [ neigh_suppress {on | off} ]\n"
" [ vlan_tunnel {on | off} ]\n"
" [ isolated {on | off} ]\n"
" [ locked {on | off} ]\n"
" [ backup_port DEVICE ] [ nobackup_port ]\n"
);
}
| void print_explain(void* a0) {
unsigned long long v1;
v1 = fprintf(a0, "Usage: ... bridge_slave [ fdb_flush ]\n\t\t\t[ state STATE ]\n\t\t\t[ priority PRIO ]\n\t\t\t[ cost COST ]\n\t\t\t[ guard {on | off} ]\n\t\t\t[ hairpin {on | off} ]\n\t\t\t[ fastleave {on | off} ]\n\t\t\t[ root_block {on | off} ]\n\t\t\t[ learning {on | off} ]\n\t\t\t[ flood {on | off} ]\n\t\t\t[ proxy_arp {on | off} ]\n\t\t\t[ proxy_arp_wifi {on | off} ]\n\t\t\t[ mcast_router MULTICAST_ROUTER ]\n\t\t\t[ mcast_fast_leave {on | off} ]\n\t\t\t[ mcast_flood {on | off} ]\n\t\t\t[ bcast_flood {on | off} ]\n\t\t\t[ mcast_to_unicast {on | off} ]\n\t\t\t[ group_fwd_mask MASK ]\n\t\t\t[ neigh_suppress {on | off} ]\n\t\t\t[ vlan_tunnel {on | off} ]\n\t\t\t[ isolated {on | off} ]\n\t\t\t[ locked {on | off} ]\n\t\t\t[ backup_port DEVICE ] [ nobackup_port ]\n");
return;
}
|
static void
print_alias (alias, flags)
alias_t *alias;
int flags;
{
char *value;
value = sh_single_quote (alias->value);
if (flags & 0x01)
printf ("alias %s", (alias->name && alias->name[0] == '-') ? "-- " : "");
printf ("%s=%s\n", alias->name, value);
sh_xfree((value), "./alias.def", 237);
fflush (
stdout
);
}
| void print_alias(char **param_1,uint param_2)
{
undefined8 uVar1;
undefined *puVar2;
uVar1 = sh_single_quote(param_1[1]);
if ((param_2 & 1) != 0) {
if ((*param_1 == (char *)0x0) || (**param_1 != '-')) {
puVar2 = &DAT_00100460;
}
else {
puVar2 = &DAT_0010045c;
}
printf("alias %s",puVar2);
}
printf("%s=%s\n",*param_1,uVar1);
sh_xfree(uVar1,"./alias.def",0xed);
fflush(stdout);
return;
}
|
void
pty_release(const char *tty)
{
}
| void pty_release(void)
{
return;
}
|
static void new_sgent (struct sgrp *sgent)
{
if (nflg) {
sgent->sg_name = xstrdup (group_newname);
}
if (pflg) {
sgent->sg_passwd = group_passwd;
}
}
| void new_sgent(undefined8 *param_1)
{
undefined8 uVar1;
if (nflg != '\0') {
uVar1 = xstrdup(group_newname);
*param_1 = uVar1;
}
if (pflg != '\0') {
param_1[1] = group_passwd;
}
return;
}
|
int
rl_vi_end_word (int count, int key)
{
if (count < 0)
{
rl_ding ();
return 1;
}
if ((1 && (1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)key
))] & (unsigned short int) _ISupper)
)))
rl_vi_eWord (count, key);
else
rl_vi_eword (count, key);
return (0);
}
| long long rl_vi_end_word(unsigned long a0, unsigned long a1) {
unsigned long long v1;
unsigned int v3;
if (a0 < 0) {
rl_ding();
v1 = 1;
} else {
v3 = *((*(__ctype_b_loc()) + a1 * 2)) & 0x100;
if (!v3)
rl_vi_eword(a0, a1);
else
rl_vi_eWord(a0, a1);
v1 = 0;
}
return v1;
}
|
static int
bash_progcomp_ignore_filenames (names)
char **names;
{
_ignore_completion_names (names, test_for_canon_directory);
return 0;
}
| long bash_progcomp_ignore_filenames(_QWORD *a1)
{
ignore_completion_names(a1, (unsigned int ( *)(_QWORD))test_for_canon_directory);
return 0LL;
}
|
void
set_color_palette (char const *palette)
{
color_palette = palette;
}
| long set_color_palette(long a1)
{
long result;
result = a1;
color_palette = a1;
return result;
}
|
static
_Bool
scan_for_digit_differences (const char *p, const char *q,
size_t *first, size_t *n)
{
_Bool
seen =
0
;
size_t i;
for (i=0; p[i] && q[i]; i++)
{
if (p[i] != q[i])
{
if (!
((*__ctype_b_loc ())[(int) ((
(unsigned char)p[i]
))] & (unsigned short int) _ISdigit)
|| !
((*__ctype_b_loc ())[(int) ((
(unsigned char)q[i]
))] & (unsigned short int) _ISdigit)
)
return
0
;
if (!seen)
{
*first = i;
*n = 1;
seen = 1;
}
else
{
if (i-*first == *n)
{
++*n;
}
else
{
return
0
;
}
}
}
}
if (p[i] || q[i])
{
return
0
;
}
return
1
;
}
| int scan_for_digit_differences(void* a0, void* a1, unsigned long long *a2, unsigned long long *a3) {
char v0;
void* v1;
unsigned int v4;
unsigned int v5;
unsigned int v6;
v0 = 0;
v1 = 0;
while (true) {
if (!*((v1 + a0))) {
LABEL_400cae:
if (!*((v1 + a0)) && !*((v1 + a1))) {
v6 = 1;
break;
}
v6 = 0;
break;
} else {
if (!*((v1 + a1)))
goto LABEL_400cae;
if (*((v1 + a0)) == *((v1 + a1))) {
LABEL_400c81:
v1 += 1;
} else {
v4 = *((*(__ctype_b_loc()) + *((v1 + a0)) * 2)) & 0x800;
if (v4) {
*(&v4) = *((*(__ctype_b_loc()) + *((v1 + a1)) * 2));
v5 = v4 & 0x800;
if (v5) {
if ((v0 ^ 1)) {
*(a2) = v1;
*(a3) = 1;
v0 = 1;
goto LABEL_400c81;
} else if (v1 - *(a2) == *(a3)) {
*(a3) = *(a3) + 1;
goto LABEL_400c81;
} else {
v6 = 0;
break;
}
}
}
v6 = 0;
break;
}
}
}
return v6;
}
|
static int vrf_identify(pid_t pid, char *name, size_t len)
{
char path[
4096
];
char buf[4096];
char *vrf, *end;
FILE *fp;
snprintf(path, sizeof(path), "/proc/%d/cgroup", pid);
fp = fopen(path, "r");
if (!fp)
return -1;
memset(name, 0, len);
while (fgets(buf, sizeof(buf), fp)) {
if (strstr(buf, "::/") ==
((void *)0)
)
continue;
vrf = strstr(buf, "/vrf/");
if (vrf) {
vrf += 5;
end = strchr(vrf, '\n');
if (end)
*end = '\0';
strlcpy(name, vrf, len);
break;
}
}
fclose(fp);
return 0;
}
| int vrf_identify(unsigned long a0, void* a1, unsigned long a2) {
void* v0;
char *v1;
char *v2;
char v3;
char v4;
char v5;
char v6;
unsigned int v8;
v6 = *(&v6);
v4 = *(&v4);
snprintf(&v3, 0x1000, "/proc/%d/cgroup", a0);
v0 = fopen64(&v3, "r");
if (!v0) {
v8 = -1;
return v8;
}
memset(a1, 0x0, a2);
do {
do {
if (!fgets(&v5, 0x1000, v0)) {
fclose(v0);
v8 = 0;
return v8;
}
} while (!strstr(&v5, "::/"));
} while ((v1 = strstr(&v5, "/vrf/"), !v1));
v1 += 5;
v2 = strchr(v1, 0xa);
if (v2)
*(v2) = 0;
strlcpy(a1, v1, a2, v1);
fclose(v0);
v8 = 0;
return v8;
}
|
static void
parser_ungetc(struct parser_st *parser, int c)
{
((void) sizeof ((
parser->pushback_length < (sizeof(parser->pushback) / sizeof((parser->pushback)[0]))
) ? 1 : 0), __extension__ ({ if (
parser->pushback_length < (sizeof(parser->pushback) / sizeof((parser->pushback)[0]))
) ; else __assert_fail (
"parser->pushback_length < SIZEOF(parser->pushback)"
, "cfg.c", 119, __extension__ __PRETTY_FUNCTION__); }))
;
parser->pushback[parser->pushback_length++] = c;
}
| void parser_ungetc(struct_1 *a0, unsigned long a1) {
unsigned long long v1;
if (a0->field_10 > 1)
__assert_fail();
v1 = a0->field_10;
a0->field_10 = a0->field_10 + 1;
a0->padding_0[8 + v1] = a1;
return;
}
|
static void
parse_column_count (char const *s)
{
getoptnum (s, 1, &columns, gettext ("invalid number of columns"));
explicit_columns =
1
;
}
| void parse_column_count(unsigned long long a0) {
unsigned long long v1;
v1 = getoptnum(a0, 0x1, &columns, gettext("invalid number of columns"));
explicit_columns = 1;
return;
}
|
struct timespec
decode_timespec (char const *arg, char **arg_lim,
_Bool
parse_fraction)
{
time_t s = ((time_t) ~ ((time_t) (! (! ((time_t) 0 < (time_t) -1)) ? (time_t) -1 : ((((time_t) 1 << ((sizeof (time_t) * 8) - 2)) - 1) * 2 + 1))));
int ns = -1;
char const *p = arg;
_Bool
negative = *arg == '-';
struct timespec r;
if (! ((unsigned) (arg[negative]) - '0' <= 9))
(*__errno_location ())
=
22
;
else
{
(*__errno_location ())
= 0;
if (negative)
{
intmax_t i = strtoimax (arg, arg_lim, 10);
if ((! ((time_t) 0 < (time_t) -1)) ? ((time_t) ~ ((time_t) (! (! ((time_t) 0 < (time_t) -1)) ? (time_t) -1 : ((((time_t) 1 << ((sizeof (time_t) * 8) - 2)) - 1) * 2 + 1)))) <= i : 0 <= i)
s = i;
else
(*__errno_location ())
=
34
;
}
else
{
uintmax_t i = strtoumax (arg, arg_lim, 10);
if (i <= ((time_t) (! (! ((time_t) 0 < (time_t) -1)) ? (time_t) -1 : ((((time_t) 1 << ((sizeof (time_t) * 8) - 2)) - 1) * 2 + 1))))
s = i;
else
(*__errno_location ())
=
34
;
}
p = *arg_lim;
ns = 0;
if (parse_fraction && *p == '.')
{
int digits = 0;
_Bool
trailing_nonzero =
0
;
while (((unsigned) (*++p) - '0' <= 9))
if (digits < LOG10_BILLION)
digits++, ns = 10 * ns + (*p - '0');
else
trailing_nonzero |= *p != '0';
while (digits < LOG10_BILLION)
digits++, ns *= 10;
if (negative)
{
ns += trailing_nonzero;
if (ns != 0)
{
if (s == ((time_t) ~ ((time_t) (! (! ((time_t) 0 < (time_t) -1)) ? (time_t) -1 : ((((time_t) 1 << ((sizeof (time_t) * 8) - 2)) - 1) * 2 + 1)))))
ns = -1;
else
{
s--;
ns = BILLION - ns;
}
}
}
}
if (
(*__errno_location ())
==
34
)
ns = -1;
}
*arg_lim = (char *) p;
r.tv_sec = s;
r.tv_nsec = ns;
return r;
}
| undefined [16] decode_timespec(char *param_1,char **param_2,char param_3)
{
int *piVar1;
uintmax_t uVar2;
bool bVar3;
bool local_42;
int local_40;
int local_3c;
uintmax_t local_38;
char *local_30;
local_38 = 0x8000000000000000;
local_40 = -1;
bVar3 = *param_1 == '-';
if ((int)param_1[bVar3] - 0x30U < 10) {
piVar1 = __errno_location();
*piVar1 = 0;
if (bVar3) {
uVar2 = strtoimax(param_1,param_2,10);
}
else {
uVar2 = strtoumax(param_1,param_2,10);
if ((long)uVar2 < 0) {
piVar1 = __errno_location();
*piVar1 = 0x22;
uVar2 = local_38;
}
}
local_38 = uVar2;
local_30 = *param_2;
local_40 = 0;
if ((param_3 != '\0') && (*local_30 == '.')) {
local_3c = 0;
local_42 = false;
while (local_30 = local_30 + 1, (int)*local_30 - 0x30U < 10) {
if (local_3c < 9) {
local_3c = local_3c + 1;
local_40 = *local_30 + -0x30 + local_40 * 10;
}
else {
local_42 = (*local_30 != '0' | local_42) != 0;
}
}
for (; local_3c < 9; local_3c = local_3c + 1) {
local_40 = local_40 * 10;
}
if ((bVar3) && (local_40 = local_40 + (uint)local_42, local_40 != 0)) {
if (local_38 == 0x8000000000000000) {
local_40 = -1;
}
else {
local_38 = local_38 - 1;
local_40 = 1000000000 - local_40;
}
}
}
piVar1 = __errno_location();
if (*piVar1 == 0x22) {
local_40 = -1;
}
}
else {
piVar1 = __errno_location();
*piVar1 = 0x16;
local_30 = param_1;
}
*param_2 = local_30;
return CONCAT88((long)local_40,local_38);
}
|
void
rl_callback_read_char(void)
{
int count = 0, done = 0;
const char *buf = el_gets(e, &count);
char *wbuf;
el_set(e, 15, 1);
if (buf ==
((void *)0)
|| count-- <= 0)
return;
if (count == 0 && buf[0] == e->el_tty.t_c[2][4])
done = 1;
if (buf[count] == '\n' || buf[count] == '\r')
done = 2;
if (done && rl_linefunc !=
((void *)0)
) {
el_set(e, 15, 0);
if (done == 2) {
if ((wbuf = strdup(buf)) !=
((void *)0)
)
wbuf[count] = '\0';
(rl_readline_state |= ((unsigned long) 0x000001));
} else
wbuf =
((void *)0)
;
(*(void (*)(const char *))rl_linefunc)(wbuf);
}
_rl_update_pos();
}
| unsigned long rl_callback_read_char()
{
int v0;
int v2;
int v3;
char *v4;
char *s;
unsigned long v6;
v6 = __readfsqword(0x28u);
v2 = 0;
v3 = 0;
s = (char *)el_gets(e, &v2);
el_set(e, 15LL, 1LL);
if ( s )
{
v0 = v2--;
if ( v0 > 0 )
{
if ( !v2 && *s == *(unsigned char *)(e + 502) )
v3 = 1;
if ( s[v2] == 10 || s[v2] == 13 )
v3 = 2;
if ( v3 && rl_linefunc )
{
el_set(e, 15LL, 0LL);
if ( v3 == 2 )
{
v4 = strdup(s);
if ( v4 )
v4[v2] = 0;
rl_readline_state |= 1uLL;
}
else
{
v4 = 0LL;
}
rl_linefunc(v4);
}
rl_update_pos();
}
}
return __readfsqword(0x28u) ^ v6;
}
|
off64_t gzoffset64(file)
gzFile file;
{
off64_t offset;
gz_statep state;
if (file ==
((void *)0)
)
return -1;
state = (gz_statep)file;
if (state->mode != 7247 && state->mode != 31153)
return -1;
offset = lseek64(state->fd, 0,
1
);
if (offset == -1)
return -1;
if (state->mode == 7247)
offset -= state->strm.avail_in;
return offset;
}
| int gzoffset64(unsigned int a0[35]) {
unsigned long v0;
unsigned int v2;
if (!a0) {
v2 = -1;
return v2;
}
switch (a0[6]) {
case 7247: case 31153:
v0 = lseek64(a0[7], 0x0, 0x1);
if (v0 == -1) {
v2 = -1;
return v2;
}
if (a0[6] == 7247) {
v0 -= a0[34];
break;
}
v2 = v0;
return v2;
default:
v2 = -1;
return v2;
}
}
|
static
_Bool
parse_exec (const struct parser_table* entry, char **argv, int *arg_ptr)
{
return insert_exec_ok ("-exec", entry, argv, arg_ptr);
}
| long long parse_exec(unsigned long long a0, unsigned long long a1, unsigned long long a2) {
return insert_exec_ok("-exec", a0, a1, a2);
}
|
static void
ipstats_show_hw_s_info_one(const struct ipstats_hw_s_info *hwsi,
enum ipstats_hw_s_info_idx idx)
{
const struct ipstats_hw_s_info_one *hwsio = hwsi->infos[idx];
const char *name = ipstats_hw_s_info_name[idx];
if (hwsio ==
((void *)0)
)
return;
print_string(PRINT_FP,
((void *)0)
, " %s", name);
open_json_object(name);
__ipstats_show_hw_s_info_one(hwsio);
close_json_object();
}
| void ipstats_show_hw_s_info_one(long param_1,uint param_2)
{
long lVar1;
lVar1 = *(long *)(param_1 + (ulong)param_2 * 8);
if (lVar1 != 0) {
print_string(1,0," %s","l3_stats");
open_json_object("l3_stats");
__ipstats_show_hw_s_info_one(lVar1);
close_json_object();
}
return;
}
|
static void
setscreensize(void)
{
struct winsize winsize;
if (ioctl(
1
,
0x5413
, &winsize) != -1 &&
winsize.ws_col != 0) {
if (winsize.ws_col > 512)
win_size = 512;
else
win_size = winsize.ws_col;
} else
win_size = 80;
win_size += 1;
}
| void setscreensize() {
char v0;
char v1;
char v2;
unsigned long long v4;
unsigned long long *v5;
unsigned long long v6;
v4 = ioctl(0x1, 0x5413);
if (v4 != -1 && *(&v1)) {
if (*(&v1) > 0x200)
win_size = 0x200;
else
win_size = *(&v1);
}
if (!*(&v1) || v4 == -1)
win_size = 80;
win_size = __addvsi3(win_size, 0x1, &v0);
v6 = *(&v2) ^ v5[5];
return;
}
|
static void
dirlist_replace_prefix (const char *pref, const char *repl)
{
struct directory *dp;
size_t pref_len = strlen (pref);
size_t repl_len = strlen (repl);
for (dp = dirhead; dp; dp = dp->next)
replace_prefix (&dp->name, pref, pref_len, repl, repl_len);
}
| void dirlist_replace_prefix(char *a0, char *a1) {
unsigned long long *v0;
unsigned long long v1;
unsigned long long v2;
unsigned long long v4;
unsigned long long v5;
v1 = strlen(a0);
v2 = strlen(a1);
v4 = dirhead;
for (v0 = dirhead; v0; v0 = *(v0)) {
replace_prefix(v0 + 11, a0, v1, a1, v2);
v5 = *(v0);
}
return;
}
|
int
bash_delete_last_history ()
{
register int i;
HIST_ENTRY **hlist, *histent;
int r;
hlist = history_list ();
if (hlist ==
((void *)0)
)
return 0;
for (i = 0; hlist[i]; i++)
;
i--;
histent = history_get (history_base + i);
if (histent ==
((void *)0)
)
return 0;
r = bash_delete_histent (i);
if (where_history () > history_length)
history_set_pos (history_length);
return r;
}
| undefined4 bash_delete_last_history(void)
{
undefined4 uVar1;
int iVar2;
long lVar3;
lVar3 = history_list();
if (lVar3 == 0) {
uVar1 = 0;
}
else {
iVar2 = 0;
while (*(long *)(lVar3 + (long)iVar2 * 8) != 0) {
iVar2 = iVar2 + 1;
}
lVar3 = history_get(history_base + iVar2 + -1);
if (lVar3 == 0) {
uVar1 = 0;
}
else {
uVar1 = bash_delete_histent(iVar2 + -1);
iVar2 = where_history();
if (history_length < iVar2) {
history_set_pos(history_length);
}
}
}
return uVar1;
}
|
void
forcibleerr(int forceflag, const char *fmt, ...)
{
va_list args;
__builtin_va_start(
args
,
fmt
)
;
if (in_force(forceflag)) {
warning(gettext("overriding problem because --force enabled:"));
warningv(fmt, args);
} else {
ohshitv(fmt, args);
}
__builtin_va_end(
args
)
;
}
| unsigned long forcibleerr(int a1, long a2, long a3, long a4, long a5, long a6, ...)
{
char *v6;
gcc_va_list va;
unsigned long v9;
long v10;
long v11;
long v12;
long v13;
va_start(va, a6);
v10 = a3;
v11 = a4;
v12 = a5;
v13 = a6;
v9 = __readfsqword(0x28u);
va[0].gp_offset = 16;
if ( !in_force(a1) )
ohshitv(a2, va);
v6 = gettext("overriding problem because --force enabled:");
warning(v6, a2);
warningv(a2, va);
return __readfsqword(0x28u) ^ v9;
}
|
static void
pkg_remove_backup_files(struct pkginfo *pkg, struct fsys_namenode_list *newfileslist)
{
struct fsys_namenode_list *cfile;
for (cfile = newfileslist; cfile; cfile = cfile->next) {
struct fsys_namenode *usenode;
if (cfile->namenode->flags & FNNF_NEW_CONFF)
continue;
usenode = namenodetouse(cfile->namenode, pkg, &pkg->installed);
if (strcmp(usenode->name, "/.") == 0)
continue;
varbuf_rollback(&fnametmpvb, &fname_state);
varbuf_add_buf(&fnametmpvb, usenode->name, strlen(usenode->name));
varbuf_add_buf(&fnametmpvb, ".dpkg-tmp", strlen(".dpkg-tmp"));
varbuf_end_str(&fnametmpvb);
path_remove_tree(fnametmpvb.buf);
}
}
| void pkg_remove_backup_files(unsigned long long a0, unsigned long long a1) {
struct_0 *v0;
struct_2 *v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
v3 = a1;
for (v0 = a1; v0; v0 = v0->field_0) {
if (!(v0->field_8->field_30 & 1)) {
v1 = namenodetouse(v0->field_8, a0, a0 + 72, a0);
if (strcmp(v1->field_8, "/.")) {
varbuf_rollback(0x5003a8, 0x5002e8, v4);
varbuf_add_buf(0x5003a8, v1->field_8, strlen(v1->field_8), v5);
varbuf_add_buf(0x5003a8, ".dpkg-tmp", strlen(".dpkg-tmp"), v5);
varbuf_end_str(0x5003a8);
path_remove_tree(cleanup_pkg_failed);
}
}
v6 = v0->field_0;
}
return;
}
|
static int
confirm_key(Identity *id, const char *extra)
{
char *p;
int ret = -1;
p = sshkey_fingerprint(id->key, fingerprint_hash, SSH_FP_DEFAULT);
if (p !=
((void *)0)
&&
ask_permission("Allow use of key %s?\nKey fingerprint %s.%s%s",
id->comment, p,
extra ==
((void *)0)
? "" : "\n", extra ==
((void *)0)
? "" : extra))
ret = 0;
free(p);
return (ret);
}
| int confirm_key(unsigned long long a0[4], unsigned long long a1) {
unsigned int v0;
void* v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
v0 = -1;
v1 = sshkey_fingerprint(a0[2], fingerprint_hash, 0x0);
if (v1) {
if (a1)
v3 = a1;
else
v3 = &g_407fb9;
if (!a1)
v4 = &g_407fb9;
else
v4 = "\n";
v5 = ask_permission("Allow use of key %s?\nKey fingerprint %s.%s%s", a0[3], v1, v4, v3);
if (v5)
v0 = 0;
}
free(v1);
return v0;
}
|
static
void check_init_fifo(void)
{
struct init_request request;
struct timeval tv;
struct stat st, st2;
fd_set fds;
int n;
int quit = 0;
if (stat("/run/initctl", &st2) < 0 &&
(*__errno_location ())
==
2
)
(void)mkfifo("/run/initctl", 0600);
if (pipe_fd >= 0) {
fstat(pipe_fd, &st);
if (stat("/run/initctl", &st2) < 0 ||
st.st_dev != st2.st_dev ||
st.st_ino != st2.st_ino) {
close(pipe_fd);
pipe_fd = -1;
}
}
if (pipe_fd == -1) {
if ((pipe_fd = open("/run/initctl",
02
|
04000
)) >= 0) {
fstat(pipe_fd, &st);
if (!
((((
st.st_mode
)) & 0170000) == (0010000))
) {
initlog((1|2), "%s is not a fifo", "/run/initctl");
close(pipe_fd);
pipe_fd = -1;
}
}
if (pipe_fd >= 0) {
(void) dup2(pipe_fd, 10);
close(pipe_fd);
pipe_fd = 10;
}
}
if (pipe_fd >= 0) {
while(!quit) {
do { unsigned int __i; fd_set *__arr = (
&fds
); for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) ((__arr)->fds_bits)[__i] = 0; } while (0)
;
((void) (((
&fds
)->fds_bits)[((
pipe_fd
) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((
pipe_fd
) % (8 * (int) sizeof (__fd_mask)))))))
;
tv.tv_sec = 5;
tv.tv_usec = 0;
n = select(pipe_fd + 1, &fds,
((void *)0)
,
((void *)0)
, &tv);
if (n <= 0) {
if (n == 0 ||
(*__errno_location ())
==
4
) return;
continue;
}
n = read(pipe_fd, &request, sizeof(request));
if (n == 0) {
close(pipe_fd);
pipe_fd = -1;
return;
}
if (n <= 0) {
if (
(*__errno_location ())
==
4
) return;
initlog((1|2), "error reading initrequest");
continue;
}
console_init();
if (request.magic != 0x03091969 || n != sizeof(request)) {
initlog((1|2), "got bogus initrequest");
continue;
}
switch(request.cmd) {
case 1:
sleep_time = request.sleeptime;
fifo_new_level(request.runlevel);
quit = 1;
break;
case 2:
sleep_time = request.sleeptime;
do_power_fail('F');
quit = 1;
break;
case 3:
sleep_time = request.sleeptime;
do_power_fail('L');
quit = 1;
break;
case 4:
sleep_time = request.sleeptime;
do_power_fail('O');
quit = 1;
break;
case 6:
initcmd_setenv(request.i.data, sizeof(request.i.data));
break;
default:
initlog((1|2), "got unimplemented initrequest.");
break;
}
}
}
if (pipe_fd == -1) pause();
}
| void check_init_fifo(unsigned long a0, unsigned long a1, unsigned long long a2, unsigned int a3, unsigned int a4, unsigned int a5) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long *v3;
unsigned long long v4;
void* v5;
char v6;
char v7;
char v8;
char v9;
char v10;
char v11;
char v12;
char v13;
char v14;
char v15;
char v16;
char v17;
unsigned long v19;
struct_0 *v20;
unsigned long long *v22;
unsigned long long v23;
v0 = 0;
if (stat("/run/initctl", &v10) < 0) {
v19 = *(__errno_location());
if (v19 == 2)
mkfifo("/run/initctl", 0x180);
}
if (pipe_fd >= 0) {
fstat(pipe_fd, &v7);
if (stat("/run/initctl", &v10) >= 0 && *(&v7) == *(&v10)) {
*(&a2) = *(&v8);
if (*(&v8) == *(&v11))
goto LABEL_40520a;
}
close(pipe_fd);
pipe_fd = -1;
}
LABEL_40520a:
if (pipe_fd == -1) {
v19 = open("/run/initctl", 0x802, a2);
pipe_fd = v19;
if (pipe_fd >= 0) {
fstat(pipe_fd, &v7);
if ((*(&v9) & 0xf000) != 0x1000) {
initlog(0x3, "%s is not a fifo", "/run/initctl", a3, a4, a5);
close(pipe_fd);
pipe_fd = -1;
}
}
if (pipe_fd >= 0) {
dup2(pipe_fd, 0xa);
close(pipe_fd);
pipe_fd = 10;
}
}
if (pipe_fd >= 0) {
while (true) {
if (v0)
break;
v3 = &v6;
for (v1 = 0; v1 <= 15; v1 += 1) {
v3[v1] = 0;
}
*(&(&v6)[8 * ((pipe_fd < 0 ? pipe_fd + 63 : pipe_fd) >> 6)]) = *(&(&v6)[8 * ((pipe_fd < 0 ? pipe_fd + 63 : pipe_fd) >> 6)]) | 1 << (((pipe_fd + (pipe_fd >> 31 >> 26) & 63) - (pipe_fd >> 31 >> 26)) & 63);
v4 = 5;
v5 = 0;
v2 = select(pipe_fd + 1, &v6, NULL, NULL, &v4);
if (v2 <= 0) {
if (v2) {
*(&v19) = *(__errno_location());
if (!(v19 == 4))
continue;
}
goto LABEL_405580;
}
v2 = read(pipe_fd, &v12, 0x180);
if (!v2) {
close(pipe_fd);
pipe_fd = -1;
goto LABEL_405580;
}
if (v2 <= 0) {
*(&v19) = *(__errno_location());
if (v19 == 4)
goto LABEL_405580;
initlog(0x3, "error reading initrequest", 0x180, 0x0, &v4, a5);
continue;
}
console_init(pipe_fd, &v12, 0x180);
if (*(&v12) != 50927977) {
LABEL_405454:
initlog(0x3, "got bogus initrequest", 0x180, 0x0, &v4, a5);
} else {
if (!(v2 == 384))
goto LABEL_405454;
v20 = *(&v13);
switch (*(&v13)) {
case 1:
sleep_time = *(&v15);
fifo_new_level(*(&v14), &v12, &g_4079b8, 0x0, &v4, a5);
v0 = 1;
break;
case 2:
sleep_time = *(&v15);
do_power_fail(0x46);
v0 = 1;
break;
case 3:
sleep_time = *(&v15);
do_power_fail(0x4c);
v0 = 1;
break;
case 4:
sleep_time = *(&v15);
do_power_fail(0x4f);
v0 = 1;
break;
case 6:
initcmd_setenv(&v16, 0x170, &g_4079b8, 0x0, &v4, a5);
break;
default:
initlog(0x3, "got unimplemented initrequest.", a2, 0x0, &v4, a5);
break;
}
}
}
}
if (pipe_fd == -1)
pause();
LABEL_405580:
v23 = *(&v17) ^ v22[5];
return;
}
|
static int
history_rename (const char *old, const char *new)
{
return (rename (old, new));
}
| void history_rename(char *a0, char *a1) {
unsigned long long v1;
v1 = rename(a0, a1);
return;
}
|
ch_enlargebufs(EditLine *el, size_t addlen)
{
size_t sz, newsz;
wchar_t *newbuffer, *oldbuf, *oldkbuf;
sz = (size_t)(el->el_line.limit - el->el_line.buffer + 2);
newsz = sz * 2;
if (addlen > sz) {
while(newsz - sz < addlen)
newsz *= 2;
}
newbuffer = realloc(el->el_line.buffer, newsz * sizeof(*newbuffer));
if (!newbuffer)
return 0;
(void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer));
oldbuf = el->el_line.buffer;
el->el_line.buffer = newbuffer;
el->el_line.cursor = newbuffer + (el->el_line.cursor - oldbuf);
el->el_line.lastchar = newbuffer + (el->el_line.lastchar - oldbuf);
el->el_line.limit = &newbuffer[sz - 2];
newbuffer = realloc(el->el_chared.c_kill.buf, newsz * sizeof(*newbuffer))
;
if (!newbuffer)
return 0;
(void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer));
oldkbuf = el->el_chared.c_kill.buf;
el->el_chared.c_kill.buf = newbuffer;
el->el_chared.c_kill.last = newbuffer +
(el->el_chared.c_kill.last - oldkbuf);
el->el_chared.c_kill.mark = el->el_line.buffer +
(el->el_chared.c_kill.mark - oldbuf);
newbuffer = realloc(el->el_chared.c_undo.buf, newsz * sizeof(*newbuffer))
;
if (!newbuffer)
return 0;
(void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer));
el->el_chared.c_undo.buf = newbuffer;
newbuffer = realloc(el->el_chared.c_redo.buf, newsz * sizeof(*newbuffer))
;
if (!newbuffer)
return 0;
el->el_chared.c_redo.pos = newbuffer +
(el->el_chared.c_redo.pos - el->el_chared.c_redo.buf);
el->el_chared.c_redo.lim = newbuffer +
(el->el_chared.c_redo.lim - el->el_chared.c_redo.buf);
el->el_chared.c_redo.buf = newbuffer;
if (!hist_enlargebuf(el, sz, newsz))
return 0;
el->el_line.limit = &el->el_line.buffer[newsz - 2];
if (el->el_chared.c_resizefun)
(*el->el_chared.c_resizefun)(el, el->el_chared.c_resizearg);
return 1;
}
| int ch_enlargebufs(unsigned long long a0[125], unsigned long a1) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
unsigned long v4;
unsigned int v6;
v1 = (a0[13] - a0[10] >> 2) + 2;
if (a1 > v1) {
for (v0 = v1 * 2; a1 > v0 - v1; v0 *= 2);
}
v2 = realloc(a0[10], v0 * 4);
if (!v2) {
v6 = 0;
} else {
memset(v2 + v1 * 4, 0x0, (v0 - v1) * 4);
v3 = a0[10];
a0[10] = v2;
a0[11] = a0[11] - v3 + v2;
a0[12] = a0[12] - v3 + v2;
a0[13] = v1 * 4 - 8 + v2;
v2 = realloc(a0[112], v0 * 4);
if (!v2) {
v6 = 0;
} else {
memset(v2 + v1 * 4, 0x0, (v0 - v1) * 4);
v4 = a0[112];
a0[112] = v2;
a0[113] = a0[113] - v4 + v2;
a0[114] = a0[10] + a0[114] - v3;
v2 = realloc(a0[111], v0 * 4);
if (!v2) {
v6 = 0;
} else {
memset(v2 + v1 * 4, 0x0, (v0 - v1) * 4);
a0[111] = v2;
v2 = realloc(a0[115], v0 * 4);
if (!v2) {
v6 = 0;
} else {
a0[116] = a0[116] - a0[115] + v2;
a0[117] = a0[117] - a0[115] + v2;
a0[115] = v2;
if (!hist_enlargebuf(a0, v1, v0, v1)) {
v6 = 0;
} else {
a0[13] = v0 * 4 - 8 + a0[10];
if (a0[122])
a0[122](a0, a0[124], a0[124], a0[122]);
v6 = 1;
}
}
}
}
}
return v6;
}
|
static void
pkg_remove_old_files(struct pkginfo *pkg,
struct fsys_namenode_queue *newfiles_queue,
struct fsys_namenode_queue *newconffiles)
{
struct fsys_hash_rev_iter rev_iter;
struct fsys_namenode_list *cfile;
struct fsys_namenode *namenode;
struct stat stab, oldfs;
for (cfile = newconffiles->head; cfile; cfile = cfile->next) {
debug(dbg_conffdetail, "%s: removing conffile '%s' for %s?", __func__,
cfile->namenode->name, pkg_name(pkg, pnaw_always));
if (!(cfile->namenode->flags & FNNF_RM_CONFF_ON_UPGRADE))
continue;
pkg_remove_conffile_on_upgrade(pkg, cfile->namenode);
}
fsys_hash_rev_iter_init(&rev_iter, pkg->files);
while ((namenode = fsys_hash_rev_iter_next(&rev_iter))) {
struct fsys_namenode *usenode;
if ((namenode->flags & FNNF_NEW_CONFF) ||
(namenode->flags & FNNF_RM_CONFF_ON_UPGRADE) ||
(namenode->flags & FNNF_NEW_INARCHIVE))
continue;
usenode = namenodetouse(namenode, pkg, &pkg->installed);
varbuf_rollback(&fnamevb, &fname_state);
varbuf_add_buf(&fnamevb, usenode->name, strlen(usenode->name));
varbuf_end_str(&fnamevb);
if (!stat(fnamevb.buf, &stab) &&
((((
stab.st_mode
)) & 0170000) == (0040000))
) {
debug(dbg_eachfiledetail, "process_archive: %s is a directory",
fnamevb.buf);
if (dir_is_used_by_others(namenode, pkg))
continue;
}
if (lstat(fnamevb.buf, &oldfs)) {
if (!(
(*__errno_location ())
==
2
||
(*__errno_location ())
==
40
||
(*__errno_location ())
==
20
))
warning(gettext("could not stat old file '%.250s' so not deleting it: %s"),
fnamevb.buf, strerror(
(*__errno_location ())
));
continue;
}
if (
((((
oldfs.st_mode
)) & 0170000) == (0040000))
) {
trig_path_activate(usenode, pkg);
if (strcmp(usenode->name, "/.") == 0)
continue;
if (rmdir(fnamevb.buf)) {
warning(gettext("unable to delete old directory '%.250s': %s"),
namenode->name, strerror(
(*__errno_location ())
));
} else if ((namenode->flags & FNNF_OLD_CONFF)) {
warning(gettext("old conffile '%.250s' was an empty directory " "(and has now been deleted)")
, namenode->name);
}
} else {
struct fsys_namenode_list *sameas =
((void *)0)
;
static struct file_ondisk_id empty_ondisk_id;
struct varbuf cfilename = { 0, 0,
((void *)0)
};
debug(dbg_eachfile, "process_archive: checking %s for same files on "
"upgrade/downgrade", fnamevb.buf);
for (cfile = newfiles_queue->head; cfile; cfile = cfile->next) {
if (cfile->namenode->flags & FNNF_FILTERED)
continue;
if (cfile->namenode->file_ondisk_id ==
((void *)0)
) {
struct stat tmp_stat;
varbuf_reset(&cfilename);
varbuf_add_buf(&cfilename, instdir, strlen(instdir));
varbuf_add_buf(&cfilename, cfile->namenode->name, strlen(cfile->namenode->name));
varbuf_end_str(&cfilename);
if (lstat(cfilename.buf, &tmp_stat) == 0) {
struct file_ondisk_id *file_ondisk_id;
file_ondisk_id = nfmalloc(sizeof(*file_ondisk_id));
file_ondisk_id->id_dev = tmp_stat.st_dev;
file_ondisk_id->id_ino = tmp_stat.st_ino;
cfile->namenode->file_ondisk_id = file_ondisk_id;
} else {
if (!(
(*__errno_location ())
==
2
||
(*__errno_location ())
==
40
||
(*__errno_location ())
==
20
))
ohshite(gettext("unable to stat other new file '%.250s'"),
cfile->namenode->name);
cfile->namenode->file_ondisk_id = &empty_ondisk_id;
continue;
}
}
if (cfile->namenode->file_ondisk_id == &empty_ondisk_id)
continue;
if (oldfs.st_dev == cfile->namenode->file_ondisk_id->id_dev &&
oldfs.st_ino == cfile->namenode->file_ondisk_id->id_ino) {
if (sameas)
warning(gettext("old file '%.250s' is the same as several new files! " "(both '%.250s' and '%.250s')")
, fnamevb.buf,
sameas->namenode->name, cfile->namenode->name);
sameas = cfile;
debug(dbg_eachfile, "process_archive: not removing %s, "
"since it matches %s", fnamevb.buf, cfile->namenode->name);
}
}
varbuf_destroy(&cfilename);
if ((namenode->flags & FNNF_OLD_CONFF)) {
if (sameas) {
if (sameas->namenode->flags & FNNF_NEW_CONFF) {
if (strcmp(sameas->namenode->oldhash, "newconffile") == 0) {
sameas->namenode->oldhash = namenode->oldhash;
debug(dbg_eachfile, "process_archive: old conff %s "
"is same as new conff %s, copying hash",
namenode->name, sameas->namenode->name);
} else {
debug(dbg_eachfile, "process_archive: old conff %s "
"is same as new conff %s but latter already has hash",
namenode->name, sameas->namenode->name);
}
}
} else {
debug(dbg_eachfile, "process_archive: old conff %s "
"is disappearing", namenode->name);
namenode->flags |= FNNF_OBS_CONFF;
tar_fsys_namenode_queue_push(newconffiles, namenode);
tar_fsys_namenode_queue_push(newfiles_queue, namenode);
}
continue;
}
if (sameas)
continue;
trig_path_activate(usenode, pkg);
if (secure_unlink_statted(fnamevb.buf, &oldfs)) {
warning(gettext("unable to securely remove old file '%.250s': %s"),
namenode->name, strerror(
(*__errno_location ())
));
}
}
}
}
| void pkg_remove_old_files(struct_0 *a0, unsigned long long *a1, unsigned long long *a2) {
char v0;
struct_6 *v1;
void* v2;
struct_4 *v3;
struct_5 *v4;
unsigned long long v5[2];
void* v6;
void* v7;
void* v8;
char v9;
char v10;
char v11;
char v12;
char v13;
char v14;
char v15;
char v16;
unsigned long long v18;
unsigned long long *v25;
unsigned long long v26;
for (v1 = *(a2); v1; v1 = v1->field_0) {
pkg_name(a0, 0x3);
debug(0x80, "%s: removing conffile '%s' for %s?", "pkg_remove_old_files", v1->field_8->field_8);
if ((v1->field_8->field_30 & 0x400))
pkg_remove_conffile_on_upgrade(a0, v1->field_8);
}
fsys_hash_rev_iter_init(&v0, a0->field_168, a0->field_168);
while (true) {
do {
do {
do {
v3 = fsys_hash_rev_iter_next(&v0);
if (!v3) {
v26 = *(&v16) ^ v25[5];
return;
}
} while ((v3->field_30 & 1));
} while ((v3->field_30 & 0x400));
} while ((v3->field_30 & 2));
v4 = namenodetouse(v3, a0, &a0->padding_0[72], a0);
varbuf_rollback(0x5002f0, 0x5002e8, a2);
varbuf_add_buf(0x5002f0, v4->field_8, strlen(v4->field_8), v18);
varbuf_end_str(0x5002f0);
if (!stat(lstat, &v9) && (*(&v10) & 0xf000) == 0x4000) {
debug(0x40, "process_archive: %s is a directory", lstat, v18);
if (!(!dir_is_used_by_others(v3, a0, a0)))
continue;
}
if (!lstat(lstat, &v11)) {
if ((*(&v13) & 0xf000) != 0x4000) {
v2 = 0;
v6 = 0;
v7 = 0;
v8 = 0;
debug(0x8, "process_archive: checking %s for same files on upgrade/downgrade", lstat, v18);
v1 = *(a1);
while (true) {
if (!v1)
break;
if (!(v1->field_8->field_30 & 0x200)) {
if (!v1->field_8->field_48) {
varbuf_reset(&v6);
varbuf_add_buf(&v6, instdir, strlen(instdir), instdir);
varbuf_add_buf(&v6, v1->field_8->field_8, strlen(v1->field_8->field_8), v1->field_8->field_8);
varbuf_end_str(&v6);
if (!lstat(v8, &v14)) {
v5[0] = nfmalloc(0x10);
v5[0] = *(&v14);
v5[1] = *(&v15);
v1->field_8->field_48 = &v5[0];
} else {
if (*(__errno_location()) != 2 && *(__errno_location()) != 40 && *(__errno_location()) != 20)
ohshite(gettext("unable to stat other new file '%.250s'"), v1->field_8->field_8);
v1->field_8->field_48 = &empty_ondisk_id.6613;
goto LABEL_402320;
}
}
if (v1->field_8->field_48 != 4212976 && *(&v11) == v1->field_8->field_48->field_0 && *(&v12) == v1->field_8->field_48->field_8) {
if (v2)
warning(gettext("old file '%.250s' is the same as several new files! (both '%.250s' and '%.250s')"));
v2[0] = v1;
debug(0x8, "process_archive: not removing %s, since it matches %s", lstat, v1->field_8->field_8);
}
}
LABEL_402320:
v1 = v1->field_0;
}
varbuf_destroy(&v6);
if ((v3->field_30 & 4)) {
if (!v2) {
debug(0x8, "process_archive: old conff %s is disappearing", v3->field_8, v18);
v3->field_30 = v3->field_30 | 8;
tar_fsys_namenode_queue_push(a2, v3, v3);
tar_fsys_namenode_queue_push(a1, v3, v3);
} else if ((*((v2[8] + 48)) & 1)) {
if (!strcmp(*((v2[8] + 56)), "newconffile")) {
*((v2[8] + 56)) = v3->field_38;
debug(0x8, "process_archive: old conff %s is same as new conff %s, copying hash", v3->field_8, *((v2[8] + 8)));
} else {
debug(0x8, "process_archive: old conff %s is same as new conff %s but latter already has hash", v3->field_8, *((v2[8] + 8)));
}
}
} else {
if (!v2) {
trig_path_activate(v4, a0, a0);
if (secure_unlink_statted(lstat, &v11, &v11)) {
strerror(*(__errno_location()));
warning(gettext("unable to securely remove old file '%.250s': %s"));
}
}
}
} else {
trig_path_activate(v4, a0, a0);
if (strcmp(v4->field_8, "/.")) {
if (rmdir(lstat)) {
strerror(*(__errno_location()));
warning(gettext("unable to delete old directory '%.250s': %s"));
} else if ((v3->field_30 & 4)) {
warning(gettext("old conffile '%.250s' was an empty directory (and has now been deleted)"));
}
}
}
} else {
if (*(__errno_location()) != 2 && *(__errno_location()) != 40 && *(__errno_location()) != 20) {
strerror(*(__errno_location()));
warning(gettext("could not stat old file '%.250s' so not deleting it: %s"));
}
}
}
}
|
static inline __s32 rta_getattr_s32(const struct rtattr *rta)
{
return *(__s32 *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| long rta_getattr_s32(long a1)
{
return *(unsigned int *)(a1 + 4);
}
|
static void remove_usergroup (void)
{
const struct group *grp;
const struct passwd *pwd =
((void *)0)
;
grp = gr_locate (user_name);
if (
((void *)0)
== grp) {
return;
}
if (grp->gr_gid != user_gid) {
fprintf (
stderr
,
gettext ("%s: group %s not removed because it is not the primary group of user %s.\n"),
Prog, grp->gr_name, user_name);
return;
}
if (
((void *)0)
!= grp->gr_mem[0]) {
fprintf (
stderr
,
gettext ("%s: group %s not removed because it has other members.\n"),
Prog, grp->gr_name);
return;
}
if (!fflg) {
prefix_setpwent ();
while ((pwd = prefix_getpwent ()) !=
((void *)0)
) {
if (strcmp (pwd->pw_name, user_name) == 0) {
continue;
}
if (pwd->pw_gid == grp->gr_gid) {
fprintf (
stderr
,
gettext ("%s: group %s is the primary group of another user and is not removed.\n"),
Prog, grp->gr_name);
break;
}
}
prefix_endpwent ();
}
if (
((void *)0)
== pwd) {
if (gr_remove (user_name) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot remove entry '%s' from %s\n"),
Prog, user_name, gr_dbname ());
fail_exit (10);
}
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
6
, "removed group '%s' owned by '%s'\n", user_name, user_name) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
)
;
if (sgr_locate (user_name) !=
((void *)0)
) {
if (sgr_remove (user_name) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot remove entry '%s' from %s\n"),
Prog, user_name, sgr_dbname ());
fail_exit (10);
}
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
6
, "removed shadow group '%s' owned by '%s'\n", user_name, user_name) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
)
;
}
}
}
| void remove_usergroup()
{
char *v0;
long v1;
long v2;
char *v3;
long v4;
long v5;
char *v6;
long v7;
long v8;
char *v9;
long v10;
char *v11;
long v12;
char *v13;
long v14;
char *v15;
long v16;
char *v17;
long v18;
char *locale;
char *v20;
long v21;
const char *s;
const char *v23;
v18 = 0LL;
v21 = gr_locate(user_name);
if ( v21 )
{
if ( *(_DWORD *)(v21 + 16) == user_gid )
{
if ( **(_QWORD **)(v21 + 24) )
{
v4 = *(_QWORD *)v21;
v5 = Prog;
v6 = gettext("%s: group %s not removed because it has other members.\n");
fprintf(stderr, v6, v5, v4);
}
else
{
if ( fflg != 1 )
{
prefix_setpwent();
while ( 1 )
{
v18 = prefix_getpwent();
if ( !v18 )
break;
if ( strcmp(*(const char **)v18, user_name) && *(_DWORD *)(v18 + 20) == *(_DWORD *)(v21 + 16) )
{
v7 = *(_QWORD *)v21;
v8 = Prog;
v9 = gettext("%s: group %s is the primary group of another user and is not removed.\n");
fprintf(stderr, v9, v8, v7);
break;
}
}
prefix_endpwent();
}
if ( !v18 )
{
if ( !(unsigned int)gr_remove(user_name) )
{
v10 = gr_dbname();
v11 = user_name;
v12 = Prog;
v13 = gettext("%s: cannot remove entry '%s' from %s\n");
fprintf(stderr, v13, v12, v11, v10);
fail_exit(10);
}
s = setlocale(6, 0LL);
locale = 0LL;
if ( s )
locale = strdup(s);
if ( locale )
setlocale(6, "C");
syslog(6, "removed group '%s' owned by '%s'\n", user_name, user_name);
if ( locale )
{
setlocale(6, locale);
free(locale);
}
if ( sgr_locate(user_name) )
{
if ( !(unsigned int)sgr_remove(user_name) )
{
v14 = sgr_dbname();
v15 = user_name;
v16 = Prog;
v17 = gettext("%s: cannot remove entry '%s' from %s\n");
fprintf(stderr, v17, v16, v15, v14);
fail_exit(10);
}
v23 = setlocale(6, 0LL);
v20 = 0LL;
if ( v23 )
v20 = strdup(v23);
if ( v20 )
setlocale(6, "C");
syslog(6, "removed shadow group '%s' owned by '%s'\n", user_name, user_name);
if ( v20 )
{
setlocale(6, v20);
free(v20);
}
}
}
}
}
else
{
v0 = user_name;
v1 = *(_QWORD *)v21;
v2 = Prog;
v3 = gettext("%s: group %s not removed because it is not the primary group of user %s.\n");
fprintf(stderr, v3, v2, v1, v0);
}
}
}
|
int
ttcbreak ()
{
struct termios tt;
if (ttsaved == 0)
return -1;
tt = ttin;
return (ttfd_cbreak (0, &tt));
}
| long long ttcbreak() {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
unsigned long v6;
unsigned int v7;
unsigned long long v9;
if (!ttsaved) {
v9 = 4294967295;
return v9;
}
v0 = ttin;
v1 = g_400748;
v2 = g_400750;
v3 = g_400758;
v4 = g_400760;
v5 = g_400768;
v6 = g_400770;
v7 = g_400778;
v9 = ttfd_cbreak(0x0, &v0);
return v9;
}
|
mode != MACVLAN_MODE_PASSTHRU) {
{ fprintf(
stderr
, "%s: ", lu->id); fprintf(
stderr
, "nopromisc flag only valid in passthru mode"); fprintf(
stderr
, "\n"); };
explain(lu);
return -1;
}
| int fprintf(FILE *__stream,char *__format,...)
{
halt_baddata();
}
|
void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo,
struct rtattr *tb[], FILE *fp, const char *prefix,
const char *title)
{
char buf[(128)] = {};
xfrm_selector_print(&xpinfo->sel, preferred_family, fp, title);
if (tb[XFRMA_SEC_CTX])
xfrm_sec_ctx_print(fp, tb[XFRMA_SEC_CTX]);
if (prefix)
strlcat(buf, prefix, sizeof(buf));
strlcat(buf, "\t", sizeof(buf));
fputs(buf, fp);
if (xpinfo->dir >= XFRM_POLICY_MAX) {
xpinfo->dir -= XFRM_POLICY_MAX;
fprintf(fp, "socket ");
} else
fprintf(fp, "dir ");
switch (xpinfo->dir) {
case XFRM_POLICY_IN:
fprintf(fp, "in");
break;
case XFRM_POLICY_OUT:
fprintf(fp, "out");
break;
case XFRM_POLICY_FWD:
fprintf(fp, "fwd");
break;
default:
fprintf(fp, "%u", xpinfo->dir);
break;
}
fprintf(fp, " ");
switch (xpinfo->action) {
case 0:
if (show_stats > 0)
fprintf(fp, "action allow ");
break;
case 1:
fprintf(fp, "action block ");
break;
default:
fprintf(fp, "action %u ", xpinfo->action);
break;
}
if (show_stats)
fprintf(fp, "index %u ", xpinfo->index);
fprintf(fp, "priority %u ", xpinfo->priority);
if (tb[XFRMA_POLICY_TYPE]) {
struct xfrm_userpolicy_type *upt;
fprintf(fp, "ptype ");
if (((int)((tb[XFRMA_POLICY_TYPE])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))) < sizeof(*upt))
fprintf(fp, "(ERROR truncated)");
upt = ((void*)(((char*)(tb[XFRMA_POLICY_TYPE])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
fprintf(fp, "%s ", strxf_ptype(upt->type));
}
if (show_stats > 0)
fprintf(fp, "share %s ", strxf_share(xpinfo->share));
if (show_stats > 0 || xpinfo->flags) {
__u8 flags = xpinfo->flags;
fprintf(fp, "flag ");
do { if (flags & 1) { flags &= ~1; fprintf(fp, "localok" "%s", (flags ? " " : "")); } } while(0);
do { if (flags & 2) { flags &= ~2; fprintf(fp, "icmp" "%s", (flags ? " " : "")); } } while(0);
if (flags)
fprintf(fp, "%x", flags);
}
if (show_stats > 0)
fprintf(fp, " (0x%s)", strxf_mask8(xpinfo->flags));
fprintf(fp, "%s", _SL_);
if (show_stats > 0)
xfrm_lifetime_print(&xpinfo->lft, &xpinfo->curlft, fp, buf);
xfrm_xfrma_print(tb, xpinfo->sel.family, fp, buf,
0
);
}
| long long xfrm_policy_info_print(struct_0 *a0, struct_1 *a1, void* a2, unsigned long long a3, char *a4) {
char v0;
char *v1;
void* v2;
void* v3;
void* v4;
void* v5;
void* v6;
void* v7;
void* v8;
void* v9;
void* v10;
void* v11;
void* v12;
void* v13;
void* v14;
void* v15;
void* v16;
void* v17;
unsigned int v19;
unsigned int v20;
v2 = 0;
v3 = 0;
v4 = 0;
v5 = 0;
v6 = 0;
v7 = 0;
v8 = 0;
v9 = 0;
v10 = 0;
v11 = 0;
v12 = 0;
v13 = 0;
v14 = 0;
v15 = 0;
v16 = 0;
v17 = 0;
xfrm_selector_print(a0, preferred_family, a2, a4);
if (a1->field_40)
xfrm_sec_ctx_print(a2, a1->field_40);
if (a3)
strlcat(&v2, a3, 0x80, a3);
strlcat(&v2, "\t", 0x80, a3);
fputs(&v2, a2);
if (a0->field_a0 <= 2) {
fprintf(a2, "dir ");
} else {
a0->field_a0 = a0->field_a0 - 3;
fprintf(a2, "socket ");
}
if (a0->field_a0 == 2) {
fprintf(a2, "fwd");
} else {
if (a0->field_a0 <= 2) {
if (!a0->field_a0) {
fprintf(a2, "in");
goto LABEL_403589;
}
if (a0->field_a0 == 1) {
fprintf(a2, "out");
goto LABEL_403589;
}
}
fprintf(a2, "%u", a0->field_a0);
}
LABEL_403589:
fprintf(a2, " ");
if (!a0->field_a1) {
if (show_stats > 0)
fprintf(a2, "action allow ");
} else {
if (a0->field_a1 == 1)
fprintf(a2, "action block ");
else
fprintf(a2, "action %u ", a0->field_a1);
}
if (show_stats)
fprintf(a2, "index %u ", a0->field_9c);
fprintf(a2, "priority %u ", a0->field_98);
if (*(&a1[256204778801521548].padding_0[32])) {
fprintf(a2, "ptype ");
if (*(*(&a1[256204778801521548].padding_0[32])) - 4 <= 5)
fprintf(a2, "(ERROR truncated)");
v1 = *(&a1[256204778801521548].padding_0[32]) + 4;
fprintf(a2, "%s ", strxf_ptype(*(v1)));
}
if (show_stats > 0)
fprintf(a2, "share %s ", strxf_share(a0->field_a3));
if (show_stats <= 0 && !a0->field_a2)
goto LABEL_403895;
v0 = a0->field_a2;
fprintf(a2, "flag ");
if ((v0 & 1)) {
v0 &= 254;
if (!v0)
v19 = &g_4057b6;
else
v19 = " ";
fprintf(a2, "localok%s", v19);
}
if ((v0 & 2)) {
v0 &= 253;
if (!v0)
v20 = &g_4057b6;
else
v20 = " ";
fprintf(a2, "icmp%s", v20);
}
if (v0)
fprintf(a2, "%x", v0);
LABEL_403895:
if (show_stats > 0)
fprintf(a2, " (0x%s)", strxf_mask8(a0->field_a2));
fprintf(a2, "%s", _SL_);
if (show_stats > 0)
xfrm_lifetime_print(&a0->padding_2a[14], &a0->padding_2a[78], a2, &v2);
xfrm_xfrma_print(a1, a0->field_28, a2, &v2, 0x0);
return 0;
}
|
static int
restartjob(struct job *jp, int mode)
{
struct procstat *ps;
int i;
int status;
pid_t pgid;
({ suppressint++; ({ __asm__ __volatile__ ("": : :"memory"); }); 0; });
if (jp->state == 2)
goto out;
jp->state = 0;
pgid = jp->ps->pid;
if (mode == 0)
xtcsetpgrp(ttyfd, pgid);
killpg(pgid,
18
);
ps = jp->ps;
i = jp->nprocs;
do {
if (
(((
ps->status
) & 0xff) == 0x7f)
) {
ps->status = -1;
}
} while (ps++, --i);
out:
status = (mode == 0) ? waitforjob(jp) : 0;
({ ({ __asm__ __volatile__ ("": : :"memory"); }); if (--suppressint == 0 && intpending) onint(); 0; });
return status;
}
| int restartjob(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3[2];
unsigned int v5;
suppressint = suppressint + 1;
if (a0->field_1e != 2) {
a0->field_1e = 0;
v1 = a0->field_10->field_0;
if (!a1)
xtcsetpgrp(ttyfd, v1);
killpg(v1, 0x12);
*(&v3[0]) = a0->field_10;
v0 = a0->field_1c;
do {
if (v3[1] == 127)
v3[1] = -1;
*(&v3[0]) = v3 + 2;
v0 -= 1;
} while (v0);
}
if (a1)
v5 = 0;
else
v5 = waitforjob(a0);
v2 = v5;
suppressint = suppressint - 1;
if (!suppressint && intpending)
onint();
return v2;
}
|
int
client_simple_escape_filter(struct ssh *ssh, Channel *c, char *buf, int len)
{
if (c->extended_usage != 2)
return 0;
return process_escapes(ssh, c, c->input, c->output, c->extended,
buf, len);
}
| long long client_simple_escape_filter(unsigned long long a0, struct_0 *a1, unsigned long long a2, unsigned long a3) {
void* v1;
if (a1->field_c0 != 2)
v1 = 0;
else
v1 = process_escapes(a0, a1, a1->field_68, a1->field_70, a1->field_78, a2, a3);
return v1;
}
|
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;
}
| void read_yesno(char *a0, unsigned long a1) {
unsigned int v0;
char v1;
unsigned long v4;
unsigned long v5;
unsigned long long v6;
void* v7;
v0 = a1;
while (true) {
fputs(a0, *(got.stderr));
if (!fgets(&v1, 0x200, *(got.stdin))) {
v4 = a1;
break;
} else {
if (v1 != 10 && v1 != 13) {
if (v1 != 121 && v1 != 89) {
if (v1 == 110)
continue;
v7 = 0;
break;
}
if (v1 == 89 || v1 == 121) {
v6 = 1;
break;
}
}
if (v1 == 13 || v1 == 10) {
v5 = a1;
break;
}
}
}
return;
}
|
int
rl_read_init_file(const char *s)
{
return el_source(e, s);
}
| long long rl_read_init_file(unsigned long long a0) {
return el_source(e, a0);
}
|
char *
get_peer_ipaddr(int sock)
{
char *p;
if ((p = get_socket_address(sock, 1,
1
)) !=
((void *)0)
)
return p;
return xstrdup("UNKNOWN");
}
| long long get_peer_ipaddr(unsigned long a0) {
unsigned long long v0;
unsigned long long v2;
v0 = get_socket_address(a0, 0x1, 0x1);
if (v0) {
v2 = v0;
return v2;
}
v2 = xstrdup("UNKNOWN");
return v2;
}
|
static const char *
fmt_multistate_int(int val, const struct multistate *m)
{
u_int i;
for (i = 0; m[i].key !=
((void *)0)
; i++) {
if (m[i].value == val)
return m[i].key;
}
return "UNKNOWN";
}
| char * fmt_multistate_int(int param_1,long param_2)
{
uint local_c;
local_c = 0;
while( true ) {
if (*(long *)(param_2 + (ulong)local_c * 0x10) == 0) {
return "UNKNOWN";
}
if (param_1 == *(int *)(param_2 + (ulong)local_c * 0x10 + 8)) break;
local_c = local_c + 1;
}
return *(char **)(param_2 + (ulong)local_c * 0x10);
}
|
static int
ipstats_req_add_filters(struct ipstats_req *req, void *data)
{
struct ipstats_stat_dump_filters dump_filters = {};
struct ipstats_stat_enabled *enabled = data;
_Bool
get_filters =
0
;
int i;
for (i = 0; i < enabled->nenabled; i++)
enabled->enabled[i].desc->pack(&dump_filters,
enabled->enabled[i].desc);
for (i = 1; i < (sizeof(dump_filters.mask) / sizeof((dump_filters.mask)[0])); i++) {
if (ipstats_req_should_filter_at(&dump_filters, i)) {
get_filters =
1
;
break;
}
}
req->ifsm.filter_mask = dump_filters.mask[0];
if (get_filters) {
struct rtattr *nest;
nest = addattr_nest(&req->nlh, sizeof(*req),
IFLA_STATS_GET_FILTERS | (1 << 15));
for (i = 1; i < (sizeof(dump_filters.mask) / sizeof((dump_filters.mask)[0])); i++) {
if (ipstats_req_should_filter_at(&dump_filters, i))
addattr32(&req->nlh, sizeof(*req), i,
dump_filters.mask[i]);
}
addattr_nest_end(&req->nlh, nest);
}
return 0;
}
| undefined8 ipstats_req_add_filters(long param_1,long *param_2)
{
bool bVar1;
char cVar2;
undefined8 uVar3;
long in_FS_OFFSET;
uint local_3c;
undefined8 local_28;
undefined8 local_20;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_28 = 0;
local_20 = 0;
local_18 = 0;
bVar1 = false;
for (local_3c = 0; (ulong)(long)(int)local_3c < (ulong)param_2[1]; local_3c = local_3c + 1) {
(**(code **)(*(long *)(*param_2 + (long)(int)local_3c * 0x20) + 0x10))
(&local_28,*(undefined8 *)(*param_2 + (long)(int)local_3c * 0x20));
}
local_3c = 1;
do {
if (5 < local_3c) {
LAB_00101a90:
*(undefined4 *)(param_1 + 0x18) = (undefined4)local_28;
if (bVar1) {
uVar3 = addattr_nest(param_1,0x9c,0x8001);
for (local_3c = 1; local_3c < 6; local_3c = local_3c + 1) {
cVar2 = ipstats_req_should_filter_at(&local_28,local_3c);
if (cVar2 != '\0') {
addattr32(param_1,0x9c,local_3c,
*(undefined4 *)((long)&local_28 + (long)(int)local_3c * 4));
}
}
addattr_nest_end(param_1,uVar3);
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return 0;
}
cVar2 = ipstats_req_should_filter_at(&local_28,local_3c);
if (cVar2 != '\0') {
bVar1 = true;
goto LAB_00101a90;
}
local_3c = local_3c + 1;
} while( true );
}
|
int
check_quietlogin(Session *s, const char *command)
{
char buf[256];
struct passwd *pw = s->pw;
struct stat st;
if (command !=
((void *)0)
)
return 1;
snprintf(buf, sizeof(buf), "%.200s/.hushlogin", pw->pw_dir);
if (stat(buf, &st) >= 0)
return 1;
return 0;
}
| undefined8 check_quietlogin(long param_1,long param_2)
{
int iVar1;
undefined8 uVar2;
long in_FS_OFFSET;
stat local_1a8;
char local_118 [264];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (param_2 == 0) {
snprintf(local_118,0x100,"%.200s/.hushlogin",*(undefined8 *)(*(long *)(param_1 + 0x10) + 0x20));
iVar1 = stat(local_118,&local_1a8);
if (iVar1 < 0) {
uVar2 = 0;
}
else {
uVar2 = 1;
}
}
else {
uVar2 = 1;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
}
|
static int
rl_domove_motion_callback (_rl_vimotion_cxt *m)
{
int c;
_rl_vi_last_motion = c = m->motion;
rl_extend_line_buffer (rl_end + 1);
rl_line_buffer[rl_end++] = ' ';
rl_line_buffer[rl_end] = '\0';
_rl_dispatch (c, _rl_keymap);
if ((rl_readline_state & (0x0080000)))
{
if ((rl_readline_state & (0x0800000)))
return 0;
else
return (_rl_vi_domove_motion_cleanup (c, m));
}
return (_rl_vi_domove_motion_cleanup (c, m));
}
| int rl_domove_motion_callback(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
int tmp_19;
unsigned int v2;
v0 = a0->field_20;
_rl_vi_last_motion = v0;
rl_extend_line_buffer(rl_end + 1);
tmp_19 = rl_end;
rl_end = rl_end + 1;
*((tmp_19 + rl_line_buffer)) = 32;
*((rl_end + rl_line_buffer)) = 0;
_rl_dispatch(v0, _rl_keymap, _rl_keymap);
if (!(rl_readline_state & 0x80000)) {
v2 = _rl_vi_domove_motion_cleanup(v0, a0, a0, a3, a4, a5);
return v2;
} else if (!(rl_readline_state & 0x800000)) {
v2 = _rl_vi_domove_motion_cleanup(v0, a0, a0, a3, a4, a5);
return v2;
} else {
v2 = 0;
return v2;
}
}
|
int allowed(const char *username, const char *allow_file,
const char *deny_file) {
FILE *fp;
int isallowed;
char buf[128];
if (getuid() == 0)
return 1;
isallowed = 0;
if ((fp = fopen(allow_file, "r")) !=
((void *)0)
) {
isallowed = in_file(username, fp, 0);
fclose(fp);
if ((getuid() == 0) && (!isallowed)) {
snprintf(buf, sizeof (buf),
"root used -u for user %s not in cron.allow", username);
log_it("crontab", getpid(), "warning", buf, 0);
isallowed = 1;
}
}
else if ((fp = fopen(deny_file, "r")) !=
((void *)0)
) {
isallowed = !in_file(username, fp, 0);
fclose(fp);
if ((getuid() == 0) && (!isallowed)) {
snprintf(buf, sizeof (buf),
"root used -u for user %s in cron.deny", username);
log_it("crontab", getpid(), "warning", buf, 0);
isallowed = 1;
}
}
return (isallowed);
}
| long allowed(const char *a1, const char *a2, const char *a3)
{
unsigned int v4;
unsigned int v5;
unsigned int v7;
FILE *stream;
FILE *streama;
char s[136];
unsigned long v11;
v11 = __readfsqword(0x28u);
if ( !getuid() )
return 1LL;
v7 = 0;
stream = fopen(a2, "r");
if ( stream )
{
v7 = in_file(a1, stream, 0);
fclose(stream);
if ( !getuid() && !v7 )
{
snprintf(s, 0x80uLL, "root used -u for user %s not in cron.allow", a1);
v4 = getpid();
log_it("crontab", v4, "warning", s, 0LL);
return 1;
}
}
else
{
streama = fopen(a3, "r");
if ( streama )
{
v7 = in_file(a1, streama, 0) == 0;
fclose(streama);
if ( !getuid() && !v7 )
{
snprintf(s, 0x80uLL, "root used -u for user %s in cron.deny", a1);
v5 = getpid();
log_it("crontab", v5, "warning", s, 0LL);
return 1;
}
}
}
return v7;
}
|
n->nlmsg_type != XFRM_MSG_DELPOLICY &&
n->nlmsg_type != XFRM_MSG_UPDPOLICY &&
n->nlmsg_type != XFRM_MSG_POLEXPIRE) {
fprintf(
stderr
, "Not a policy: %08x %08x %08x\n",
n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
return 0;
}
| int fprintf(FILE *__stream,char *__format,...)
{
halt_baddata();
}
|
static char *
make_dev_fd_filename (fd)
int fd;
{
char *ret, intbuf[(((sizeof (int) * 8) - (! ((int) 0 < (int) -1))) * 302 / 1000 + 1 + (! ((int) 0 < (int) -1))) + 1], *p;
ret = (char *)sh_xmalloc((sizeof ("/dev/fd/") + 8), "subst.c", 6447);
strcpy (ret, "/dev/fd/");
p = inttostr (fd, intbuf, sizeof (intbuf));
strcpy (ret + sizeof ("/dev/fd/") - 1, p);
add_fifo_list (fd);
return (ret);
}
| char * make_dev_fd_filename(int param_1)
{
char *__dest;
char *__src;
long in_FS_OFFSET;
undefined local_1c [12];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
__dest = (char *)sh_xmalloc(0x11,"subst.c",0x192f);
strcpy(__dest,"/dev/fd/");
__src = (char *)inttostr((long)param_1,local_1c,0xc);
strcpy(__dest + 8,__src);
add_fifo_list(param_1);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return __dest;
}
|
static void Hide(unsigned char *c,unsigned char *r_enc,const Inputs r,const unsigned char *pk,const unsigned char *cache)
{
Small_encode(r_enc,r);
ZEncrypt(c,r,pk); c += 1007;
HashConfirm(c,r_enc,pk,cache);
}
| unsigned long Hide(_BYTE *a1, _BYTE *a2, _BYTE *a3, unsigned char *a4, long a5)
{
Small_encode(a2, a3);
ZEncrypt(a1, (long)a3, a4);
return HashConfirm((long)(a1 + 1007), (long)a2, (long)a4, a5);
}
|
static void
pkg_infodb_update_file(const char *filename, const char *filetype)
{
if (strlen(filetype) > 100)
ohshit(gettext("old version of package has overly-long info file name starting '%.250s'"),
filename);
if (strcmp(filetype, "list") == 0)
return;
match_head = match_node_new(filename, filetype, match_head);
}
| long long pkg_infodb_update_file(unsigned long long a0, char *a1, unsigned long a2, unsigned long long a3) {
unsigned long long v2;
unsigned long long v3;
if (strlen(a1) > 100) {
v2 = gettext("old version of package has overly-long info file name starting '%.250s'");
ohshit(v2, a0, v2, a3);
}
v3 = strcmp(a1, "list");
if (v3) {
v3 = match_node_new(a0, a1, match_head, a1);
match_head = v3;
}
return v3;
}
|
static int R3_recip(small *out,const small *in)
{
small f[761 +1],g[761 +1],v[761 +1],r[761 +1];
int i,loop,delta;
int sign,swap,t;
for (i = 0;i < 761 +1;++i) v[i] = 0;
for (i = 0;i < 761 +1;++i) r[i] = 0;
r[0] = 1;
for (i = 0;i < 761;++i) f[i] = 0;
f[0] = 1; f[761 -1] = f[761] = -1;
for (i = 0;i < 761;++i) g[761 -1-i] = in[i];
g[761] = 0;
delta = 1;
for (loop = 0;loop < 2*761 -1;++loop) {
for (i = 761;i > 0;--i) v[i] = v[i-1];
v[0] = 0;
sign = -g[0]*f[0];
swap = int16_negative_mask(-delta) & int16_nonzero_mask(g[0]);
delta ^= swap&(delta^-delta);
delta += 1;
for (i = 0;i < 761 +1;++i) {
t = swap&(f[i]^g[i]); f[i] ^= t; g[i] ^= t;
t = swap&(v[i]^r[i]); v[i] ^= t; r[i] ^= t;
}
for (i = 0;i < 761 +1;++i) g[i] = F3_freeze(g[i]+sign*f[i]);
for (i = 0;i < 761 +1;++i) r[i] = F3_freeze(r[i]+sign*v[i]);
for (i = 0;i < 761;++i) g[i] = g[i+1];
g[761] = 0;
}
sign = f[0];
for (i = 0;i < 761;++i) out[i] = sign*v[761 -1-i];
return int16_nonzero_mask(delta);
}
| int R3_recip(unsigned long a0, char *a1, unsigned long long a2) {
char *v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
char v7;
char v8;
char v9;
char v10;
char v11;
char v12;
char v13;
char *v15;
char *v16;
unsigned long long v17;
char *v19;
char *v20;
v0 = a0;
for (v1 = 0; v1 <= 761; v1 = __addvsi3(v1, 0x1, a2)) {
(&v12)[v1] = 0;
}
for (v1 = 0; v1 <= 761; v1 = __addvsi3(v1, 0x1, a2)) {
(&v13)[v1] = 0;
}
v13 = 1;
for (v1 = 0; v1 <= 760; v1 = __addvsi3(v1, 0x1, a2)) {
(&v7)[v1] = 0;
}
v7 = 1;
v9 = 255;
v8 = v9;
for (v1 = 0; v1 <= 760; v1 = __addvsi3(v1, 0x1, a1[v1])) {
v15 = &a1[v1];
a2 = *(v15);
(&v10)[__subvsi3(0x2f8, v1, v1)] = *(v15);
}
v11 = 0;
v3 = 1;
for (v2 = 0; v2 <= 1520; v2 = __addvsi3(v2, 0x1, a2)) {
for (v1 = 761; v1 > 0; v1 = __addvsi3(v1, 0xffffffff, *((&v12 + v16)))) {
v16 = __addvsi3(v1, 0xffffffff, a2);
a2 = *((&v12 + v16));
(&v12)[v1] = *((&v12 + v16));
}
v12 = 0;
v17 = __negvsi2(v10);
v4 = __mulvsi3(v17, v7, v17);
v5 = int16_nonzero_mask(v10) & int16_negative_mask(-(v3));
v3 ^= (__negvsi2(v3) ^ v3) & v5;
v3 = __addvsi3(v3, 0x1, a2);
for (v1 = 0; v1 <= 761; v1 = __addvsi3(v1, 0x1, v6 ^ (&v13)[v1])) {
v6 = ((&v10)[v1] ^ (&v7)[v1]) & v5;
(&v7)[v1] = v6 ^ (&v7)[v1];
(&v10)[v1] = v6 ^ (&v10)[v1];
v6 = ((&v13)[v1] ^ (&v12)[v1]) & v5;
(&v12)[v1] = v6 ^ (&v12)[v1];
a2 = v6 ^ (&v13)[v1];
(&v13)[v1] = v6 ^ (&v13)[v1];
}
for (v1 = 0; v1 <= 761; v1 = __addvsi3(v1, 0x1, v1)) {
*(&a2) = (&v10)[v1];
(&v10)[v1] = F3_freeze(v4 * (&v7)[v1] + a2, 0x1, a2);
}
for (v1 = 0; v1 <= 761; v1 = __addvsi3(v1, 0x1, v1)) {
*(&a2) = (&v13)[v1];
(&v13)[v1] = F3_freeze(v4 * (&v12)[v1] + a2, 0x1, a2);
}
for (v1 = 0; v1 <= 760; v1 = __addvsi3(v1, 0x1, *((&v10 + v19)))) {
v19 = __addvsi3(v1, 0x1, a2);
a2 = *((&v10 + v19));
(&v10)[v1] = *((&v10 + v19));
}
v11 = 0;
}
v4 = v7;
for (v1 = 0; v1 <= 760; v1 = __addvsi3(v1, 0x1, v4 * *((&v12 + v20)))) {
v20 = __subvsi3(0x2f8, v1, a2);
a2 = v4 * *((&v12 + v20));
v0[v1] = v4 * *((&v12 + v20));
}
return int16_nonzero_mask(v3);
}
|
void get_key_purpose_set(int type, void *crt)
{
int ret, i;
if (batch) {
if (!cfg.key_purpose_oids)
return;
for (i = 0; cfg.key_purpose_oids[i] !=
((void *)0)
; i++) {
if (type == 1)
ret =
gnutls_x509_crt_set_key_purpose_oid
(crt, cfg.key_purpose_oids[i], 0);
else
ret =
gnutls_x509_crq_set_key_purpose_oid
(crt, cfg.key_purpose_oids[i], 0);
if (ret < 0) {
fprintf(
stderr
,
"set_key_purpose_oid (%s): %s\n",
cfg.key_purpose_oids[i],
gnutls_strerror(ret));
exit(1);
}
}
}
}
| long long get_key_purpose_set(unsigned long a0, unsigned long long a1) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
v3 = *(got.batch);
if (*(got.batch)) {
v3 = *((got.cfg + 608));
if (*((got.cfg + 608))) {
v1 = 0;
while (true) {
v3 = *((*((got.cfg + 608)) + v1 * 8));
if (!*((*((got.cfg + 608)) + (v1 << 3))))
break;
if (a0 == 1)
v0 = gnutls_x509_crt_set_key_purpose_oid(a1, *((*((got.cfg + 608)) + v1 * 8)), 0x0, *((*((got.cfg + 608)) + v1 * 8)));
else
v0 = gnutls_x509_crq_set_key_purpose_oid(a1, *((*((got.cfg + 608)) + v1 * 8)), 0x0, *((*((got.cfg + 608)) + v1 * 8)));
if (v0 < 0) {
fprintf(*(got.stderr), "set_key_purpose_oid (%s): %s\n", *((*((got.cfg + 608)) + v1 * 8)), gnutls_strerror(v0));
exit(0x1);
}
v1 += 1;
}
}
}
return v3;
}
|
static
void bsFinishWrite ( EState* s )
{
while (s->bsLive > 0) {
s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24);
s->numZ++;
s->bsBuff <<= 8;
s->bsLive -= 8;
}
}
| void bsFinishWrite(struct_0 *a0) {
unsigned long long v1;
while (true) {
v1 = a0->field_284;
if (a0->field_284 <= 0)
break;
*((a0->field_74 + a0->field_50)) = a0->field_280 >> 24;
a0->field_74 = a0->field_74 + 1;
a0->field_280 = a0->field_280 * 0x100;
a0->field_284 = a0->field_284 - 8;
}
return;
}
|
int
strnunvisx(char *dst, size_t dlen, const char *src, int flag)
{
char c;
char t = '\0', *start = dst;
int state = 0;
;
;
while ((c = *src++) != '\0') {
again:
switch (unvis(&t, c, &state, flag)) {
case
1
:
do { if (dlen-- == 0) {
(*__errno_location ())
=
28
; return -1; } } while ( 0);
*dst++ = t;
break;
case
2
:
do { if (dlen-- == 0) {
(*__errno_location ())
=
28
; return -1; } } while ( 0);
*dst++ = t;
goto again;
case 0:
case
3
:
break;
case
-1
:
(*__errno_location ())
=
22
;
return -1;
default:
;
(*__errno_location ())
=
22
;
return -1;
}
}
if (unvis(&t, c, &state,
0x0800
) ==
1
) {
do { if (dlen-- == 0) {
(*__errno_location ())
=
28
; return -1; } } while ( 0);
*dst++ = t;
}
do { if (dlen-- == 0) {
(*__errno_location ())
=
28
; return -1; } } while ( 0);
*dst = '\0';
return (int)(dst - start);
}
| int strnunvisx(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long a3) {
char *v0;
int tmp_11;
unsigned long long v1;
char *v2;
char v3;
char v4;
unsigned int v5;
char *v6;
unsigned long v9;
char *v10;
char *v11;
char *v12;
v2 = a0;
v1 = a1;
v0 = a2;
v3 = 0;
v6 = v2;
v5 = 0;
while (true) {
LABEL_400aee:
tmp_11 = v0;
v0 += 1;
v4 = *(tmp_11);
if (!v4)
break;
while (true) {
v9 = unvis(&v3, v4, &v5, a3) + 1;
switch (v9) {
case 0:
*(__errno_location()) = 22;
*(&v9) = -1;
break;
case 1: case 4:
goto LABEL_400aee;
case 2:
v9 = v1;
v1 -= 1;
if (!v9) {
*(__errno_location()) = 28;
*(&v9) = -1;
break;
} else {
v11 = v2;
v2 += 1;
*(v11) = v3;
goto LABEL_400aee;
}
case 3:
v9 = v1;
v1 -= 1;
if (v9) {
v10 = v2;
v2 += 1;
*(v10) = v3;
continue;
} else {
*(__errno_location()) = 28;
*(&v9) = -1;
break;
}
default:
*(__errno_location()) = 22;
*(&v9) = -1;
break;
}
}
}
if (unvis(&v3, v4, &v5, 0x800) == 1) {
v9 = v1;
v1 -= 1;
if (v9) {
v12 = v2;
v2 += 1;
*(v12) = v3;
} else {
*(__errno_location()) = 28;
*(&v9) = -1;
goto LABEL_400b8f;
}
}
v9 = v1;
v1 -= 1;
if (v9) {
*(v2) = 0;
*(&v9) = v2 - v6;
} else {
*(__errno_location()) = 28;
*(&v9) = -1;
}
LABEL_400b8f:
return v9;
}
|
static int xfrm_policy_dir_parse(__u8 *dir, int *argcp, char ***argvp)
{
int argc = *argcp;
char **argv = *argvp;
if (strcmp(*argv, "in") == 0)
*dir = XFRM_POLICY_IN;
else if (strcmp(*argv, "out") == 0)
*dir = XFRM_POLICY_OUT;
else if (strcmp(*argv, "fwd") == 0)
*dir = XFRM_POLICY_FWD;
else
invarg("DIR value is invalid", *argv);
*argcp = argc;
*argvp = argv;
return 0;
}
| long xfrm_policy_dir_parse(_BYTE *a1, int *a2, const char ***a3)
{
int v5;
const char **v6;
v5 = *a2;
v6 = *a3;
if ( !strcmp(**a3, "in") )
{
*a1 = 0;
}
else if ( !strcmp(*v6, "out") )
{
*a1 = 1;
}
else if ( !strcmp(*v6, "fwd") )
{
*a1 = 2;
}
else
{
invarg("DIR value is invalid", *v6);
}
*a2 = v5;
*a3 = v6;
return 0LL;
}
|
rsRetVal modExitIminternal(void)
{
rsRetVal iRet = RS_RET_OK;
iRet = llDestroy(&llMsgs);
return iRet;
}
| undefined4 modExitIminternal(void)
{
undefined4 uVar1;
uVar1 = llDestroy(llMsgs);
return uVar1;
}
|
u_int64_t
get_u64(const void *vp)
{
const u_char *p = (const u_char *)vp;
u_int64_t v;
v = (u_int64_t)p[0] << 56;
v |= (u_int64_t)p[1] << 48;
v |= (u_int64_t)p[2] << 40;
v |= (u_int64_t)p[3] << 32;
v |= (u_int64_t)p[4] << 24;
v |= (u_int64_t)p[5] << 16;
v |= (u_int64_t)p[6] << 8;
v |= (u_int64_t)p[7];
return (v);
}
| ulong get_u64(byte *param_1)
{
return (ulong)*param_1 << 0x38 | (ulong)param_1[1] << 0x30 | (ulong)param_1[2] << 0x28 |
(ulong)param_1[3] << 0x20 | (ulong)param_1[4] << 0x18 | (ulong)param_1[5] << 0x10 |
(ulong)param_1[6] << 8 | (ulong)param_1[7];
}
|
static int
ipstats_stat_desc_show_hw_stats_info(struct ipstats_stat_show_attrs *attrs,
const struct ipstats_stat_desc *desc)
{
return ipstats_show_hw_s_info(attrs,
IFLA_STATS_LINK_OFFLOAD_XSTATS,
IFLA_OFFLOAD_XSTATS_HW_S_INFO);
}
| long long ipstats_stat_desc_show_hw_stats_info(void* a0, unsigned long a1, unsigned long a2, unsigned int a3, unsigned long long a4, unsigned long long a5) {
unsigned long v0;
v0 = a1;
return ipstats_show_hw_s_info(a0, 0x4, 0x2, a3, a4, a5);
}
|
int gzgetc(file)
gzFile file;
{
unsigned char buf[1];
gz_statep state;
if (file ==
((void *)0)
)
return -1;
state = (gz_statep)file;
if (state->mode != 7247 ||
(state->err != 0 && state->err != (-5)))
return -1;
if (state->x.have) {
state->x.have--;
state->x.pos++;
return *(state->x.next)++;
}
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
}
| void gzgetc(struct_0 *a0) {
struct_2 *v0;
int tmp_49;
char v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
if (!a0) {
v3 = 4294967295;
} else {
v0 = &a0->field_0;
if (a0->field_18 != 7247) {
LABEL_400c6b:
v4 = 4294967295;
} else if (!a0->field_74) {
LABEL_400c72:
if (a0->field_0) {
a0->field_0 = a0->field_0 - 1;
a0->field_10 = a0->field_10 + 1;
tmp_49 = a0->field_8;
a0->field_8 = a0->field_8 + 1;
v5 = *(tmp_49);
} else if (!gz_read(a0, &v1, 0x1)) {
v6 = 4294967295;
} else {
v7 = v1;
}
} else {
if (a0->field_74 == -5)
goto LABEL_400c72;
goto LABEL_400c6b;
}
}
return;
}
|
static int xfrm_spd_setdefault(int argc, char **argv)
{
struct rtnl_handle rth;
struct {
struct nlmsghdr n;
struct xfrm_userpolicy_default up;
} req = {
.n.nlmsg_len = ((sizeof(struct xfrm_userpolicy_default)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))),
.n.nlmsg_flags = 0x01,
.n.nlmsg_type = XFRM_MSG_SETDEFAULT,
};
while (argc > 0) {
if (strcmp(*argv, "in") == 0) {
if (req.up.in)
duparg("in", *argv);
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (xfrm_str_to_policy(*argv, &req.up.in) < 0)
invarg("in policy value is invalid", *argv);
} else if (strcmp(*argv, "fwd") == 0) {
if (req.up.fwd)
duparg("fwd", *argv);
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (xfrm_str_to_policy(*argv, &req.up.fwd) < 0)
invarg("fwd policy value is invalid", *argv);
} else if (strcmp(*argv, "out") == 0) {
if (req.up.out)
duparg("out", *argv);
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (xfrm_str_to_policy(*argv, &req.up.out) < 0)
invarg("out policy value is invalid", *argv);
} else {
invarg("unknown direction", *argv);
}
argc--; argv++;
}
if (rtnl_open_byproto(&rth, 0, 6) < 0)
exit(1);
if (rtnl_talk(&rth, &req.n,
((void *)0)
) < 0)
exit(2);
rtnl_close(&rth);
return 0;
}
| undefined8 xfrm_spd_setdefault(int param_1,char **param_2)
{
int iVar1;
long in_FS_OFFSET;
char **local_78;
int local_6c;
undefined8 local_68;
undefined8 local_60;
undefined4 local_58;
undefined local_48 [56];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_60 = 0;
local_58 = 0;
local_68 = 0x1002700000013;
local_78 = param_2;
local_6c = param_1;
do {
if (local_6c < 1) {
iVar1 = rtnl_open_byproto(local_48,0,6);
if (iVar1 < 0) {
exit(1);
}
iVar1 = rtnl_talk(local_48,&local_68,0);
if (iVar1 < 0) {
exit(2);
}
rtnl_close(local_48);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return 0;
}
iVar1 = strcmp(*local_78,"in");
if (iVar1 == 0) {
if ((char)local_58 != '\0') {
duparg(&DAT_00104875,*local_78);
}
local_78 = local_78 + 1;
local_6c = local_6c + -1;
if (local_6c < 1) {
incomplete_command();
}
iVar1 = xfrm_str_to_policy(*local_78,&local_58);
if (iVar1 < 0) {
invarg("in policy value is invalid",*local_78);
goto LAB_00103878;
}
}
else {
LAB_00103878:
iVar1 = strcmp(*local_78,"fwd");
if (iVar1 == 0) {
if (local_58._1_1_ != '\0') {
duparg(&DAT_0010487c,*local_78);
}
local_78 = local_78 + 1;
local_6c = local_6c + -1;
if (local_6c < 1) {
incomplete_command();
}
iVar1 = xfrm_str_to_policy(*local_78,(long)&local_58 + 1);
if (-1 < iVar1) goto LAB_00103992;
invarg("fwd policy value is invalid",*local_78);
}
iVar1 = strcmp(*local_78,"out");
if (iVar1 == 0) {
if (local_58._2_1_ != '\0') {
duparg(&DAT_00104878,*local_78);
}
local_78 = local_78 + 1;
local_6c = local_6c + -1;
if (local_6c < 1) {
incomplete_command();
}
iVar1 = xfrm_str_to_policy(*local_78,(long)&local_58 + 2);
if (-1 < iVar1) goto LAB_00103992;
invarg("out policy value is invalid",*local_78);
}
invarg("unknown direction",*local_78);
}
LAB_00103992:
local_6c = local_6c + -1;
local_78 = local_78 + 1;
} while( true );
}
|
size_t ext2fs_get_refcount_size(ext2_refcount_t refcount)
{
if (!refcount)
return 0;
return refcount->size;
}
| long long ext2fs_get_refcount_size(struct_0 *a0) {
void* v1;
if (!a0)
v1 = 0;
else
v1 = a0->field_8;
return v1;
}
|
static void
process_write(u_int32_t id)
{
u_int64_t off;
size_t len;
int r, handle, fd, ret, status;
u_char *data;
if ((r = get_handle(iqueue, &handle)) != 0 ||
(r = sshbuf_get_u64(iqueue, &off)) != 0 ||
(r = sshbuf_get_string(iqueue, &data, &len)) != 0)
sshfatal("sftp-server.c", __func__, 864, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse");
sshlog("sftp-server.c", __func__, 866, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "request %u: write \"%s\" (handle %d) off %llu len %zu", id, handle_to_name(handle), handle, (unsigned long long)off, len)
;
fd = handle_to_fd(handle);
if (fd < 0)
status = 4;
else {
if (!(handle_to_flags(handle) &
02000
) &&
lseek(fd, off,
0
) == -1) {
status = errno_to_portable(
(*__errno_location ())
);
sshlog("sftp-server.c", __func__, 876, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "seek \"%.100s\": %s", handle_to_name(handle), strerror(
(*__errno_location ())
))
;
} else {
ret = write(fd, data, len);
if (ret == -1) {
status = errno_to_portable(
(*__errno_location ())
);
sshlog("sftp-server.c", __func__, 883, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "write \"%.100s\": %s", handle_to_name(handle), strerror(
(*__errno_location ())
))
;
} else if ((size_t)ret == len) {
status = 0;
handle_update_write(handle, ret);
} else {
sshlog("sftp-server.c", __func__, 889, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "nothing at all written");
status = 4;
}
}
}
send_status(id, status);
free(data);
}
| long long process_write(unsigned long a0) {
unsigned long long v0;
unsigned int v1;
char v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
char v7;
char v8;
char v9;
unsigned long long v10;
unsigned long v11;
unsigned long long v12;
unsigned long v13;
unsigned long long v14;
unsigned long long v15;
char v16;
unsigned long long v19;
unsigned long long v20;
unsigned int v23;
unsigned long long v24;
unsigned long long v25;
v1 = a0;
v3 = get_handle(0xe87d894820ec8348, &v2);
if (v3) {
LABEL_4026a3:
v0 = "parse";
sshfatal("sftp-server.c", "process_write", 0x360, 0x1, 0x1, ssh_err(v3));
} else {
v3 = sshbuf_get_u64(0xe87d894820ec8348, &v7, &v7);
if (v3 || (v3 = sshbuf_get_string(0xe87d894820ec8348, &v9, &v8, &v9), v3))
goto LABEL_4026a3;
}
v19 = *(&v7);
v20 = *(&v2);
v15 = *(&v8);
v14 = v19;
v13 = v20;
v12 = handle_to_name(*(&v2));
v11 = v1;
v10 = "request %u: write \"%s\" (handle %d) off %llu len %zu";
sshlog("sftp-server.c", "process_write", 0x362, 0x0, 0x5, 0x0, *(&v16));
v5 = handle_to_fd(*(&v2));
if (v5 < 0) {
v4 = 4;
} else {
v23 = handle_to_flags(*(&v2)) & 0x400;
if (v23 || lseek(v5, *(&v7), 0x0) != -1) {
v6 = write(v5, *(&v9), *(&v8));
if (v6 == -1) {
v4 = errno_to_portable(*(__errno_location()));
v25 = *(&v2);
v14 = strerror(*(__errno_location()));
v13 = handle_to_name(v25);
v12 = "write \"%.100s\": %s";
sshlog("sftp-server.c", "process_write", 0x373, 0x1, 0x2, 0x0, *(&v16));
} else if (v6 == *(&v8)) {
v4 = 0;
handle_update_write(*(&v2), v6);
} else {
v14 = "nothing at all written";
sshlog("sftp-server.c", "process_write", 0x379, 0x1, 0x6, 0x0, *(&v16));
v4 = 4;
}
} else {
v4 = errno_to_portable(*(__errno_location()));
v24 = *(&v2);
v14 = strerror(*(__errno_location()));
v13 = handle_to_name(v24);
v12 = "seek \"%.100s\": %s";
sshlog("sftp-server.c", "process_write", 0x36c, 0x1, 0x2, 0x0, *(&v16));
}
}
send_status(v1, v4);
free(*(&v9));
return 0;
}
|
static void
send_read_request(struct sftp_conn *conn, u_int id, u_int64_t offset,
u_int len, const u_char *handle, u_int handle_len)
{
struct sshbuf *msg;
int r;
if ((msg = sshbuf_new()) ==
((void *)0)
)
sshfatal("sftp-client.c", __func__, 1519, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
if ((r = sshbuf_put_u8(msg, 5)) != 0 ||
(r = sshbuf_put_u32(msg, id)) != 0 ||
(r = sshbuf_put_string(msg, handle, handle_len)) != 0 ||
(r = sshbuf_put_u64(msg, offset)) != 0 ||
(r = sshbuf_put_u32(msg, len)) != 0)
sshfatal("sftp-client.c", __func__, 1525, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose");
send_msg(conn, msg);
sshbuf_free(msg);
}
| void send_read_request(undefined8 param_1,undefined4 param_2,undefined8 param_3,undefined4 param_4,
undefined8 param_5,undefined4 param_6)
{
undefined8 uVar1;
char **ppcVar2;
undefined *puVar3;
char *apcStack112 [5];
undefined auStack72 [12];
undefined4 local_3c;
undefined8 local_38;
undefined8 local_30;
undefined4 local_28;
undefined4 local_24;
undefined8 local_20;
int local_14;
long local_10;
ppcVar2 = (char **)auStack72;
apcStack112[4] = (char *)0x105949;
local_3c = param_6;
local_38 = param_5;
local_30 = param_3;
local_28 = param_4;
local_24 = param_2;
local_20 = param_1;
local_10 = sshbuf_new();
if (local_10 == 0) {
ppcVar2 = apcStack112 + 3;
apcStack112[3] = "sshbuf_new failed";
sshfatal("sftp-client.c","send_read_request",0x5ef,1,1,0);
}
*(undefined8 *)((long)ppcVar2 + -8) = 0x10599f;
local_14 = sshbuf_put_u8(local_10,5);
if (local_14 == 0) {
*(undefined8 *)((long)ppcVar2 + -8) = 0x1059b9;
local_14 = sshbuf_put_u32(local_10,local_24);
if (local_14 == 0) {
*(undefined8 *)((long)ppcVar2 + -8) = 0x1059d8;
local_14 = sshbuf_put_string(local_10,local_38,local_3c);
if (local_14 == 0) {
*(undefined8 *)((long)ppcVar2 + -8) = 0x1059f4;
local_14 = sshbuf_put_u64(local_10,local_30);
if (local_14 == 0) {
*(undefined8 *)((long)ppcVar2 + -8) = 0x105a0e;
local_14 = sshbuf_put_u32(local_10,local_28);
puVar3 = (undefined *)ppcVar2;
if (local_14 == 0) goto LAB_00105a58;
}
}
}
}
*(undefined8 *)((long)ppcVar2 + -8) = 0x105a21;
uVar1 = ssh_err(local_14);
puVar3 = (undefined *)((long)ppcVar2 + -0x10);
*(char **)((long)ppcVar2 + -0x10) = "compose";
*(undefined8 *)((long)ppcVar2 + -0x18) = 0x105a58;
sshfatal("sftp-client.c","send_read_request",0x5f5,1,1,uVar1);
LAB_00105a58:
*(undefined8 *)(puVar3 + -8) = 0x105a6b;
send_msg(local_20,local_10);
*(undefined8 *)(puVar3 + -8) = 0x105a77;
sshbuf_free(local_10);
return;
}
|
static int
parse_no_flags(const char *cmd, char **argv, int argc)
{
int ch;
BSDoptind = BSDoptreset = 1;
BSDopterr = 0;
while ((ch = BSDgetopt(argc, argv, "")) != -1) {
switch (ch) {
default:
sshlog("sftp.c", __func__, 598, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "%s: Invalid flag -%c", cmd, BSDoptopt);
return -1;
}
}
return BSDoptind;
}
| undefined4 parse_no_flags(undefined8 param_1,undefined8 param_2,undefined4 param_3)
{
int iVar1;
undefined4 uVar2;
undefined8 uVar3;
BSDoptreset = 1;
BSDoptind = 1;
_BSDopterr = 0;
uVar3 = 0x100d96;
iVar1 = BSDgetopt(param_3,param_2,&DAT_001099e1);
uVar2 = BSDoptind;
if (iVar1 != -1) {
sshlog("sftp.c","parse_no_flags",0x256,0,2,0,"%s: Invalid flag -%c",param_1,BSDoptopt,uVar3);
uVar2 = 0xffffffff;
}
return uVar2;
}
|
static
_Bool
periodic_pattern (int type)
{
if (type <= 0)
return
0
;
unsigned char r[3];
unsigned int bits = type & 0xfff;
bits |= bits << 12;
r[0] = (bits >> 4) & 255;
r[1] = (bits >> 8) & 255;
r[2] = bits & 255;
return (r[0] != r[1]) || (r[0] != r[2]);
}
| undefined4 periodic_pattern(uint param_1)
{
uint uVar1;
char cVar2;
undefined4 uVar3;
long in_FS_OFFSET;
if ((int)param_1 < 1) {
uVar3 = 0;
}
else {
param_1 = param_1 & 0xfff;
uVar1 = param_1 | param_1 << 0xc;
cVar2 = (char)(uVar1 >> 4);
if ((cVar2 == (char)(uVar1 >> 8)) && (cVar2 == (char)param_1)) {
uVar3 = 0;
}
else {
uVar3 = 1;
}
}
if (*(long *)(in_FS_OFFSET + 0x28) == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar3;
}
__stack_chk_fail();
}
|
static struct request *
request_enqueue(struct requests *requests, u_int id, size_t len,
uint64_t offset)
{
struct request *req;
req = xcalloc(1, sizeof(*req));
req->id = id;
req->len = len;
req->offset = offset;
do { (req)->tq.tqe_next =
((void *)0)
; (req)->tq.tqe_prev = (requests)->tqh_last; *(requests)->tqh_last = (req); (requests)->tqh_last = &(req)->tq.tqe_next; } while (0);
return req;
}
| int request_enqueue(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long a3) {
struct_2 *v0;
v0 = xcalloc(0x1, 0x28);
v0->field_0 = a1;
v0->field_8 = a2;
v0->field_10 = a3;
v0->field_18 = 0;
v0->field_20 = a0->field_8;
a0->field_8->field_0 = v0;
a0->field_8 = &v0->field_18;
return v0;
}
|
&&
set_rdomain(listen_sock, la->rdomain) == -1) {
close(listen_sock);
continue;
}
| void set_rdomain(void)
{
halt_baddata();
}
|
static inline void
restore_variable (sv)
SAVED_VAR *sv;
{
__builtin_memcpy ((sv->variable), (sv->desired_setting), (sv->size));
}
| void * restore_variable(long a1)
{
return memcpy(*(void **)a1, (const void *)(a1 + 12), *(int *)(a1 + 8));
}
|
static
void fifo_new_level(int level)
{
int oldlevel;
if (level == runlevel) return;
{
oldlevel = runlevel;
runlevel = read_level(level);
if (runlevel == 'U') {
runlevel = oldlevel;
my_re_exec();
} else {
if (oldlevel != 'S' && runlevel == 'S') console_stty();
if (runlevel == '6' || runlevel == '0' ||
runlevel == '1') console_stty();
if (runlevel > '1' && runlevel < '6') redo_utmp_wtmp();
read_inittab();
fail_cancel();
setproctitle("init [%c]", (int)runlevel);
}
}
Write_Runlevel_Log(runlevel);
}
| void fifo_new_level(unsigned int a0, unsigned int a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) {
unsigned int v0;
unsigned long long v2;
unsigned long long v3;
v2 = runlevel;
if (a0 != runlevel) {
v0 = runlevel;
runlevel = read_level(a0, a1, a2, a3, a4, a5);
if (runlevel == 85) {
runlevel = v0;
my_re_exec(a0, a1, a2, a3, a4, a5);
} else {
if (v0 != 83 && runlevel == 83)
console_stty(a0, a1, a2, a3, a4, a5);
if (runlevel != 54 && runlevel != 48 && !(runlevel == 49))
goto LABEL_404e8f;
console_stty(a0, a1, a2, a3, a4, a5);
LABEL_404e8f:
if (runlevel > 49 && runlevel <= 53)
redo_utmp_wtmp();
read_inittab(a0, a1, a2, a3, a4, a5);
fail_cancel();
setproctitle();
}
v3 = Write_Runlevel_Log(runlevel);
}
return;
}
|
static intmax_t
expband ()
{
register intmax_t val1, val2;
val1 = exp5 ();
while (curtok == '&')
{
readtok ();
val2 = exp5 ();
val1 = val1 & val2;
lasttok = 6;
}
return (val1);
}
| int expband(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long long a3) {
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
for (v1 = exp5(a0, a1, a2, a3); curtok == 38; lasttok = 6) {
readtok(a0, a1, a2, a3, v2, v3);
v1 &= exp5(a0, a1, a2, a3);
}
return v1;
}
|
int
num_posix_options ()
{
return ((sizeof (posix_vars) / sizeof (posix_vars[0])) - 1);
}
| long num_posix_options()
{
return 5LL;
}
|
static void
map_read (Hash_table **ptab, char const *file,
uintmax_t (*name_to_id) (char const *), char const *what,
uintmax_t maxval)
{
FILE *fp;
char *buf =
((void *)0)
;
size_t bufsize = 0;
ssize_t n;
struct wordsplit ws;
int wsopt;
unsigned line;
int err = 0;
fp = fopen (file, "r");
if (!fp)
open_fatal (file);
ws.ws_comment = "#";
wsopt = 0x00008000 | 0x00000040 | 0x00000004 | 0x00000800
| (0x00000200|0x00000400);
line = 0;
while ((n = getline (&buf, &bufsize, fp)) > 0)
{
struct mapentry *ent;
uintmax_t orig_id, new_id;
char *name =
((void *)0)
;
char *colon;
++line;
if (wordsplit (buf, &ws, wsopt))
do { if (error_hook) error_hook (); error (0, 0, gettext ("%s:%u: cannot split line: %s"), file, line, wordsplit_strerror (&ws)); fatal_exit (); } while (0)
;
wsopt |= 0x00000008;
if (ws.ws_wordc == 0)
continue;
if (ws.ws_wordc != 2)
{
error (0, 0, gettext ("%s:%u: malformed line"), file, line);
err = 1;
continue;
}
if (ws.ws_wordv[0][0] == '+')
{
if (parse_id (&orig_id, ws.ws_wordv[0]+1, what, maxval, file, line))
{
err = 1;
continue;
}
}
else if (name_to_id)
{
orig_id = name_to_id (ws.ws_wordv[0]);
if (orig_id ==
(18446744073709551615UL)
)
{
error (0, 0, gettext ("%s:%u: can't obtain %s of %s"),
file, line, what, ws.ws_wordv[0]);
err = 1;
continue;
}
}
colon = strchr (ws.ws_wordv[1], ':');
if (colon)
{
if (colon > ws.ws_wordv[1])
name = ws.ws_wordv[1];
*colon++ = 0;
if (parse_id (&new_id, colon, what, maxval, file, line))
{
err = 1;
continue;
}
}
else if (ws.ws_wordv[1][0] == '+')
{
if (parse_id (&new_id, ws.ws_wordv[1], what, maxval, file, line))
{
err = 1;
continue;
}
}
else
{
name = ws.ws_wordv[1];
new_id = name_to_id (ws.ws_wordv[1]);
if (new_id ==
(18446744073709551615UL)
)
{
error (0, 0, gettext ("%s:%u: can't obtain %s of %s"),
file, line, what, ws.ws_wordv[1]);
err = 1;
continue;
}
}
ent = xmalloc (sizeof (*ent));
ent->orig_id = orig_id;
ent->new_id = new_id;
ent->new_name = name ? xstrdup (name) :
((void *)0)
;
if (!((*ptab
|| (*ptab = hash_initialize (0, 0, map_hash, map_compare, 0)))
&& hash_insert (*ptab, ent)))
xalloc_die ();
}
if (wsopt & 0x00000008)
wordsplit_free (&ws);
fclose (fp);
if (err)
do { if (error_hook) error_hook (); error (0, 0, gettext ("errors reading map file")); fatal_exit (); } while (0);
}
| void map_read(unsigned long long *a0, unsigned long a1, void* a2, unsigned long a3, unsigned long a4) {
unsigned long v0;
int tmp_14;
unsigned int v1;
unsigned long v2;
void* v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
void* v7;
void* v8;
unsigned long v9;
unsigned long v10;
void* v11;
void* v12;
unsigned long v13;
char *v14;
unsigned long long v15[3];
char v16;
char v17;
unsigned long long v18;
char v19;
unsigned long long v21;
unsigned long long *v27;
unsigned long long v28;
v3 = a2;
v2 = a3;
*(&v1) = a4;
v7 = 0;
v8 = 0;
v6 = 0;
v12 = fopen(a1, "r");
if (!v12)
open_fatal(a1);
v18 = "#";
v4 = 36420;
v5 = 0;
do {
while (true) {
while (true) {
do {
v13 = getline(&v7, &v8, v12);
if (v13 <= 0) {
if ((v4 & 8))
wordsplit_free(&v16);
fclose(v12);
if (v6) {
if (error_hook)
*(5242944)();
a1 = 0;
error(0x0, 0x0, gettext("errors reading map file"));
fatal_exit(0x0, a1, a2, a3, a4, v21);
}
v28 = *(&v19) ^ v27[5];
return;
}
v11 = 0;
v5 += 1;
if (wordsplit(v7, &v16, v4, &v16)) {
if (error_hook)
*(5242944)();
v21 = wordsplit_strerror(&v16);
a4 = v5;
a3 = a1;
a1 = 0;
error(0x0, 0x0, gettext("%s:%u: cannot split line: %s"));
fatal_exit(0x0, reg_64, a2, a1, v5, v21);
}
v4 |= 8;
} while (!*(&v16));
if (*(&v16) == 2)
break;
a4 = v5;
a3 = a1;
error(0x0, 0x0, gettext("%s:%u: malformed line"));
v6 = 1;
}
if (*(*(*(&v17))) != 43) {
if (v3) {
v9 = (stack_base)[384](*(*(&v17)));
if (v9 == -1) {
v0 = *(*(&v17));
v21 = v2;
a4 = v5;
a3 = a1;
error(0x0, 0x0, gettext("%s:%u: can't obtain %s of %s"));
v6 = 1;
continue;
}
}
} else {
if (parse_id(&v9, *(*(&v17)) + 1, v2, *(&v1), a1, v5)) {
v6 = 1;
continue;
}
}
v14 = strchr(*((*(&v17) + 8)), 0x3a);
if (v14) {
if (v14 > *((*(&v17) + 8)))
v11 = *((*(&v17) + 8));
tmp_14 = v14;
v14 += 1;
*(tmp_14) = 0;
if (parse_id(&v10, v14, v2, *(&v1), a1, v5)) {
v6 = 1;
continue;
}
goto LABEL_400626;
}
if (*(*((*(&v17) + 8))) == 43) {
if (!parse_id(&v10, *((*(&v17) + 8)), v2, *(&v1), a1, v5))
goto LABEL_400626;
v6 = 1;
} else {
v11 = *((*(&v17) + 8));
v10 = (stack_base)[384](*((*(&v17) + 8)));
if (v10 == -1) {
v0 = *((*(&v17) + 8));
v21 = v2;
a4 = v5;
a3 = a1;
error(0x0, 0x0, gettext("%s:%u: can't obtain %s of %s"));
v6 = 1;
continue;
}
LABEL_400626:
v15[0] = xmalloc(0x18);
v15[0] = v9;
v15[1] = v10;
if (!v11) {
a2 = 0;
break;
} else {
a2 = xstrdup(v11);
break;
}
}
}
v15[2] = a2;
if (!(!*(a0)))
continue;
*(a0) = hash_initialize(0x0, 0x0, map_hash, map_compare, 0x0);
if (!*(a0))
break;
continue;
} while (hash_insert(*(a0), v15, v15));
xalloc_die();
}
|
static void
checked_fflush (struct format_val *dest)
{
if (0 !=
rpl_fflush
(dest->stream))
{
nonfatal_nontarget_file_error (
(*__errno_location ())
, dest->filename);
}
}
| void checked_fflush(unsigned long long a0[3]) {
unsigned long long v2;
if (rpl_fflush(a0[1]))
v2 = nonfatal_nontarget_file_error(*(__errno_location()), a0[2]);
return;
}
|
static void
wait_until_can_do_something(struct ssh *ssh,
int connection_in, int connection_out, struct pollfd **pfdp,
u_int *npfd_allocp, u_int *npfd_activep, u_int64_t max_time_ms,
sigset_t *sigsetp, int *conn_in_readyp, int *conn_out_readyp)
{
struct timespec ts, *tsp;
int ret;
time_t minwait_secs = 0;
int client_alive_scheduled = 0;
u_int p;
static time_t last_client_time;
*conn_in_readyp = *conn_out_readyp = 0;
channel_prepare_poll(ssh, pfdp, npfd_allocp, npfd_activep,
2, &minwait_secs);
if (*npfd_activep < 2)
sshfatal("serverloop.c", __func__, 188, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "bad npfd %u", *npfd_activep);
if (minwait_secs != 0)
max_time_ms = (((max_time_ms) < ((u_int)minwait_secs * 1000)) ? (max_time_ms) : ((u_int)minwait_secs * 1000));
if (options.client_alive_interval) {
uint64_t keepalive_ms =
(uint64_t)options.client_alive_interval * 1000;
if (max_time_ms == 0 || max_time_ms > keepalive_ms) {
max_time_ms = keepalive_ms;
client_alive_scheduled = 1;
}
if (last_client_time == 0)
last_client_time = monotime();
}
(*pfdp)[0].fd = connection_in;
(*pfdp)[0].events =
0x001
;
(*pfdp)[1].fd = connection_out;
(*pfdp)[1].events = ssh_packet_have_data_to_write(ssh) ?
0x004
: 0;
if (child_terminated && ssh_packet_not_very_much_data_to_write(ssh))
if (max_time_ms == 0 || client_alive_scheduled)
max_time_ms = 100;
if (max_time_ms == 0)
tsp =
((void *)0)
;
else {
ts.tv_sec = max_time_ms / 1000;
ts.tv_nsec = 1000000 * (max_time_ms % 1000);
tsp = &ts;
}
ret = ppoll(*pfdp, *npfd_activep, tsp, sigsetp);
if (ret == -1) {
for (p = 0; p < *npfd_activep; p++)
(*pfdp)[p].revents = 0;
if (
(*__errno_location ())
!=
4
)
sshfatal("serverloop.c", __func__, 247, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "ppoll: %.100s", strerror(
(*__errno_location ())
));
return;
}
*conn_in_readyp = (*pfdp)[0].revents != 0;
*conn_out_readyp = (*pfdp)[1].revents != 0;
if (client_alive_scheduled) {
time_t now = monotime();
if (ret == 0 || (last_client_time != 0 && last_client_time +
options.client_alive_interval <= now)) {
client_alive_check(ssh);
last_client_time = now;
} else if (*conn_in_readyp)
last_client_time = now;
}
}
| void wait_until_can_do_something
(undefined8 param_1,int param_2,int param_3,pollfd **param_4,undefined8 param_5,
uint *param_6,ulong param_7,__sigset_t *param_8,uint *param_9,uint *param_10)
{
uint uVar1;
pollfd *__fds;
int iVar2;
ulong uVar3;
int *piVar4;
char *pcVar5;
long lVar6;
short sVar7;
uint **ppuVar8;
long in_FS_OFFSET;
char *apcStack192 [4];
ulong uStack160;
uint *local_98;
uint *local_90;
__sigset_t *local_88;
uint *local_80;
undefined8 local_78;
pollfd **local_70;
int local_68;
int local_64;
undefined8 local_60;
int local_54;
uint local_50;
int local_4c;
long local_48;
timespec *local_40;
ulong local_38;
long local_30;
timespec local_28;
long local_10;
ppuVar8 = &local_98;
local_88 = param_8;
local_90 = param_9;
local_98 = param_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_48 = 0;
local_54 = 0;
*param_10 = 0;
*param_9 = *param_10;
uStack160 = 0x100331;
local_80 = param_6;
local_78 = param_5;
local_70 = param_4;
local_68 = param_3;
local_64 = param_2;
local_60 = param_1;
channel_prepare_poll(param_1,param_4,param_5,param_6,2,&local_48);
if (*local_80 < 2) {
uStack160 = (ulong)*local_80;
ppuVar8 = (uint **)(apcStack192 + 3);
apcStack192[3] = "bad npfd %u";
sshfatal("serverloop.c","wait_until_can_do_something",0xbc,1,1,0);
}
uVar3 = param_7;
if ((local_48 != 0) && (uVar3 = (ulong)(uint)((int)local_48 * 1000), param_7 <= uVar3)) {
uVar3 = param_7;
}
param_7 = uVar3;
if (_DAT_00105e04 != 0) {
local_38 = (long)_DAT_00105e04 * 1000;
if ((param_7 == 0) || (local_38 < param_7)) {
local_54 = 1;
param_7 = local_38;
}
if (last_client_time_20432 == 0) {
*(undefined8 *)((long)ppuVar8 + -8) = 0x1003e9;
last_client_time_20432 = monotime();
}
}
(*local_70)->fd = local_64;
(*local_70)->events = 1;
(*local_70)[1].fd = local_68;
*(undefined8 *)((long)ppuVar8 + -8) = 0x100425;
iVar2 = ssh_packet_have_data_to_write(local_60);
if (iVar2 == 0) {
sVar7 = 0;
}
else {
sVar7 = 4;
}
(*local_70)[1].events = sVar7;
if (child_terminated != 0) {
*(undefined8 *)((long)ppuVar8 + -8) = 0x10045a;
iVar2 = ssh_packet_not_very_much_data_to_write(local_60);
if ((iVar2 != 0) && ((param_7 == 0 || (local_54 != 0)))) {
param_7 = 100;
}
}
if (param_7 == 0) {
local_40 = (timespec *)0x0;
}
else {
local_28.tv_sec = (param_7 >> 3) / 0x7d;
local_28.tv_nsec = (param_7 + ((param_7 >> 3) / 0x7d) * -1000) * 1000000;
local_40 = &local_28;
}
uVar1 = *local_80;
__fds = *local_70;
*(undefined8 *)((long)ppuVar8 + -8) = 0x100502;
local_4c = ppoll(__fds,(ulong)uVar1,local_40,local_88);
if (local_4c == -1) {
for (local_50 = 0; local_50 < *local_80; local_50 = local_50 + 1) {
(*local_70)[local_50].revents = 0;
}
*(undefined8 *)((long)ppuVar8 + -8) = 0x100543;
piVar4 = __errno_location();
if (*piVar4 == 4) goto LAB_00100646;
*(undefined8 *)((long)ppuVar8 + -8) = 0x100553;
piVar4 = __errno_location();
iVar2 = *piVar4;
*(undefined8 *)((long)ppuVar8 + -8) = 0x10055c;
pcVar5 = strerror(iVar2);
*(char **)((long)ppuVar8 + -8) = pcVar5;
*(char **)((long)ppuVar8 + -0x10) = "ppoll: %.100s";
*(undefined8 *)((long)ppuVar8 + -0x18) = 0x100593;
sshfatal("serverloop.c","wait_until_can_do_something",0xf7,1,1,0);
ppuVar8 = (uint **)((long)ppuVar8 + -0x10);
}
*local_90 = (uint)((*local_70)->revents != 0);
*local_98 = (uint)((*local_70)[1].revents != 0);
if (local_54 == 0) goto LAB_00100646;
*(undefined8 *)((long)ppuVar8 + -8) = 0x1005dc;
local_30 = monotime();
if (local_4c == 0) {
LAB_00100612:
*(undefined8 *)((long)ppuVar8 + -8) = 0x10061e;
client_alive_check(local_60);
last_client_time_20432 = local_30;
}
else {
if (last_client_time_20432 != 0) {
*(undefined8 *)((long)ppuVar8 + -8) = 0x10060c;
lVar6 = __addvdi3((long)_DAT_00105e04,last_client_time_20432);
if (lVar6 <= local_30) goto LAB_00100612;
}
if (*local_90 != 0) {
last_client_time_20432 = local_30;
}
}
LAB_00100646:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
*(undefined8 *)((long)ppuVar8 + -8) = 0x10065a;
__stack_chk_fail();
}
|
ARRAY *
array_create (width)
int width;
{
ARRAY *array;
array = (ARRAY *)xmalloc (sizeof (ARRAY));
array->size = 0;
array->sindex = 0;
array->width = width;
array->growth_rate = 20;
array->array = (char **)
((void *)0)
;
return (array);
}
| undefined4 * array_create(undefined4 param_1)
{
undefined4 *puVar1;
puVar1 = (undefined4 *)xmalloc(0x18);
*puVar1 = 0;
puVar1[1] = 0;
puVar1[2] = param_1;
puVar1[3] = 0x14;
*(undefined8 *)(puVar1 + 4) = 0;
return puVar1;
}
|
int
zmapfd (fd, ostr, fn)
int fd;
char **ostr;
char *fn;
{
ssize_t nr;
int rval;
char lbuf[4096];
char *result;
size_t rsize, rind;
rval = 0;
result = (char *)sh_xmalloc((rsize = 4096), "zmapfd.c", 60);
rind = 0;
while (1)
{
nr = zread (fd, lbuf, sizeof (lbuf));
if (nr == 0)
{
rval = rind;
break;
}
else if (nr < 0)
{
sh_xfree((result), "zmapfd.c", 73);
if (ostr)
*ostr = (char *)
((void *)0)
;
return -1;
}
do { if ((rind) + (nr) >= rsize) { while ((rind) + (nr) >= rsize) rsize += (4096); result = sh_xrealloc((result), (rsize), "zmapfd.c", 79); } } while (0);
memcpy (result+rind, lbuf, nr);
rind += nr;
}
do { if ((rind) + (1) >= rsize) { while ((rind) + (1) >= rsize) rsize += (128); result = sh_xrealloc((result), (rsize), "zmapfd.c", 84); } } while (0);
result[rind] = '\0';
if (ostr)
*ostr = result;
else
sh_xfree((result), "zmapfd.c", 90);
return rval;
}
| undefined4 zmapfd(undefined4 param_1,long *param_2)
{
undefined4 uVar1;
size_t __n;
long in_FS_OFFSET;
long local_1038;
ulong local_1030;
long local_1028;
undefined local_1018 [4104];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_1030 = 0x1000;
local_1038 = sh_xmalloc(0x1000,"zmapfd.c",0x3c);
local_1028 = 0;
do {
__n = zread(param_1,local_1018,0x1000);
if (__n == 0) {
uVar1 = (undefined4)local_1028;
if (local_1030 <= local_1028 + 1U) {
for (; local_1030 <= local_1028 + 1U; local_1030 = local_1030 + 0x80) {
}
local_1038 = sh_xrealloc(local_1038,local_1030,"zmapfd.c",0x54);
}
*(undefined *)(local_1028 + local_1038) = 0;
if (param_2 == (long *)0x0) {
sh_xfree(local_1038,"zmapfd.c",0x5a);
}
else {
*param_2 = local_1038;
}
LAB_0010025a:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar1;
}
__stack_chk_fail();
}
if ((long)__n < 0) {
sh_xfree(local_1038,"zmapfd.c",0x49);
if (param_2 != (long *)0x0) {
*param_2 = 0;
}
uVar1 = 0xffffffff;
goto LAB_0010025a;
}
if (local_1030 <= local_1028 + __n) {
for (; local_1030 <= local_1028 + __n; local_1030 = local_1030 + 0x1000) {
}
local_1038 = sh_xrealloc(local_1038,local_1030,"zmapfd.c",0x4f);
}
memcpy((void *)(local_1038 + local_1028),local_1018,__n);
local_1028 = local_1028 + __n;
} while( true );
}
|
static void
add_exclude_array (char const * const * fv, int opts)
{
int i;
for (i = 0; fv[i]; i++)
add_exclude (excluded, fv[i], opts);
}
| long long add_exclude_array(unsigned long long *a0, unsigned long a1) {
unsigned int v0;
for (v0 = 0; a0[v0]; v0 += 1) {
add_exclude(excluded, a0[v0], a1, a0[v0]);
}
return a0[v0];
}
|
void
free_hostkeys(struct hostkeys *hostkeys)
{
u_int i;
for (i = 0; i < hostkeys->num_entries; i++) {
free(hostkeys->entries[i].host);
free(hostkeys->entries[i].file);
sshkey_free(hostkeys->entries[i].key);
explicit_bzero(hostkeys->entries + i, sizeof(*hostkeys->entries));
}
free(hostkeys->entries);
freezero(hostkeys, sizeof(*hostkeys));
}
| long long free_hostkeys(struct_1 *a0) {
unsigned int v0;
for (v0 = 0; v0 < a0->field_8; v0 += 1) {
free(*((v0 * 40 + a0->field_0)));
free(*((v0 * 40 + a0->field_0 + 8)));
sshkey_free(*((v0 * 40 + a0->field_0 + 24)));
explicit_bzero(v0 * 40 + a0->field_0, 0x28);
}
free(a0->field_0);
return freezero(a0, 0x10);
}
|
rsRetVal
multiSubmitMsg(multi_submit_t *pMultiSub)
{
return multiSubmitMsg2(pMultiSub);
}
| void multiSubmitMsg(undefined8 param_1)
{
multiSubmitMsg2(param_1);
return;
}
|
static int ip_addr_list(struct nlmsg_chain *ainfo)
{
if (rtnl_addrdump_req(&rth, filter.family, ipaddr_dump_filter) < 0) {
perror("Cannot send dump request");
return 1;
}
if (rtnl_dump_filter_nc(&rth, store_nlmsg, ainfo, 0) < 0) {
fprintf(
stderr
, "Dump terminated\n");
return 1;
}
return 0;
}
| int ip_addr_list(unsigned long long a0) {
unsigned int v1;
v1 = rtnl_addrdump_req(0x5001d0, g_408504, ipaddr_dump_filter);
if (v1 < 0) {
perror("Cannot send dump request");
v1 = 1;
} else {
v1 = rtnl_dump_filter_nc(0x5001d0, store_nlmsg, a0, 0x0);
if (v1 < 0) {
fprintf(stderr, "Dump terminated\n");
v1 = 1;
} else {
v1 = 0;
}
}
return v1;
}
|
static
_Bool
record_exec_dir (struct exec_val *execp)
{
if (!execp->state.todo)
{
((void) sizeof ((
!execp->state.todo
) ? 1 : 0), __extension__ ({ if (
!execp->state.todo
) ; else __assert_fail (
"!execp->state.todo"
, "exec.c", 71, __extension__ __PRETTY_FUNCTION__); }))
;
if (strchr (state.rel_pathname, '/'))
{
char *dir = mdir_name (state.rel_pathname);
_Bool
result = initialize_wd_for_exec (execp, state.cwd_dir_fd, dir);
free (dir);
return result;
}
else
{
return initialize_wd_for_exec (execp, state.cwd_dir_fd, ".");
}
}
return
1
;
}
| long record_exec_dir(long a1)
{
unsigned char v2;
void *ptr;
if ( *(_DWORD *)(a1 + 152) )
return 1LL;
if ( !strchr(*(const char **)&state[4], 47) )
return initialize_wd_for_exec(a1, state[6], (long)".");
ptr = (void *)((long ( *)(_QWORD))mdir_name)(*(_QWORD *)&state[4]);
v2 = initialize_wd_for_exec(a1, state[6], (long)ptr);
free(ptr);
return v2;
}
|
in_force(FORCE_NON_ROOT) ? msdbrw_write :
msdbrw_needsuperuser);
checkpath();
pkg_infodb_upgrade();
log_message("startup packages %s", cipaction->olong);
if (f_pending) {
if (*argv)
badusage(gettext("--%s --pending does not take any non-option arguments"),cipaction->olong);
enqueue_pending();
} else {
| void in_force(void)
{
halt_baddata();
}
|
static void
chr_to_env (char const *envar, char c)
{
char buf[2];
buf[0] = c;
buf[1] = 0;
if (setenv (envar, buf, 1) != 0)
xalloc_die ();
}
| unsigned long chr_to_env(const char *a1, char a2)
{
char value[2];
unsigned long v4;
v4 = __readfsqword(0x28u);
value[0] = a2;
value[1] = 0;
if ( setenv(a1, value, 1) )
xalloc_die(a1);
return __readfsqword(0x28u) ^ v4;
}
|
static void generate_request(gnutls_datum_t *nonce)
{
gnutls_datum_t dat;
gnutls_x509_crt_t cert, issuer;
common_info_st info;
memset(&info, 0, sizeof(info));
info.verbose = verbose;
if (!ocsptool_options.present.load_cert) {
fprintf(
stderr
, "Missing option --load-cert\n");
app_exit(1);
}
info.cert = ocsptool_options.arg.load_cert;
cert = load_cert(1, &info);
memset(&info, 0, sizeof(info));
info.verbose = verbose;
if (!ocsptool_options.present.load_issuer) {
fprintf(
stderr
, "Missing option --load-issuer\n");
app_exit(1);
}
info.cert = ocsptool_options.arg.load_issuer;
issuer = load_cert(1, &info);
_generate_request(cert, issuer, &dat, nonce);
gnutls_x509_crt_deinit(cert);
gnutls_x509_crt_deinit(issuer);
fwrite(dat.data, 1, dat.size, outfile);
gnutls_free((void *) (dat.data)), dat.data=
((void *)0)
;
}
| void generate_request(unsigned long long a0) {
unsigned long long v0;
unsigned long long v1;
void* v2;
char v3;
char v4;
unsigned long v5;
unsigned int v6;
char v7;
unsigned long long *v9;
unsigned long long v10;
memset(&v4, 0x0, 0xd8);
v6 = verbose;
if ((g_500044 ^ 1)) {
fprintf(*(&stderr), "Missing option --load-cert\n");
app_exit(0x1);
}
v5 = gnutls_ocsp_req_deinit;
v0 = load_cert(0x1, &v4);
memset(&v4, 0x0, 0xd8);
v6 = verbose;
if ((g_500043 ^ 1)) {
fprintf(*(&stderr), "Missing option --load-issuer\n");
app_exit(0x1);
}
v5 = printf;
v1 = load_cert(0x1, &v4);
_generate_request(v0, v1, &v2, a0);
gnutls_x509_crt_deinit(v0);
gnutls_x509_crt_deinit(v1);
fwrite(*(&v2), 0x1, *(&v3), outfile);
*(5243000)(*(&v2));
v2 = 0;
v10 = *(&v7) ^ v9[5];
return;
}
|
void
usage (int status)
{
if (status !=
0
)
do { fprintf (
stderr
, gettext ("Try '%s --help' for more information.\n"), program_name); } while (0);
else
{
printf (gettext ("Usage: %s [OPTION] NEWROOT [COMMAND [ARG]...]\n or: %s OPTION\n")
, program_name, program_name);
fputs_unlocked (gettext ("Run COMMAND with root directory set to NEWROOT.\n\n"),
stdout
)
;
fputs_unlocked (gettext (" --groups=G_LIST specify supplementary groups as g1,g2,..,gN\n"),
stdout
)
;
fputs_unlocked (gettext (" --userspec=USER:GROUP specify user and group (ID or name) to use\n"),
stdout
)
;
printf (gettext (" --skip-chdir do not change working directory to %s\n")
, quotearg_style (shell_escape_always_quoting_style, "/"));
fputs_unlocked (gettext (" --help display this help and exit\n"),
stdout
);
fputs_unlocked (gettext (" --version output version information and exit\n"),
stdout
);
fputs_unlocked (gettext ("\nIf no command is given, run '\"$SHELL\" -i' (default: '/bin/sh -i').\n"),
stdout
)
;
emit_ancillary_info ("chroot");
}
exit (status);
}
| void usage(unsigned long a0) {
unsigned long v0;
unsigned long v1;
unsigned long v3;
unsigned long v4;
unsigned long long v5;
v1 = v3;
v0 = v4;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s [OPTION] NEWROOT [COMMAND [ARG]...]\n or: %s OPTION\n"));
fputs_unlocked(gettext("Run COMMAND with root directory set to NEWROOT.\n\n"), stdout);
fputs_unlocked(gettext(" --groups=G_LIST specify supplementary groups as g1,g2,..,gN\n"), stdout);
fputs_unlocked(gettext(" --userspec=USER:GROUP specify user and group (ID or name) to use\n"), stdout);
v5 = quotearg_style(0x4, "/");
printf(gettext(" --skip-chdir do not change working directory to %s\n"));
fputs_unlocked(gettext(" --help display this help and exit\n"), stdout);
fputs_unlocked(gettext(" --version output version information and exit\n"), stdout);
fputs_unlocked(gettext("\nIf no command is given, run \'\"$SHELL\" -i\' (default: \'/bin/sh -i\').\n"), stdout);
emit_ancillary_info("chroot");
}
exit(a0);
}
|
void region_free(region_t region)
{
struct region_el *r, *next;
for (r = region->allocated; r; r = next) {
next = r->next;
ext2fs_free_mem(&r);
}
memset(region, 0, sizeof(struct region_struct));
ext2fs_free_mem(®ion);
}
| unsigned long region_free(_QWORD *a1)
{
void *s;
long i;
long v4;
unsigned long v5;
s = a1;
v5 = __readfsqword(0x28u);
for ( i = a1[2]; i; i = v4 )
{
v4 = *(_QWORD *)(i + 16);
ext2fs_free_mem(&i);
}
memset(s, 0, 0x20uLL);
ext2fs_free_mem(&s);
return __readfsqword(0x28u) ^ v5;
}
|
static void
free_dns_rr(struct dns_rr *p)
{
if (p ==
((void *)0)
)
return;
if (p->name)
free(p->name);
if (p->rdata)
free(p->rdata);
free_dns_rr(p->next);
free(p);
}
| void free_dns_rr(void **param_1)
{
if (param_1 != (void **)0x0) {
if (*param_1 != (void *)0x0) {
free(*param_1);
}
if (param_1[2] != (void *)0x0) {
free(param_1[2]);
}
free_dns_rr(param_1[3]);
free(param_1);
}
return;
}
|
static int nud_state_a2n(unsigned int *state, const char *arg)
{
if (matches(arg, "permanent") == 0)
*state = 0x80;
else if (matches(arg, "reachable") == 0)
*state = 0x02;
else if (strcmp(arg, "noarp") == 0)
*state = 0x40;
else if (strcmp(arg, "none") == 0)
*state = 0x00;
else if (strcmp(arg, "stale") == 0)
*state = 0x04;
else if (strcmp(arg, "incomplete") == 0)
*state = 0x01;
else if (strcmp(arg, "delay") == 0)
*state = 0x08;
else if (strcmp(arg, "probe") == 0)
*state = 0x10;
else if (matches(arg, "failed") == 0)
*state = 0x20;
else {
if (get_unsigned(state, arg, 0))
return -1;
if (*state >= 0x100 || (*state&((*state)-1)))
return -1;
}
return 0;
}
| int nud_state_a2n(unsigned int *a0, char *a1) {
unsigned int v4;
if ((matches(a1, "permanent") ^ 1)) {
*(a0) = 128;
v4 = 0;
return v4;
} else if ((matches(a1, "reachable") ^ 1)) {
*(a0) = 2;
v4 = 0;
return v4;
} else if (!strcmp(a1, "noarp")) {
*(a0) = 64;
v4 = 0;
return v4;
} else if (!strcmp(a1, "none")) {
*(a0) = 0;
v4 = 0;
return v4;
} else if (!strcmp(a1, "stale")) {
*(a0) = 4;
v4 = 0;
return v4;
} else if (!strcmp(a1, "incomplete")) {
*(a0) = 1;
v4 = 0;
return v4;
} else if (!strcmp(a1, "delay")) {
*(a0) = 8;
v4 = 0;
return v4;
} else if (!strcmp(a1, "probe")) {
*(a0) = 16;
v4 = 0;
return v4;
} else if ((matches(a1, "failed") ^ 1)) {
*(a0) = 32;
v4 = 0;
return v4;
} else if (get_unsigned(a0, a1, 0x0, a1)) {
v4 = -1;
return v4;
} else if (*(a0) > 255) {
v4 = -1;
return v4;
} else if ((*(a0) - 1 & *(a0))) {
v4 = -1;
return v4;
} else {
v4 = 0;
return v4;
}
}
|
static int
pkcs11_start_helper(void)
{
int pair[2];
char *helper, *verbosity =
((void *)0)
;
if (log_level_get() >= SYSLOG_LEVEL_DEBUG1)
verbosity = "-vvv";
if (pkcs11_start_helper_methods() == -1) {
sshlog("ssh-pkcs11-client.c", __func__, 281, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "pkcs11_start_helper_methods failed");
return (-1);
}
if (socketpair(
1
,
SOCK_STREAM
, 0, pair) == -1) {
sshlog("ssh-pkcs11-client.c", __func__, 286, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "socketpair: %s", strerror(
(*__errno_location ())
));
return (-1);
}
if ((pid = fork()) == -1) {
sshlog("ssh-pkcs11-client.c", __func__, 290, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "fork: %s", strerror(
(*__errno_location ())
));
return (-1);
} else if (pid == 0) {
if ((dup2(pair[1],
0
) == -1) ||
(dup2(pair[1],
1
) == -1)) {
fprintf(
stderr
, "dup2: %s\n", strerror(
(*__errno_location ())
));
_exit(1);
}
close(pair[0]);
close(pair[1]);
helper = getenv("SSH_PKCS11_HELPER");
if (helper ==
((void *)0)
|| strlen(helper) == 0)
helper = "/usr/local/libexec/ssh-pkcs11-helper";
sshlog("ssh-pkcs11-client.c", __func__, 303, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "starting %s %s", helper, verbosity ==
((void *)0)
? "" : verbosity)
;
execlp(helper, helper, verbosity, (char *)
((void *)0)
);
fprintf(
stderr
, "exec: %s: %s\n", helper, strerror(
(*__errno_location ())
));
_exit(1);
}
close(pair[1]);
fd = pair[0];
return (0);
}
| undefined8 pkcs11_start_helper(void)
{
int iVar1;
int *piVar2;
char *pcVar3;
size_t sVar4;
undefined *puVar5;
long in_FS_OFFSET;
undefined8 uVar6;
char *local_28;
undefined *local_20;
int local_18;
int local_14;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_20 = (undefined *)0x0;
iVar1 = log_level_get();
if (4 < iVar1) {
local_20 = &DAT_0010171c;
}
uVar6 = 0x100e2b;
iVar1 = pkcs11_start_helper_methods();
if (iVar1 == -1) {
sshlog("ssh-pkcs11-client.c","pkcs11_start_helper",0x119,0,2,0,
"pkcs11_start_helper_methods failed",uVar6);
uVar6 = 0xffffffff;
LAB_001010cd:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar6;
}
__stack_chk_fail();
}
iVar1 = socketpair(1,1,0,&local_18);
if (iVar1 == -1) {
piVar2 = __errno_location();
pcVar3 = strerror(*piVar2);
sshlog("ssh-pkcs11-client.c","pkcs11_start_helper",0x11e,0,2,0,"socketpair: %s",pcVar3);
uVar6 = 0xffffffff;
goto LAB_001010cd;
}
pid = fork();
if (pid == -1) {
piVar2 = __errno_location();
pcVar3 = strerror(*piVar2);
sshlog("ssh-pkcs11-client.c","pkcs11_start_helper",0x122,0,2,0,"fork: %s",pcVar3);
uVar6 = 0xffffffff;
goto LAB_001010cd;
}
if (pid != 0) {
close(local_14);
fd = local_18;
uVar6 = 0;
goto LAB_001010cd;
}
iVar1 = dup2(local_14,0);
if ((iVar1 == -1) || (iVar1 = dup2(local_14,1), iVar1 == -1)) {
piVar2 = __errno_location();
pcVar3 = strerror(*piVar2);
fprintf(stderr,"dup2: %s\n",pcVar3);
_exit(1);
}
close(local_18);
close(local_14);
uVar6 = 0x100fe0;
local_28 = getenv("SSH_PKCS11_HELPER");
if (local_28 != (char *)0x0) {
uVar6 = 0x100ff7;
sVar4 = strlen(local_28);
if (sVar4 != 0) goto LAB_00101007;
}
local_28 = "/usr/local/libexec/ssh-pkcs11-helper";
LAB_00101007:
puVar5 = local_20;
if (local_20 == (undefined *)0x0) {
puVar5 = &DAT_001017a5;
}
sshlog("ssh-pkcs11-client.c","pkcs11_start_helper",0x12f,1,5,0,"starting %s %s",local_28,puVar5,
uVar6);
execlp(local_28,local_28,local_20,0);
piVar2 = __errno_location();
pcVar3 = strerror(*piVar2);
fprintf(stderr,"exec: %s: %s\n",local_28,pcVar3);
_exit(1);
}
|
static
_Bool
decode_time (struct timespec *ts, char const *arg, char const *keyword)
{
char *arg_lim;
struct timespec t = decode_timespec (arg, &arg_lim,
1
);
if (! valid_timespec (t))
{
if (arg < arg_lim && !*arg_lim)
out_of_range_header (keyword, arg, ((time_t) ~ ((time_t) (! (! ((time_t) 0 < (time_t) -1)) ? (time_t) -1 : ((((time_t) 1 << ((sizeof (time_t) * 8) - 2)) - 1) * 2 + 1)))),
((time_t) (! (! ((time_t) 0 < (time_t) -1)) ? (time_t) -1 : ((((time_t) 1 << ((sizeof (time_t) * 8) - 2)) - 1) * 2 + 1))));
else
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed extended header: invalid %s=%s"), keyword, arg); exit_status = 2; } while (0)
;
return
0
;
}
*ts = t;
return
1
;
}
| int decode_time(unsigned long long a0[2], unsigned long a1, unsigned int a2) {
char v0;
unsigned long long v1;
unsigned long long v2;
unsigned int v5;
v1 = decode_timespec(a1, &v0, 0x1, &v0);
v2 = 1;
if (!(valid_timespec(v1, v2, v1) ^ 1)) {
a0[0] = v1;
a0[1] = v2;
v5 = 1;
return v5;
}
if (a1 < *(&v0) && !*(*(&v0))) {
out_of_range_header(a2, a1, 0x8000000000000000, 0x7fffffffffffffff);
v5 = 0;
return v5;
}
if (error_hook)
*(5242936)();
error(0x0, 0x0, gettext("Malformed extended header: invalid %s=%s"));
exit_status = 2;
v5 = 0;
return v5;
}
|
void warning (char const *m)
{
{if (!quiet) fprintf (
stderr
, "%s: %s: warning: %s\n", program_name, ifname, m) ; if (exit_code == 0) exit_code = 2;};
}
| long long warning(unsigned long a0) {
unsigned long long v1;
if (!quiet)
fprintf(stderr, "%s: %s: warning: %s\n", program_name, &ifname, a0);
v1 = exit_code;
if (!exit_code)
exit_code = 2;
return v1;
}
|
static char *
parameter_brace_casemod (varname, value, estatep, modspec, patspec, quoted, pflags, flags)
char *varname, *value;
array_eltstate_t *estatep;
int modspec;
char *patspec;
int quoted, pflags, flags;
{
int vtype, starsub, modop, mflags, x;
char *val, *temp, *pat, *p, *lpat, *tt, *oname;
SHELL_VAR *v;
if (value == 0)
return ((char *)
((void *)0)
);
oname = this_command_name;
this_command_name = varname;
vtype = get_var_and_type (varname, value, estatep, quoted, flags, &v, &val);
if (vtype == -1)
{
this_command_name = oname;
return ((char *)
((void *)0)
);
}
starsub = vtype & 128;
vtype &= ~128;
modop = 0;
mflags = 0;
if (quoted & (0x002|0x001))
mflags |= 0x020;
if (starsub)
mflags |= 0x080;
if (pflags & 0x08)
mflags |= 0x040;
p = patspec;
if (modspec == '^')
{
x = p && p[0] == modspec;
modop = x ? 0x0002 : 0x0040;
p += x;
}
else if (modspec == ',')
{
x = p && p[0] == modspec;
modop = x ? 0x0001 : 0x0080;
p += x;
}
else if (modspec == '~')
{
x = p && p[0] == modspec;
modop = x ? 0x0020 : 0x0010;
p += x;
}
lpat = p ? (char *)strcpy (sh_xmalloc((1 + strlen (p)), "subst.c", 9394), (p)) : 0;
pat = lpat ? getpattern (lpat, quoted, 1) : 0;
switch (vtype)
{
case 0:
case 3:
temp = sh_modcase (val, pat, modop);
if (vtype == 0)
do { if (val) sh_xfree((val), "subst.c", 9406); } while (0);
if (temp)
{
tt = (mflags & 0x020) ? quote_string (temp) : quote_escapes (temp);
sh_xfree((temp), "subst.c", 9410);
temp = tt;
}
break;
case 1:
temp = pos_params_modcase (val, pat, modop, mflags);
if (temp && quoted == 0 && ifs_is_null)
{
}
else if (temp && (mflags & 0x020) == 0)
{
tt = quote_escapes (temp);
sh_xfree((temp), "subst.c", 9424);
temp = tt;
}
break;
case 2:
if ((mflags & 0x080) && (mflags & 0x040) && ifs_is_null)
mflags |= 0x020;
temp = ((((v)->attributes) & (0x0000040))) ? assoc_modcase ((HASH_TABLE *)((v)->value), pat, modop, mflags)
: array_modcase ((ARRAY *)((v)->value), pat, modop, mflags);
if (temp && quoted == 0 && ifs_is_null)
{
}
else if (temp && (mflags & 0x020) == 0)
{
tt = quote_escapes (temp);
sh_xfree((temp), "subst.c", 9447);
temp = tt;
}
break;
}
do { if (pat) sh_xfree((pat), "subst.c", 9455); } while (0);
sh_xfree((lpat), "subst.c", 9456);
this_command_name = oname;
return temp;
}
| int parameter_brace_casemod(void* a0, void* a1, void* a2, unsigned long a3, char *a4, unsigned long a5, unsigned int v13, unsigned int a6) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
char v5;
char v6;
unsigned long v7;
char *v8;
unsigned long long v9;
void* v10;
void* v11;
unsigned long long v12;
unsigned long long v14;
unsigned int v15;
unsigned int v16;
unsigned int v17;
unsigned int v18;
unsigned int v19;
unsigned int v20;
void* v21;
if (!a1) {
v14 = 0;
} else {
v9 = this_command_name;
this_command_name = a0;
v2 = get_var_and_type(a0, a1, a2, a5, a6, &v6, &v5);
if (v2 == -1) {
this_command_name = v9;
v14 = 0;
} else {
v3 = v2 & 128;
v2 &= -129;
v0 = 0;
v1 = 0;
if ((a5 & 3))
v1 |= 32;
if (v3)
v1 |= 128;
if ((v13 & 8))
v1 |= 64;
v8 = a4;
if (a3 == 94) {
if (v8 && a3 == *(v8)) {
v15 = 1;
goto LABEL_416658;
}
v15 = 0;
LABEL_416658:
v4 = v15;
if (!v4)
v18 = 64;
else
v18 = 2;
v0 = v18;
v8 = &v8[v4];
} else if (a3 == 44) {
if (v8 && a3 == *(v8)) {
v16 = 1;
goto LABEL_4166a6;
}
v16 = 0;
LABEL_4166a6:
v4 = v16;
if (!v4)
v19 = 128;
else
v19 = 1;
v0 = v19;
v8 = &v8[v4];
} else if (a3 == 126) {
if (v8 && a3 == *(v8)) {
v17 = 1;
goto LABEL_4166f1;
}
v17 = 0;
LABEL_4166f1:
v4 = v17;
if (!v4)
v20 = 16;
else
v20 = 32;
v0 = v20;
v8 = &v8[v4];
}
if (!v8)
v21 = 0;
else
v21 = strcpy(sh_xmalloc(strlen(v8) + 1, "subst.c", 0x24b2), v8);
v10 = v21;
if (!v10)
v14 = 0;
else
v14 = getpattern(v10, a5, 0x1);
v11 = v14;
if (v2 == 3) {
v14 = sh_modcase(*(&v5), v11, v0);
v7 = v14;
if (!v2 && *(&v5))
sh_xfree(*(&v5), "subst.c", 0x24be);
if (v7) {
if (!(v1 & 32))
v14 = quote_escapes(v7);
else
v14 = quote_string(v7);
v12 = v14;
sh_xfree(v7, "subst.c", 0x24c2);
v7 = v12;
}
} else {
if (!(v2 <= 3))
goto LABEL_4169ac;
if (v2 == 2) {
if ((v1 & 128) && (v1 & 64))
v1 |= 32;
if (!(*((*(&v6) + 40)) & 64))
v14 = array_modcase(*((*(&v6) + 8)), v11, v0, v1);
else
v14 = assoc_modcase(*((*(&v6) + 8)), v11, v0, v1);
v7 = v14;
if (v7 && !a5 && !(!5023220010551146633))
goto LABEL_4169ab;
if (v7 && !(v1 & 32)) {
v14 = quote_escapes(v7);
v12 = v14;
sh_xfree(v7, "subst.c", 0x24e7);
v7 = v12;
}
LABEL_4169ab:
} else {
if (!(v2 <= 2))
goto LABEL_4169ac;
if (v2 && v2 == 1) {
v14 = pos_params_modcase(*(&v5), v11, v0, v1, a4, &v6);
v7 = v14;
if (v7 && !a5 && !(!5023220010551146633))
goto LABEL_4169a8;
if (v7 && !(v1 & 32)) {
v14 = quote_escapes(v7);
v12 = v14;
sh_xfree(v7, "subst.c", 0x24d0);
v7 = v12;
}
LABEL_4169a8:
}
}
}
LABEL_4169ac:
if (v11)
sh_xfree(v11, "subst.c", 0x24ef);
sh_xfree(v10, "subst.c", 0x24f0);
this_command_name = v9;
v14 = v7;
}
}
return v14;
}
|
static
_Bool
parse_newer (const struct parser_table* entry, char **argv, int *arg_ptr)
{
struct predicate *our_pred;
struct stat stat_newer;
const char *arg;
set_stat_placeholders (&stat_newer);
if (collect_arg_stat_info (argv, arg_ptr, &stat_newer, &arg))
{
our_pred = insert_primary (entry, arg);
our_pred->args.reftime.ts = get_stat_mtime (&stat_newer);
our_pred->args.reftime.xval = XVAL_MTIME;
our_pred->args.reftime.kind = COMP_GT;
our_pred->est_success_rate = estimate_timestamp_success_rate (stat_newer.
st_mtim.tv_sec
);
return
1
;
}
return
0
;
}
| bool parse_newer(undefined8 param_1,undefined8 param_2,undefined8 param_3)
{
char cVar1;
long lVar2;
long in_FS_OFFSET;
undefined4 extraout_XMM0_Da;
undefined auVar3 [16];
undefined8 local_c8;
long local_c0;
undefined local_b8 [88];
undefined8 local_60;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
set_stat_placeholders(local_b8);
cVar1 = collect_arg_stat_info(param_2,param_3,local_b8,&local_c8);
if (cVar1 != '\0') {
lVar2 = insert_primary(param_1,local_c8);
local_c0 = lVar2;
auVar3 = get_stat_mtime(local_b8);
*(long *)(lVar2 + 0x40) = SUB168(auVar3,0);
*(long *)(lVar2 + 0x48) = SUB168(auVar3 >> 0x40,0);
*(undefined4 *)(local_c0 + 0x38) = 3;
*(undefined4 *)(local_c0 + 0x3c) = 0;
estimate_timestamp_success_rate(local_60);
*(undefined4 *)(local_c0 + 0x24) = extraout_XMM0_Da;
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return cVar1 != '\0';
}
__stack_chk_fail();
}
|
int timescmd() {
struct tms buf;
long int clk_tck = sysconf(
_SC_CLK_TCK
);
int mutime, mstime, mcutime, mcstime;
double utime, stime, cutime, cstime;
times(&buf);
utime = (double)buf.tms_utime / clk_tck;
mutime = utime / 60;
utime -= mutime * 60.0;
stime = (double)buf.tms_stime / clk_tck;
mstime = stime / 60;
stime -= mstime * 60.0;
cutime = (double)buf.tms_cutime / clk_tck;
mcutime = cutime / 60;
cutime -= mcutime * 60.0;
cstime = (double)buf.tms_cstime / clk_tck;
mcstime = cstime / 60;
cstime -= mcstime * 60.0;
out1fmt("%dm%fs %dm%fs\n%dm%fs %dm%fs\n", mutime, utime, mstime, stime,
mcutime, cutime, mcstime, cstime);
return 0;
}
| long long timescmd() {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long v4;
unsigned long v5;
unsigned long v6;
unsigned long v7;
unsigned long v8;
char v9;
char v10;
char v11;
char v12;
unsigned long long v14;
unsigned long long v15;
int v16;
int v17;
uint128_t v19;
unsigned long long v20;
uint128_t v21;
unsigned long long v22;
uint128_t v23;
unsigned long long v24;
v4 = sysconf(0x2);
times(&v9);
v14 = *(&v9);
v15 = v4;
v5 = (v16 / v17);
s_70 =L Conv(128->32, (Conv(64->128, Load(addr=stack_base-88, size=8, endness=Iend_LE)) / 0x404e000000000000<128>))<4>
xmm1<16> = (Conv(32->128, Load(addr=stack_base-112, size=4, endness=Iend_LE)) * 0x404e000000000000<128>)
xmm0<16> = (Conv(64->128, Load(addr=stack_base-88, size=8, endness=Iend_LE)) - (Conv(32->128, Load(addr=stack_base-112, size=4, endness=Iend_LE)) * 0x404e000000000000<128>))
s_58 =L Conv(128->64, (Conv(64->128, Load(addr=stack_base-88, size=8, endness=Iend_LE)) - (Conv(32->128, Load(addr=stack_base-112, size=4, endness=Iend_LE)) * 0x404e000000000000<128>)))<8>
v20 = *(&v10);
*(&v19) = v4;
v20 /= v19;
v6 = v20;
s_6c =L Conv(128->32, (Conv(64->128, Load(addr=stack_base-80, size=8, endness=Iend_LE)) / 0x404e000000000000<128>))<4>
xmm1<16> = (Conv(32->128, Load(addr=stack_base-108, size=4, endness=Iend_LE)) * 0x404e000000000000<128>)
xmm0<16> = (Conv(64->128, Load(addr=stack_base-80, size=8, endness=Iend_LE)) - (Conv(32->128, Load(addr=stack_base-108, size=4, endness=Iend_LE)) * 0x404e000000000000<128>))
s_50 =L Conv(128->64, (Conv(64->128, Load(addr=stack_base-80, size=8, endness=Iend_LE)) - (Conv(32->128, Load(addr=stack_base-108, size=4, endness=Iend_LE)) * 0x404e000000000000<128>)))<8>
v22 = *(&v11);
*(&v21) = v4;
v22 /= v21;
v7 = v22;
s_68 =L Conv(128->32, (Conv(64->128, Load(addr=stack_base-72, size=8, endness=Iend_LE)) / 0x404e000000000000<128>))<4>
xmm1<16> = (Conv(32->128, Load(addr=stack_base-104, size=4, endness=Iend_LE)) * 0x404e000000000000<128>)
xmm0<16> = (Conv(64->128, Load(addr=stack_base-72, size=8, endness=Iend_LE)) - (Conv(32->128, Load(addr=stack_base-104, size=4, endness=Iend_LE)) * 0x404e000000000000<128>))
s_48 =L Conv(128->64, (Conv(64->128, Load(addr=stack_base-72, size=8, endness=Iend_LE)) - (Conv(32->128, Load(addr=stack_base-104, size=4, endness=Iend_LE)) * 0x404e000000000000<128>)))<8>
v24 = *(&v12);
*(&v23) = v4;
v24 /= v23;
v8 = v24;
s_64 =L Conv(128->32, (Conv(64->128, Load(addr=stack_base-64, size=8, endness=Iend_LE)) / 0x404e000000000000<128>))<4>
s_40 =L Conv(128->64, (Conv(64->128, Load(addr=stack_base-64, size=8, endness=Iend_LE)) - (Conv(32->128, Load(addr=stack_base-100, size=4, endness=Iend_LE)) * 0x404e000000000000<128>)))<8>
out1fmt("%dm%fs %dm%fs\n%dm%fs %dm%fs\n", v0, v1, v2, v3);
return 0;
}
|
static void
skip_construct (struct Spec_list *s)
{
s->tail = s->tail->next;
s->state = ((
(18446744073709551615UL)
- 1) + 1);
}
| void skip_construct(struct_0 *a0) {
char v0;
unsigned long long v2[3];
unsigned long long v3;
a0->field_8 = a0->field_8->field_8;
v2 = a0;
a0->field_10 = -1;
v3 = *(&v0);
return;
}
|
static
Bool hasSuffix ( Char* s, const Char* suffix )
{
Int32 ns = strlen(s);
Int32 nx = strlen(suffix);
if (ns < nx) return ((Bool)0);
if (strcmp(s + ns - nx, suffix) == 0) return ((Bool)1);
return ((Bool)0);
}
| undefined8 hasSuffix(char *param_1,char *param_2)
{
int iVar1;
size_t sVar2;
size_t sVar3;
undefined8 uVar4;
sVar2 = strlen(param_1);
sVar3 = strlen(param_2);
if ((int)sVar2 < (int)sVar3) {
uVar4 = 0;
}
else {
iVar1 = strcmp(param_1 + ((long)(int)sVar2 - (long)(int)sVar3),param_2);
if (iVar1 == 0) {
uVar4 = 1;
}
else {
uVar4 = 0;
}
}
return uVar4;
}
|
static
void signal_handler(int sig)
{
((got_signals) |= (1 << (sig)));
}
| long long signal_handler(unsigned long a0) {
oops_error = 874961156424106824 | (1 << (a0 & 31));
return 874961156424106824 | (1 << (a0 & 31));
}
|
_Bool
sci_complete(
_Bool
sci,
_Bool
port,
_Bool
addr,
_Bool
port_only)
{
return sci || (port && (addr || port_only));
}
| int sci_complete(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3) {
unsigned int v1;
unsigned int v2;
if (a0) {
LABEL_400734:
v1 = 1;
} else if (!a1) {
LABEL_40073b:
v1 = 0;
} else if (!a2) {
if (!(!a3))
goto LABEL_400734;
goto LABEL_40073b;
}
v2 = v1 & 1;
return v2;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.