input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
static uintmax_t
mulredc2 (uintmax_t *r1p,
uintmax_t a1, uintmax_t a0, uintmax_t b1, uintmax_t b0,
uintmax_t m1, uintmax_t m0, uintmax_t mi)
{
uintmax_t r1, r0, q, p1, t1, t0, s1, s0;
__attribute__ ((__unused__)) uintmax_t p0;
mi = -mi;
((void) sizeof ((
(a1 >> (64 - 1)) == 0
) ? 1 : 0), __extension__ ({ if (
(a1 >> (64 - 1)) == 0
) ; else __assert_fail (
"(a1 >> (W_TYPE_SIZE - 1)) == 0"
, "src/factor.c", 993, __extension__ __PRETTY_FUNCTION__); }))
;
((void) sizeof ((
(b1 >> (64 - 1)) == 0
) ? 1 : 0), __extension__ ({ if (
(b1 >> (64 - 1)) == 0
) ; else __assert_fail (
"(b1 >> (W_TYPE_SIZE - 1)) == 0"
, "src/factor.c", 994, __extension__ __PRETTY_FUNCTION__); }))
;
((void) sizeof ((
(m1 >> (64 - 1)) == 0
) ? 1 : 0), __extension__ ({ if (
(m1 >> (64 - 1)) == 0
) ; else __assert_fail (
"(m1 >> (W_TYPE_SIZE - 1)) == 0"
, "src/factor.c", 995, __extension__ __PRETTY_FUNCTION__); }))
;
__asm__ ("mulq\t%3" : "=a" (t0), "=d" (t1) : "%0" ((UDItype)(a0)), "rm" ((UDItype)(b0)));
__asm__ ("mulq\t%3" : "=a" (r0), "=d" (r1) : "%0" ((UDItype)(a0)), "rm" ((UDItype)(b1)));
q = mi * t0;
__asm__ ("mulq\t%3" : "=a" (p0), "=d" (p1) : "%0" ((UDItype)(q)), "rm" ((UDItype)(m0)));
__asm__ ("mulq\t%3" : "=a" (s0), "=d" (s1) : "%0" ((UDItype)(q)), "rm" ((UDItype)(m1)));
r0 += (t0 != 0);
__asm__ ("addq %5,%q1\n\tadcq %3,%q0" : "=r" (r1), "=&r" (r0) : "0" ((UDItype)(r1)), "rme" ((UDItype)(0)), "%1" ((UDItype)(r0)), "rme" ((UDItype)(p1)));
__asm__ ("addq %5,%q1\n\tadcq %3,%q0" : "=r" (r1), "=&r" (r0) : "0" ((UDItype)(r1)), "rme" ((UDItype)(0)), "%1" ((UDItype)(r0)), "rme" ((UDItype)(t1)));
__asm__ ("addq %5,%q1\n\tadcq %3,%q0" : "=r" (r1), "=&r" (r0) : "0" ((UDItype)(r1)), "rme" ((UDItype)(s1)), "%1" ((UDItype)(r0)), "rme" ((UDItype)(s0)));
__asm__ ("mulq\t%3" : "=a" (t0), "=d" (t1) : "%0" ((UDItype)(a1)), "rm" ((UDItype)(b0)));
__asm__ ("mulq\t%3" : "=a" (s0), "=d" (s1) : "%0" ((UDItype)(a1)), "rm" ((UDItype)(b1)));
__asm__ ("addq %5,%q1\n\tadcq %3,%q0" : "=r" (t1), "=&r" (t0) : "0" ((UDItype)(t1)), "rme" ((UDItype)(0)), "%1" ((UDItype)(t0)), "rme" ((UDItype)(r0)));
q = mi * t0;
__asm__ ("addq %5,%q1\n\tadcq %3,%q0" : "=r" (r1), "=&r" (r0) : "0" ((UDItype)(s1)), "rme" ((UDItype)(0)), "%1" ((UDItype)(s0)), "rme" ((UDItype)(r1)));
__asm__ ("mulq\t%3" : "=a" (p0), "=d" (p1) : "%0" ((UDItype)(q)), "rm" ((UDItype)(m0)));
__asm__ ("mulq\t%3" : "=a" (s0), "=d" (s1) : "%0" ((UDItype)(q)), "rm" ((UDItype)(m1)));
r0 += (t0 != 0);
__asm__ ("addq %5,%q1\n\tadcq %3,%q0" : "=r" (r1), "=&r" (r0) : "0" ((UDItype)(r1)), "rme" ((UDItype)(0)), "%1" ((UDItype)(r0)), "rme" ((UDItype)(p1)));
__asm__ ("addq %5,%q1\n\tadcq %3,%q0" : "=r" (r1), "=&r" (r0) : "0" ((UDItype)(r1)), "rme" ((UDItype)(0)), "%1" ((UDItype)(r0)), "rme" ((UDItype)(t1)));
__asm__ ("addq %5,%q1\n\tadcq %3,%q0" : "=r" (r1), "=&r" (r0) : "0" ((UDItype)(r1)), "rme" ((UDItype)(s1)), "%1" ((UDItype)(r0)), "rme" ((UDItype)(s0)));
if (((r1) > (m1) || ((r1) == (m1) && (r0) >= (m0))))
__asm__ ("subq %5,%q1\n\tsbbq %3,%q0" : "=r" (r1), "=&r" (r0) : "0" ((UDItype)(r1)), "rme" ((UDItype)(m1)), "1" ((UDItype)(r0)), "rme" ((UDItype)(m0)));
*r1p = r1;
return r0;
}
| int mulredc2(unsigned long long *a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5, unsigned long v9, unsigned long a6) {
unsigned long v0;
int tmp_137;
int tmp_174;
int tmp_491;
int tmp_511;
int tmp_514;
int tmp_534;
int tmp_537;
int tmp_559;
unsigned long v1;
unsigned long v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
unsigned long v6;
unsigned long v7;
unsigned long v8;
a6 = -(a6);
if (a1 < 0) {
__assert_fail();
} else if (a3 < 0) {
__assert_fail();
} else if (a5 < 0) {
__assert_fail();
} else {
v2 = a2 * a4;
v3 = a2 * a4 >> 64;
v1 = a2 * a3;
v0 = a2 * a3 >> 64;
v4 = v2 * a6;
v5 = v4 * v9;
v6 = v4 * v9 >> 64;
v7 = v4 * a5;
v8 = v4 * a5 >> 64;
v1 += v2;
v0 += (v1 + v6 <= v1 ? 1 : 0) & 1;
v1 += v6;
v0 += (v1 + v3 <= v1 ? 1 : 0) & 1;
v1 += v3;
v0 = v0 + v8 + ((v1 + v7 <= v1 ? 1 : 0) & 1);
v1 += v7;
v2 = a1 * a4;
v3 = a1 * a4 >> 64;
v7 = a1 * a3;
v8 = a1 * a3 >> 64;
v3 += (v2 + v1 <= v2 ? 1 : 0) & 1;
v2 += v1;
v4 = v2 * a6;
tmp_137 = v0;
v0 = v8 + ((v7 + v0 <= v7 ? 1 : 0) & 1);
v1 = v7 + tmp_137;
v5 = v4 * v9;
v6 = v4 * v9 >> 64;
v7 = v4 * a5;
v8 = v4 * a5 >> 64;
tmp_174 = v1;
v1 = tmp_174 + (v2);
tmp_491 = v1;
v0 += (tmp_491 + v6 <= tmp_491 ? 1 : 0) & 1;
v1 = tmp_491 + v6;
tmp_511 = v0;
tmp_514 = v1;
v0 = tmp_511 + ((tmp_514 + v3 <= tmp_514 ? 1 : 0) & 1);
v1 = tmp_514 + v3;
tmp_534 = v0;
tmp_537 = v1;
v0 = tmp_534 + v8 + ((tmp_537 + v7 <= tmp_537 ? 1 : 0) & 1);
v1 = tmp_537 + v7;
tmp_559 = v0;
if (tmp_559 > a5 || v0 == a5 && v1 >= v9) {
v0 = v0 - a5 - (v1 < v9);
v1 -= v9;
}
*(a0) = v0;
return v1;
}
}
|
int
archivefiles(const char *const *argv)
{
const char *const *volatile argp;
const char **volatile arglist =
((void *)0)
;
int i;
jmp_buf ejbuf;
enum modstatdb_rw msdbflags;
trigproc_install_hooks();
if (f_noact)
msdbflags = msdbrw_readonly;
else if (cipaction->arg_int == act_avail)
msdbflags = msdbrw_readonly | msdbrw_available_write;
else if (in_force(FORCE_NON_ROOT))
msdbflags = msdbrw_write;
else
msdbflags = msdbrw_needsuperuser;
modstatdb_open(msdbflags);
checkpath();
pkg_infodb_upgrade();
log_message("startup archives %s", cipaction->olong);
if (f_recursive) {
const char *const *ap;
int nfiles = 0;
if (!*argv)
badusage(gettext("--%s --recursive needs at least one path argument"),cipaction->olong);
for (ap = argv; *ap; ap++) {
struct treeroot *tree;
struct treenode *node;
tree = treewalk_open((const char *)*ap, TREEWALK_FOLLOW_LINKS,
((void *)0)
);
while ((node = treewalk_next(tree))) {
const char *nodename;
if (!
((((
treenode_get_mode(node)
)) & 0170000) == (0100000))
)
continue;
nodename = treenode_get_pathname(node);
if (strcmp(nodename + strlen(nodename) - 4, ".deb") != 0)
continue;
arglist = m_realloc(arglist, sizeof(char *) * (nfiles + 2));
arglist[nfiles++] = m_strdup(nodename);
}
treewalk_close(tree);
}
if (!nfiles)
ohshit(gettext("searched, but found no packages (files matching *.deb)"));
arglist[nfiles] =
((void *)0)
;
argp= arglist;
} else {
if (!*argv) badusage(gettext("--%s needs at least one package archive file argument"),
cipaction->olong);
argp= argv;
}
for (i = 0; argp[i]; i++) {
struct stat st;
if (stat(argp[i], &st) < 0)
ohshite(gettext("cannot access archive '%s'"), argp[i]);
if (!
((((
st.st_mode
)) & 0170000) == (0100000))
)
ohshit(gettext("archive '%s' is not a regular file"), argp[i]);
}
currenttime = time(
((void *)0)
);
varbuf_reset(&fnamevb);
varbuf_reset(&fnametmpvb);
varbuf_reset(&fnamenewvb);
varbuf_add_buf(&fnamevb, instdir, strlen(instdir));
varbuf_add_buf(&fnametmpvb, instdir, strlen(instdir));
varbuf_add_buf(&fnamenewvb, instdir, strlen(instdir));
varbuf_snapshot(&fnamevb, &fname_state);
ensure_diversions();
ensure_statoverrides(STATDB_PARSE_NORMAL);
for (i = 0; argp[i]; i++) {
if (
_setjmp (
ejbuf
)
) {
pop_error_context(ehflag_bombout);
if (abort_processing)
break;
continue;
}
push_error_context_jump(&ejbuf, print_error_perarchive, argp[i]);
dpkg_selabel_load();
process_archive(argp[i]);
onerr_abort++;
m_output(
stdout
, gettext("<standard output>"));
m_output(
stderr
, gettext("<standard error>"));
onerr_abort--;
pop_error_context(ehflag_normaltidy);
}
dpkg_selabel_close();
free(arglist);
switch (cipaction->arg_int) {
case act_install:
case act_configure:
case act_triggers:
case act_remove:
case act_purge:
process_queue();
case act_unpack:
case act_avail:
break;
default:
do_internerr("archives.c", 1607, __func__, "unknown action '%d'", cipaction->arg_int);
}
trigproc_run_deferred();
modstatdb_shutdown();
return 0;
}
| long archivefiles(_QWORD *a1)
{
const char *v1;
const char *v2;
char *v3;
long j;
size_t v5;
int v6;
char *v7;
long v8;
long v9;
char *v10;
char *v11;
long v12;
char *v13;
long v14;
size_t v15;
size_t v16;
size_t v17;
char *v18;
char *v19;
int v20;
int k;
int m;
unsigned int v24;
int v25;
_QWORD *v26;
_QWORD *ptr;
_QWORD *i;
long v29;
long v30;
char *s;
struct stat v32;
jmp_buf env;
unsigned long v34;
v34 = __readfsqword(0x28u);
ptr = 0LL;
trigproc_install_hooks();
if ( f_noact )
{
v24 = 0;
}
else if ( *(_DWORD *)(cipaction + 40LL) == 38 )
{
v24 = 512;
}
else if ( (unsigned char)in_force(0x10000LL) )
{
v24 = 3;
}
else
{
v24 = 4;
}
modstatdb_open(v24);
checkpath();
pkg_infodb_upgrade();
v1 = (const char *)*cipaction;
log_message("startup archives %s", (const char *)*cipaction);
if ( f_recursive )
{
v25 = 0;
if ( !*a1 )
{
v2 = (const char *)*cipaction;
v3 = gettext("--%s --recursive needs at least one path argument");
v1 = v2;
badusage(v3, v2);
}
for ( i = a1; *i; ++i )
{
v1 = (_BYTE *)(&loc_1 + 1);
v29 = treewalk_open(*i, 2LL, 0LL);
for ( j = treewalk_next(v29); ; j = treewalk_next(v29) )
{
v30 = j;
if ( !j )
break;
if ( (treenode_get_mode(j) & 0xF000) == 0x8000 )
{
s = (char *)treenode_get_pathname(v30);
v5 = strlen(s);
v1 = ".deb";
if ( !strcmp(&s[v5 - 4], ".deb") )
{
v1 = (const char *)(8LL * (v25 + 2));
ptr = (_QWORD *)m_realloc(ptr, v1);
v6 = v25++;
ptr[v6] = m_strdup(s);
}
}
}
treewalk_close(v29);
}
if ( !v25 )
{
v7 = gettext("searched, but found no packages (files matching *.deb)");
ohshit(v7, v1, v8);
}
ptr[v25] = 0LL;
v26 = ptr;
}
else
{
if ( !*a1 )
{
v9 = *cipaction;
v10 = gettext("--%s needs at least one package archive file argument");
badusage(v10, v9);
}
v26 = a1;
}
for ( k = 0; v26[k]; ++k )
{
if ( stat((const char *)v26[k], &v32) < 0 )
{
v11 = gettext("cannot access archive '%s'");
ohshite(v11);
}
if ( (v32.st_mode & 0xF000) != 0x8000 )
{
v12 = v26[k];
v13 = gettext("archive '%s' is not a regular file");
ohshit(v13, v12, v14);
}
}
currenttime = time(0LL);
varbuf_reset(fnamevb);
varbuf_reset(fnametmpvb);
varbuf_reset(&fnamenewvb);
v15 = strlen(instdir);
varbuf_add_buf(fnamevb, instdir, v15);
v16 = strlen(instdir);
varbuf_add_buf(fnametmpvb, instdir, v16);
v17 = strlen(instdir);
varbuf_add_buf(&fnamenewvb, instdir, v17);
varbuf_snapshot(fnamevb, &fname_state);
ensure_diversions();
ensure_statoverrides(0LL);
for ( m = 0; v26[m]; ++m )
{
if ( setjmp(env) )
{
pop_error_context(2LL);
if ( abort_processing )
break;
}
else
{
push_error_context_jump(env, &print_error_perarchive, v26[m]);
dpkg_selabel_load();
process_archive(v26[m]);
++onerr_abort;
v18 = gettext("<standard output>");
m_output(stdout, v18);
v19 = gettext("<standard error>");
m_output(stderr, v19);
--onerr_abort;
pop_error_context(1LL);
}
}
dpkg_selabel_close();
free(ptr);
v20 = *(_DWORD *)(cipaction + 40LL);
if ( v20 != 38 )
{
if ( v20 > 38 )
goto LABEL_46;
if ( v20 != 1 )
{
if ( v20 > 0 && (unsigned int)(v20 - 2) <= 4 )
{
process_queue();
goto LABEL_47;
}
LABEL_46:
do_internerr("archives.c", 1607LL, "archivefiles", "unknown action '%d'", *(unsigned int *)(cipaction + 40LL));
}
}
LABEL_47:
trigproc_run_deferred();
modstatdb_shutdown();
return 0LL;
}
|
int
gettok(char *line, char *dest, int size, int eatspace)
{
int bpos, epos, eaten;
char *t;
bpos = strchr(line, '[') - line;
if (bpos < 0) {
fprintf(
stderr
, "Extraneous newline in file. Exiting.");
exit(1);
}
line += 1 + bpos;
epos = strchr(line, ']') - line;
if (epos < 0) {
fprintf(
stderr
, "Extraneous newline in file. Exiting.");
exit(1);
}
line[epos] = '\0';
eaten = bpos + epos + 1;
if (eatspace)
if ((t = strchr(line, ' ')))
*t = 0;
strncpy(dest, line, size);
return eaten + 1;
}
| int gettok(char *a0, char *a1, unsigned long a2, unsigned long a3) {
char *v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
char *v4;
v0 = a0;
v1 = strchr(v0, 0x5b) - v0;
if (v1 < 0) {
fprintf(*(&stderr), "Extraneous newline in file. Exiting.");
exit(0x1);
}
v0 = &v0[1 + v1];
v2 = strchr(v0, 0x5d) - v0;
if (v2 < 0) {
fprintf(*(&stderr), "Extraneous newline in file. Exiting.");
exit(0x1);
}
v0[v2] = 0;
v3 = v2 + v1 + 1;
if (a3) {
v4 = strchr(v0, 0x20);
if (v4)
*(v4) = 0;
}
strncpy(a1, v0, a2);
return v3 + 1;
}
|
long long
strtonum(const char *numstr, long long minval, long long maxval,
const char **errstrp)
{
long long ll = 0;
char *ep;
int error = 0;
struct errval {
const char *errstr;
int err;
} ev[4] = {
{
((void *)0)
, 0 },
{ "invalid",
22
},
{ "too small",
34
},
{ "too large",
34
},
};
ev[0].err =
(*__errno_location ())
;
(*__errno_location ())
= 0;
if (minval > maxval)
error = 1;
else {
ll = strtoll(numstr, &ep, 10);
if (numstr == ep || *ep != '\0')
error = 1;
else if ((ll ==
(-0x7fffffffffffffffLL - 1LL)
&&
(*__errno_location ())
==
34
) || ll < minval)
error = 2;
else if ((ll == 0x7fffffffffffffffLL &&
(*__errno_location ())
==
34
) || ll > maxval)
error = 3;
}
if (errstrp !=
((void *)0)
)
*errstrp = ev[error].errstr;
(*__errno_location ())
= ev[error].err;
if (error)
ll = 0;
return (ll);
}
| long strtonum(char *a1, long a2, long a3, _QWORD *a4)
{
int v7;
char *endptr;
long v9;
long v10;
int v11[2];
const char *v12;
int v13;
const char *v14;
int v15;
const char *v16;
int v17;
unsigned long v18;
v18 = __readfsqword(0x28u);
v9 = 0LL;
v7 = 0;
v10 = 0LL;
v11[0] = 0;
v12 = "invalid";
v13 = 22;
v14 = "too small";
v15 = 34;
v16 = "too large";
v17 = 34;
v11[0] = *_errno_location();
*_errno_location() = 0;
if ( a2 <= a3 )
{
v9 = strtoll(a1, &endptr, 10);
if ( a1 == endptr || *endptr )
{
v7 = 1;
}
else if ( v9 == 0x8000000000000000LL && *_errno_location() == 34 || v9 < a2 )
{
v7 = 2;
}
else if ( v9 == 0x7FFFFFFFFFFFFFFFLL && *_errno_location() == 34 || v9 > a3 )
{
v7 = 3;
}
}
else
{
v7 = 1;
}
if ( a4 )
*a4 = *(_QWORD *)&v11[4 * v7 - 2];
*_errno_location() = v11[4 * v7];
if ( v7 )
return 0LL;
return v9;
}
|
static void
linkpath_decoder (struct tar_stat_info *st,
char const *keyword __attribute__((unused)),
char const *arg,
size_t size __attribute__((unused)))
{
decode_string (&st->link_name, arg);
}
| long long linkpath_decoder(unsigned long a0, unsigned long a1, unsigned long long a2, unsigned long a3) {
unsigned long v0;
unsigned long v1;
v1 = a1;
v0 = a3;
return decode_string(a0 + 24, a2);
}
|
static char *
channel_format_status(const Channel *c)
{
char *ret =
((void *)0)
;
xasprintf(&ret, "t%d %s%u i%u/%zu o%u/%zu e[%s]/%zu "
"fd %d/%d/%d sock %d cc %d io 0x%02x/0x%02x",
c->type,
c->have_remote_id ? "r" : "nr", c->remote_id,
c->istate, sshbuf_len(c->input),
c->ostate, sshbuf_len(c->output),
channel_format_extended_usage(c), sshbuf_len(c->extended),
c->rfd, c->wfd, c->efd, c->sock, c->ctl_chan,
c->io_want, c->io_ready);
return ret;
}
| int channel_format_status(struct_0 *a0) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
unsigned long v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
unsigned long v10;
unsigned long v11;
unsigned int v12;
unsigned int v13;
unsigned int v14;
unsigned int v15;
unsigned int v16;
unsigned int v17;
void* v18;
unsigned long long v20;
unsigned long long v22;
unsigned long long v23;
v18 = 0;
v17 = a0->field_44;
v16 = a0->field_28;
v15 = a0->field_24;
v14 = a0->field_20;
v13 = a0->field_1c;
v20 = sshbuf_len(a0->field_78);
v22 = sshbuf_len(a0->field_70);
v12 = a0->field_14;
v23 = sshbuf_len(a0->field_68);
v11 = a0->field_30;
v10 = a0->field_2c;
v9 = v17;
v8 = v16;
v7 = v15;
v6 = v14;
v5 = v13;
v4 = v20;
v3 = channel_format_extended_usage(a0);
v2 = v22;
v1 = v12;
v0 = v23;
xasprintf(&v18, "t%d %s%u i%u/%zu o%u/%zu e[%s]/%zu fd %d/%d/%d sock %d cc %d io 0x%02x/0x%02x", a0->field_0);
return v18;
}
|
int
reportbroken_retexitstatus(int ret)
{
if (reports) {
fputs(gettext("Errors were encountered while processing:\n"),
stderr
);
while (reports) {
fprintf(
stderr
," %s\n",reports->what);
free(reports->what);
reports= reports->next;
}
}
if (abort_processing) {
fputs(gettext("Processing was halted because there were too many errors.\n"),
stderr
);
}
return nerrs ? 1 : ret;
}
| undefined4 reportbroken_retexitstatus(undefined4 param_1)
{
FILE *pFVar1;
char *pcVar2;
pFVar1 = stderr;
if (reports != (undefined8 *)0x0) {
pcVar2 = (char *)gettext("Errors were encountered while processing:\n");
fputs(pcVar2,pFVar1);
for (; reports != (undefined8 *)0x0; reports = (undefined8 *)*reports) {
fprintf(stderr," %s\n",reports[1]);
free((void *)reports[1]);
}
}
pFVar1 = stderr;
if (abort_processing != '\0') {
pcVar2 = (char *)gettext("Processing was halted because there were too many errors.\n");
fputs(pcVar2,pFVar1);
}
if (nerrs != 0) {
param_1 = 1;
}
return param_1;
}
|
static inline __u8 rta_getattr_u8(const struct rtattr *rta)
{
return *(__u8 *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| int rta_getattr_u8(struct_0 *a0) {
return a0->field_4;
}
|
static int
do_local_cmd(arglist *a)
{
u_int i;
int status;
pid_t pid;
if (a->num == 0)
sshfatal("scp.c", __func__, 231, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "do_local_cmd: no arguments");
if (verbose_mode) {
fprintf(
stderr
, "Executing:");
for (i = 0; i < a->num; i++)
fmprintf(
stderr
, " %s", a->list[i]);
fprintf(
stderr
, "\n");
}
if ((pid = fork()) == -1)
sshfatal("scp.c", __func__, 240, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "do_local_cmd: fork: %s", strerror(
(*__errno_location ())
));
if (pid == 0) {
execvp(a->list[0], a->list);
perror(a->list[0]);
exit(1);
}
do_cmd_pid = pid;
ssh_signal(
15
, killchild);
ssh_signal(
2
, killchild);
ssh_signal(
1
, killchild);
while (waitpid(pid, &status, 0) == -1)
if (
(*__errno_location ())
!=
4
)
sshfatal("scp.c", __func__, 255, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "do_local_cmd: waitpid: %s", strerror(
(*__errno_location ())
));
do_cmd_pid = -1;
if (!
(((
status
) & 0x7f) == 0)
||
(((
status
) & 0xff00) >> 8)
!= 0)
return (-1);
return (0);
}
| undefined8 do_local_cmd(long *param_1)
{
int iVar1;
char **__argv;
__pid_t _Var2;
int *piVar3;
char *pcVar4;
undefined8 uVar5;
char **ppcVar6;
undefined *puVar7;
long in_FS_OFFSET;
char *apcStack96 [5];
undefined auStack56 [8];
long *local_30;
uint local_1c;
uint local_18;
__pid_t local_14;
long local_10;
ppcVar6 = (char **)auStack56;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_30 = param_1;
if (*(int *)(param_1 + 1) == 0) {
ppcVar6 = apcStack96 + 3;
apcStack96[3] = "do_local_cmd: no arguments";
sshfatal("scp.c","do_local_cmd",0xe7,0,1,0);
}
if (verbose_mode != 0) {
*(undefined8 *)((long)ppcVar6 + -8) = 0x1001f0;
fprintf(stderr,"Executing:");
for (local_18 = 0; local_18 < *(uint *)(local_30 + 1); local_18 = local_18 + 1) {
uVar5 = *(undefined8 *)(*local_30 + (ulong)local_18 * 8);
*(undefined8 *)((long)ppcVar6 + -8) = 0x100228;
fmprintf(stderr,&DAT_00106c2f,uVar5);
}
*(undefined8 *)((long)ppcVar6 + -8) = 0x100253;
fprintf(stderr,"\n");
}
*(undefined8 *)((long)ppcVar6 + -8) = 0x100258;
local_14 = fork();
puVar7 = (undefined *)ppcVar6;
if (local_14 == -1) {
*(undefined8 *)((long)ppcVar6 + -8) = 0x100266;
piVar3 = __errno_location();
iVar1 = *piVar3;
*(undefined8 *)((long)ppcVar6 + -8) = 0x10026f;
pcVar4 = strerror(iVar1);
*(char **)((long)ppcVar6 + -8) = pcVar4;
puVar7 = (undefined *)((long)ppcVar6 + -0x10);
*(char **)((long)ppcVar6 + -0x10) = "do_local_cmd: fork: %s";
*(undefined8 *)((long)ppcVar6 + -0x18) = 0x1002a6;
sshfatal("scp.c","do_local_cmd",0xf0,0,1,0);
}
if (local_14 == 0) {
__argv = (char **)*local_30;
pcVar4 = *(char **)*local_30;
*(undefined8 *)(puVar7 + -8) = 0x1002c8;
execvp(pcVar4,__argv);
pcVar4 = *(char **)*local_30;
*(undefined8 *)(puVar7 + -8) = 0x1002da;
perror(pcVar4);
*(undefined8 *)(puVar7 + -8) = 0x1002e4;
exit(1);
}
do_cmd_pid = local_14;
*(undefined8 *)(puVar7 + -8) = 0x1002fe;
ssh_signal(0xf,0x100000);
*(undefined8 *)(puVar7 + -8) = 0x10030f;
ssh_signal(2,0x100000);
*(undefined8 *)(puVar7 + -8) = 0x100320;
ssh_signal(1,0x100000);
while( true ) {
*(undefined8 *)(puVar7 + -8) = 0x100389;
_Var2 = waitpid(local_14,(int *)&local_1c,0);
if (_Var2 != -1) break;
*(undefined8 *)(puVar7 + -8) = 0x100327;
piVar3 = __errno_location();
if (*piVar3 != 4) {
*(undefined8 *)(puVar7 + -8) = 0x100333;
piVar3 = __errno_location();
iVar1 = *piVar3;
*(undefined8 *)(puVar7 + -8) = 0x10033c;
pcVar4 = strerror(iVar1);
*(char **)(puVar7 + -8) = pcVar4;
*(char **)(puVar7 + -0x10) = "do_local_cmd: waitpid: %s";
*(undefined8 *)(puVar7 + -0x18) = 0x100373;
sshfatal("scp.c","do_local_cmd",0xff,0,1,0);
puVar7 = puVar7 + -0x10;
}
}
do_cmd_pid = 0xffffffff;
if (((local_1c & 0x7f) == 0) && (((int)local_1c >> 8 & 0xffU) == 0)) {
uVar5 = 0;
}
else {
uVar5 = 0xffffffff;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)(puVar7 + -8) = 0x1003cf;
__stack_chk_fail();
}
do_cmd_pid = 0xffffffff;
return uVar5;
}
|
static int
yyerror (parser_control const *pc __attribute__ ((__unused__)),
char const *s __attribute__ ((__unused__)))
{
return 0;
}
| undefined8 yyerror(void)
{
return 0;
}
|
int hasttygrp(void)
{
struct group *grp;
if ((grp = getgrnam("tty")) !=
((void *)0)
)
return 1;
return 0;
}
| bool hasttygrp(void)
{
group *pgVar1;
pgVar1 = getgrnam("tty");
return pgVar1 != (group *)0x0;
}
|
void
unspace(char *s, int len)
{
while (*s && *s != ' ' && len--)
++s;
if (len > 0)
*s = '\0';
}
| long long unspace(unsigned long long a0, unsigned long a1) {
unsigned int v0;
int tmp_9;
char *v1;
unsigned long long v3;
v1 = a0;
v0 = a1;
while (true) {
v3 = *(v1);
switch (*(v1)) {
case 32:
v3 = *(v1);
case 0:
LABEL_40047c:
if (v0 > 0) {
v3 = v1;
*(v1) = 0;
break;
}
default:
v3 = *(v1);
goto LABEL_40046d;
}
LABEL_40046d:
tmp_9 = v0;
v3 = v0;
v0 -= 1;
if (!tmp_9)
goto LABEL_40047c;
v1 += 1;
}
return v3;
}
|
static void
set_argv0 ()
{
SHELL_VAR *v;
v = find_variable ("BASH_ARGV0");
if (v && ((((v)->attributes) & (0x0008000))))
assign_bash_argv0 (v, ((v)->value), 0, 0);
}
| void set_argv0() {
struct_0 *v0;
unsigned long long v3;
unsigned long long v4;
*(&v0) = find_variable("BASH_ARGV0");
if (v0) {
v3 = v0->field_28 & 0x8000;
if ((v0->field_28 & 0x8000))
v4 = assign_bash_argv0(v0, v0->field_8, 0x0, 0x0);
}
return;
}
|
int
sshpkt_put(struct ssh *ssh, const void *v, size_t len)
{
return sshbuf_put(ssh->state->outgoing_packet, v, len);
}
| void sshpkt_put(long *param_1,undefined8 param_2,undefined8 param_3)
{
sshbuf_put(*(undefined8 *)(*param_1 + 0x30),param_2,param_3);
return;
}
|
static void send_tree (tree, max_code)
ct_data *tree;
int max_code;
{
int n;
int prevlen = -1;
int curlen;
int nextlen = tree[0].dl.len;
int count = 0;
int max_count = 7;
int min_count = 4;
if (nextlen == 0) max_count = 138, min_count = 3;
for (n = 0; n <= max_code; n++) {
curlen = nextlen; nextlen = tree[n+1].dl.len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
do { send_bits(bl_tree[curlen].fc.code, bl_tree[curlen].dl.len); } while (--count != 0);
} else if (curlen != 0) {
if (curlen != prevlen) {
send_bits(bl_tree[curlen].fc.code, bl_tree[curlen].dl.len); count--;
}
;
send_bits(bl_tree[16].fc.code, bl_tree[16].dl.len); send_bits(count-3, 2);
} else if (count <= 10) {
send_bits(bl_tree[17].fc.code, bl_tree[17].dl.len); send_bits(count-3, 3);
} else {
send_bits(bl_tree[18].fc.code, bl_tree[18].dl.len); send_bits(count-11, 7);
}
count = 0; prevlen = curlen;
if (nextlen == 0) {
max_count = 138, min_count = 3;
} else if (curlen == nextlen) {
max_count = 6, min_count = 3;
} else {
max_count = 7, min_count = 4;
}
}
}
| void send_tree(struct_0 *a0, unsigned long a1, unsigned long long a2, unsigned long long a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned long long v8;
v1 = -1;
v2 = a0->field_2;
v3 = 0;
v4 = 7;
v5 = 4;
if (!v2) {
v4 = 138;
v5 = 3;
}
v0 = 0;
while (true) {
v8 = v0;
if (v0 > a1)
break;
v6 = v2;
v2 = a0[1 + v0].field_2;
v3 += 1;
if (v3 >= v4 || v6 != v2) {
if (v3 < v5) {
do {
send_bits(*(&(&bl_tree)[4 * v6]), *(&(&g_402e42)[4 * v6]), *(&(&g_402e42)[4 * v6]), v6 * 4);
v3 -= 1;
} while (v3);
} else if (v6) {
if (v6 != v1) {
send_bits(*(&(&bl_tree)[4 * v6]), *(&(&g_402e42)[4 * v6]), *(&(&g_402e42)[4 * v6]), v6 * 4);
v3 -= 1;
}
send_bits(g_402e80, g_402e82, g_402e82, a3);
send_bits(v3 - 3, 0x2, a2, a3);
} else if (v3 > 10) {
send_bits(g_402e88, g_402e8a, g_402e8a, a3);
send_bits(v3 - 11, 0x7, a2, a3);
} else {
send_bits(g_402e84, g_402e86, g_402e86, a3);
send_bits(v3 - 3, 0x3, a2, a3);
}
v3 = 0;
v1 = v6;
if (!v2) {
v4 = 138;
v5 = 3;
} else if (v6 == v2) {
v4 = 6;
v5 = 3;
} else {
v4 = 7;
v5 = 4;
}
}
v0 += 1;
}
return;
}
|
size_t
sshbuf_len(const struct sshbuf *buf)
{
if (sshbuf_check_sanity(buf) != 0)
return 0;
return buf->size - buf->off;
}
| long sshbuf_len(long a1)
{
if ( (unsigned int)sshbuf_check_sanity(a1) )
return 0LL;
else
return *(_QWORD *)(a1 + 24) - *(_QWORD *)(a1 + 16);
}
|
int
sshbuf_get_eckey(struct sshbuf *buf, EC_KEY *v)
{
EC_POINT *pt = EC_POINT_new(EC_KEY_get0_group(v));
int r;
const u_char *d;
size_t len;
if (pt ==
((void *)0)
) {
;
return -2;
}
if ((r = sshbuf_peek_string_direct(buf, &d, &len)) < 0) {
EC_POINT_free(pt);
return r;
}
if ((r = get_ec(d, len, pt, EC_KEY_get0_group(v))) != 0) {
EC_POINT_free(pt);
return r;
}
if (EC_KEY_set_public_key(v, pt) != 1) {
EC_POINT_free(pt);
return -2;
}
EC_POINT_free(pt);
if (sshbuf_get_string_direct(buf,
((void *)0)
,
((void *)0)
) != 0) {
;
;
return -1;
}
return 0;
}
| long long sshbuf_get_eckey(unsigned long long a0, unsigned long long a1) {
unsigned int v0;
char v1;
char v2;
unsigned long long v3;
unsigned long long v5;
v3 = EC_POINT_new(EC_KEY_get0_group(a1));
if (!v3) {
v5 = 4294967294;
return v5;
}
v0 = sshbuf_peek_string_direct(a0, &v1, &v2, &v1);
if (v0 < 0) {
EC_POINT_free(v3);
v5 = v0;
return v5;
}
v0 = get_ec(*(&v1), *(&v2), v3, EC_KEY_get0_group(a1));
if (v0) {
EC_POINT_free(v3);
v5 = v0;
return v5;
} else if (EC_KEY_set_public_key(a1, v3, v3) != 1) {
EC_POINT_free(v3);
v5 = 4294967294;
return v5;
} else {
EC_POINT_free(v3);
v5 = (!sshbuf_get_string_direct(a0, 0x0, 0x0) ? 4294967295 : 0);
return v5;
}
}
|
int
rl_vi_redo (int count, int c)
{
int r;
if (rl_explicit_arg == 0)
{
rl_numeric_arg = _rl_vi_last_repeat;
rl_arg_sign = _rl_vi_last_arg_sign;
}
r = 0;
_rl_vi_redoing = 1;
if (_rl_vi_last_command == 'i' && vi_insert_buffer && *vi_insert_buffer)
{
_rl_vi_stuff_insert (count);
if (rl_point > 0)
_rl_vi_backup ();
}
else if (_rl_vi_last_command == 'R' && vi_insert_buffer && *vi_insert_buffer)
{
_rl_vi_replace_insert (count);
if (rl_point > 0)
_rl_vi_backup ();
}
else if (_rl_vi_last_command == 'I' && vi_insert_buffer && *vi_insert_buffer)
{
rl_beg_of_line (1, 'I');
_rl_vi_stuff_insert (count);
if (rl_point > 0)
_rl_vi_backup ();
}
else if (_rl_vi_last_command == 'a' && vi_insert_buffer && *vi_insert_buffer)
{
_rl_vi_append_forward ('a');
_rl_vi_stuff_insert (count);
if (rl_point > 0)
_rl_vi_backup ();
}
else if (_rl_vi_last_command == 'A' && vi_insert_buffer && *vi_insert_buffer)
{
rl_end_of_line (1, 'A');
_rl_vi_stuff_insert (count);
if (rl_point > 0)
_rl_vi_backup ();
}
else if (_rl_vi_last_command == '.' && _rl_keymap == vi_movement_keymap)
{
rl_ding ();
r = 0;
}
else
r = _rl_dispatch (_rl_vi_last_command, _rl_keymap);
_rl_vi_redoing = 0;
return (r);
}
| long long rl_vi_redo(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
unsigned int v1;
v0 = a1;
if (!rl_explicit_arg) {
rl_numeric_arg = _rl_vi_last_repeat;
rl_arg_sign = _rl_vi_last_arg_sign;
}
v1 = 0;
_rl_vi_redoing = 1;
if (_rl_vi_last_command == 105 && vi_insert_buffer && *(vi_insert_buffer)) {
_rl_vi_stuff_insert(a0, a1, a2, a3, a4, a5);
if (*(&rl_point) > 0) {
_rl_vi_backup();
goto LABEL_400416;
}
}
if (_rl_vi_last_command == 82 && vi_insert_buffer && *(vi_insert_buffer)) {
_rl_vi_replace_insert(a0, a1, a2, a3, a4, a5);
if (*(&rl_point) > 0) {
_rl_vi_backup();
goto LABEL_400416;
}
}
if (_rl_vi_last_command == 73 && vi_insert_buffer && *(vi_insert_buffer)) {
rl_beg_of_line(0x1, 0x49);
_rl_vi_stuff_insert(a0, 0x49, a2, a3, a4, a5);
if (*(&rl_point) > 0) {
_rl_vi_backup();
goto LABEL_400416;
}
}
if (_rl_vi_last_command == 97 && vi_insert_buffer && *(vi_insert_buffer)) {
_rl_vi_append_forward(0x61);
_rl_vi_stuff_insert(a0, a1, a2, a3, a4, a5);
if (*(&rl_point) > 0) {
_rl_vi_backup();
goto LABEL_400416;
}
}
if (_rl_vi_last_command == 65 && vi_insert_buffer && *(vi_insert_buffer)) {
rl_end_of_line(0x1, 0x41);
_rl_vi_stuff_insert(a0, 0x41, a2, a3, a4, a5);
if (*(&rl_point) > 0) {
_rl_vi_backup();
goto LABEL_400416;
}
}
if (_rl_vi_last_command == 46 && _rl_keymap == 5242992) {
rl_ding();
v1 = 0;
goto LABEL_400416;
}
v1 = _rl_dispatch(_rl_vi_last_command, _rl_keymap, _rl_keymap);
LABEL_400416:
_rl_vi_redoing = 0;
return v1;
}
|
static void
showjob(struct output *out, struct job *jp, int mode)
{
struct procstat *ps;
struct procstat *psend;
int col;
int indent;
char s[80];
ps = jp->ps;
if (mode & 0x01) {
outfmt(out, "%d\n", ps->pid);
return;
}
col = fmtstr(s, 16, "[%d] ", jobno(jp));
indent = col;
if (jp == curjob)
s[col - 2] = '+';
else if (curjob && jp == curjob->prev_job)
s[col - 2] = '-';
if (mode & 0x04)
col += fmtstr(s + col, 16, "%d ", ps->pid);
psend = ps + jp->nprocs;
if (jp->state == 0) {
((void)strcpy(s + col, "Running"));
col += strlen("Running");
} else {
int status = psend[-1].status;
if (jp->state == 1)
status = jp->stopstatus;
col += sprint_status(s + col, status, 0);
}
goto start;
do {
col = fmtstr(s, 48, " |\n%*c%d ", indent, ' ', ps->pid) - 3;
start:
outfmt(
out, "%s%*c%s",
s, 33 - col >= 0 ? 33 - col : 0, ' ', ps->cmd
);
if (!(mode & 0x04)) {
showpipe(jp, out);
break;
}
if (++ps == psend) {
outcslow('\n', out);
break;
}
} while (1);
jp->changed = 0;
if (jp->state == 2) {
;
freejob(jp);
}
}
| void showjob(unsigned long a0, struct_0 *a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long v3;
struct_1 *v4;
char v5;
char v6;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long *v13;
unsigned long long v14;
v3 = a1->field_10;
if (!(a2 & 1)) {
v0 = fmtstr(&v5, 0x10, "[%d] ", jobno(a1));
v2 = v0;
if (a1 == curjob) {
(&v5)[2 + v0] = 43;
} else if (curjob && a1 == *((curjob + 32))) {
(&v5)[2 + v0] = 45;
}
if ((a2 & 4))
v0 += fmtstr(&(&v5)[v0], 0x10, "%d ", *(v3));
v4 = &v3[4 * a1->field_1c];
if (a1->field_1e) {
v1 = *(&v4->padding_0[12]);
if (a1->field_1e == 1)
v1 = a1->field_18;
v0 += sprint_status(&(&v5)[v0], v1, 0x0);
} else {
strcpy(&(&v5)[v0], "Running");
v0 += strlen("Running");
}
while (true) {
outfmt(a0, "%s%*c%s", &v5);
if (!(a2 & 4)) {
showpipe(a1, a0, a0, v10, v11, v12);
break;
} else {
v3 += 4;
if (v3 != v4) {
v0 = fmtstr(&v5, 0x30, " |\n%*c%d ", v2) - 3;
} else {
outcslow(0xa, a0);
break;
}
}
}
a1->field_1f = a1->field_1f & 4294967279;
if (a1->field_1e == 2)
freejob(a1);
} else {
outfmt(a0, "%d\n", *(v3));
}
v14 = *(&v6) ^ v13[5];
return;
}
|
static char *
evalvar(char *p, int flag)
{
int subtype;
int varflags;
char *var;
int patloc;
int startloc;
ssize_t varlen;
int discard;
int quoted;
varflags = *p++;
subtype = varflags & 0x0f;
quoted = flag & 0x100;
var = p;
startloc = expdest - (char *)((void *)stacknxt);
p = strchr(p, '=') + 1;
again:
varlen = varvalue(var, varflags, flag, quoted);
if (varflags & 0x10)
varlen--;
discard = varlen < 0 ? 0x400 : 0;
switch (subtype) {
case 0x3:
discard ^= 0x400;
case 0:
case 0x2:
p = argstr(p, flag | 0x2 | 0x80 |
(discard ^ 0x400));
goto record;
case 0x5:
case 0x4:
p = subevalvar(p, var, 0, startloc, varflags,
(flag & ~(0x1 | 0x10)) |
(discard ^ 0x400));
if ((flag | ~discard) & 0x400)
goto record;
varflags &= ~0x10;
subtype = 0x1;
goto again;
}
if ((discard & ~flag) && optlist[14])
varunset(p, var, 0, 0);
if (subtype == 0xa) {
p++;
if (flag & 0x400)
return p;
cvtnum(varlen > 0 ? varlen : 0, flag);
goto really_record;
}
if (subtype == 0x1)
goto record;
flag |= discard;
if (!(flag & 0x400)) {
((expdest) = _STPUTC(('\0'), (expdest)));
}
patloc = expdest - (char *)((void *)stacknxt);
p = subevalvar(p,
((void *)0)
, patloc, startloc, varflags, flag);
record:
if ((flag | discard) & 0x400)
return p;
really_record:
if (quoted) {
quoted = *var == '@' && shellparam.nparam;
if (!quoted)
return p;
}
recordregion(startloc, expdest - (char *)((void *)stacknxt), quoted);
return p;
}
| int evalvar(unsigned long a0, unsigned long a1) {
unsigned int v0;
int tmp_45;
int tmp_19;
int tmp_30;
int tmp_39;
void* v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned long v8;
char *v9;
unsigned int v12;
unsigned long long v14;
v1 = a0;
v0 = a1;
tmp_45 = v1;
v1 += 1;
v3 = *(tmp_45);
v2 = v3 & 15;
v5 = v0 & 0x100;
v9 = v1;
v6 = expdest - stacknxt;
v12 = strchr(v1, 0x3d) + 1;
v1 = v12;
while (true) {
v8 = varvalue(v9, v3, v0, v5);
if ((v3 & 16))
v8 -= 1;
v4 = (v8 >> 53) & 0x400;
if (v2 > 5) {
LABEL_4011cb:
if ((!(v0) & v4) && g_5000f6)
varunset(v1, v9, 0x0, 0x0);
switch (v2) {
case 10:
v1 += 1;
if ((v0 & 0x400)) {
v12 = v1;
return v12;
}
v12 = (!v8 - 0 >> 63 ? 0 : v8);
cvtnum(v12, v0);
break;
case 1:
LABEL_4012b4:
if (((v0 | v4) & 0x400)) {
v12 = v1;
return v12;
}
default:
v0 |= v4;
if (!(v0 & 0x400))
expdest = _STPUTC(0x0, expdest);
v7 = expdest - stacknxt;
v1 = subevalvar(v1, 0x0, v7, v6, v3, v0);
goto LABEL_4012b4;
}
if (v5) {
if (*(v9) != 64 || !shellparam)
v12 = 0;
else
v12 = 1;
v5 = v12;
if (!v5) {
v12 = v1;
break;
}
}
recordregion(v6, expdest - stacknxt, v5);
v12 = v1;
return v12;
}
if (v2 < 4) {
if (v2 == 3) {
v4 ^= 0x400;
v14 = v0;
*(&v14) = v0 | 130;
tmp_19 = v14;
goto LABEL_0x40114e;
}
if (!(v2 <= 3) || !(!v2) && !(v2 == 2))
goto LABEL_4011cb;
v14 = v0;
*(&v14) = v0 | 130;
tmp_19 = v14;
}
v12 = v4;
*(&v12) = (v4 >> 8) ^ 4;
if (v2 < 4) {
tmp_30 = v12;
v1 = argstr(v1, tmp_19 | tmp_30);
goto LABEL_4012b4;
} else {
tmp_39 = v12;
v1 = subevalvar(v1, v9, 0x0, v6, v3, v0 & -18 | tmp_39);
if (!(!((!(v4) | v0) & 0x400)))
goto LABEL_4012b4;
v3 &= -17;
v2 = 1;
}
}
return v12;
}
|
static int process_block(ext2_filsys fs,
blk64_t *block_nr,
e2_blkcnt_t blockcnt,
blk64_t ref_block __attribute__((unused)),
int ref_offset __attribute__((unused)),
void *priv_data)
{
struct process_block_struct *p;
struct problem_context *pctx;
blk64_t blk = *block_nr;
int ret_code = 0;
problem_t problem = 0;
e2fsck_t ctx;
p = (struct process_block_struct *) priv_data;
pctx = p->pctx;
ctx = p->ctx;
if (p->is_dir && blockcnt == 0 && blk == 0) {
pctx->errcode = ext2fs_add_dir_block2(fs->dblist, p->ino, 0, 0);
if (pctx->errcode) {
pctx->blk = blk;
pctx->num = blockcnt;
goto failed_add_dir_block;
}
p->last_db_block++;
}
if (blk == 0)
return 0;
if (p->previous_block && p->ino != 7) {
if (p->previous_block+1 != blk) {
if (ctx->options & 0x0800) {
char type = '?';
if (p->is_dir)
type = 'd';
else if (p->is_reg)
type = 'f';
printf((gettext ("%6lu(%c): expecting %6lu " "got phys %6lu (blkcnt %lld)\n"))
,
(unsigned long) pctx->ino, type,
(unsigned long) p->previous_block+1,
(unsigned long) blk,
(long long) blockcnt);
}
p->fragmented = 1;
}
}
if (p->is_dir && !ext2fs_has_feature_largedir(fs->super) &&
!pctx->inode->i_size_high &&
blockcnt > (1 << (21 - fs->super->s_log_block_size)))
problem = 0x010044;
if (p->is_dir && p->num_blocks + 1 >= p->max_blocks)
problem = 0x010044;
if (p->is_reg && p->num_blocks + 1 >= p->max_blocks)
problem = 0x010045;
if (!p->is_dir && !p->is_reg && blockcnt > 0)
problem = 0x010046;
if (blk < fs->super->s_first_data_block ||
blk >= ext2fs_blocks_count(fs->super))
problem = 0x01000E;
if (blockcnt < 0 &&
p->ino != 7 &&
blk < ctx->fs->super->s_blocks_count &&
ext2fs_test_block_bitmap2(ctx->block_metadata_map, blk)) {
pctx->blk = blk;
fix_problem(ctx, 0x010071, pctx);
if ((ctx->options & 0x0008) == 0)
ctx->flags |= 0x0008;
}
if (problem) {
p->num_illegal_blocks++;
if (p->ino != 7 &&
ref_block != 0 &&
ext2fs_test_block_bitmap2(ctx->block_metadata_map,
ref_block)) {
*block_nr = 0;
return 0;
}
if (!p->suppress && (p->num_illegal_blocks % 12) == 0) {
if (fix_problem(ctx, 0x010011, pctx)) {
p->clear = 1;
return 2;
}
if (fix_problem(ctx, 0x01002D, pctx)) {
p->suppress = 1;
set_latch_flags(0x0010,
0x0008, 0);
}
}
pctx->blk = blk;
pctx->blkcount = blockcnt;
if (fix_problem(ctx, problem, pctx)) {
blk = *block_nr = 0;
ret_code = 1;
p->inode_modified = 1;
if (problem == 0x010044)
return ret_code;
goto mark_dir;
} else
return 0;
}
if (p->ino == 7) {
if (blockcnt == (-2))
mark_block_used(ctx, blk);
p->num_blocks++;
} else if (!(ctx->fs->cluster_ratio_bits &&
p->previous_block &&
(((blk) >> (ctx->fs)->cluster_ratio_bits) ==
((p->previous_block) >> (ctx->fs)->cluster_ratio_bits)) &&
(blk & ((1 << (ctx->fs)->cluster_ratio_bits) - 1)) ==
((unsigned) blockcnt & ((1 << (ctx->fs)->cluster_ratio_bits) - 1)))) {
mark_block_used(ctx, blk);
p->num_blocks++;
} else if (has_unaligned_cluster_map(ctx, p->previous_block,
p->last_block, blk, blockcnt)) {
pctx->blk = blockcnt;
pctx->blk2 = blk;
fix_problem(ctx, 0x010074, pctx);
mark_block_used(ctx, blk);
mark_block_used(ctx, blk);
}
if (blockcnt >= 0)
p->last_block = blockcnt;
p->previous_block = blk;
mark_dir:
if (p->is_dir && (blockcnt >= 0)) {
while (++p->last_db_block < blockcnt) {
pctx->errcode = ext2fs_add_dir_block2(fs->dblist,
p->ino, 0,
p->last_db_block);
if (pctx->errcode) {
pctx->blk = 0;
pctx->num = p->last_db_block;
goto failed_add_dir_block;
}
}
pctx->errcode = ext2fs_add_dir_block2(fs->dblist, p->ino,
blk, blockcnt);
if (pctx->errcode) {
pctx->blk = blk;
pctx->num = blockcnt;
failed_add_dir_block:
fix_problem(ctx, 0x01002B, pctx);
ctx->flags |= 0x0001;
return 2;
}
}
return ret_code;
}
| long long process_block(struct_1 *a0, unsigned long long *a1, unsigned long a2, unsigned long long a3, unsigned long a4, struct_0 *a5) {
unsigned int v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned long v4;
struct_3 *v5;
struct_5 *v6;
unsigned long long v8;
unsigned long long v12;
unsigned long long v14;
unsigned long long v16;
v0 = a4;
v4 = *(a1);
v2 = 0;
v3 = 0;
v5 = a5->field_48;
v6 = a5->field_58;
if ((a5->field_4 & 1) && !a2 && !v4) {
v5->field_0 = ext2fs_add_dir_block2(a0->field_90, a5->field_0, 0x0, 0x0);
if (v5->field_0) {
v5->field_28 = v4;
v5->field_50 = a2;
} else {
a5->field_28 = a5->field_28 + 1;
}
}
if (!v4 && (!v5->field_0 || !(a5->field_4 & 1) || a2))
v8 = 0;
if (v4) {
if (a5->field_38 && a5->field_0 != 7 && v4 != a5->field_38 + 1) {
if ((v6->field_4c & 0x800)) {
v1 = 63;
if ((a5->field_4 & 1)) {
v1 = 100;
} else if ((a5->field_4 & 2)) {
v1 = 102;
}
printf(gettext("%6lu(%c): expecting %6lu got phys %6lu (blkcnt %lld)\n"));
}
a5->field_4 = a5->field_4 | 16;
}
if ((a5->field_4 & 1) && !ext2fs_has_feature_largedir(a0->field_20) && !v5->field_18->field_6c && a2 > 1 << ((21 - a0->field_20->field_18) & 31))
v3 = 65604;
if ((a5->field_4 & 1) && a5->field_8 + 1 >= a5->field_10)
v3 = 65604;
if ((a5->field_4 & 2) && a5->field_8 + 1 >= a5->field_10)
v3 = 65605;
if (!(a5->field_4 & 1) && !(a5->field_4 & 2) && a2 > 0)
v3 = 65606;
if (v4 < a0->field_20->field_14 || v4 >= ext2fs_blocks_count(a0->field_20))
v3 = 65550;
if ((a2 - 0 >> 63) && a5->field_0 != 7 && v4 < v6->field_0->field_20->field_4 && ext2fs_test_block_bitmap2(v6->field_390, v4, v4)) {
v5->field_28 = v4;
fix_problem(v6, 0x10071, v5);
if (!(v6->field_4c & 8))
v6->field_48 = v6->field_48 | 8;
}
if (v3) {
a5->field_30 = a5->field_30 + 1;
if (a5->field_0 != 7 && a3) {
v12 = ext2fs_test_block_bitmap2(v6->field_390, a3, a3);
if (v12) {
*(a1) = 0;
v8 = 0;
}
}
if ((!v12 || !a3 || a5->field_0 == 7) && !(a5->field_4 & 8) && !a5->field_30 - ((((a5->field_30 * 715827883 >> 33) - (a5->field_30 >> 31)) << 1) + ((a5->field_30 * 715827883 >> 33) - (a5->field_30 >> 31)) << 2)) {
v14 = fix_problem(v6, 0x10011, v5);
if (v14) {
a5->field_4 = a5->field_4 | 4;
v8 = 2;
} else if (fix_problem(v6, 0x1002d, v5)) {
a5->field_4 = a5->field_4 | 8;
set_latch_flags(0x10, 0x8, 0x0);
}
}
} else {
if (a5->field_0 == 7) {
if (a2 == -2)
mark_block_used(v6, v4);
a5->field_8 = a5->field_8 + 1;
} else {
if (...) {
v5->field_28 = a2;
v5->field_30 = v4;
fix_problem(v6, 0x10074, v5);
mark_block_used(v6, v4);
mark_block_used(v6, v4);
}
if (!a5->field_38 || !v6->field_0->field_c0 || v4 >> (v6->field_0->field_c0 & 63) != a5->field_38 >> (v6->field_0->field_c0 & 63) || ((1 << (v6->field_0->field_c0 & 31)) - 1 & v4) != ((1 << (v6->field_0->field_c0 & 31)) - 1 & a2)) {
mark_block_used(v6, v4);
a5->field_8 = a5->field_8 + 1;
}
}
if (!((a2 - 0 >> 63)))
a5->field_18 = a2;
a5->field_38 = v4;
}
}
if (...) {
v5->field_28 = v4;
v5->field_38 = a2;
v16 = fix_problem(v6, v3, v5);
if (v16) {
*(a1) = 0;
v4 = *(a1);
v2 = 1;
a5->field_4 = a5->field_4 | -128;
if (v3 == 65604)
v8 = v2;
} else {
v8 = 0;
}
}
if (...) {
while (true) {
a5->field_28 = a5->field_28 + 1;
if (a2 > a5->field_28) {
v5->field_0 = ext2fs_add_dir_block2(a0->field_90, a5->field_0, 0x0, a5->field_28);
if (!v5->field_0)
continue;
v5->field_28 = 0;
v5->field_50 = a5->field_28;
break;
} else {
v5->field_0 = ext2fs_add_dir_block2(a0->field_90, a5->field_0, v4, a2);
if (!v5->field_0)
break;
if (v5->field_0) {
v5->field_28 = v4;
v5->field_50 = a2;
break;
}
}
}
}
if (...)
v8 = v2;
if (...) {
fix_problem(v6, 0x1002b, v5);
v6->field_48 = v6->field_48 | 1;
v8 = 2;
}
return v8;
}
|
static
_Bool
file_ignored (char const *name)
{
return ((ignore_mode != IGNORE_MINIMAL
&& name[0] == '.'
&& (ignore_mode == IGNORE_DEFAULT || ! name[1 + (name[1] == '.')]))
|| (ignore_mode == IGNORE_DEFAULT
&& patterns_match (hide_patterns, name))
|| patterns_match (ignore_patterns, name));
}
| int file_ignored(char a0[2]) {
unsigned int v2;
unsigned int v3;
if (ignore_mode != 2 && a0[0] == 46 && (!ignore_mode || !(a0[(a0[1] == 46 ? 1 : 2)])) || !ignore_mode && patterns_match(hide_patterns, a0) || patterns_match(ignore_patterns, a0))
v2 = 1;
else
v2 = 0;
v3 = v2 & 1;
return v3;
}
|
void
cleanup_exit(int i)
{
if (the_active_state !=
((void *)0)
&& the_authctxt !=
((void *)0)
) {
do_cleanup(the_active_state, the_authctxt);
if (use_privsep && privsep_is_preauth &&
pmonitor !=
((void *)0)
&& pmonitor->m_pid > 1) {
sshlog("sshd.c", __func__, 2448, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Killing privsep child %d", pmonitor->m_pid);
if (kill(pmonitor->m_pid,
9
) != 0 &&
(*__errno_location ())
!=
3
) {
sshlog("sshd.c", __func__, 2451, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "kill(%d): %s", pmonitor->m_pid, strerror(
(*__errno_location ())
))
;
}
}
}
_exit(i);
}
| void cleanup_exit(unsigned long a0) {
unsigned long long v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
if (the_authctxt) {
do_cleanup(0xfc45c710ec8348, the_authctxt, the_authctxt);
if (use_privsep && privsep_is_preauth && pmonitor && *((pmonitor + 24)) > 1) {
v3 = *((pmonitor + 24));
v2 = "Killing privsep child %d";
sshlog("sshd.c", "cleanup_exit", 0x990, 0x0, 0x5, 0x0);
if (kill(*((pmonitor + 24)), 0x9) && *(__errno_location()) != 3) {
v2 = strerror(*(__errno_location()));
v1 = *((pmonitor + 24));
v0 = "kill(%d): %s";
sshlog("sshd.c", "cleanup_exit", 0x993, 0x1, 0x2, 0x0);
}
}
}
_exit(a0);
}
|
static inline
_Bool
nonexistent_file_errno (int errnum)
{
switch (errnum)
{
case
84
:
case
22
:
case
2
:
case
20
:
return
1
;
default:
return
0
;
}
}
| int nonexistent_file_errno(unsigned long a0) {
unsigned int v1;
if (a0 != 84 && (a0 > 84 || a0 != 22) && (a0 > 22 || a0 != 20 || a0 > 84) && (a0 > 22 || a0 > 84 || a0 != 2))
v1 = 0;
if (a0 == 84 || a0 <= 84 && a0 == 22 || a0 <= 22 && a0 == 20 && a0 <= 84 || a0 <= 22 && a0 <= 84 && a0 == 2)
v1 = 1;
return v1;
}
|
static pid_t
pipe_fork (int pipefds[2], size_t tries)
{
struct tempnode *saved_temphead;
int saved_errno;
double wait_retry = 0.25;
pid_t pid;
struct cs_status cs;
if (
rpl_pipe2
(pipefds,
02000000
) < 0)
return -1;
if (nmerge + 1 < nprocs)
reap_some ();
while (tries--)
{
cs_enter (&cs);
saved_temphead = temphead;
temphead =
((void *)0)
;
pid = fork ();
saved_errno =
(*__errno_location ())
;
if (pid)
temphead = saved_temphead;
cs_leave (&cs);
(*__errno_location ())
= saved_errno;
if (0 <= pid ||
(*__errno_location ())
!=
11
)
break;
else
{
xnanosleep (wait_retry);
wait_retry *= 2;
reap_exited ();
}
}
if (pid < 0)
{
saved_errno =
(*__errno_location ())
;
close (pipefds[0]);
close (pipefds[1]);
(*__errno_location ())
= saved_errno;
}
else if (pid == 0)
{
close (
0
);
close (
1
);
}
else
++nprocs;
return pid;
}
| int pipe_fork(unsigned int a0[2], unsigned long a1) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned long v3;
unsigned long long v4;
char v5;
unsigned int v7;
v0 = a1;
v3 = 0x3fd0000000000000;
if (rpl_pipe2(a0, 0x80000) < 0) {
v7 = -1;
return v7;
}
if (nmerge + 1 < nprocs)
reap_some();
while (true) {
v7 = v0;
v0 -= 1;
if (!v7)
break;
cs_enter(&v5);
v4 = temphead;
temphead = 0;
v1 = fork();
v7 = *(__errno_location());
v2 = v7;
if (v1)
temphead = v4;
cs_leave(&v5);
*(__errno_location()) = v2;
if (!(v1 < 0) || !((v7 = *(__errno_location()), v7 == 11)))
break;
xnanosleep();
v3 += v3;
reap_exited();
}
if (v1 < 0) {
v2 = *(__errno_location());
close(a0[0]);
close(a0[1]);
*(__errno_location()) = v2;
} else if (v1) {
nprocs = nprocs + 1;
} else {
close(0x0);
close(0x1);
}
v7 = v1;
return v7;
}
|
vi_to_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
{
return cv_csearch(el, (-1), -1, el->el_state.argument, 1);
}
| long long vi_to_prev_char(struct_0 *a0, unsigned long a1) {
unsigned int v0;
v0 = a1;
return cv_csearch(a0, 0xffffffff, 0xffffffff, a0->field_78, 0x1);
}
|
inline void ext2fs_mark_super_dirty(ext2_filsys fs)
{
fs->flags |= 0x04 | 0x02;
}
| void ext2fs_mark_super_dirty(void)
{
halt_baddata();
}
|
sh_builtin_func_t *
find_shell_builtin (name)
char *name;
{
current_builtin = builtin_address_internal (name, 0);
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)
((void *)0)
);
}
| undefined8 find_shell_builtin(undefined8 param_1)
{
undefined8 uVar1;
current_builtin = builtin_address_internal(param_1,0);
if (current_builtin == 0) {
uVar1 = 0;
}
else {
uVar1 = *(undefined8 *)(current_builtin + 8);
}
return uVar1;
}
|
ed_quoted_insert(EditLine *el, wint_t c __attribute__((__unused__)))
{
int num;
wchar_t ch;
tty_quotemode(el);
num = el_wgetc(el, &ch);
tty_noquotemode(el);
if (num == 1)
return ed_insert(el, ch);
else
return ed_end_of_file(el, 0);
}
| long long ed_quoted_insert(void* a0, unsigned long a1) {
unsigned int v0;
char v1;
unsigned int v2;
unsigned long long v4;
v0 = a1;
tty_quotemode(a0);
v2 = el_wgetc(a0, &v1, &v1);
tty_noquotemode(a0);
if (v2 == 1)
v4 = ed_insert(a0, *(&v1));
else
v4 = ed_end_of_file(a0, 0x0);
return v4;
}
|
(r = sshpkt_get_string(ssh,
((void *)0)
,
((void *)0)
)) != 0) {
free(msg);
return r;
}
| long sshpkt_get_string(long a1, long a2, long a3)
{
return sshbuf_get_string(*(_QWORD *)(*(_QWORD *)a1 + 56LL), a2, a3);
}
|
static int
evalcase(union node *n, int flags)
{
union node *cp;
union node *patp;
struct arglist arglist;
int status = 0;
errlinno = lineno = n->ncase.linno;
if (funcline)
lineno -= funcline - 1;
arglist.lastp = &arglist.list;
expandarg(n->ncase.expr, &arglist, 0x2);
for (cp = n->ncase.cases ; cp && evalskip == 0 ; cp = cp->nclist.next) {
for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) {
if (casematch(patp, arglist.list->text)) {
if (evalskip == 0 && cp->nclist.body) {
status = evaltree(cp->nclist.body,
flags);
}
goto out;
}
}
}
out:
return status;
}
| long evalcase(long a1, unsigned int a2)
{
unsigned int v3;
_QWORD *v4;
long i;
long v6[4];
v6[3] = __readfsqword(0x28u);
v3 = 0;
lineno = *(_DWORD *)(a1 + 4);
errlinno = lineno;
if ( funcline )
lineno -= funcline - 1;
v6[1] = (long)v6;
expandarg(*(_QWORD *)(a1 + 8), v6, 2LL);
v4 = *(_QWORD **)(a1 + 16);
LABEL_12:
if ( v4 && !evalskip )
{
for ( i = v4[2]; ; i = *(_QWORD *)(i + 8) )
{
if ( !i )
{
v4 = (_QWORD *)v4[1];
goto LABEL_12;
}
if ( (unsigned int)casematch(i, *(_QWORD *)(v6[0] + 8)) )
break;
}
if ( !evalskip && v4[3] )
return (unsigned int)evaltree(v4[3], a2);
}
return v3;
}
|
static
_Bool
find_closing_delim (const struct E_string *es, size_t start_idx,
char pre_bracket_char, size_t *result_idx)
{
for (size_t i = start_idx; i < es->len - 1; i++)
if (es->s[i] == pre_bracket_char && es->s[i + 1] == ']'
&& !es->escaped[i] && !es->escaped[i + 1])
{
*result_idx = i;
return
1
;
}
return
0
;
}
| int find_closing_delim(unsigned long long a0[3], unsigned long a1, unsigned long a2, unsigned long long *a3) {
char *v0;
unsigned int v2;
v0 = a1;
while (true) {
if (v0 < a0[2] - 1) {
if (a2 == v0[a0[0]] && v0[1 + a0[0]] == 93 && (v0[a0[1]] ^ 1) && (v0[1 + a0[1]] ^ 1)) {
*(a3) = v0;
v2 = 1;
break;
}
if (!(v0[a0[1]] ^ 1) || !(v0[1 + a0[1]] ^ 1) || a2 != v0[a0[0]] || v0[1 + a0[0]] != 93)
v0 += 1;
} else {
v2 = 0;
break;
}
}
return v2;
}
|
static
time_t get_int_date(const char *txt_val, int int_val, const char *msg)
{
if (batch) {
if (txt_val ==
((void *)0)
) {
time_t secs;
if (int_val == 0 || int_val < -2)
secs = days_to_secs(365);
else {
secs = days_to_secs(int_val);
}
return secs;
} else
return get_date(txt_val);
} else {
int days;
do {
days =
read_int(msg);
}
while (days == 0);
return days_to_secs(days);
}
}
| void get_int_date(unsigned long long a0, unsigned long a1, unsigned long long a2) {
unsigned int v0;
unsigned long long v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v7;
if (!*(got.batch)) {
do {
v0 = read_int(a2);
} while (!v0);
v4 = days_to_secs(v0);
} else if (a0) {
v3 = get_date(a0);
} else {
if (!a1) {
LABEL_407276:
*(&v1) = days_to_secs(0x16d);
} else {
if (a1 < -2)
goto LABEL_407276;
*(&v1) = days_to_secs(a1);
}
v7 = v1;
}
return;
}
|
static void
retop(struct bitmap *b)
{
if (b->top >= b->len)
return;
while (b->top > 0 && b->d[b->top] == 0)
b->top--;
}
| void retop(long *param_1)
{
if ((ulong)param_1[2] < (ulong)param_1[1]) {
while ((param_1[2] != 0 && (*(int *)(param_1[2] * 4 + *param_1) == 0))) {
param_1[2] = param_1[2] + -1;
}
}
return;
}
|
static int do_modify_nl(enum cmd c, enum macsec_nl_commands cmd, int ifindex,
struct rxsc_desc *rxsc, struct sa_desc *sa)
{
struct rtattr *attr_sa;
struct { struct nlmsghdr n; struct genlmsghdr g; char buf[( ((0)+4U -1) & ~(4U -1) ) + (1024)]; } req = { .n = { .nlmsg_type = (genl_family), .nlmsg_flags = (0x01), .nlmsg_len = ((( ((sizeof(struct genlmsghdr))+4U -1) & ~(4U -1) ) + (0)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))), }, .g = { .cmd = (cmd), .version = (1), }, };
addattr32(&req.n, 1024, MACSEC_ATTR_IFINDEX, ifindex);
if (rxsc) {
struct rtattr *attr_rxsc;
attr_rxsc = addattr_nest(&req.n, 1024,
MACSEC_ATTR_RXSC_CONFIG);
addattr64(&req.n, 1024,
MACSEC_RXSC_ATTR_SCI, rxsc->sci);
if (c != CMD_DEL && rxsc->active != 0xff)
addattr8(&req.n, 1024,
MACSEC_RXSC_ATTR_ACTIVE, rxsc->active);
addattr_nest_end(&req.n, attr_rxsc);
}
if (sa->an == 0xff)
goto talk;
attr_sa = addattr_nest(&req.n, 1024, MACSEC_ATTR_SA_CONFIG);
addattr8(&req.n, 1024, MACSEC_SA_ATTR_AN, sa->an);
if (c != CMD_DEL) {
if (sa->pn)
addattr32(&req.n, 1024, MACSEC_SA_ATTR_PN,
sa->pn);
if (sa->key_len) {
addattr_l(&req.n, 1024, MACSEC_SA_ATTR_KEYID,
sa->key_id, 16);
addattr_l(&req.n, 1024, MACSEC_SA_ATTR_KEY,
sa->key, sa->key_len);
}
if (sa->active != 0xff) {
addattr8(&req.n, 1024,
MACSEC_SA_ATTR_ACTIVE, sa->active);
}
}
addattr_nest_end(&req.n, attr_sa);
talk:
if (rtnl_talk(&genl_rth, &req.n,
((void *)0)
) < 0)
return -2;
return 0;
}
| undefined8 do_modify_nl(int param_1,undefined param_2,undefined4 param_3,long param_4,char *param_5)
{
int iVar1;
undefined8 uVar2;
long lVar3;
undefined8 *puVar4;
long in_FS_OFFSET;
undefined8 local_428;
undefined local_418;
undefined local_417;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
puVar4 = &local_428;
for (lVar3 = 0x82; lVar3 != 0; lVar3 = lVar3 + -1) {
*puVar4 = 0;
puVar4 = puVar4 + 1;
}
*(undefined4 *)puVar4 = 0;
local_428._0_4_ = 0x14;
local_428._4_2_ = (undefined2)genl_family;
local_428._6_2_ = 1;
local_417 = 1;
local_418 = param_2;
addattr32(&local_428,0x400,1,param_3);
if (param_4 != 0) {
uVar2 = addattr_nest(&local_428,0x400,2);
addattr64(&local_428,0x400,1,*(undefined8 *)(param_4 + 8));
if ((param_1 != 1) && (*(char *)(param_4 + 0x10) != -1)) {
addattr8(&local_428,0x400,2,*(undefined *)(param_4 + 0x10));
}
addattr_nest_end(&local_428,uVar2);
}
if (*param_5 != -1) {
uVar2 = addattr_nest(&local_428,0x400,3);
addattr8(&local_428,0x400,1,*param_5);
if (param_1 != 1) {
if (*(int *)(param_5 + 4) != 0) {
addattr32(&local_428,0x400,3,*(undefined4 *)(param_5 + 4));
}
if (*(int *)(param_5 + 0x18) != 0) {
addattr_l(&local_428,0x400,5,param_5 + 8,0x10);
addattr_l(&local_428,0x400,4,param_5 + 0x1c,*(undefined4 *)(param_5 + 0x18));
}
if (param_5[0x9c] != -1) {
addattr8(&local_428,0x400,2,param_5[0x9c]);
}
}
addattr_nest_end(&local_428,uVar2);
}
iVar1 = rtnl_talk(genl_rth,&local_428,0);
if (iVar1 < 0) {
uVar2 = 0xfffffffe;
}
else {
uVar2 = 0;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
}
|
static char *
human_time (struct timespec t)
{
static char str[((((((sizeof (intmax_t) * 8) - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) + 1)
+ (((((sizeof (int) * 8) - (! ((__typeof__ (int)) 0 < (__typeof__ (int)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (int)) 0 < (__typeof__ (int)) -1)))
+ 1
+ sizeof "-MM-DD HH:MM:SS.NNNNNNNNN +"];
static timezone_t tz;
if (!tz)
tz = tzalloc (getenv ("TZ"));
struct tm tm;
int ns = t.tv_nsec;
if (localtime_rz (tz, &t.tv_sec, &tm))
nstrftime (str, sizeof str, "%Y-%m-%d %H:%M:%S.%N %z", &tm, tz, ns);
else
{
char secbuf[((((((sizeof (intmax_t) * 8) - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) + 1)];
sprintf (str, "%s.%09d", timetostr (t.tv_sec, secbuf), ns);
}
return str;
}
| undefined1 * human_time(undefined8 param_1,undefined8 param_2)
{
char *pcVar1;
long lVar2;
undefined8 uVar3;
long in_FS_OFFSET;
undefined8 local_88;
undefined8 local_80;
uint local_6c;
undefined local_68 [64];
undefined local_28 [24];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_88 = param_1;
local_80 = param_2;
if (tz_6653 == 0) {
pcVar1 = getenv("TZ");
tz_6653 = tzalloc(pcVar1);
}
local_6c = (uint)local_80;
lVar2 = localtime_rz(tz_6653,&local_88,local_68);
if (lVar2 == 0) {
uVar3 = timetostr(local_88,local_28);
sprintf(str_6652,"%s.%09d",uVar3,(ulong)local_6c);
}
else {
nstrftime(str_6652,0x3d,"%Y-%m-%d %H:%M:%S.%N %z",local_68,tz_6653,local_6c);
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return str_6652;
}
|
static SHELL_VAR *
get_seconds (var)
SHELL_VAR *var;
{
time_t time_since_start;
struct timeval tv;
gettimeofday(&tv,
((void *)0)
);
time_since_start = tv.tv_sec - shell_start_time;
return (set_int_value (var, seconds_value_assigned + time_since_start, 1));
}
| long get_seconds(long a1)
{
struct timeval tv;
unsigned long v3;
v3 = __readfsqword(0x28u);
gettimeofday(&tv, 0LL);
return set_int_value(a1, seconds_value_assigned + tv.tv_sec - shell_start_time, 1);
}
|
static void
write_recent_blocks (union block *h, size_t blocks)
{
size_t i;
for (i = 0; i < blocks; i++)
{
new_record[new_blocks++] = h[i];
if (new_blocks == blocking_factor)
write_record (1);
}
}
| void write_recent_blocks(unsigned long long a0, unsigned long a1) {
unsigned long v0;
void* v1;
void* v2;
void* v4;
unsigned long long *v5;
unsigned long long *v6;
unsigned long long v7;
unsigned long v8;
v1 = a0;
v0 = a1;
v2 = 0;
while (true) {
v4 = v2;
if (v2 >= v0)
break;
new_blocks = new_blocks + 1;
*((new_blocks * 0x200 + new_record)) = *((0x200 * v2 + v1));
*((0x200 + new_blocks * 0x200 + new_record - 8)) = *((504 + 0x200 * v2 + v1));
v5 = new_blocks * 0x200 + new_record + 8 & -8;
v6 = v2 * 0x200 + v1 - (new_blocks * 0x200 + new_record - (new_blocks * 0x200 + new_record + 8 & -8));
for (v7 = (0x200 + (new_blocks * 0x200 + new_record - (new_blocks * 0x200 + new_record + 8 & -8)) & -8) >> 3; v7; v6 = &v6[v8]) {
v7 -= 1;
*(v5) = *(v6);
v5 = &v5[v8];
}
if (new_blocks == blocking_factor)
write_record(0x1);
v2 += 1;
}
return;
}
|
void
mux_exit_message(struct ssh *ssh, Channel *c, int exitval)
{
struct sshbuf *m;
Channel *mux_chan;
int r;
sshlog("mux.c", __func__, 1218, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "channel %d: exit message, exitval %d", c->self, exitval);
if ((mux_chan = channel_by_id(ssh, c->ctl_chan)) ==
((void *)0)
)
sshfatal("mux.c", __func__, 1221, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "channel %d missing mux %d", c->self, c->ctl_chan);
if ((m = sshbuf_new()) ==
((void *)0)
)
sshfatal("mux.c", __func__, 1225, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new");
if ((r = sshbuf_put_u32(m, 0x80000004)) != 0 ||
(r = sshbuf_put_u32(m, c->self)) != 0 ||
(r = sshbuf_put_u32(m, exitval)) != 0 ||
(r = sshbuf_put_stringb(mux_chan->output, m)) != 0)
sshfatal("mux.c", __func__, 1230, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "reply");
sshbuf_free(m);
}
| long long mux_exit_message(unsigned long long a0, unsigned int a1[18], unsigned long long a2) {
unsigned long v0;
unsigned long v1;
unsigned int v2;
struct_0 *v3;
unsigned long long v4;
char v5;
unsigned long long v7;
v1 = a2;
v0 = a1[1];
sshlog("mux.c", "mux_exit_message", 0x4c2, 0x1, 0x7, 0x0, "channel %d: exit message, exitval %d");
v3 = channel_by_id(a0, a1[17], a1[17]);
if (!v3) {
v1 = a1[17];
v0 = a1[1];
sshfatal("mux.c", "mux_exit_message", 0x4c5, 0x1, 0x1, 0x0, "channel %d missing mux %d");
}
v4 = sshbuf_new(a0, a1, a2, 0x1, v7, 0x0);
if (!v4) {
v4 = "sshbuf_new";
sshfatal("mux.c", "mux_exit_message", 0x4c9, 0x1, 0x1, 0x0, *(&v5));
}
v2 = sshbuf_put_u32(v4, 0x80000004);
if (!v2) {
v2 = sshbuf_put_u32(v4, a1[1]);
if (!v2) {
v2 = sshbuf_put_u32(v4, a2);
if (!v2)
v2 = sshbuf_put_stringb(v3->field_70, v4, v4);
}
}
if (v2 || v2 || v2 || v2) {
v4 = "reply";
sshfatal("mux.c", "mux_exit_message", 0x4ce, 0x1, 0x1, ssh_err(v2), *(&v5));
}
return sshbuf_free(v4);
}
|
COMMAND *
make_arith_command (exp)
WORD_LIST *exp;
{
COMMAND *command;
ARITH_COM *temp;
command = (COMMAND *)sh_xmalloc((sizeof (COMMAND)), "make_cmd.c", 434);
command->value.Arith = temp = (ARITH_COM *)sh_xmalloc((sizeof (ARITH_COM)), "make_cmd.c", 435);
temp->flags = 0;
temp->line = line_number;
temp->exp = exp;
command->type = cm_arith;
command->redirects = (REDIRECT *)
((void *)0)
;
command->flags = 0;
return (command);
}
| long long make_arith_command(unsigned long a0) {
struct_1 *v0;
struct_0 *v1;
v0 = sh_xmalloc(0x20, "make_cmd.c", 0x1b2);
v1 = sh_xmalloc(0x10, "make_cmd.c", 0x1b3);
v0->field_18 = v1;
v1->field_0 = 0;
v1->field_4 = line_number;
v1->field_8 = a0;
v0->field_0 = 10;
v0->field_10 = 0;
v0->field_4 = 0;
return v0;
}
|
static void
color_cap_ne_fct (void)
{
sgr_start = "\33[%sm";
sgr_end = "\33[m";
}
| long long color_cap_ne_fct() {
sgr_start = &g_405fe3;
sgr_end = &g_405fe9;
return &g_405fe9;
}
|
int
ssh_packet_not_very_much_data_to_write(struct ssh *ssh)
{
if (ssh->state->interactive_mode)
return sshbuf_len(ssh->state->output) < 16384;
else
return sshbuf_len(ssh->state->output) < 128 * 1024;
}
| long long ssh_packet_not_very_much_data_to_write(struct struct_0 **a0) {
unsigned long v1;
if (*(a0)->field_140)
v1 = sshbuf_len(*(a0)->field_28) <= 16383;
else
v1 = sshbuf_len(*(a0)->field_28) <= 131071;
return v1;
}
|
int
ssh_packet_set_log_preamble(struct ssh *ssh, const char *fmt, ...)
{
va_list args;
int r;
free(ssh->log_preamble);
if (fmt ==
((void *)0)
)
ssh->log_preamble =
((void *)0)
;
else {
__builtin_va_start(
args
,
fmt
)
;
r = vasprintf(&ssh->log_preamble, fmt, args);
__builtin_va_end(
args
)
;
if (r < 0 || ssh->log_preamble ==
((void *)0)
)
return -2;
}
return 0;
}
| long long ssh_packet_set_log_preamble() {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
char v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
unsigned long v10;
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
int v17;
int v18;
unsigned long v19;
unsigned long v20;
unsigned long v21;
unsigned long v22;
unsigned long v23;
char v24;
int v25;
int v26;
int v27;
int v28;
int v29;
int v30;
int v31;
int v32;
unsigned long long *v33;
struct_0 *v34;
char *v35;
unsigned long long v36;
v7 = v20;
v8 = v21;
v9 = v22;
v10 = v23;
if (v24) {
v11 = v25;
v12 = v26;
v13 = v27;
v14 = v28;
v15 = v29;
v16 = v30;
v17 = v31;
v18 = v32;
}
v5 = v33[5];
free(v34->field_38);
if (!v35) {
v34->field_38 = 0;
} else {
v1 = 16;
v2 = 48;
v3 = &v19;
v4 = &v6;
v0 = vasprintf(&v34->field_38, v35, &v1);
if (v0 < 0) {
LABEL_4006df:
v36 = 4294967294;
goto LABEL_4006eb;
} else if (!v34->field_38) {
goto LABEL_4006df;
}
}
v36 = 0;
LABEL_4006eb:
if (!(v5 ^ v33[5]))
return v36;
__stack_chk_fail();
}
|
cv_csearch(EditLine *el, int direction, wint_t ch, int count, int tflag)
{
wchar_t *cp;
if (ch == 0)
return 6;
if (ch == (wint_t)-1) {
wchar_t c;
if (el_wgetc(el, &c) != 1)
return ed_end_of_file(el, 0);
ch = c;
}
el->el_search.chacha = ch;
el->el_search.chadir = direction;
el->el_search.chatflg = (char)tflag;
cp = el->el_line.cursor;
while (count--) {
if ((wint_t)*cp == ch)
cp += direction;
for (;;cp += direction) {
if (cp >= el->el_line.lastchar)
return 6;
if (cp < el->el_line.buffer)
return 6;
if ((wint_t)*cp == ch)
break;
}
}
if (tflag)
cp -= direction;
el->el_line.cursor = cp;
if (el->el_chared.c_vcmd.action != 0x00) {
if (direction > 0)
el->el_line.cursor++;
cv_delfini(el);
return 4;
}
return 5;
}
| long long cv_csearch(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4) {
unsigned int v0;
int tmp_9;
unsigned int v1;
char v2;
unsigned int *v3;
unsigned long long v5;
unsigned long long v6;
v1 = a2;
v0 = a3;
if (!v1) {
v5 = 6;
} else {
if (v1 == -1) {
v6 = el_wgetc(a0, &v2, &v2);
if (v6 != 1)
v5 = ed_end_of_file(a0, 0x0);
else
v1 = *(&v2);
}
if (v6 == 1 || v1 != -1) {
a0->field_4b0 = v1;
a0->field_4ac = a1;
a0->field_4b4 = a4;
v3 = a0->field_58;
while (true) {
tmp_9 = v0;
v0 -= 1;
if (tmp_9) {
if (*(v3) == v1)
v3 = &v3[a1];
while (true) {
if (v3 >= a0->field_60) {
v5 = 6;
break;
} else if (v3 < a0->field_50) {
v5 = 6;
break;
} else {
if (*(v3) == v1)
break;
if (*(v3) != v1)
v3 = &v3[a1];
}
}
if (v3 < a0->field_50 || v3 >= a0->field_60)
break;
} else {
if (a4)
v3 = v3 + -(a1 << 2);
a0->field_58 = v3;
if (a0->field_3c0) {
if (a1 > 0)
a0->field_58 = a0->field_58 + 4;
cv_delfini(a0);
v5 = 4;
break;
} else {
v5 = 5;
break;
}
}
}
}
}
return v5;
}
|
static
void bsPutUInt32 ( EState* s, UInt32 u )
{
bsW ( s, 8, (u >> 24) & 0xffL );
bsW ( s, 8, (u >> 16) & 0xffL );
bsW ( s, 8, (u >> 8) & 0xffL );
bsW ( s, 8, u & 0xffL );
}
| void bsPutUInt32(undefined8 param_1,uint param_2)
{
bsW(param_1,8,param_2 >> 0x18);
bsW(param_1,8,param_2 >> 0x10 & 0xff);
bsW(param_1,8,param_2 >> 8 & 0xff);
bsW(param_1,8,param_2 & 0xff);
return;
}
|
static int depmod_report_one_cycle(struct depmod *depmod,
struct vertex *vertex,
struct kmod_list **roots,
struct hash *loop_set)
{
const char sep[] = " -> ";
size_t sz;
char *buf;
struct array reverse;
int i;
int n;
struct vertex *v;
int rc;
array_init(&reverse, 3);
sz = 0;
for (v = vertex->parent, n = 0;
v !=
((void *)0)
;
v = v->parent, n++) {
sz += v->mod->modnamesz - 1;
array_append(&reverse, v);
rc = hash_add(loop_set, v->mod->modname,
((void *)0)
);
if (rc != 0)
return rc;
}
sz += vertex->mod->modnamesz - 1;
buf = malloc(sz + n * strlen(sep) + 1);
sz = 0;
for (i = reverse.count - 1; i >= 0; i--) {
size_t len;
v = reverse.array[i];
len = v->mod->modnamesz - 1;
memcpy(buf + sz, v->mod->modname, len);
sz += len;
strcpy(buf + sz, sep);
sz += strlen(sep);
depmod_list_remove_data(roots, v->mod);
}
strcpy(buf + sz, vertex->mod->modname);
log_printf(
3
, "Cycle detected: %s\n", buf);
free(buf);
array_free_array(&reverse);
return 0;
}
| int depmod_report_one_cycle(unsigned long a0, struct_0 *a1, unsigned long long *a2, unsigned long long a3, unsigned long long a4) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
void* v4;
struct_0 *v5;
void* v6;
unsigned int v7;
char v8;
char v9;
unsigned int v10;
char v11;
unsigned int v13;
v0 = a0;
v10 = 540945696;
v11 = 0;
array_init(&v8, 0x3, a2);
v4 = 0;
v5 = a1->field_0;
for (v2 = 0; v5; v2 += 1) {
v4 = v4 + v5->field_8->field_58 - 1;
array_append(&v8, v5, v5);
v3 = hash_add(a3, &v5->field_8[1].padding_0[24], 0x0, &v5->field_8[1].padding_0[24]);
if (v3) {
v13 = v3;
return v13;
}
v5 = v5->field_0;
}
v4 = v4 + a1->field_8->field_58 - 1;
v6 = malloc(v4 + strlen(&v10) * v2 + 1);
v4 = 0;
for (v1 = *(&v9) - 1; v1 >= 0; v1 -= 1) {
v5 = *((*(&v8) + v1 * 8));
*(&v7) = v5->field_8->field_58 - 1;
memcpy(v6 + v4, &v5->field_8[1].padding_0[24], *(&v7));
v4 += *(&v7);
strcpy(v6 + v4, &v10);
v4 += strlen(&v10);
depmod_list_remove_data(a2, v5->field_8);
}
strcpy(v4 + v6, &a1->field_8[1].padding_0[24]);
log_printf(0x3, "Cycle detected: %s\n", v6, a3, a4);
free(v6);
array_free_array(&v8);
v13 = 0;
return v13;
}
|
static int ipnh_list_flush(int argc, char **argv, int action)
{
unsigned int all = (argc == 0);
while (argc > 0) {
if (!matches(*argv, "dev")) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
filter.ifindex = ll_name_to_index(*argv);
if (!filter.ifindex)
invarg("Device does not exist\n", *argv);
} else if (!matches(*argv, "groups")) {
filter.groups = 1;
} else if (!matches(*argv, "master")) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
filter.master = ll_name_to_index(*argv);
if (!filter.master)
invarg("Device does not exist\n", *argv);
} else if (matches(*argv, "vrf") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (!name_is_vrf(*argv))
invarg("Invalid VRF\n", *argv);
filter.master = ll_name_to_index(*argv);
if (!filter.master)
invarg("VRF does not exist\n", *argv);
} else if (!strcmp(*argv, "id")) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
return ipnh_list_flush_id(ipnh_parse_id(*argv), action);
} else if (!matches(*argv, "protocol")) {
__u32 proto;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_unsigned(&proto, *argv, 0))
invarg("invalid protocol value", *argv);
filter.proto = proto;
} else if (!matches(*argv, "fdb")) {
filter.fdb = 1;
} else if (matches(*argv, "help") == 0) {
usage();
} else {
invarg("", *argv);
}
argc--; argv++;
}
if (action == IPNH_FLUSH)
return ipnh_flush(all);
if (rtnl_nexthopdump_req(&rth, preferred_family, nh_dump_filter) < 0) {
perror("Cannot send dump request");
return -2;
}
new_json_obj(json);
if (rtnl_dump_filter_nc(&rth, print_nexthop_nocache,
stdout
, 0) < 0) {
fprintf(
stderr
, "Dump terminated\n");
return -2;
}
delete_json_obj();
fflush(
stdout
);
return 0;
}
| void ipnh_list_flush(unsigned long a0, unsigned long a1, unsigned long a2) {
unsigned long long *v0;
unsigned int v1;
char v2;
unsigned int v3;
char v5;
char v6;
char v7;
char v8;
unsigned long long v10;
unsigned long long v12;
unsigned long long v14;
unsigned long long v15;
unsigned long long v17;
void* v18;
v1 = a0;
v0 = a1;
v3 = !v1;
while (true) {
if (v1 > 0) {
v5 = matches(*(v0), "dev") ^ 1;
if (v5) {
v0 = v0 + 1;
v1 = v1 - 1;
if (v1 <= 0)
incomplete_command();
g_403a08 = ll_name_to_index(*(v0));
if (!g_403a08)
invarg("Device does not exist\n", *(v0));
}
if (!g_403a08 || !v5) {
v6 = matches(*(v0), "groups") ^ 1;
if (v6) {
g_403a04 = 1;
} else {
v7 = matches(*(v0), "master") ^ 1;
if (v7) {
v0 = v0 + 1;
v1 = v1 - 1;
if (v1 <= 0)
incomplete_command();
g_403a0c = ll_name_to_index(*(v0));
if (!g_403a0c)
invarg("Device does not exist\n", *(v0));
}
if (!v7 || !g_403a0c) {
v8 = matches(*(v0), "vrf") ^ 1;
if (v8) {
v0 = v0 + 1;
v1 = v1 - 1;
if (v1 <= 0)
incomplete_command();
if (!name_is_vrf(*(v0)))
invarg("Invalid VRF\n", *(v0));
g_403a0c = ll_name_to_index(*(v0));
}
if (!v8 || !g_403a0c) {
v10 = strcmp(*(v0), "id");
if (!v10) {
v0 = v0 + 1;
v1 = v1 - 1;
if (v1 <= 0)
incomplete_command();
v14 = ipnh_list_flush_id(ipnh_parse_id(*(v0)), a2);
break;
} else {
*(&v10) = matches(*(v0), "protocol") ^ 1;
if (v10) {
v0 = v0 + 1;
v1 = v1 - 1;
if (v1 <= 0)
incomplete_command();
if (get_unsigned(&v2, *(v0), 0x0, *(v0)))
invarg("invalid protocol value", *(v0));
g_403a10 = *(&v2);
} else {
*(&v10) = matches(*(v0), "fdb") ^ 1;
*(&v10) = matches(*(v0), "help") ^ 1;
invarg(&g_406126, *(v0));
}
}
}
}
if (!g_403a0c && v8)
invarg("VRF does not exist\n", *(v0));
}
}
if (false) {
g_403a14 = 1;
usage();
}
if (v10 || v6 || v8 && g_403a0c || g_403a08 && v5 || v7 && g_403a0c) {
v1 = v1 - 1;
v0 += 1;
}
} else if (a2 == 1) {
v12 = ipnh_flush(v3);
break;
} else if (rtnl_nexthopdump_req(0x500090, preferred_family, nh_dump_filter) < 0) {
perror("Cannot send dump request");
v15 = 4294967294;
break;
} else {
new_json_obj(json);
if (rtnl_dump_filter_nc(0x500090, print_nexthop_nocache, stdout, 0x0) < 0) {
fprintf(stderr, "Dump terminated\n");
v17 = 4294967294;
break;
} else {
delete_json_obj();
fflush(stdout);
v18 = 0;
break;
}
}
}
return;
}
|
(r = ssh_packet_write_wait(ssh)) != 0)
sshfatal("packet.c", __func__, 1848, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send DEBUG");
}
void
sshpkt_fmt_connection_id(struct ssh *ssh, char *s, size_t l)
{
snprintf(s, l, "%.200s%s%s port %d",
ssh->log_preamble ? ssh->log_preamble : "",
ssh->log_preamble ? " " : "",
ssh_remote_ipaddr(ssh), ssh_remote_port(ssh));
}
| int ssh_packet_write_wait(long *param_1)
{
long lVar1;
int iVar2;
int *piVar3;
long in_FS_OFFSET;
int local_5c;
int local_58;
timespec *local_50;
pollfd local_40;
undefined local_38 [16];
timespec local_28;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_5c = 0;
local_50 = (timespec *)0x0;
lVar1 = *param_1;
iVar2 = ssh_packet_write_poll(param_1);
do {
if (iVar2 != 0) {
LAB_00105211:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return iVar2;
}
iVar2 = ssh_packet_have_data_to_write(param_1);
if (iVar2 == 0) {
iVar2 = 0;
goto LAB_00105211;
}
local_40.fd = *(int *)(lVar1 + 4);
local_40.events = 4;
if (0 < *(int *)(lVar1 + 0x150)) {
local_5c = *(int *)(lVar1 + 0x150);
local_50 = &local_28;
}
do {
if (0 < *(int *)(lVar1 + 0x150)) {
ms_to_timespec(&local_28,local_5c);
monotime_tv(local_38);
}
local_58 = ppoll(&local_40,1,local_50,(__sigset_t *)0x0);
if ((-1 < local_58) ||
(((piVar3 = __errno_location(), *piVar3 != 0xb &&
(piVar3 = __errno_location(), *piVar3 != 4)) &&
(piVar3 = __errno_location(), *piVar3 != 0xb)))) goto LAB_001051d1;
} while ((*(int *)(lVar1 + 0x150) < 1) || (ms_subtract_diff(local_38), 0 < local_5c));
local_58 = 0;
LAB_001051d1:
if (local_58 == 0) {
iVar2 = -0x35;
goto LAB_00105211;
}
iVar2 = ssh_packet_write_poll(param_1);
} while( true );
}
|
static void
sshsk_free_resident_key(struct sshsk_resident_key *srk)
{
if (srk ==
((void *)0)
)
return;
sshkey_free(srk->key);
freezero(srk->user_id, srk->user_id_len);
free(srk);
}
| void sshsk_free_resident_key(_QWORD *a1)
{
if ( a1 )
{
sshkey_free(*a1);
freezero(a1[1], a1[2]);
free(a1);
}
}
|
static void
assign_time_option (char **sval, time_t *tval, const char *input)
{
char *p;
struct timespec t = decode_timespec (input, &p,
0
);
if (! valid_timespec (t) || *p)
do { if (error_hook) error_hook (); error (0, 0, gettext ("Time stamp is out of allowed range")); exit_status = 2; } while (0);
else
{
*tval = t.tv_sec;
assign_string (sval, input);
}
}
| unsigned long assign_time_option(long a1, _QWORD *a2, long a3)
{
long v3;
long v4;
char *v5;
_BYTE *v9;
long v10;
long v11;
unsigned long v12;
v12 = __readfsqword(0x28u);
v10 = decode_timespec(a3, &v9, 0LL);
v11 = v3;
v4 = v10;
if ( (unsigned char)valid_timespec(v10, v3) != 1 || *v9 )
{
if ( error_hook )
error_hook(v4);
v5 = gettext("Time stamp is out of allowed range");
error(0, 0, v5);
exit_status = 2;
}
else
{
*a2 = v10;
assign_string(a1, a3);
}
return __readfsqword(0x28u) ^ v12;
}
|
int
progcomp_insert (cmd, cs)
char *cmd;
COMPSPEC *cs;
{
register BUCKET_CONTENTS *item;
if (cs ==
((void *)0)
)
programming_error (gettext("progcomp_insert: %s: NULL COMPSPEC"), cmd);
if (prog_completes == 0)
progcomp_create ();
cs->refcount++;
item = hash_insert (cmd, prog_completes, 0);
if (item->data)
free_progcomp (item->data);
else
item->key = (char *)strcpy (sh_xmalloc((1 + strlen (cmd)), "pcomplib.c", 192), (cmd));
item->data = cs;
return 1;
}
| undefined8 progcomp_insert(char *param_1,int *param_2)
{
undefined8 uVar1;
long lVar2;
size_t sVar3;
char *pcVar4;
if (param_2 == (int *)0x0) {
uVar1 = gettext("progcomp_insert: %s: NULL COMPSPEC");
programming_error(uVar1,param_1);
}
if (prog_completes == 0) {
progcomp_create();
}
*param_2 = *param_2 + 1;
lVar2 = hash_insert(param_1,prog_completes,0);
if (*(long *)(lVar2 + 0x10) == 0) {
sVar3 = strlen(param_1);
pcVar4 = (char *)sh_xmalloc(sVar3 + 1,"pcomplib.c",0xc0);
pcVar4 = strcpy(pcVar4,param_1);
*(char **)(lVar2 + 8) = pcVar4;
}
else {
free_progcomp(*(undefined8 *)(lVar2 + 0x10));
}
*(int **)(lVar2 + 0x10) = param_2;
return 1;
}
|
const char *
directory_contents (struct directory *dir)
{
if (!dir)
return
((void *)0)
;
return dir->dump ? dir->dump->contents :
((void *)0)
;
}
| long directory_contents(long a1)
{
if ( !a1 )
return 0LL;
if ( *(_QWORD *)(a1 + 40) )
return **(_QWORD **)(a1 + 40);
return 0LL;
}
|
static
ssize_t send_line(socket_st * socket, const char *txt)
{
int len = strlen(txt);
int ret;
if (socket->verbose)
fprintf(
stderr
, "starttls: sending: %s\n", txt);
ret = send(socket->fd, txt, len, 0);
if (ret == -1) {
fprintf(
stderr
, "error sending \"%s\"\n", txt);
exit(2);
}
return ret;
}
| void send_line(unsigned int a0[19], void* a1) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
v0 = strlen(a1);
if (a0[18])
fprintf(stderr, "starttls: sending: %s\n", a1);
v1 = send(a0[0], a1, v0, 0x0);
if (v1 == -1) {
fprintf(stderr, "error sending \"%s\"\n", a1);
exit(0x2);
}
v3 = v1;
return;
}
|
void printentry(char *indent, entry *e, time_t next) {
printf("%s - user: %s\n", indent, e->pwd->pw_name);
printf("%s cmd: \"%s\"\n", indent, e->cmd);
printf("%s flags: 0x%02X\n", indent, e->flags);
printflags(indent, e->flags);
printf("%s delay: %d\n", indent, e->delay);
printf("%s next: %ld\n", indent, (long)next);
printf("%s nextstring: ", indent);
printf("%s", asctime(localtime(&next)));
}
| void printentry(unsigned int a0, struct_0 *a1, unsigned long a2) {
char v0;
unsigned long long v2;
printf("%s - user: %s\n", a0, a1->field_8->field_0);
printf("%s cmd: \"%s\"\n", a0, a1->field_18);
printf("%s flags: 0x%02X\n", a0, a1->field_34);
printflags(a0, a1->field_34);
printf("%s delay: %d\n", a0, a1->field_38);
printf("%s next: %ld\n", a0, a2);
printf("%s nextstring: ", a0);
v2 = printf("%s", asctime(localtime(&v0)));
return;
}
|
void
print_ed_script (struct change *script)
{
print_script (script, find_reverse_change, print_ed_hunk);
}
| void print_ed_script(undefined8 param_1)
{
print_script(param_1,uRam0000000000100022,print_ed_hunk);
return;
}
|
static void netns_save(void)
{
if (saved_netns != -1)
return;
saved_netns = open("/proc/self/ns/net",
00
|
02000000
);
if (saved_netns == -1) {
perror("Cannot open init namespace");
exit(1);
}
}
| void netns_save(void)
{
if (saved_netns == -1) {
saved_netns = open64("/proc/self/ns/net",0x80000);
if (saved_netns == -1) {
perror("Cannot open init namespace");
exit(1);
}
}
return;
}
|
static inline void
emit_mandatory_arg_note (void)
{
fputs_unlocked (gettext ("\nMandatory arguments to long options are mandatory for short options too.\n"),
stdout
)
;
}
| void emit_mandatory_arg_note() {
unsigned long long v1;
v1 = fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory for short options too.\n"), stdout);
return;
}
|
static void Encode(unsigned char *out,const crypto_uint16 *R,const crypto_uint16 *M,long long len)
{
if (len == 1) {
crypto_uint16 r = R[0];
crypto_uint16 m = M[0];
while (m > 1) {
*out++ = r;
r >>= 8;
m = (m+255)>>8;
}
}
if (len > 1) {
crypto_uint16 R2[(len+1)/2];
crypto_uint16 M2[(len+1)/2];
long long i;
for (i = 0;i < len-1;i += 2) {
crypto_uint32 m0 = M[i];
crypto_uint32 r = R[i]+R[i+1]*m0;
crypto_uint32 m = M[i+1]*m0;
while (m >= 16384) {
*out++ = r;
r >>= 8;
m = (m+255)>>8;
}
R2[i/2] = r;
M2[i/2] = m;
}
if (i < len) {
R2[i/2] = R[i];
M2[i/2] = M[i];
}
Encode(out,R2,M2,(len+1)/2);
}
}
| void Encode(undefined *param_1,ushort *param_2,ushort *param_3,long param_4)
{
long lVar1;
undefined *puVar2;
long lVar3;
undefined *puVar4;
undefined *puVar5;
ushort extraout_var;
ulong uVar6;
long lVar7;
long lVar8;
long *plVar9;
undefined *puVar10;
long in_FS_OFFSET;
long local_b8;
undefined8 local_b0;
long local_a8;
undefined8 local_a0;
long local_98;
undefined8 local_90;
long local_88;
ushort *local_80;
ushort *local_78;
undefined *local_70;
ushort local_68;
ushort local_66;
uint local_64;
uint local_60;
uint local_5c;
long local_58;
undefined8 local_50;
undefined *local_48;
undefined8 local_40;
undefined *local_38;
long local_30;
plVar9 = &local_b8;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
local_88 = param_4;
local_80 = param_3;
local_78 = param_2;
local_70 = param_1;
if (param_4 == 1) {
local_66 = *param_2;
local_68 = *param_3;
while (1 < local_68) {
*local_70 = (char)local_66;
local_66 = local_66 >> 8;
local_70 = local_70 + 1;
__addvsi3(local_68,0xff);
local_68 = extraout_var;
}
}
if (1 < local_88) {
local_98 = __addvdi3(local_88,1);
local_98 = local_98 / 2;
local_50 = __addvdi3(local_98,0xffffffffffffffff);
local_90 = 0;
local_a8 = local_98;
local_a0 = 0;
uVar6 = ((local_98 * 2 + 0xfU) / 0x10) * 0x10;
for (; plVar9 != (long *)((long)&local_b8 - (uVar6 & 0xfffffffffffff000));
plVar9 = (long *)((long)plVar9 + -0x1000)) {
*(undefined8 *)((long)plVar9 + -8) = *(undefined8 *)((long)plVar9 + -8);
}
lVar1 = -(ulong)((uint)uVar6 & 0xfff);
puVar10 = (undefined *)((long)plVar9 + lVar1);
if ((uVar6 & 0xfff) != 0) {
*(undefined8 *)((long)plVar9 + ((ulong)((uint)uVar6 & 0xfff) - 8) + lVar1) =
*(undefined8 *)((long)plVar9 + ((ulong)((uint)uVar6 & 0xfff) - 8) + lVar1);
}
lVar8 = local_88;
local_48 = (undefined *)((long)plVar9 + lVar1);
*(undefined8 *)((long)plVar9 + lVar1 + -8) = 0x10171c;
local_b8 = __addvdi3(lVar8,1);
local_b8 = local_b8 / 2;
*(undefined8 *)((long)plVar9 + lVar1 + -8) = 0x10173b;
local_40 = __addvdi3(local_b8,0xffffffffffffffff);
local_b0 = 0;
uVar6 = ((local_b8 * 2 + 0xfU) / 0x10) * 0x10;
for (; puVar10 != (undefined *)((long)plVar9 + (lVar1 - (uVar6 & 0xfffffffffffff000)));
puVar10 = puVar10 + -0x1000) {
*(undefined8 *)(puVar10 + -8) = *(undefined8 *)(puVar10 + -8);
}
lVar1 = -(ulong)((uint)uVar6 & 0xfff);
if ((uVar6 & 0xfff) != 0) {
*(undefined8 *)(puVar10 + ((ulong)((uint)uVar6 & 0xfff) - 8) + lVar1) =
*(undefined8 *)(puVar10 + ((ulong)((uint)uVar6 & 0xfff) - 8) + lVar1);
}
local_38 = puVar10 + lVar1;
local_58 = 0;
while( true ) {
lVar8 = local_88;
*(undefined8 *)(puVar10 + lVar1 + -8) = 0x1018f9;
lVar7 = __addvdi3(lVar8,0xffffffffffffffff);
lVar3 = local_58;
lVar8 = local_88;
if (lVar7 <= local_58) break;
local_5c = (uint)local_80[local_58];
local_60 = local_78[local_58 + 1] * local_5c + (uint)local_78[local_58];
for (local_64 = local_80[local_58 + 1] * local_5c; puVar2 = local_70, 0x3fff < local_64;
local_64 = local_64 + 0xff >> 8) {
local_70 = local_70 + 1;
*puVar2 = (char)local_60;
local_60 = local_60 >> 8;
}
*(short *)(local_48 + (local_58 / 2) * 2) = (short)local_60;
*(short *)(local_38 + (local_58 / 2) * 2) = (short)local_64;
*(undefined8 *)(puVar10 + lVar1 + -8) = 0x1018e5;
local_58 = __addvdi3(lVar3,2);
}
if (local_58 < local_88) {
*(ushort *)(local_48 + (local_58 / 2) * 2) = local_78[local_58];
*(ushort *)(local_38 + (local_58 / 2) * 2) = local_80[local_58];
}
*(undefined8 *)(puVar10 + lVar1 + -8) = 0x101977;
lVar8 = __addvdi3(lVar8,1);
puVar5 = local_38;
puVar4 = local_48;
puVar2 = local_70;
*(undefined8 *)(puVar10 + lVar1 + -8) = 0x10199b;
Encode(puVar2,puVar4,puVar5,lVar8 / 2);
}
if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
static int
bash_check_expchar (dirname, need_closer, nextp, closerp)
char *dirname;
int need_closer;
int *nextp, *closerp;
{
char *t;
int ret, n, c;
ret = n = c = 0;
if (t = mbschr (dirname, '$'))
{
ret = '$';
n = t[1];
if (n == '(')
c = ')';
else if (n == '{')
c = '}';
else
n = 0;
if (c && need_closer)
{
int p;
char delims[2];
delims[0] = c; delims[1] = 0;
p = skip_to_delim (t, 1, delims, 0x001|0x100);
if (t[p] != c)
ret = 0;
}
}
else if (dirname[0] == '~')
ret = '~';
else
{
t = mbschr (dirname, '`');
if (t)
{
if (need_closer == 0)
ret = '`';
else if (unclosed_pair (dirname, strlen (dirname), "`") == 0)
ret = '`';
}
}
if (nextp)
*nextp = n;
if (closerp)
*closerp = c;
return ret;
}
| int bash_check_expchar(char *a0, unsigned long a1, unsigned int *a2, unsigned int *a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
char v4[2];
char v5;
char v6;
v2 = 0;
v1 = v2;
v0 = v1;
*(&v4) = mbschr(a0, 0x24, a2);
if (v4) {
v0 = 36;
v1 = v4[1];
switch (v1) {
case 40:
v2 = 41;
break;
case 123:
v2 = 125;
break;
default:
v1 = 0;
break;
}
if (v2 && a1) {
v5 = v2;
v6 = 0;
v3 = skip_to_delim(v4, 0x1, &v5, 0x101);
if (v2 != v4[v3])
v0 = 0;
}
} else if (*(a0) == 126) {
v0 = 126;
} else {
v4 = mbschr(a0, 0x60, a2);
if (v4) {
if (!a1) {
v0 = 96;
} else if (!unclosed_pair(a0, strlen(a0), "`", strlen(a0))) {
v0 = 96;
}
}
}
if (a2)
*(a2) = v1;
if (a3)
*(a3) = v2;
return v0;
}
|
static void
bind_lastarg (arg)
char *arg;
{
SHELL_VAR *var;
if (arg == 0)
arg = "";
var = bind_variable ("_", arg, 0);
if (var)
((var)->attributes &= ~(0x0000001));
}
| long bind_lastarg(const char *a1)
{
long result;
const char *v2;
v2 = a1;
if ( !a1 )
v2 = &src;
result = bind_variable("_", v2, 0LL);
if ( result )
*(_DWORD *)(result + 40) &= ~1u;
return result;
}
|
static void
dumpdir_decoder (struct tar_stat_info *st,
char const *keyword __attribute__((unused)),
char const *arg,
size_t size)
{
st->dumpdir = xmalloc (size);
memcpy (st->dumpdir, arg, size);
}
| void dumpdir_decoder(long param_1,undefined8 param_2,void *param_3,size_t param_4)
{
undefined8 uVar1;
uVar1 = xmalloc(param_4);
*(undefined8 *)(param_1 + 400) = uVar1;
memcpy(*(void **)(param_1 + 400),param_3,param_4);
return;
}
|
static void open_files (void)
{
_Bool
use_tcb =
0
;
if (!read_only) {
if (pw_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, pw_dbname ());
fail_exit (4);
}
pw_locked =
1
;
if (is_shadow && !use_tcb) {
if (spw_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, spw_dbname ());
fail_exit (4);
}
spw_locked =
1
;
}
}
if (pw_open (read_only ?
00
:
02
) == 0) {
fprintf (
stderr
, gettext ("%s: cannot open %s\n"),
Prog, pw_dbname ());
if (use_system_pw_file) {
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 (
4
, "cannot open %s", pw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
fail_exit (3);
}
if (is_shadow && !use_tcb) {
if (spw_open (read_only ?
00
:
02
) == 0) {
fprintf (
stderr
, gettext ("%s: cannot open %s\n"),
Prog, spw_dbname ());
if (use_system_spw_file) {
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 (
4
, "cannot open %s", spw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
)
;
}
fail_exit (3);
}
spw_opened =
1
;
}
}
| long open_files()
{
long v0;
long v1;
char *v2;
long v3;
long v4;
char *v5;
unsigned int v6;
long v7;
long v8;
char *v9;
const char *v10;
long result;
unsigned int v12;
long v13;
long v14;
char *v15;
const char *v16;
char *locale;
char *v18;
const char *s;
const char *v20;
if ( read_only != 1 )
{
if ( !(unsigned int)pw_lock() )
{
v0 = pw_dbname();
v1 = Prog;
v2 = gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr, v2, v1, v0);
fail_exit(4);
}
pw_locked = 1;
if ( is_shadow )
{
if ( !(unsigned int)spw_lock() )
{
v3 = spw_dbname();
v4 = Prog;
v5 = gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr, v5, v4, v3);
fail_exit(4);
}
spw_locked = 1;
}
}
if ( read_only )
v6 = 0;
else
v6 = 2;
if ( !(unsigned int)pw_open(v6) )
{
v7 = pw_dbname();
v8 = Prog;
v9 = gettext("%s: cannot open %s\n");
fprintf(stderr, v9, v8, v7);
if ( use_system_pw_file )
{
s = setlocale(6, 0LL);
locale = 0LL;
if ( s )
locale = strdup(s);
if ( locale )
setlocale(6, "C");
v10 = (const char *)pw_dbname();
syslog(4, "cannot open %s", v10);
if ( locale )
{
setlocale(6, locale);
free(locale);
}
}
fail_exit(3);
}
result = (unsigned char)is_shadow;
if ( is_shadow )
{
if ( read_only )
v12 = 0;
else
v12 = 2;
result = spw_open(v12);
if ( !(_DWORD)result )
{
v13 = spw_dbname();
v14 = Prog;
v15 = gettext("%s: cannot open %s\n");
fprintf(stderr, v15, v14, v13);
if ( use_system_spw_file )
{
v20 = setlocale(6, 0LL);
v18 = 0LL;
if ( v20 )
v18 = strdup(v20);
if ( v18 )
setlocale(6, "C");
v16 = (const char *)spw_dbname();
syslog(4, "cannot open %s", v16);
if ( v18 )
{
setlocale(6, v18);
free(v18);
}
}
fail_exit(3);
}
spw_opened = 1;
}
return result;
}
|
static const char *nh_group_type_name(__u16 type)
{
switch (type) {
case NEXTHOP_GRP_TYPE_MPATH:
return "mpath";
case NEXTHOP_GRP_TYPE_RES:
return "resilient";
default:
return "<unknown type>";
}
}
| const char * nh_group_type_name(short a1)
{
if ( !a1 )
return "mpath";
if ( a1 == 1 )
return "resilient";
return "<unknown type>";
}
|
static inline void
emit_stdin_note (void)
{
fputs_unlocked (gettext ("\nWith no FILE, or when FILE is -, read standard input.\n"),
stdout
)
;
}
| void emit_stdin_note(void)
{
char *__s;
FILE *__stream;
__stream = stdout;
__s = (char *)gettext("\nWith no FILE, or when FILE is -, read standard input.\n");
fputs_unlocked(__s,__stream);
return;
}
|
static inline __u16 rta_getattr_u16(const struct rtattr *rta)
{
return *(__u16 *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| int rta_getattr_u16(struct_0 *a0) {
return a0->field_4;
}
|
static inline char *
preglob(const char *pattern, int flag) {
flag |= 0x2;
return _rmescapes((char *)pattern, flag);
}
| int preglob(unsigned int a0, unsigned long a1) {
unsigned int v0;
v0 = a1;
v0 |= 2;
return _rmescapes(a0, v0);
}
|
void
chdir_do (int i)
{
if (chdir_current != i)
{
struct wd *curr = &wd[i];
int fd = curr->fd;
if (! fd)
{
if (!
(((
curr->name
)[0]) == '/')
)
chdir_do (i - 1);
fd = openat (chdir_fd, curr->name,
open_searchdir_flags & ~
0400000
);
if (fd < 0)
open_fatal (curr->name);
curr->fd = fd;
if (wdcache_count < CHDIR_CACHE_SIZE)
wdcache[wdcache_count++] = i;
else
{
struct wd *stale = &wd[wdcache[CHDIR_CACHE_SIZE - 1]];
if (close (stale->fd) != 0)
close_diag (stale->name);
stale->fd = 0;
wdcache[CHDIR_CACHE_SIZE - 1] = i;
}
}
if (0 < fd)
{
size_t ci;
int prev = wdcache[0];
for (ci = 1; prev != i; ci++)
{
int cur = wdcache[ci];
wdcache[ci] = prev;
if (cur == i)
break;
prev = cur;
}
wdcache[0] = i;
}
chdir_current = i;
chdir_fd = fd;
}
}
| void chdir_do(int param_1)
{
long lVar1;
int iVar2;
char **ppcVar3;
undefined8 *puVar4;
int local_2c;
int local_28;
long local_20;
if (param_1 != chdir_current) {
ppcVar3 = (char **)((long)param_1 * 0x18 + wd);
local_2c = *(int *)(ppcVar3 + 2);
if (local_2c == 0) {
if (**ppcVar3 != '/') {
chdir_do();
}
local_2c = openat(chdir_fd,*ppcVar3,open_searchdir_flags & 0xfffdffff);
if (local_2c < 0) {
open_fatal();
}
*(int *)(ppcVar3 + 2) = local_2c;
if (wdcache_count < 0x10) {
lVar1 = wdcache_count * 4;
wdcache_count = wdcache_count + 1;
*(int *)(wdcache + lVar1) = param_1;
}
else {
puVar4 = (undefined8 *)((long)wdcache._60_4_ * 0x18 + wd);
iVar2 = close(*(int *)(puVar4 + 2));
if (iVar2 != 0) {
close_diag(*puVar4);
}
*(undefined4 *)(puVar4 + 2) = 0;
wdcache._60_4_ = param_1;
}
}
if (0 < local_2c) {
local_28 = wdcache._0_4_;
local_20 = 1;
while (wdcache._0_4_ = param_1, local_28 != param_1) {
iVar2 = *(int *)(wdcache + local_20 * 4);
*(int *)(wdcache + local_20 * 4) = local_28;
if (iVar2 == param_1) break;
local_20 = local_20 + 1;
local_28 = iVar2;
}
}
chdir_fd = local_2c;
chdir_current = param_1;
}
return;
}
|
static inline void
emit_ancillary_info (char const *program)
{
struct infomap { char const *program; char const *node; } const infomap[] = {
{ "[", "test invocation" },
{ "coreutils", "Multi-call invocation" },
{ "sha224sum", "sha2 utilities" },
{ "sha256sum", "sha2 utilities" },
{ "sha384sum", "sha2 utilities" },
{ "sha512sum", "sha2 utilities" },
{
((void *)0)
,
((void *)0)
}
};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && ! (strcmp (program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
}
| void emit_ancillary_info(char *a0) {
unsigned long v0;
unsigned long long v1[2];
char *v2;
unsigned long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void* v16;
void* v17;
char v18;
unsigned long long *v21;
unsigned long long v22;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
for (v1[0] = &v4; v1[0] && strcmp(a0, v1[0]); v1[0] = v1 + 1);
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
*(&v3) = (!strcmp(a0, "[") ? a0 : "test");
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v22 = *(&v18) ^ v21[5];
return;
}
|
static char *
unescape (char *c)
{
int i, l;
l = strlen (c);
i = 0;
while (i < l && c[i]) {
if (c[i] == '\a') {
if (c[i+1])
memmove (c + i, c + i + 1, l - i);
else {
c[i] = '\0';
break;
}
}
i++;
}
return c;
}
| int unescape(char *a0) {
unsigned int v0;
unsigned int v1;
v1 = strlen(a0);
v0 = 0;
while (true) {
while (true) {
if (!(v0 < v1))
goto LABEL_403d50;
switch (a0[v0]) {
case 0:
LABEL_403d50:
return a0;
case 7:
if (!a0[1 + v0])
goto LABEL_0x403d1a;
memmove(&a0[v0], &a0[1 + v0], v1 - v0);
break;
default:
v0 += 1;
continue;
}
}
a0[v0] = 0;
goto LABEL_0x403d50;
}
}
|
inline ptrdiff_t
imbrlen (char const *s, idx_t n, mbstate_t *mbs)
{
size_t len =
rpl_mbrlen
(s, n, mbs);
if (len <=
16
)
return len;
ptrdiff_t neglen = -len;
return -neglen;
}
| void imbrlen(void)
{
halt_baddata();
}
|
int
fpurge(FILE *fp)
{
if (fp ==
((void *)0)
) {
(*__errno_location ())
=
9
;
return
(-1)
;
}
__fpurge(fp);
return 0;
}
| long long fpurge(void* a0) {
unsigned long long v1;
if (a0) {
__fpurge(a0);
v1 = 0;
return v1;
}
*(__errno_location()) = 9;
v1 = 4294967295;
return v1;
}
|
static int
choose_kex(struct kex *k, char *client, char *server)
{
const struct kexalg *kexalg;
k->name = match_list(client, server,
((void *)0)
);
sshlog("kex.c", __func__, 847, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "kex: algorithm: %s", k->name ? k->name : "(no match)");
if (k->name ==
((void *)0)
)
return -34;
if ((kexalg = kex_alg_by_name(k->name)) ==
((void *)0)
) {
sshlog("kex.c", __func__, 851, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "unsupported KEX method %s", k->name);
return -1;
}
k->kex_type = kexalg->type;
k->hash_alg = kexalg->hash_alg;
k->ec_nid = kexalg->ec_nid;
return 0;
}
| int choose_kex(struct_0 *a0, unsigned long long a1, unsigned long long a2) {
unsigned long v0;
unsigned int v1[5];
unsigned long v3;
a0->field_20 = match_list(a1, a2, 0x0, a2);
if (!a0->field_20)
v3 = "(no match)";
else
v3 = a0->field_20;
v0 = v3;
sshlog("kex.c", "choose_kex", 0x34f, 0x0, 0x5, 0x0, "kex: algorithm: %s");
if (!a0->field_20) {
*(&v3) = -34;
} else {
*(&v1[0]) = kex_alg_by_name(a0->field_20);
if (v1) {
a0->field_38 = v1[2];
a0->field_90 = v1[4];
a0->field_94 = v1[3];
*(&v3) = 0;
} else {
v0 = a0->field_20;
sshlog("kex.c", "choose_kex", 0x353, 0x1, 0x2, 0x0, "unsupported KEX method %s");
*(&v3) = -1;
}
}
return v3;
}
|
static void print_explain(FILE *f)
{
fprintf(f, "Usage: ... bond_slave [ queue_id ID ] [ prio PRIORITY ]\n");
}
| int print_explain(FILE *a1)
{
return fprintf(a1, "Usage: ... bond_slave [ queue_id ID ] [ prio PRIORITY ]\n");
}
|
static int
authmethod_is_enabled(Authmethod *method)
{
if (method ==
((void *)0)
)
return 0;
if (method->enabled ==
((void *)0)
|| *method->enabled == 0)
return 0;
if (method->batch_flag !=
((void *)0)
&& *method->batch_flag != 0)
return 0;
return 1;
}
| int authmethod_is_enabled(struct struct_0 *a0[5]) {
unsigned int v1;
if (!a0) {
v1 = 0;
} else {
if (a0[3] && a0[3]->field_0) {
if (a0[4] && a0[4]->field_0)
v1 = 0;
if (!a0[4]->field_0 || !a0[4])
v1 = 1;
}
if (!a0[3] || !a0[3]->field_0)
v1 = 0;
}
return v1;
}
|
static void
check_path_safety (const char *action)
{
const char *path = getenv ("PATH");
const char *path_separators = ":";
size_t pos, len;
if (
((void *)0)
== path)
{
return;
}
splitstring (path, path_separators,
1
, &pos, &len);
do
{
if (0 == len || (1 == len && path[pos] == '.'))
{
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"The current directory is included in the PATH \" \"environment variable, which is insecure in \" \"combination with the %s action of find. \" \"Please remove the current directory from your \" \"$PATH (that is, remove \\\".\\\", doubled colons, \" \"or leading or trailing colons)\"), action), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("The current directory is included in the PATH " "environment variable, which is insecure in " "combination with the %s action of find. " "Please remove the current directory from your " "$PATH (that is, remove \".\", doubled colons, " "or leading or trailing colons)"), action), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("The current directory is included in the PATH " "environment variable, which is insecure in " "combination with the %s action of find. " "Please remove the current directory from your " "$PATH (that is, remove \".\", doubled colons, " "or leading or trailing colons)"), action), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
else if (path[pos] != '/')
{
char *relpath = strndup (&path[pos], len);
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"The relative path %s is included in the PATH \" \"environment variable, which is insecure in \" \"combination with the %s action of find. \" \"Please remove that entry from $PATH\"), safely_quote_err_filename (0, relpath ? relpath : &path[pos]), action), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("The relative path %s is included in the PATH " "environment variable, which is insecure in " "combination with the %s action of find. " "Please remove that entry from $PATH"), safely_quote_err_filename (0, relpath ? relpath : &path[pos]), action), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("The relative path %s is included in the PATH " "environment variable, which is insecure in " "combination with the %s action of find. " "Please remove that entry from $PATH"), safely_quote_err_filename (0, relpath ? relpath : &path[pos]), action), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
free (relpath);
}
} while (splitstring (path, path_separators,
0
, &pos, &len));
}
| void check_path_safety(unsigned long a0) {
unsigned long v0;
char v1;
char v2;
unsigned long long v3;
unsigned long long v4;
unsigned long v5;
char v6;
unsigned long long *v8;
unsigned long long v9;
unsigned long long v11;
v0 = a0;
v3 = getenv("PATH");
v4 = ":";
if (!v3) {
v9 = *(&v6) ^ v8[5];
return;
}
splitstring(v3, v4, 0x1, &v1, &v2);
while (true) {
switch (*(&v2)) {
case 0:
error(0x1, 0x0, gettext("The current directory is included in the PATH environment variable, which is insecure in combination with the %s action of find. Please remove the current directory from your $PATH (that is, remove \".\", doubled colons, or leading or trailing colons)"));
case 1:
if (*((v3 + *(&v1))) == 46)
error(0x1, 0x0, gettext("The current directory is included in the PATH environment variable, which is insecure in combination with the %s action of find. Please remove the current directory from your $PATH (that is, remove \".\", doubled colons, or leading or trailing colons)"));
default:
if (*((v3 + *(&v1))) == 47) {
if (!splitstring(v3, v4, 0x0, &v1, &v2)) {
v9 = *(&v6) ^ v8[5];
return;
}
break;
} else {
v5 = strndup(v3 + *(&v1), *(&v2));
v11 = safely_quote_err_filename(0x0, (!v5 ? v5 : v3 + *(&v1)));
error(0x1, 0x0, gettext("The relative path %s is included in the PATH environment variable, which is insecure in combination with the %s action of find. Please remove that entry from $PATH"));
}
}
}
}
|
int
match_pattern_wchar (pat, string, flags)
wchar_t *pat, *string;
int flags;
{
wchar_t c;
if (*string == 0)
return (*pat == L'*');
switch (c = *pat++)
{
default:
return (((flags & (1 << 4)) && iswupper (*string) ? towlower (*string) : (*string)) == ((flags & (1 << 4)) && iswupper (c) ? towlower (c) : (c)));
case L'\\':
return (((flags & (1 << 4)) && iswupper (*string) ? towlower (*string) : (*string)) == ((flags & (1 << 4)) && iswupper (*pat) ? towlower (*pat) : (*pat)));
case L'?':
return (*pat == L'(' ? 1 : (*string != L'\0'));
case L'*':
return (1);
case L'+':
case L'!':
case L'@':
return (*pat == L'(' ? 1 : (((flags & (1 << 4)) && iswupper (*string) ? towlower (*string) : (*string)) == ((flags & (1 << 4)) && iswupper (c) ? towlower (c) : (c))));
case L'[':
return (*string != L'\0');
}
}
| long long match_pattern_wchar(unsigned long a0, unsigned int *a1, unsigned long a2) {
unsigned int *v0;
int tmp_11;
unsigned int v1;
unsigned long long v3;
unsigned int v4;
unsigned long v5;
unsigned int v6;
unsigned int v7;
unsigned long v8;
unsigned long v9;
v0 = a0;
if (!*(a1)) {
v3 = *(v0) == 42;
return v3;
}
tmp_11 = v0;
v0 += 1;
v1 = *(tmp_11);
if (v1 == 92) {
if (!(a2 & 16) || !iswupper(*(a1)))
v4 = *(a1);
else
v4 = towlower(*(a1));
if (!(a2 & 16) || !iswupper(*(v0)))
v5 = *(v0);
else
v5 = towlower(*(v0));
v3 = v4 == v5;
return v3;
} else {
if (!(v1 <= 92))
goto LABEL_400745;
if (v1 > 64) {
if (!(v1 == 91))
goto LABEL_400745;
v3 = *(a1);
return v3;
}
if (v1 < 33)
goto LABEL_400745;
switch (v1) {
case 33: case 43: case 64:
if (*(v0) != 40) {
if (!(a2 & 16) || !iswupper(*(a1)))
v6 = *(a1);
else
v6 = towlower(*(a1));
if (!(a2 & 16) || !iswupper(v1)) {
v9 = v1;
break;
} else {
v9 = towlower(v1);
break;
}
if (v6 != v9) {
v3 = 0;
return v3;
}
v3 = 1;
return v3;
} else {
v3 = 1;
return v3;
}
case 42:
v3 = 1;
return v3;
case 63:
if (*(v0) == 40) {
v3 = 1;
return v3;
} else if (*(a1)) {
v3 = 1;
return v3;
} else {
v3 = 0;
return v3;
}
default:
LABEL_400745:
if (!(a2 & 16) || !iswupper(*(a1)))
v7 = *(a1);
else
v7 = towlower(*(a1));
if (!(a2 & 16) || !iswupper(v1))
v8 = v1;
else
v8 = towlower(v1);
v3 = v7 == v8;
return v3;
}
}
}
|
void
xbcopy (s, d, n)
char *s, *d;
int n;
{
__builtin_memcpy ((d), (s), (n));
}
| long long xbcopy(void* a0, void* a1, unsigned long a2) {
return memcpy(a1, a0, a2);
}
|
int
ssh_packet_read_poll2(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
{
struct session_state *state = ssh->state;
u_int padlen, need;
u_char *cp;
u_int maclen, aadlen = 0, authlen = 0, block_size;
struct sshenc *enc =
((void *)0)
;
struct sshmac *mac =
((void *)0)
;
struct sshcomp *comp =
((void *)0)
;
int r;
if (state->mux)
return ssh_packet_read_poll2_mux(ssh, typep, seqnr_p);
*typep = 0;
if (state->packet_discard)
return 0;
if (state->newkeys[MODE_IN] !=
((void *)0)
) {
enc = &state->newkeys[MODE_IN]->enc;
mac = &state->newkeys[MODE_IN]->mac;
comp = &state->newkeys[MODE_IN]->comp;
if ((authlen = cipher_authlen(enc->cipher)) != 0)
mac =
((void *)0)
;
}
maclen = mac && mac->enabled ? mac->mac_len : 0;
block_size = enc ? enc->block_size : 8;
aadlen = (mac && mac->enabled && mac->etm) || authlen ? 4 : 0;
if (aadlen && state->packlen == 0) {
if (cipher_get_length(state->receive_context,
&state->packlen, state->p_read.seqnr,
sshbuf_ptr(state->input), sshbuf_len(state->input)) != 0)
return 0;
if (state->packlen < 1 + 4 ||
state->packlen > (256 * 1024)) {
sshlog("packet.c", __func__, 1520, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Bad packet length %u.", state->packlen);
if ((r = sshpkt_disconnect(ssh, "Packet corrupt")) != 0)
return r;
return -54;
}
sshbuf_reset(state->incoming_packet);
} else if (state->packlen == 0) {
if (sshbuf_len(state->input) < block_size)
return 0;
sshbuf_reset(state->incoming_packet);
if ((r = sshbuf_reserve(state->incoming_packet, block_size,
&cp)) != 0)
goto out;
if ((r = cipher_crypt(state->receive_context,
state->p_send.seqnr, cp, sshbuf_ptr(state->input),
block_size, 0, 0)) != 0)
goto out;
state->packlen = (((u_int32_t)(((const u_char *)(sshbuf_ptr(state->incoming_packet)))[0]) << 24) | ((u_int32_t)(((const u_char *)(sshbuf_ptr(state->incoming_packet)))[1]) << 16) | ((u_int32_t)(((const u_char *)(sshbuf_ptr(state->incoming_packet)))[2]) << 8) | (u_int32_t)(((const u_char *)(sshbuf_ptr(state->incoming_packet)))[3]));
if (state->packlen < 1 + 4 ||
state->packlen > (256 * 1024)) {
sshlog("packet.c", __func__, 1550, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Bad packet length %u.", state->packlen);
return ssh_packet_start_discard(ssh, enc, mac, 0,
(256 * 1024));
}
if ((r = sshbuf_consume(state->input, block_size)) != 0)
goto out;
}
;
if (aadlen) {
need = state->packlen;
} else {
need = 4 + state->packlen - block_size;
}
;
if (need % block_size != 0) {
sshlog("packet.c", __func__, 1572, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "padding error: need %d block %d mod %d", need, block_size, need % block_size)
;
return ssh_packet_start_discard(ssh, enc, mac, 0,
(256 * 1024) - block_size);
}
if (sshbuf_len(state->input) < aadlen + need + authlen + maclen)
return 0;
if (mac && mac->enabled && mac->etm) {
if ((r = mac_check(mac, state->p_read.seqnr,
sshbuf_ptr(state->input), aadlen + need,
sshbuf_ptr(state->input) + aadlen + need + authlen,
maclen)) != 0) {
if (r == -30)
sshlog("packet.c", __func__, 1598, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Corrupted MAC on input.");
goto out;
}
}
if ((r = sshbuf_reserve(state->incoming_packet, aadlen + need,
&cp)) != 0)
goto out;
if ((r = cipher_crypt(state->receive_context, state->p_read.seqnr, cp,
sshbuf_ptr(state->input), need, aadlen, authlen)) != 0)
goto out;
if ((r = sshbuf_consume(state->input, aadlen + need + authlen)) != 0)
goto out;
if (mac && mac->enabled) {
if (!mac->etm && (r = mac_check(mac, state->p_read.seqnr,
sshbuf_ptr(state->incoming_packet),
sshbuf_len(state->incoming_packet),
sshbuf_ptr(state->input), maclen)) != 0) {
if (r != -30)
goto out;
sshlog("packet.c", __func__, 1618, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Corrupted MAC on input.");
if (need + block_size > (256 * 1024))
return -1;
return ssh_packet_start_discard(ssh, enc, mac,
sshbuf_len(state->incoming_packet),
(256 * 1024) - need - block_size);
}
;
if ((r = sshbuf_consume(state->input, mac->mac_len)) != 0)
goto out;
}
if (seqnr_p !=
((void *)0)
)
*seqnr_p = state->p_read.seqnr;
if (++state->p_read.seqnr == 0)
sshlog("packet.c", __func__, 1633, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "incoming seqnr wraps around");
if (++state->p_read.packets == 0)
if (!(ssh->compat & 0x00008000))
return -39;
state->p_read.blocks += (state->packlen + 4) / block_size;
state->p_read.bytes += state->packlen + 4;
padlen = sshbuf_ptr(state->incoming_packet)[4];
;
if (padlen < 4) {
if ((r = sshpkt_disconnect(ssh,
"Corrupted padlen %d on input.", padlen)) != 0 ||
(r = ssh_packet_write_wait(ssh)) != 0)
return r;
return -54;
}
if ((r = sshbuf_consume(state->incoming_packet, 4 + 1)) != 0 ||
((r = sshbuf_consume_end(state->incoming_packet, padlen)) != 0))
goto out;
;
if (comp && comp->enabled) {
sshbuf_reset(state->compression_buffer);
if ((r = uncompress_buffer(ssh, state->incoming_packet,
state->compression_buffer)) != 0)
goto out;
sshbuf_reset(state->incoming_packet);
if ((r = sshbuf_putb(state->incoming_packet,
state->compression_buffer)) != 0)
goto out;
;
}
if ((r = sshbuf_get_u8(state->incoming_packet, typep)) != 0)
goto out;
if (ssh_packet_log_type(*typep))
sshlog("packet.c", __func__, 1677, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "receive packet: type %u", *typep);
if (*typep < 1 || *typep >= 192) {
if ((r = sshpkt_disconnect(ssh,
"Invalid ssh2 packet type: %d", *typep)) != 0 ||
(r = ssh_packet_write_wait(ssh)) != 0)
return r;
return -55;
}
if (state->hook_in !=
((void *)0)
&&
(r = state->hook_in(ssh, state->incoming_packet, typep,
state->hook_in_ctx)) != 0)
return r;
if (*typep == 52 && !state->server_side)
r = ssh_packet_enable_delayed_compress(ssh);
else
r = 0;
state->packlen = 0;
if ((r = ssh_packet_check_rekey(ssh)) != 0)
return r;
out:
return r;
}
| long ssh_packet_read_poll2(long a1, unsigned char *a2, _DWORD *a3)
{
unsigned int v4;
int v5;
int v6;
unsigned int v7;
long v8;
long v9;
long v10;
long v11;
long v12;
long v13;
int v14;
int v15;
int v16;
long v17;
long v18;
long v19;
unsigned long v20;
long v21;
long v22;
long v23;
long v24;
long v25;
long v26;
long v27;
long v28;
long v29;
long v30;
long v31;
long v32;
long v33;
unsigned int v35;
unsigned int v36;
unsigned int v37;
unsigned int u8;
unsigned int v39;
unsigned int v40;
unsigned int v41;
unsigned int v42;
unsigned int v43;
unsigned int v44;
unsigned int v45;
long v46;
long v47;
_DWORD *v48;
long v49;
long v50;
unsigned long v51;
v51 = __readfsqword(0x28u);
v50 = *(_QWORD *)a1;
v36 = 0;
v47 = 0LL;
v48 = 0LL;
v49 = 0LL;
if ( *(_DWORD *)(v50 + 480) )
return ssh_packet_read_poll2_mux((long *)a1, a2);
*a2 = 0;
if ( *(_DWORD *)(v50 + 452) )
return 0LL;
if ( *(_QWORD *)(v50 + 344) )
{
v47 = *(_QWORD *)(v50 + 344);
v48 = (_DWORD *)(*(_QWORD *)(v50 + 344) + 48LL);
v49 = *(_QWORD *)(v50 + 344) + 104LL;
v36 = cipher_authlen(*(_QWORD *)(v47 + 8));
if ( v36 )
v48 = 0LL;
}
if ( v48 && v48[2] )
v4 = v48[3];
else
v4 = 0;
v43 = v4;
if ( v47 )
v5 = *(_DWORD *)(v47 + 28);
else
v5 = 8;
v44 = v5;
if ( v48 && v48[2] && v48[8] || v36 )
v6 = 4;
else
v6 = 0;
v42 = v6;
if ( !v6 || *(_DWORD *)(v50 + 472) )
{
if ( !*(_DWORD *)(v50 + 472) )
{
if ( sshbuf_len(*(_QWORD *)(v50 + 32)) < (unsigned long)v44 )
return 0LL;
sshbuf_reset(*(_QWORD *)(v50 + 56));
u8 = sshbuf_reserve(*(_QWORD *)(v50 + 56), v44, &v46);
if ( u8 )
return u8;
v13 = sshbuf_ptr(*(_QWORD *)(v50 + 32));
u8 = cipher_crypt(*(_QWORD *)(v50 + 16), *(unsigned int *)(v50 + 384), v46, v13, v44, 0LL, 0LL);
if ( u8 )
return u8;
v14 = *(unsigned char *)sshbuf_ptr(*(_QWORD *)(v50 + 56)) << 24;
v15 = (*(unsigned char *)(sshbuf_ptr(*(_QWORD *)(v50 + 56)) + 1) << 16) | v14;
v16 = (*(unsigned char *)(sshbuf_ptr(*(_QWORD *)(v50 + 56)) + 2) << 8) | v15;
v17 = sshbuf_ptr(*(_QWORD *)(v50 + 56));
*(_DWORD *)(v50 + 472) = *(unsigned char *)(v17 + 3) | v16;
if ( *(_DWORD *)(v50 + 472) <= 4u || *(_DWORD *)(v50 + 472) > 0x40000u )
{
sshlog(
"packet.c",
"ssh_packet_read_poll2",
1550LL,
0LL,
3LL,
0LL,
"Bad packet length %u.",
*(unsigned int *)(v50 + 472));
return ssh_packet_start_discard((unsigned int **)a1, v47, (long)v48, 0LL, 0x40000LL, v18);
}
u8 = sshbuf_consume(*(_QWORD *)(v50 + 32), v44);
if ( u8 )
return u8;
}
}
else
{
v7 = sshbuf_len(*(_QWORD *)(v50 + 32));
v8 = sshbuf_ptr(*(_QWORD *)(v50 + 32));
if ( (unsigned int)cipher_get_length(*(_QWORD *)(v50 + 16), v50 + 472, *(unsigned int *)(v50 + 360), v8, v7) )
return 0LL;
if ( *(_DWORD *)(v50 + 472) <= 4u || *(_DWORD *)(v50 + 472) > 0x40000u )
{
sshlog(
"packet.c",
"ssh_packet_read_poll2",
1520LL,
0LL,
3LL,
0LL,
"Bad packet length %u.",
*(unsigned int *)(v50 + 472));
v37 = sshpkt_disconnect((long *)a1, "Packet corrupt", v9, v10, v11, v12);
if ( v37 )
return v37;
else
return 4294967242LL;
}
sshbuf_reset(*(_QWORD *)(v50 + 56));
}
if ( v42 )
v35 = *(_DWORD *)(v50 + 472);
else
v35 = *(_DWORD *)(v50 + 472) - v44 + 4;
if ( v35 % v44 )
{
sshlog(
"packet.c",
"ssh_packet_read_poll2",
1572LL,
0LL,
3LL,
0LL,
"padding error: need %d block %d mod %d",
v35,
v44,
v35 % v44);
return ssh_packet_start_discard((unsigned int **)a1, v47, (long)v48, 0LL, 0x40000 - v44, v19);
}
if ( sshbuf_len(*(_QWORD *)(v50 + 32)) < (unsigned long)(v36 + v35 + v42 + v43) )
return 0LL;
if ( v48 )
{
if ( v48[2] )
{
if ( v48[8] )
{
v20 = sshbuf_ptr(*(_QWORD *)(v50 + 32)) + v35 + (unsigned long)v42 + v36;
v21 = sshbuf_ptr(*(_QWORD *)(v50 + 32));
u8 = mac_check(v48, *(unsigned int *)(v50 + 360), v21, v42 + v35, v20, v43);
if ( u8 )
{
if ( u8 == -30 )
sshlog("packet.c", "ssh_packet_read_poll2", 1598LL, 0LL, 3LL, 0LL, "Corrupted MAC on input.");
return u8;
}
}
}
}
u8 = sshbuf_reserve(*(_QWORD *)(v50 + 56), v42 + v35, &v46);
if ( u8 )
return u8;
v22 = sshbuf_ptr(*(_QWORD *)(v50 + 32));
u8 = cipher_crypt(*(_QWORD *)(v50 + 16), *(unsigned int *)(v50 + 360), v46, v22, v35, v42, v36);
if ( u8 )
return u8;
u8 = sshbuf_consume(*(_QWORD *)(v50 + 32), v35 + v42 + v36);
if ( u8 )
return u8;
if ( v48 && v48[2] )
{
if ( !v48[8] )
{
v23 = sshbuf_ptr(*(_QWORD *)(v50 + 32));
v24 = sshbuf_len(*(_QWORD *)(v50 + 56));
v25 = sshbuf_ptr(*(_QWORD *)(v50 + 56));
u8 = mac_check(v48, *(unsigned int *)(v50 + 360), v25, v24, v23, v43);
if ( u8 )
{
if ( u8 == -30 )
{
sshlog("packet.c", "ssh_packet_read_poll2", 1618LL, 0LL, 3LL, 0LL, "Corrupted MAC on input.");
if ( v35 + v44 > 0x40000 )
return 0xFFFFFFFFLL;
v26 = sshbuf_len(*(_QWORD *)(v50 + 56));
return ssh_packet_start_discard((unsigned int **)a1, v47, (long)v48, v26, 0x40000 - (v35 + v44), v27);
}
return u8;
}
}
u8 = sshbuf_consume(*(_QWORD *)(v50 + 32), (unsigned int)v48[3]);
if ( u8 )
return u8;
}
if ( a3 )
*a3 = *(_DWORD *)(v50 + 360);
if ( !++*(_DWORD *)(v50 + 360) )
sshlog("packet.c", "ssh_packet_read_poll2", 1633LL, 0LL, 3LL, 0LL, "incoming seqnr wraps around");
if ( !++*(_DWORD *)(v50 + 364) && (*(_DWORD *)(a1 + 2108) & 0x8000) == 0 )
return 4294967257LL;
*(_QWORD *)(v50 + 368) += (*(_DWORD *)(v50 + 472) + 4) / v44;
*(_QWORD *)(v50 + 376) += (unsigned int)(*(_DWORD *)(v50 + 472) + 4);
v45 = *(unsigned char *)(sshbuf_ptr(*(_QWORD *)(v50 + 56)) + 4);
if ( v45 > 3 )
{
u8 = sshbuf_consume(*(_QWORD *)(v50 + 56), 5LL);
if ( u8 )
return u8;
u8 = sshbuf_consume_end(*(_QWORD *)(v50 + 56), v45);
if ( u8 )
return u8;
if ( v49 )
{
if ( *(_DWORD *)(v49 + 4) )
{
sshbuf_reset(*(_QWORD *)(v50 + 64));
u8 = uncompress_buffer((long *)a1, *(_QWORD *)(v50 + 56), *(_QWORD *)(v50 + 64));
if ( u8 )
return u8;
sshbuf_reset(*(_QWORD *)(v50 + 56));
u8 = sshbuf_putb(*(_QWORD *)(v50 + 56), *(_QWORD *)(v50 + 64));
if ( u8 )
return u8;
}
}
u8 = sshbuf_get_u8(*(_QWORD *)(v50 + 56), a2);
if ( u8 )
return u8;
if ( ssh_packet_log_type(*a2) )
sshlog("packet.c", "ssh_packet_read_poll2", 1677LL, 0LL, 7LL, 0LL, "receive packet: type %u", *a2);
if ( *a2 && *a2 <= 0xBFu )
{
if ( *(_QWORD *)(v50 + 496) )
{
v41 = (*(long ( **)(long, _QWORD, unsigned char *, _QWORD))(v50 + 496))(
a1,
*(_QWORD *)(v50 + 56),
a2,
*(_QWORD *)(v50 + 504));
if ( v41 )
return v41;
}
if ( *a2 == 52 && !*(_DWORD *)(v50 + 324) )
ssh_packet_enable_delayed_compress((long *)a1);
*(_DWORD *)(v50 + 472) = 0;
u8 = ssh_packet_check_rekey((long *)a1);
if ( u8 )
return u8;
return u8;
}
v40 = sshpkt_disconnect((long *)a1, "Invalid ssh2 packet type: %d", *a2, v31, v32, v33);
if ( v40 )
return v40;
v40 = ssh_packet_write_wait((long *)a1);
if ( v40 )
return v40;
else
return 4294967241LL;
}
else
{
v39 = sshpkt_disconnect((long *)a1, "Corrupted padlen %d on input.", v45, v28, v29, v30);
if ( v39 )
return v39;
v39 = ssh_packet_write_wait((long *)a1);
if ( v39 )
return v39;
else
return 4294967242LL;
}
}
|
int
main (int argc, char **argv)
{
int c;
_Bool
ok;
_Bool
make_backups =
0
;
char const *backup_suffix =
((void *)0)
;
char *version_control_string =
((void *)0)
;
struct cp_options x;
_Bool
remove_trailing_slashes =
0
;
char const *target_directory =
((void *)0)
;
_Bool
no_target_directory =
0
;
int n_files;
char **file;
_Bool
selinux_enabled = (0 < is_selinux_enabled ());
;
set_program_name (argv[0]);
setlocale (
6
, "");
bindtextdomain ("coreutils", "/usr/local/share/locale");
textdomain ("coreutils");
atexit (close_stdin);
cp_option_init (&x);
priv_set_remove_linkdir ();
while ((c = getopt_long (argc, argv, "bfint:uvS:TZ", long_options,
((void *)0)
))
!= -1)
{
switch (c)
{
case 'b':
make_backups =
1
;
if (optarg)
version_control_string = optarg;
break;
case 'f':
x.interactive = I_ALWAYS_YES;
break;
case 'i':
x.interactive = I_ASK_USER;
break;
case 'n':
x.interactive = I_ALWAYS_NO;
break;
case STRIP_TRAILING_SLASHES_OPTION:
remove_trailing_slashes =
1
;
break;
case 't':
if (target_directory)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"multiple target directories specified\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("multiple target directories specified")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("multiple target directories specified")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
target_directory = optarg;
break;
case 'T':
no_target_directory =
1
;
break;
case 'u':
x.update =
1
;
break;
case 'v':
x.verbose =
1
;
break;
case 'S':
make_backups =
1
;
backup_suffix = optarg;
break;
case 'Z':
if (selinux_enabled)
{
x.preserve_security_context =
0
;
x.set_security_context = selabel_open (
0
,
((void *)0)
, 0);
if (! x.set_security_context)
error (0,
(*__errno_location ())
, gettext ("warning: ignoring --context"));
}
break;
case GETOPT_HELP_CHAR: usage (
0
); break;;
case GETOPT_VERSION_CHAR: version_etc (
stdout
, "mv", "GNU coreutils", Version, ("Mike Parker"), ("David MacKenzie"), ("Jim Meyering"), (char *)
((void *)0)
); exit (
0
); break;;
default:
usage (
1
);
}
}
n_files = argc - optind;
file = argv + optind;
if (n_files <= !target_directory)
{
if (n_files <= 0)
error (0, 0, gettext ("missing file operand"));
else
error (0, 0, gettext ("missing destination file operand after %s"),
quotearg_style (shell_escape_always_quoting_style, file[0]));
usage (
1
);
}
struct stat sb;
sb.st_mode = 0;
int target_dirfd =
-100
;
if (no_target_directory)
{
if (target_directory)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"cannot combine --target-directory (-t) \" \"and --no-target-directory (-T)\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("cannot combine --target-directory (-t) " "and --no-target-directory (-T)")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("cannot combine --target-directory (-t) " "and --no-target-directory (-T)")), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
if (2 < n_files)
{
error (0, 0, gettext ("extra operand %s"), quotearg_style (shell_escape_always_quoting_style, file[2]));
usage (
1
);
}
}
else if (target_directory)
{
target_dirfd = target_directory_operand (target_directory, &sb);
if (! target_dirfd_valid (target_dirfd))
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"target directory %s\"), quotearg_style (shell_escape_always_quoting_style, target_directory)), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, gettext ("target directory %s"), quotearg_style (shell_escape_always_quoting_style, target_directory)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, gettext ("target directory %s"), quotearg_style (shell_escape_always_quoting_style, target_directory)), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
else
{
char const *lastfile = file[n_files - 1];
if (n_files == 2)
x.rename_errno = (renameatu (
-100
, file[0],
-100
, lastfile,
(1 << 0)
)
?
(*__errno_location ())
: 0);
if (x.rename_errno != 0)
{
int fd = target_directory_operand (lastfile, &sb);
if (target_dirfd_valid (fd))
{
x.rename_errno = -1;
target_dirfd = fd;
target_directory = lastfile;
n_files--;
}
else
{
int err =
(*__errno_location ())
;
if (2 < n_files
|| (O_PATHSEARCH ==
00
&& err ==
13
&& (sb.st_mode != 0 || stat (lastfile, &sb) == 0)
&&
((((
sb.st_mode
)) & 0170000) == (0040000))
))
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, err, gettext (\"target %s\"), quotearg_style (shell_escape_always_quoting_style, lastfile)), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, err, gettext ("target %s"), quotearg_style (shell_escape_always_quoting_style, lastfile)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, err, gettext ("target %s"), quotearg_style (shell_escape_always_quoting_style, lastfile)), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
}
}
}
if (remove_trailing_slashes)
for (int i = 0; i < n_files; i++)
strip_trailing_slashes (file[i]);
if (x.interactive == I_ALWAYS_NO)
x.update =
0
;
if (make_backups && x.interactive == I_ALWAYS_NO)
{
error (0, 0,
gettext ("options --backup and --no-clobber are mutually exclusive"));
usage (
1
);
}
x.backup_type = (make_backups
? xget_version (gettext ("backup type"),
version_control_string)
: no_backups);
set_simple_backup_suffix (backup_suffix);
hash_init ();
if (target_directory)
{
if (2 <= n_files)
dest_info_init (&x);
ok =
1
;
for (int i = 0; i < n_files; ++i)
{
x.last_file = i + 1 == n_files;
char const *source = file[i];
char const *source_basename = last_component (source);
char *dest_relname;
char *dest = file_name_concat (target_directory, source_basename,
&dest_relname);
strip_trailing_slashes (dest_relname);
ok &= do_move (source, dest, target_dirfd, dest_relname, &x);
free (dest);
}
}
else
{
x.last_file =
1
;
ok = do_move (file[0], file[1],
-100
, file[1], &x);
}
return ok ?
0
:
1
;
}
| int main(unsigned long long a0, unsigned long long *a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
void* v0;
char v1;
char v2;
char v3;
char v4;
char v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
unsigned int v11;
unsigned int v12;
char v13;
void* v14;
void* v15;
void* v16;
unsigned long long v17[3];
unsigned long long v18;
unsigned long long v19;
unsigned long long v20;
void* v21;
unsigned int v22;
unsigned int v23;
unsigned long v24;
char v25;
char v26;
char v27;
char v28;
unsigned int v29;
char v30;
unsigned int v31;
unsigned long long v33;
unsigned int v34;
unsigned long long v35;
unsigned long long v36;
unsigned long long v37;
unsigned long long v38;
v2 = 0;
v14 = 0;
v15 = 0;
v3 = 0;
v16 = 0;
v4 = 0;
v5 = is_selinux_enabled() > 0;
set_program_name(*(a1));
setlocale(0x6, &g_401413);
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(got.close_stdin);
cp_option_init(&v22);
priv_set_remove_linkdir(&v22, "/usr/local/share/locale", a2, a3, a4, a5);
while (true) {
v10 = getopt_long(a0, a1, "bfint:uvS:TZ", &long_options, NULL);
if (v10 == -1) {
v6 = a0 - optind;
v17[0] = &a1[optind];
if (v6 <= (!v16)) {
if (v6 <= 0) {
error(0x0, 0x0, gettext("missing file operand"));
} else {
v33 = quotearg_style(0x4, v17[0]);
error(0x0, 0x0, gettext("missing destination file operand after %s"));
}
usage(0x1);
} else {
v31 = 0;
v7 = -100;
if (v4) {
if (v16)
error(0x1, 0x0, gettext("cannot combine --target-directory (-t) and --no-target-directory (-T)"));
if (v6 > 2) {
v35 = quotearg_style(0x4, v17[2]);
error(0x0, 0x0, gettext("extra operand %s"));
usage(0x1);
}
} else {
if (v16) {
v7 = target_directory_operand(v16, &v30, &v30);
v34 = target_dirfd_valid(v7) ^ 1;
if (v34) {
v36 = quotearg_style(0x4, v16);
error(0x1, *(__errno_location()), gettext("target directory %s"));
}
} else {
v18 = v17[1 + v6];
if (v6 == 2) {
v34 = renameatu(0xffffff9c, v17[0], 0xffffff9c, v18, 0x1);
if (v34)
v34 = *(__errno_location());
else
v34 = 0;
v29 = v34;
}
if (v29) {
v11 = target_directory_operand(v18, &v30, &v30);
v34 = target_dirfd_valid(v11);
if (v34) {
v29 = -1;
v7 = v11;
v16 = v18;
v6 -= 1;
} else {
*(&v34) = *(__errno_location());
v12 = v34;
if (v6 > 2) {
v37 = quotearg_style(0x4, v18);
error(0x1, v12, gettext("target %s"));
}
}
}
}
}
if ((!v4 || !v16) && (!v4 || v6 <= 2) && (!v16 || !v34) && (!v29 || v6 <= 2 || v16 || v34)) {
if (!v3)
break;
if (v3) {
for (v8 = 0; v8 < v6; v8 += 1) {
strip_trailing_slashes(v17[v8]);
}
}
}
}
} else if (v10 <= 128) {
if (v10 < 83) {
if (v10 == -131) {
v0 = 0;
version_etc(stdout, "mv", "GNU coreutils", Version, "Mike Parker", "David MacKenzie", "Jim Meyering");
exit(0x0);
}
if (v10 == -130)
usage(0x0);
} else {
switch (v10) {
case 83:
v2 = 1;
v14 = *(&optarg);
break;
case 84:
v4 = 1;
break;
case 90:
if (!v5)
continue;
v25 = 0;
v24 = selabel_open(0x0, 0x0, 0x0);
if (v24)
continue;
error(0x0, *(__errno_location()), gettext("warning: ignoring --context"));
break;
case 98:
v2 = 1;
if (!*(&optarg))
continue;
v15 = *(&optarg);
break;
case 102:
v23 = 1;
break;
case 105:
v23 = 3;
break;
case 110:
v23 = 2;
break;
case 116:
if (v16)
error(0x1, 0x0, gettext("multiple target directories specified"));
v16 = *(&optarg);
break;
case 117:
v26 = 1;
break;
case 118:
v27 = 1;
break;
case 128:
v3 = 1;
break;
default:
usage(0x1);
}
}
}
}
if (v23 == 2)
v26 = 0;
if (v2 && v23 == 2) {
error(0x0, 0x0, gettext("options --backup and --no-clobber are mutually exclusive"));
usage(0x1);
}
if (!v2 || v23 != 2) {
if (v2) {
v38 = gettext("backup type");
v34 = xget_version(v38, v15, v38);
} else {
v34 = 0;
}
v22 = v34;
set_simple_backup_suffix(v14);
hash_init(a0, a1, a2, a3, a4, a5);
if (v16) {
if (v6 > 1)
dest_info_init(&v22);
v1 = 1;
for (v9 = 0; v9 < v6; v9 += 1) {
v28 = v6 == v9 + 1;
v19 = v17[v9];
v20 = last_component(v19);
v21 = file_name_concat(v16, v20, &v13, v20);
strip_trailing_slashes(*(&v13));
v1 = (do_move(v19, v21, v7, *(&v13), &v22) & v1);
free(v21);
}
} else {
v28 = 1;
v1 = do_move(v17[0], v17[1], 0xffffff9c, v17[1], &v22);
}
return v1 ^ 1;
}
}
|
int
validate_version(const char *const *argv)
{
struct dpkg_version version;
struct dpkg_error err;
if (!argv[0] || argv[1])
badusage(gettext("--%s takes one <version> argument"), cipaction->olong);
if (parseversion(&version, argv[0], &err) < 0) {
dpkg_error_print(&err, gettext("version '%s' has bad syntax"), argv[0]);
dpkg_error_destroy(&err);
return 1;
}
return 0;
}
| long long validate_version(unsigned long long a0[2]) {
char v0;
char v1;
unsigned long long v3;
unsigned long long v4;
if (a0[0] && !a0[1])
goto LABEL_401672;
badusage(gettext("--%s takes one <version> argument"), *(cipaction));
LABEL_401672:
if (parseversion(&v1, a0[0], &v0, a0[0]) >= 0) {
v3 = 0;
} else {
v4 = gettext("version '%s' has bad syntax");
dpkg_error_print(&v0, v4, a0[0], v4);
dpkg_error_destroy(&v0);
v3 = 1;
}
return v3;
}
|
void test_gzio(fname, uncompr, uncomprLen)
const char *fname;
Byte *uncompr;
uLong uncomprLen;
{
int err;
int len = (int)strlen(hello)+1;
gzFile file;
off_t pos;
file = gzopen(fname, "wb");
if (file ==
((void *)0)
) {
fprintf(
stderr
, "gzopen error\n");
exit(1);
}
gzputc(file, 'h');
if (gzputs(file, "ello") != 4) {
fprintf(
stderr
, "gzputs err: %s\n", gzerror(file, &err));
exit(1);
}
if (gzprintf(file, ", %s!", "hello") != 8) {
fprintf(
stderr
, "gzprintf err: %s\n", gzerror(file, &err));
exit(1);
}
gzseek(file, 1L,
1
);
gzclose(file);
file = gzopen(fname, "rb");
if (file ==
((void *)0)
) {
fprintf(
stderr
, "gzopen error\n");
exit(1);
}
strcpy((char*)uncompr, "garbage");
if (gzread(file, uncompr, (unsigned)uncomprLen) != len) {
fprintf(
stderr
, "gzread err: %s\n", gzerror(file, &err));
exit(1);
}
if (strcmp((char*)uncompr, hello)) {
fprintf(
stderr
, "bad gzread: %s\n", (char*)uncompr);
exit(1);
} else {
printf("gzread(): %s\n", (char*)uncompr);
}
pos = gzseek(file, -8L,
1
);
if (pos != 6 || gztell(file) != pos) {
fprintf(
stderr
, "gzseek error, pos=%ld, gztell=%ld\n",
(long)pos, (long)gztell(file));
exit(1);
}
if (((file)->have ? ((file)->have--, (file)->pos++, *((file)->next)++) : (gzgetc)(file)) != ' ') {
fprintf(
stderr
, "gzgetc error\n");
exit(1);
}
if (gzungetc(' ', file) != ' ') {
fprintf(
stderr
, "gzungetc error\n");
exit(1);
}
gzgets(file, (char*)uncompr, (int)uncomprLen);
if (strlen((char*)uncompr) != 7) {
fprintf(
stderr
, "gzgets err after gzseek: %s\n", gzerror(file, &err));
exit(1);
}
if (strcmp((char*)uncompr, hello + 6)) {
fprintf(
stderr
, "bad gzgets after gzseek\n");
exit(1);
} else {
printf("gzgets() after gzseek: %s\n", (char*)uncompr);
}
gzclose(file);
}
| unsigned long test_gzio(long a1, char *a2, unsigned int a3)
{
const char *v3;
const char *v4;
const char *v5;
long v6;
_BYTE *v7;
bool v8;
const char *v9;
char v12[4];
int v13;
long v14;
long v15;
unsigned long v16;
v16 = __readfsqword(0x28u);
v13 = strlen(hello) + 1;
v14 = gzopen(a1, "wb");
if ( !v14 )
{
fprintf(stderr, "gzopen error\n");
exit(1);
}
gzputc(v14, 104LL);
if ( (unsigned int)gzputs(v14, "ello") != 4 )
{
v3 = (const char *)gzerror(v14, v12);
fprintf(stderr, "gzputs err: %s\n", v3);
exit(1);
}
if ( (unsigned int)gzprintf(v14, ", %s!", "hello") != 8 )
{
v4 = (const char *)gzerror(v14, v12);
fprintf(stderr, "gzprintf err: %s\n", v4);
exit(1);
}
gzseek(v14, 1LL, 1LL);
gzclose(v14);
v14 = gzopen(a1, "rb");
if ( !v14 )
{
fprintf(stderr, "gzopen error\n");
exit(1);
}
strcpy(a2, "garbage");
if ( v13 != (unsigned int)gzread(v14, a2, a3) )
{
v5 = (const char *)gzerror(v14, v12);
fprintf(stderr, "gzread err: %s\n", v5);
exit(1);
}
if ( strcmp(a2, hello) )
{
fprintf(stderr, "bad gzread: %s\n", a2);
exit(1);
}
printf("gzread(): %s\n", a2);
v15 = gzseek(v14, -8LL, 1LL);
if ( v15 != 6 || gztell(v14) != 6 )
{
v6 = gztell(v14);
fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", v15, v6);
exit(1);
}
if ( *(_DWORD *)v14 )
{
--*(_DWORD *)v14;
++*(_QWORD *)(v14 + 16);
v7 = *(_BYTE **)(v14 + 8);
*(_QWORD *)(v14 + 8) = v7 + 1;
v8 = *v7 != 32;
}
else
{
v8 = (unsigned int)gzgetc(v14) != 32;
}
if ( v8 )
{
fprintf(stderr, "gzgetc error\n");
exit(1);
}
if ( (unsigned int)gzungetc(32LL, v14) != 32 )
{
fprintf(stderr, "gzungetc error\n");
exit(1);
}
gzgets(v14, a2, a3);
if ( strlen(a2) != 7 )
{
v9 = (const char *)gzerror(v14, v12);
fprintf(stderr, "gzgets err after gzseek: %s\n", v9);
exit(1);
}
if ( strcmp(a2, &hello[6]) )
{
fprintf(stderr, "bad gzgets after gzseek\n");
exit(1);
}
printf("gzgets() after gzseek: %s\n", a2);
gzclose(v14);
return __readfsqword(0x28u) ^ v16;
}
|
int
returncmd(int argc, char **argv)
{
int skip;
int status;
if (argv[1]) {
skip = (1 << 2);
status = number(argv[1]);
} else {
skip = (1 << 3);
status = exitstatus;
}
evalskip = skip;
return status;
}
| long long returncmd(unsigned long a0, struct_0 *a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
v0 = a0;
if (a1->field_8) {
v1 = 4;
v2 = number(a1->field_8);
} else {
v1 = 8;
v2 = 17905618636109546312;
}
inps4 = v1;
return v2;
}
|
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... [FILE]...\n")
,
program_name);
fputs_unlocked (gettext ("Print selected parts of lines from each FILE to standard output.\n"),
stdout
)
;
emit_stdin_note ();
emit_mandatory_arg_note ();
fputs_unlocked (gettext (" -b, --bytes=LIST select only these bytes\n -c, --characters=LIST select only these characters\n -d, --delimiter=DELIM use DELIM instead of TAB for field delimiter\n"),
stdout
)
;
fputs_unlocked (gettext (" -f, --fields=LIST select only these fields; also print any line\n that contains no delimiter character, unless\n the -s option is specified\n -n (ignored)\n"),
stdout
)
;
fputs_unlocked (gettext (" --complement complement the set of selected bytes, characters\n or fields\n"),
stdout
)
;
fputs_unlocked (gettext (" -s, --only-delimited do not print lines not containing delimiters\n --output-delimiter=STRING use STRING as the output delimiter\n the default is to use the input delimiter\n"),
stdout
)
;
fputs_unlocked (gettext (" -z, --zero-terminated line delimiter is NUL, not newline\n"),
stdout
)
;
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 ("\nUse one, and only one of -b, -c or -f. Each LIST is made up of one\nrange, or many ranges separated by commas. Selected input is written\nin the same order that it is read, and is written exactly once.\n"),
stdout
)
;
fputs_unlocked (gettext ("Each range is one of:\n\n N N'th byte, character or field, counted from 1\n N- from N'th byte, character or field, to end of line\n N-M from N'th to M'th (included) byte, character or field\n -M from first to M'th (included) byte, character or field\n"),
stdout
)
;
emit_ancillary_info ("cut");
}
exit (status);
}
| void usage(unsigned long a0) {
unsigned long v0;
unsigned long v2;
v0 = v2;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s OPTION... [FILE]...\n"));
fputs_unlocked(gettext("Print selected parts of lines from each FILE to standard output.\n"), stdout);
emit_stdin_note();
emit_mandatory_arg_note();
fputs_unlocked(gettext(" -b, --bytes=LIST select only these bytes\n -c, --characters=LIST select only these characters\n -d, --delimiter=DELIM use DELIM instead of TAB for field delimiter\n"), stdout);
fputs_unlocked(gettext(" -f, --fields=LIST select only these fields; also print any line\n that contains no delimiter character, unless\n the -s option is specified\n -n (ignored)\n"), stdout);
fputs_unlocked(gettext(" --complement complement the set of selected bytes, characters\n or fields\n"), stdout);
fputs_unlocked(gettext(" -s, --only-delimited do not print lines not containing delimiters\n --output-delimiter=STRING use STRING as the output delimiter\n the default is to use the input delimiter\n"), stdout);
fputs_unlocked(gettext(" -z, --zero-terminated line delimiter is NUL, not newline\n"), stdout);
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("\nUse one, and only one of -b, -c or -f. Each LIST is made up of one\nrange, or many ranges separated by commas. Selected input is written\nin the same order that it is read, and is written exactly once.\n"), stdout);
fputs_unlocked(gettext("Each range is one of:\n\n N N'th byte, character or field, counted from 1\n N- from N'th byte, character or field, to end of line\n N-M from N'th to M'th (included) byte, character or field\n -M from first to M'th (included) byte, character or field\n"), stdout);
emit_ancillary_info("cut");
}
exit(a0);
}
|
static const char *strxf_time(__u64 time)
{
static char str[32];
if (time == 0)
strcpy(str, "-");
else {
time_t t;
struct tm *tp;
t = (long)time;
tp = localtime(&t);
strftime(str, sizeof(str), "%Y-%m-%d %T", tp);
}
return str;
}
| int strxf_time(unsigned long a0) {
unsigned long v0;
void* v1;
if (!a0) {
strcpy(&str.9329, "-");
} else {
v0 = a0;
v1 = localtime(&v0);
strftime(&str.9329, 0x20, "%Y-%m-%d %T", v1);
}
return &str.9329;
}
|
void
undo_partial_redirects ()
{
if (redirection_undo_list)
{
cleanup_redirects (redirection_undo_list);
redirection_undo_list = (REDIRECT *)
((void *)0)
;
}
}
| long long undo_partial_redirects() {
unsigned long long v1;
v1 = redirection_undo_list;
if (redirection_undo_list) {
v1 = cleanup_redirects(redirection_undo_list);
redirection_undo_list = 0;
return v1;
}
return v1;
}
|
int
sys_truncate (int fd)
{
off_t pos = lseek (fd, (off_t) 0,
1
);
return pos < 0 ? -1 : ftruncate (fd, pos);
}
| long long sys_truncate(unsigned long a0) {
char v0;
unsigned int v1;
unsigned long long v3;
*(&v1) = lseek(a0, 0x0, 0x1);
if ((*(&v1) - 0 >> 63)) {
v3 = 4294967295;
return v3;
}
v3 = ftruncate(*(&v0), *(&v1));
return v3;
}
|
void
clear_fifo (i)
int i;
{
if (dev_fd_list[i])
{
dev_fd_list[i] = 0;
nfds--;
}
}
| long clear_fifo(int a1)
{
long result;
result = *((unsigned int *)dev_fd_list + a1);
if ( (_DWORD)result )
{
*((_DWORD *)dev_fd_list + a1) = 0;
return (unsigned int)--nfds;
}
return result;
}
|
unsigned long crc32(crc, buf, len)
unsigned long crc;
const unsigned char *buf;
uInt len;
{
return crc32_z(crc, buf, len);
}
| long long crc32(unsigned long long a0, unsigned int a1, unsigned long a2) {
return crc32_z(a0, a1, a2);
}
|
int
sshbuf_peek_u8(const struct sshbuf *buf, size_t offset, u_char *valp)
{
const u_char *p =
((void *)0)
;
int r;
if (valp !=
((void *)0)
)
*valp = 0;
if ((r = check_roffset(buf, offset, 1, &p)) != 0)
return r;
if (valp !=
((void *)0)
)
*valp = *p;
return 0;
}
| long long sshbuf_peek_u8(unsigned long long a0, unsigned long a1, char *a2) {
unsigned int v0;
void* v1;
void* v3;
v1 = 0;
if (a2)
*(a2) = 0;
v0 = check_roffset(a0, a1, 0x1, &v1);
if (v0) {
v3 = v0;
} else {
if (a2)
*(a2) = *(v1);
v3 = 0;
}
return v3;
}
|
void
bashline_reinitialize ()
{
bash_readline_initialized = 0;
}
| void bashline_reinitialize(void)
{
bash_readline_initialized = 0;
return;
}
|
static int
shouldexp_filterpat (s)
char *s;
{
register char *p;
for (p = s; p && *p; p++)
{
if (*p == '\\')
p++;
else if (*p == '&')
return 1;
}
return 0;
}
| int shouldexp_filterpat(unsigned long long a0) {
char *v1;
unsigned int v2;
v1 = a0;
while (v1) {
switch (*(v1)) {
case 0:
v2 = 0;
return v2;
case 92:
v1 += 1;
break;
case 38:
v2 = 1;
return v2;
default:
v1 += 1;
continue;
}
}
v2 = 0;
return v2;
}
|
int
rl_maybe_save_line (void)
{
if (_rl_saved_line_for_history == 0)
{
_rl_saved_line_for_history = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
_rl_saved_line_for_history->line = strcpy ((char *)xmalloc (1 + strlen (rl_line_buffer)), (rl_line_buffer));
_rl_saved_line_for_history->timestamp = (char *)
((void *)0)
;
_rl_saved_line_for_history->data = (char *)rl_undo_list;
}
return 0;
}
| undefined8 rl_maybe_save_line(void)
{
char **ppcVar1;
size_t sVar2;
char *__dest;
char *pcVar3;
if (_rl_saved_line_for_history == (char **)0x0) {
_rl_saved_line_for_history = (char **)xmalloc(0x18);
pcVar3 = rl_line_buffer;
sVar2 = strlen(rl_line_buffer);
__dest = (char *)xmalloc(sVar2 + 1);
ppcVar1 = _rl_saved_line_for_history;
pcVar3 = strcpy(__dest,pcVar3);
*ppcVar1 = pcVar3;
_rl_saved_line_for_history[1] = (char *)0x0;
_rl_saved_line_for_history[2] = rl_undo_list;
}
return 0;
}
|
void
sh_getopt_restore_istate (state)
sh_getopt_state_t *state;
{
sh_optarg = state->gs_optarg;
sh_optind = state->gs_optind;
sh_curopt = state->gs_curopt;
nextchar = state->gs_nextchar;
sh_charindex = state->gs_charindex;
sh_getopt_dispose_istate (state);
}
| void sh_getopt_restore_istate(undefined8 *param_1)
{
sh_optarg = *param_1;
sh_optind = *(undefined4 *)(param_1 + 1);
sh_curopt = *(undefined4 *)((long)param_1 + 0xc);
nextchar = param_1[2];
sh_charindex = *(undefined4 *)(param_1 + 3);
sh_getopt_dispose_istate(param_1);
return;
}
|
static void
print_sep_string (void)
{
char const *s = col_sep_string;
int l = col_sep_length;
if (separators_not_printed <= 0)
{
if (spaces_not_printed > 0)
print_white_space ();
}
else
{
for (; separators_not_printed > 0; --separators_not_printed)
{
while (l-- > 0)
{
if (*s == ' ')
{
s++;
++spaces_not_printed;
}
else
{
if (spaces_not_printed > 0)
print_white_space ();
putchar_unlocked (*s++);
++output_position;
}
}
if (spaces_not_printed > 0)
print_white_space ();
}
}
}
| void print_sep_string() {
unsigned long long v0;
int tmp_8;
char *v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
v1 = col_sep_string;
*(&v0) = col_sep_length;
if (separators_not_printed <= 0) {
v3 = spaces_not_printed;
if (spaces_not_printed > 0)
v5 = print_white_space();
} else {
while (true) {
v4 = separators_not_printed;
if (separators_not_printed <= 0)
break;
while (true) {
*(&v4) = v0;
*(&v0) = v0 - 1;
if (v4 <= 0)
break;
if (*(v1) == 32) {
v1 += 1;
spaces_not_printed = spaces_not_printed + 1;
} else {
if (spaces_not_printed > 0)
print_white_space();
tmp_8 = v1;
v1 += 1;
*(&v4) = *(tmp_8);
putchar_unlocked(v4);
output_position = output_position + 1;
}
}
if (spaces_not_printed > 0)
print_white_space();
separators_not_printed = separators_not_printed - 1;
}
}
return;
}
|
static void vxlan_print_help(struct link_util *lu, int argc, char **argv,
FILE *f)
{
print_explain(f);
}
| long long vxlan_print_help(unsigned long a0, unsigned long a1, unsigned long a2, void* a3) {
unsigned long v0;
unsigned int v1;
unsigned long v2;
v2 = a0;
v1 = a1;
v0 = a2;
return print_explain(a3);
}
|
int do_handshake(socket_st * socket)
{
return -1;
}
| long long do_handshake(unsigned long a0) {
unsigned long v0;
v0 = a0;
return 4294967295;
}
|
static void
suspchild(int signo)
{
suspone(do_cmd_pid, signo);
suspone(do_cmd_pid2, signo);
kill(getpid(),
19
);
}
| long long suspchild(unsigned long a0) {
suspone(do_cmd_pid, a0);
suspone(do_cmd_pid2, a0);
return kill(getpid(), 0x13);
}
|
char *
get_posix_options (bitmap)
char *bitmap;
{
register int i;
if (bitmap == 0)
bitmap = (char *)sh_xmalloc((num_posix_options ()), "general.c", 143);
for (i = 0; posix_vars[i].posix_mode_var; i++)
bitmap[i] = *(posix_vars[i].posix_mode_var);
return bitmap;
}
| int get_posix_options(unsigned long long a0) {
void* v0;
void* v2;
v0 = a0;
if (!v0)
v0 = sh_xmalloc(num_posix_options(), "general.c", 0x8f);
for (v2 = 0; *((0x8 * v2 + &posix_vars[0])); v2 = v2 + 1) {
*((v0 + v2)) = *(*((0x8 * v2 + &posix_vars[0])));
}
return v0;
}
|
static const Char *
globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, _ssh_compat_glob_t *pglob)
{
struct passwd *pwd;
char *h;
const Char *p;
Char *b, *eb;
if (*pattern != '~' || !(pglob->gl_flags & 0x0800))
return pattern;
eb = &patbuf[patbuf_len - 1];
for (p = pattern + 1, h = (char *) patbuf;
h < (char *)eb && *p && *p != '/'; *h++ = *p++)
;
*h = '\0';
if (((char *) patbuf)[0] == '\0') {
if ((getuid() != geteuid()) || (h = getenv("HOME")) ==
((void *)0)
) {
if ((pwd = getpwuid(getuid())) ==
((void *)0)
)
return pattern;
else
h = pwd->pw_dir;
}
} else {
if ((pwd = getpwnam((char*) patbuf)) ==
((void *)0)
)
return pattern;
else
h = pwd->pw_dir;
}
for (b = patbuf; b < eb && *h; *b++ = *h++)
;
while (b < eb && (*b++ = *p++) != '\0')
;
*b = '\0';
return patbuf;
}
| int globtilde(unsigned short *a0, void* a1, unsigned long long a2, struct_0 *a3) {
char *v0;
int tmp_10;
int tmp_14;
int tmp_22;
unsigned short *v1;
void* v2;
unsigned long v3;
struct_1 *v4;
void* v6;
unsigned int v7;
unsigned short v8;
if (*(a0) == 126 && (a3->field_18 & 0x800)) {
v3 = a1 + a2 * 2 - 2;
v1 = a0 + 1;
for (v0 = a1; v0 < v3; *(v6) = a2) {
if (!*(v1))
break;
if (*(v1)) {
if (*(v1) == 47)
break;
}
tmp_10 = v1;
v1 = v1 + 1;
v6 = v0;
v0 += 1;
a2 = *(tmp_10);
}
*(v0) = 0;
if (!*(a1)) {
v7 = getuid();
v6 = geteuid();
if (v7 == v6)
v0 = getenv("HOME");
if (!v0 || v7 != v6) {
v4 = &getpwuid(getuid())->pw_name;
if (!v4)
*(&v6) = a0;
else
v0 = v4->field_20;
}
} else {
v4 = &getpwnam(a1)->pw_name;
if (!v4)
*(&v6) = a0;
else
v0 = v4->field_20;
}
if (!*(a1) && v4 || *(a1) && v4 || !*(a1) && v7 == v6 && v0) {
for (v2 = a1; v2 < v3; *(v6) = v8) {
if (!*(v0))
break;
tmp_10 = v0;
v0 = &v0[1];
v8 = *(tmp_10);
v6 = v2;
v2 += 2;
}
while (v2 < v3) {
tmp_14 = v1;
v1 = v1 + 1;
tmp_22 = v2;
v2 += 2;
*(&a2) = *(tmp_14);
*(tmp_22) = a2;
*(&v6) = *(tmp_22);
if (!v6)
break;
}
*(v2) = 0;
*(&v6) = a1;
}
}
if (!(a3->field_18 & 0x800) || *(a0) != 126)
v6 = a0;
return v6;
}
|
static
_Bool
gid_to_chars (gid_t v, char *p, size_t s)
{
return to_chars (v < 0, (uintmax_t) v, sizeof v, gid_substitute, p, s, "gid_t");
}
| long gid_to_chars(unsigned int a1, char *a2, long a3)
{
return to_chars(0, a1, 4LL, gid_substitute, a2, a3, (long)"gid_t");
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.