input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
static void
check_inputs (char *const *files, size_t nfiles)
{
for (size_t i = 0; i < nfiles; i++)
{
if ((strcmp (files[i], "-") == 0))
continue;
if (euidaccess (files[i],
4
) != 0)
sort_die (gettext ("cannot read"), files[i]);
}
}
| void check_inputs(long param_1,ulong param_2)
{
undefined8 uVar1;
int iVar2;
undefined8 uVar3;
ulong local_20;
for (local_20 = 0; local_20 < param_2; local_20 = local_20 + 1) {
iVar2 = strcmp(*(char **)(param_1 + local_20 * 8),"-");
if (iVar2 != 0) {
iVar2 = euidaccess(*(char **)(param_1 + local_20 * 8),4);
if (iVar2 != 0) {
uVar1 = *(undefined8 *)(param_1 + local_20 * 8);
uVar3 = gettext("cannot read");
sort_die(uVar3,uVar1);
}
}
}
return;
}
|
static enum found_status
deppossi_ok_found(struct pkginfo *possdependee, struct pkginfo *requiredby,
struct pkginfo *removing, struct deppossi *provider,
struct pkginfo **fixbytrig,
_Bool
*matched, struct deppossi *checkversion,
int *interestingwarnings, struct varbuf *oemsgs)
{
enum found_status thisf;
if (ignore_depends(possdependee)) {
debug(dbg_depcondetail," ignoring depended package so ok and found");
return FOUND_OK;
}
thisf = FOUND_NONE;
if (possdependee == removing) {
if (provider) {
varbuf_printf(oemsgs,
gettext(" Package %s which provides %s is to be removed.\n"),
pkg_name(possdependee, pnaw_nonambig),
provider->ed->name);
} else {
varbuf_printf(oemsgs, gettext(" Package %s is to be removed.\n"),
pkg_name(possdependee, pnaw_nonambig));
}
*matched =
1
;
debug(dbg_depcondetail," removing possdependee, returning %d",thisf);
return thisf;
}
switch (possdependee->status) {
case PKG_STAT_UNPACKED:
case PKG_STAT_HALFCONFIGURED:
case PKG_STAT_TRIGGERSAWAITED:
case PKG_STAT_TRIGGERSPENDING:
case PKG_STAT_INSTALLED:
if (checkversion) {
if (provider) {
debug(dbg_depcondetail, " checking package %s provided by pkg %s",
checkversion->ed->name, pkg_name(possdependee, pnaw_always));
if (!pkg_virtual_deppossi_satisfied(checkversion, provider)) {
varbuf_printf(oemsgs,
gettext(" Version of %s on system, provided by %s, is %s.\n"),
checkversion->ed->name,
pkg_name(possdependee, pnaw_always),
versiondescribe(&provider->version, vdew_nonambig));
if (in_force(FORCE_DEPENDS_VERSION))
thisf = found_forced_on(DEPEND_TRY_FORCE_DEPENDS_VERSION);
debug(dbg_depcondetail, " bad version");
goto unsuitable;
}
} else {
debug(dbg_depcondetail, " checking non-provided pkg %s",
pkg_name(possdependee, pnaw_always));
if (!versionsatisfied(&possdependee->installed, checkversion)) {
varbuf_printf(oemsgs, gettext(" Version of %s on system is %s.\n"),
pkg_name(possdependee, pnaw_nonambig),
versiondescribe(&possdependee->installed.version,
vdew_nonambig));
if (in_force(FORCE_DEPENDS_VERSION))
thisf = found_forced_on(DEPEND_TRY_FORCE_DEPENDS_VERSION);
debug(dbg_depcondetail, " bad version");
goto unsuitable;
}
}
}
if (possdependee->status == PKG_STAT_INSTALLED ||
possdependee->status == PKG_STAT_TRIGGERSPENDING) {
debug(dbg_depcondetail," is installed, ok and found");
return FOUND_OK;
}
if (possdependee->status == PKG_STAT_TRIGGERSAWAITED) {
if (possdependee->trigaw.head ==
((void *)0)
)
do_internerr("packages.c", 448, __func__, "package %s in state %s, has no awaited triggers", pkg_name(possdependee, pnaw_always), pkg_status_name(possdependee))
;
if (removing ||
!(f_triggers ||
(possdependee->clientdata &&
possdependee->clientdata->istobe == PKG_ISTOBE_INSTALLNEW))) {
if (provider) {
varbuf_printf(oemsgs,
gettext(" Package %s which provides %s awaits trigger processing.\n"),
pkg_name(possdependee, pnaw_nonambig),
provider->ed->name);
} else {
varbuf_printf(oemsgs,
gettext(" Package %s awaits trigger processing.\n"),
pkg_name(possdependee, pnaw_nonambig));
}
debug(dbg_depcondetail, " triggers-awaited, no fixbytrig");
goto unsuitable;
}
*fixbytrig = possdependee->trigaw.head->pend;
debug(dbg_depcondetail,
" triggers-awaited, fixbytrig '%s', defer",
pkg_name(*fixbytrig, pnaw_always));
return FOUND_DEFER;
}
if (possdependee->clientdata &&
possdependee->clientdata->istobe == PKG_ISTOBE_INSTALLNEW) {
debug(dbg_depcondetail," unpacked/halfconfigured, defer");
return FOUND_DEFER;
} else if (!removing && in_force(FORCE_CONFIGURE_ANY) &&
!skip_due_to_hold(possdependee) &&
!(possdependee->status == PKG_STAT_HALFCONFIGURED)) {
notice(gettext("also configuring '%s' (required by '%s')"),
pkg_name(possdependee, pnaw_nonambig),
pkg_name(requiredby, pnaw_nonambig));
enqueue_package(possdependee);
sincenothing = 0;
return FOUND_DEFER;
} else {
if (provider) {
varbuf_printf(oemsgs,
gettext(" Package %s which provides %s is not configured yet.\n"),
pkg_name(possdependee, pnaw_nonambig),
provider->ed->name);
} else {
varbuf_printf(oemsgs, gettext(" Package %s is not configured yet.\n"),
pkg_name(possdependee, pnaw_nonambig));
}
debug(dbg_depcondetail, " not configured/able");
goto unsuitable;
}
default:
if (provider) {
varbuf_printf(oemsgs,
gettext(" Package %s which provides %s is not installed.\n"),
pkg_name(possdependee, pnaw_nonambig),
provider->ed->name);
} else {
varbuf_printf(oemsgs, gettext(" Package %s is not installed.\n"),
pkg_name(possdependee, pnaw_nonambig));
}
debug(dbg_depcondetail, " not installed");
goto unsuitable;
}
unsuitable:
debug(dbg_depcondetail, " returning %d", thisf);
(*interestingwarnings)++;
return thisf;
}
| int deppossi_ok_found(struct_2 *a0, unsigned long long a1, unsigned long long a2, struct_0 *a3, unsigned long long a4, char *a5, struct_0 *v1, unsigned int *a6, unsigned long long a7) {
unsigned int v0;
unsigned int v2;
if (ignore_depends(a0)) {
debug(0x100, " ignoring depended package so ok and found", a2, a3, a4, a5);
v2 = 3;
} else {
v0 = 0;
if (a0 == a2) {
if (!a3) {
v2 = gettext(" Package %s is to be removed.\n");
varbuf_printf(a7, v2, pkg_name(a0, 0x1), v2);
} else {
varbuf_printf(a7, gettext(" Package %s which provides %s is to be removed.\n"), pkg_name(a0, 0x1), a3->field_8->field_8);
}
*(a5) = 1;
debug(0x100, " removing possdependee, returning %d", v0, a3, a4, a5);
v2 = v0;
} else if (a0->field_18 - 3 <= 4) {
if (v1) {
if (a3) {
debug(0x100, " checking package %s provided by pkg %s", v1->field_8->field_8, pkg_name(a0, 0x3), a4, a5);
v2 = pkg_virtual_deppossi_satisfied(v1, a3) ^ 1;
if (v2) {
versiondescribe(a3 + 3, 0x1);
varbuf_printf(a7, gettext(" Version of %s on system, provided by %s, is %s.\n"), v1->field_8->field_8, pkg_name(a0, 0x3));
if (in_force(0x2000))
v0 = found_forced_on(0x5);
debug(0x100, " bad version", a2, a3, a4, a5);
goto LABEL_401177;
}
} else {
debug(0x100, " checking non-provided pkg %s", pkg_name(a0, 0x3), a3, a4, a5);
v2 = versionsatisfied(&a0->padding_1c[44], v1) ^ 1;
if (v2) {
varbuf_printf(a7, gettext(" Version of %s on system is %s.\n"), pkg_name(a0, 0x1), versiondescribe(&a0->padding_1c[124], 0x1));
if (in_force(0x2000))
v0 = found_forced_on(0x5);
debug(0x100, " bad version", a2, a3, a4, a5);
goto LABEL_401177;
}
}
}
if (a0->field_18 != 7 && a0->field_18 != 6) {
if (a0->field_18 != 5) {
if (a0->field_138 && a0->field_138->field_0 == 2) {
debug(0x100, " unpacked/halfconfigured, defer", a2, a3, a4, a5);
v2 = 1;
goto LABEL_4011a4;
}
if (!a2 && in_force(0x400)) {
v2 = skip_due_to_hold(a0) ^ 1;
if (v2 && a0->field_18 != 4) {
notice(gettext("also configuring '%s' (required by '%s')"), pkg_name(a0, 0x1), pkg_name(a1, 0x1));
enqueue_package(a0);
sincenothing = 0;
v2 = 1;
goto LABEL_4011a4;
}
}
if (!a3) {
v2 = gettext(" Package %s is not configured yet.\n");
varbuf_printf(a7, v2, pkg_name(a0, 0x1), v2);
} else {
varbuf_printf(a7, gettext(" Package %s which provides %s is not configured yet.\n"), pkg_name(a0, 0x1), a3->field_8->field_8);
}
debug(0x100, " not configured/able", a2, a3, a4, a5);
goto LABEL_401177;
} else {
if (!a0->field_148) {
pkg_status_name(a0);
do_internerr("packages.c", 0x1c0, "deppossi_ok_found", "package %s in state %s, has no awaited triggers", pkg_name(a0, 0x3));
}
if (!a2) {
if (f_triggers) {
LABEL_400f01:
*(a4) = a0->field_148->field_8;
debug(0x100, " triggers-awaited, fixbytrig '%s', defer", pkg_name(*(a4), 0x3), a3, a4, a5);
v2 = 1;
goto LABEL_4011a4;
} else if (a0->field_138) {
if (!(a0->field_138->field_0 == 2))
goto LABEL_400e5d;
goto LABEL_400f01;
}
}
LABEL_400e5d:
if (!a3) {
v2 = gettext(" Package %s awaits trigger processing.\n");
varbuf_printf(a7, v2, pkg_name(a0, 0x1), v2);
} else {
varbuf_printf(a7, gettext(" Package %s which provides %s awaits trigger processing.\n"), pkg_name(a0, 0x1), a3->field_8->field_8);
}
debug(0x100, " triggers-awaited, no fixbytrig", a2, a3, a4, a5);
goto LABEL_401177;
}
}
debug(0x100, " is installed, ok and found", a2, a3, a4, a5);
v2 = 3;
} else {
if (!a3) {
v2 = gettext(" Package %s is not installed.\n");
varbuf_printf(a7, v2, pkg_name(a0, 0x1), v2);
} else {
varbuf_printf(a7, gettext(" Package %s which provides %s is not installed.\n"), pkg_name(a0, 0x1), a3->field_8->field_8);
}
debug(0x100, " not installed", a2, a3, a4, a5);
LABEL_401177:
debug(0x100, " returning %d", v0, a3, a4, a5);
*(a6) = *(a6) + 1;
v2 = v0;
}
}
LABEL_4011a4:
return v2;
}
|
int
ssh_packet_send2(struct ssh *ssh)
{
struct session_state *state = ssh->state;
struct packet *p;
u_char type;
int r, need_rekey;
if (sshbuf_len(state->outgoing_packet) < 6)
return -1;
type = sshbuf_ptr(state->outgoing_packet)[5];
need_rekey = !ssh_packet_type_is_kex(type) &&
ssh_packet_need_rekeying(ssh, sshbuf_len(state->outgoing_packet));
if ((need_rekey || state->rekeying) && !ssh_packet_type_is_kex(type)) {
if (need_rekey)
sshlog("packet.c", __func__, 1259, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "rekex triggered");
sshlog("packet.c", __func__, 1260, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "enqueue packet: %u", type);
p = calloc(1, sizeof(*p));
if (p ==
((void *)0)
)
return -2;
p->type = type;
p->payload = state->outgoing_packet;
do { (p)->next.tqe_next =
((void *)0)
; (p)->next.tqe_prev = (&state->outgoing)->tqh_last; *(&state->outgoing)->tqh_last = (p); (&state->outgoing)->tqh_last = &(p)->next.tqe_next; } while (0);
state->outgoing_packet = sshbuf_new();
if (state->outgoing_packet ==
((void *)0)
)
return -2;
if (need_rekey) {
return kex_start_rekex(ssh);
}
return 0;
}
if (type == 20)
state->rekeying = 1;
if ((r = ssh_packet_send2_wrapped(ssh)) != 0)
return r;
if (type == 21) {
state->rekeying = 0;
state->rekey_time = monotime();
while ((p = ((&state->outgoing)->tqh_first))) {
type = p->type;
if (ssh_packet_need_rekeying(ssh,
sshbuf_len(p->payload))) {
sshlog("packet.c", __func__, 1301, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "queued packet triggered rekex");
return kex_start_rekex(ssh);
}
sshlog("packet.c", __func__, 1304, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "dequeue packet: %u", type);
sshbuf_free(state->outgoing_packet);
state->outgoing_packet = p->payload;
do { if (((p)->next.tqe_next) !=
((void *)0)
) (p)->next.tqe_next->next.tqe_prev = (p)->next.tqe_prev; else (&state->outgoing)->tqh_last = (p)->next.tqe_prev; *(p)->next.tqe_prev = (p)->next.tqe_next; ; ; } while (0);
memset(p, 0, sizeof(*p));
free(p);
if ((r = ssh_packet_send2_wrapped(ssh)) != 0)
return r;
}
}
return 0;
}
| long ssh_packet_send2(long *a1, long a2)
{
unsigned int v3;
_BOOL4 v4;
int v5;
unsigned char v6;
unsigned char v7;
_BOOL4 v8;
unsigned int v9;
unsigned int v10;
long v11;
_BYTE *s;
_BYTE *sa;
v11 = *a1;
if ( (unsigned long)sshbuf_len(*(_QWORD *)(*a1 + 48)) <= 5 )
return 0xFFFFFFFFLL;
v6 = *(_BYTE *)(sshbuf_ptr(*(_QWORD *)(v11 + 48)) + 5);
v4 = 0;
if ( !ssh_packet_type_is_kex(v6) )
{
v3 = sshbuf_len(*(_QWORD *)(v11 + 48));
a2 = v3;
if ( ssh_packet_need_rekeying(a1, v3) )
v4 = 1;
}
v8 = v4;
if ( (v4 || *(_DWORD *)(v11 + 476)) && !ssh_packet_type_is_kex(v6) )
{
if ( v8 )
sshlog("packet.c", "ssh_packet_send2", 1259LL, 1LL, 7LL, 0LL, "rekex triggered");
sshlog("packet.c", "ssh_packet_send2", 1260LL, 0LL, 5LL, 0LL, "enqueue packet: %u", v6);
s = calloc(1uLL, 0x20uLL);
if ( s )
{
s[16] = v6;
*((_QWORD *)s + 3) = *(_QWORD *)(v11 + 48);
*(_QWORD *)s = 0LL;
*((_QWORD *)s + 1) = *(_QWORD *)(v11 + 520);
**(_QWORD **)(v11 + 520) = s;
*(_QWORD *)(v11 + 520) = s;
*(_QWORD *)(v11 + 48) = sshbuf_new();
if ( *(_QWORD *)(v11 + 48) )
{
if ( v8 )
return kex_start_rekex(a1);
else
return 0LL;
}
else
{
return 4294967294LL;
}
}
else
{
return 4294967294LL;
}
}
else
{
if ( v6 == 20 )
*(_DWORD *)(v11 + 476) = 1;
v9 = ssh_packet_send2_wrapped((long)a1);
if ( v9 )
{
return v9;
}
else
{
if ( v6 == 21 )
{
*(_DWORD *)(v11 + 476) = 0;
*(_QWORD *)(v11 + 440) = monotime(a1, a2);
while ( 1 )
{
sa = *(_BYTE **)(v11 + 512);
if ( !sa )
break;
v7 = sa[16];
v5 = sshbuf_len(*((_QWORD *)sa + 3));
if ( ssh_packet_need_rekeying(a1, v5) )
{
sshlog("packet.c", "ssh_packet_send2", 1301LL, 1LL, 7LL, 0LL, "queued packet triggered rekex");
return kex_start_rekex(a1);
}
sshlog("packet.c", "ssh_packet_send2", 1304LL, 0LL, 5LL, 0LL, "dequeue packet: %u", v7);
sshbuf_free(*(_QWORD *)(v11 + 48));
*(_QWORD *)(v11 + 48) = *((_QWORD *)sa + 3);
if ( *(_QWORD *)sa )
*(_QWORD *)(*(_QWORD *)sa + 8LL) = *((_QWORD *)sa + 1);
else
*(_QWORD *)(v11 + 520) = *((_QWORD *)sa + 1);
**((_QWORD **)sa + 1) = *(_QWORD *)sa;
memset(sa, 0, 0x20uLL);
free(sa);
v10 = ssh_packet_send2_wrapped((long)a1);
if ( v10 )
return v10;
}
}
return 0LL;
}
}
}
|
static void help(void)
{
printf("Usage:\n"
"\t%s [options] [-i] [-b] modulename\n"
"\t%s [options] -a [-i] [-b] modulename [modulename...]\n"
"\t%s [options] -r [-i] modulename\n"
"\t%s [options] -r -a [-i] modulename [modulename...]\n"
"\t%s [options] -c\n"
"\t%s [options] --dump-modversions filename\n"
"Management Options:\n"
"\t-a, --all Consider every non-argument to\n"
"\t be a module name to be inserted\n"
"\t or removed (-r)\n"
"\t-r, --remove Remove modules instead of inserting\n"
"\t --remove-dependencies Deprecated: use --remove-holders\n"
"\t --remove-holders Also remove module holders (use together with -r)\n"
"\t-w, --wait <MSEC> When removing a module, wait up to MSEC for\n"
"\t module's refcount to become 0 so it can be\n"
"\t removed (use together with -r)\n"
"\t --first-time Fail if module already inserted or removed\n"
"\t-i, --ignore-install Ignore install commands\n"
"\t-i, --ignore-remove Ignore remove commands\n"
"\t-b, --use-blacklist Apply blacklist to resolved alias.\n"
"\t-f, --force Force module insertion or removal.\n"
"\t implies --force-modversions and\n"
"\t --force-vermagic\n"
"\t --force-modversion Ignore module's version\n"
"\t --force-vermagic Ignore module's version magic\n"
"\n"
"Query Options:\n"
"\t-R, --resolve-alias Only lookup and print alias and exit\n"
"\t-D, --show-depends Only print module dependencies and exit\n"
"\t-c, --showconfig Print out known configuration and exit\n"
"\t-c, --show-config Same as --showconfig\n"
"\t --show-modversions Dump module symbol version and exit\n"
"\t --dump-modversions Same as --show-modversions\n"
"\t --show-exports Only print module exported symbol versions and exit\n"
"\n"
"General Options:\n"
"\t-n, --dry-run Do not execute operations, just print out\n"
"\t-n, --show Same as --dry-run\n"
"\t-C, --config=FILE Use FILE instead of default search paths\n"
"\t-d, --dirname=DIR Use DIR as filesystem root for /lib/modules\n"
"\t-S, --set-version=VERSION Use VERSION instead of `uname -r`\n"
"\t-s, --syslog print to syslog, not stderr\n"
"\t-q, --quiet disable messages\n"
"\t-v, --verbose enables more messages\n"
"\t-V, --version show version\n"
"\t-h, --help show this help\n",
program_invocation_short_name, program_invocation_short_name,
program_invocation_short_name, program_invocation_short_name,
program_invocation_short_name, program_invocation_short_name);
}
| void help() {
unsigned long long v1;
v1 = printf("Usage:\n\t%s [options] [-i] [-b] modulename\n\t%s [options] -a [-i] [-b] modulename [modulename...]\n\t%s [options] -r [-i] modulename\n\t%s [options] -r -a [-i] modulename [modulename...]\n\t%s [options] -c\n\t%s [options] --dump-modversions filename\nManagement Options:\n\t-a, --all Consider every non-argument to\n\t be a module name to be inserted\n\t or removed (-r)\n\t-r, --remove Remove modules instead of inserting\n\t --remove-dependencies Deprecated: use --remove-holders\n\t --remove-holders Also remove module holders (use together with -r)\n\t-w, --wait <MSEC> When removing a module, wait up to MSEC for\n\t module's refcount to become 0 so it can be\n\t removed (use together with -r)\n\t --first-time Fail if module already inserted or removed\n\t-i, --ignore-install Ignore install commands\n\t-i, --ignore-remove Ignore remove commands\n\t-b, --use", program_invocation_short_name, program_invocation_short_name, program_invocation_short_name, program_invocation_short_name, program_invocation_short_name, program_invocation_short_name);
return;
}
|
static int
globextend(const Char *path, _ssh_compat_glob_t *pglob, struct glob_lim *limitp,
struct stat *sb)
{
char **pathv;
size_t i, newn, len;
char *copy =
((void *)0)
;
const Char *p;
struct stat **statv;
newn = 2 + pglob->gl_pathc + pglob->gl_offs;
if (pglob->gl_offs >= 0x7fffffffffffffffL ||
pglob->gl_pathc >= 0x7fffffffffffffffL ||
newn >= 0x7fffffffffffffffL ||
(18446744073709551615UL)
/ sizeof(*pathv) <= newn ||
(18446744073709551615UL)
/ sizeof(*statv) <= newn) {
nospace:
for (i = pglob->gl_offs; i < newn - 2; i++) {
if (pglob->gl_pathv && pglob->gl_pathv[i])
free(pglob->gl_pathv[i]);
if ((pglob->gl_flags & 0x4000) != 0 &&
pglob->gl_pathv && pglob->gl_pathv[i])
free(pglob->gl_statv[i]);
}
free(pglob->gl_pathv);
pglob->gl_pathv =
((void *)0)
;
free(pglob->gl_statv);
pglob->gl_statv =
((void *)0)
;
return((-1));
}
pathv = reallocarray(pglob->gl_pathv, newn, sizeof(*pathv));
if (pathv ==
((void *)0)
)
goto nospace;
if (pglob->gl_pathv ==
((void *)0)
&& pglob->gl_offs > 0) {
pathv += pglob->gl_offs;
for (i = pglob->gl_offs; i > 0; i--)
*--pathv =
((void *)0)
;
}
pglob->gl_pathv = pathv;
if ((pglob->gl_flags & 0x4000) != 0) {
statv = reallocarray(pglob->gl_statv, newn, sizeof(*statv));
if (statv ==
((void *)0)
)
goto nospace;
if (pglob->gl_statv ==
((void *)0)
&& pglob->gl_offs > 0) {
statv += pglob->gl_offs;
for (i = pglob->gl_offs; i > 0; i--)
*--statv =
((void *)0)
;
}
pglob->gl_statv = statv;
if (sb ==
((void *)0)
)
statv[pglob->gl_offs + pglob->gl_pathc] =
((void *)0)
;
else {
limitp->glim_malloc += sizeof(**statv);
if ((pglob->gl_flags & 0x2000) &&
limitp->glim_malloc >= 65536) {
(*__errno_location ())
= 0;
return((-1));
}
if ((statv[pglob->gl_offs + pglob->gl_pathc] =
malloc(sizeof(**statv))) ==
((void *)0)
)
goto copy_error;
memcpy(statv[pglob->gl_offs + pglob->gl_pathc], sb,
sizeof(*sb));
}
statv[pglob->gl_offs + pglob->gl_pathc + 1] =
((void *)0)
;
}
for (p = path; *p++;)
;
len = (size_t)(p - path);
limitp->glim_malloc += len;
if ((copy = malloc(len)) !=
((void *)0)
) {
if (g_Ctoc(path, copy, len)) {
free(copy);
return((-1));
}
pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
}
pathv[pglob->gl_offs + pglob->gl_pathc] =
((void *)0)
;
if ((pglob->gl_flags & 0x2000) &&
(newn * sizeof(*pathv)) + limitp->glim_malloc >
65536) {
(*__errno_location ())
= 0;
return((-1));
}
copy_error:
return(copy ==
((void *)0)
? (-1) : 0);
}
| undefined8 globextend(short *param_1,ulong *param_2,ulong *param_3,void *param_4)
{
short *psVar1;
short sVar2;
ulong uVar3;
ulong uVar4;
int iVar5;
ulong uVar6;
void *pvVar7;
long lVar8;
size_t __size;
int *piVar9;
undefined8 uVar10;
undefined8 *local_50;
ulong local_48;
void *local_40;
short *local_38;
undefined8 *local_30;
local_40 = (void *)0x0;
uVar3 = *param_2;
uVar4 = param_2[2];
uVar6 = uVar4 + uVar3 + 2;
if (((((0x7ffffffffffffffe < param_2[2]) || (0x7ffffffffffffffe < *param_2)) ||
(0x7ffffffffffffffe < uVar6)) ||
((0x1ffffffffffffffe < uVar6 || (0x1ffffffffffffffe < uVar6)))) ||
(local_50 = (undefined8 *)reallocarray(param_2[4],uVar6,8), local_50 == (undefined8 *)0x0)) {
LAB_00101d06:
for (local_48 = param_2[2]; local_48 < uVar4 + uVar3; local_48 = local_48 + 1) {
if ((param_2[4] != 0) && (*(long *)(param_2[4] + local_48 * 8) != 0)) {
free(*(void **)(param_2[4] + local_48 * 8));
}
if ((((*(uint *)(param_2 + 3) & 0x4000) != 0) && (param_2[4] != 0)) &&
(*(long *)(param_2[4] + local_48 * 8) != 0)) {
free(*(void **)(param_2[5] + local_48 * 8));
}
}
free((void *)param_2[4]);
param_2[4] = 0;
free((void *)param_2[5]);
param_2[5] = 0;
return 0xffffffff;
}
if ((param_2[4] == 0) && (param_2[2] != 0)) {
local_50 = local_50 + param_2[2];
for (local_48 = param_2[2]; local_48 != 0; local_48 = local_48 - 1) {
local_50 = local_50 + -1;
*local_50 = 0;
}
}
param_2[4] = (ulong)local_50;
local_38 = param_1;
if ((*(uint *)(param_2 + 3) & 0x4000) != 0) {
local_30 = (undefined8 *)reallocarray(param_2[5],uVar6,8);
if (local_30 == (undefined8 *)0x0) goto LAB_00101d06;
if ((param_2[5] == 0) && (param_2[2] != 0)) {
local_30 = local_30 + param_2[2];
for (local_48 = param_2[2]; local_48 != 0; local_48 = local_48 - 1) {
local_30 = local_30 + -1;
*local_30 = 0;
}
}
param_2[5] = (ulong)local_30;
if (param_4 == (void *)0x0) {
local_30[*param_2 + param_2[2]] = 0;
}
else {
*param_3 = *param_3 + 0x90;
if (((*(uint *)(param_2 + 3) & 0x2000) != 0) && (0xffff < *param_3)) {
piVar9 = __errno_location();
*piVar9 = 0;
return 0xffffffff;
}
uVar3 = param_2[2];
uVar4 = *param_2;
pvVar7 = malloc(0x90);
local_30[uVar4 + uVar3] = pvVar7;
if ((void *)local_30[uVar4 + uVar3] == (void *)0x0) goto LAB_0010217f;
memcpy((void *)local_30[*param_2 + param_2[2]],param_4,0x90);
}
local_30[*param_2 + param_2[2] + 1] = 0;
}
do {
psVar1 = local_38 + 1;
sVar2 = *local_38;
local_38 = psVar1;
} while (sVar2 != 0);
lVar8 = __subvdi3(psVar1,param_1);
__size = lVar8 >> 1;
*param_3 = *param_3 + __size;
local_40 = malloc(__size);
if (local_40 != (void *)0x0) {
iVar5 = g_Ctoc(param_1,local_40,__size);
if (iVar5 != 0) {
free(local_40);
return 0xffffffff;
}
uVar3 = *param_2;
*param_2 = uVar3 + 1;
local_50[uVar3 + param_2[2]] = local_40;
}
local_50[*param_2 + param_2[2]] = 0;
if (((*(uint *)(param_2 + 3) & 0x2000) != 0) && (0x10000 < *param_3 + uVar6 * 8)) {
piVar9 = __errno_location();
*piVar9 = 0;
return 0xffffffff;
}
LAB_0010217f:
if (local_40 == (void *)0x0) {
uVar10 = 0xffffffff;
}
else {
uVar10 = 0;
}
return uVar10;
}
|
struct chachapoly_ctx *
chachapoly_new(const u_char *key, u_int keylen)
{
struct chachapoly_ctx *ctx;
if (keylen != (32 + 32))
return
((void *)0)
;
if ((ctx = calloc(1, sizeof(*ctx))) ==
((void *)0)
)
return
((void *)0)
;
if ((ctx->main_evp = EVP_CIPHER_CTX_new()) ==
((void *)0)
||
(ctx->header_evp = EVP_CIPHER_CTX_new()) ==
((void *)0)
)
goto fail;
if (!EVP_CipherInit(ctx->main_evp, EVP_chacha20(), key,
((void *)0)
, 1))
goto fail;
if (!EVP_CipherInit(ctx->header_evp, EVP_chacha20(), key + 32,
((void *)0)
, 1))
goto fail;
if (
EVP_CIPHER_CTX_get_iv_length
(ctx->header_evp) != 16)
goto fail;
return ctx;
fail:
chachapoly_free(ctx);
return
((void *)0)
;
}
| long long chachapoly_new(unsigned long long a0, unsigned long a1) {
void* v0;
void* v2;
if (a1 != 64) {
v2 = 0;
} else {
v0 = calloc(0x1, 0x10);
if (!v0) {
v2 = 0;
} else {
*(v0) = EVP_CIPHER_CTX_new();
if (*(v0)) {
*(&v0[8]) = EVP_CIPHER_CTX_new();
if (v0[8] && EVP_CipherInit(*(v0), EVP_chacha20(), a0, 0x0, 0x1) && EVP_CipherInit(v0[8], EVP_chacha20(), a0 + 32, 0x0, 0x1) && EVP_CIPHER_CTX_get_iv_length(v0[8]) == 16) {
v2 = v0;
goto LABEL_400110;
}
}
chachapoly_free(v0);
v2 = 0;
}
}
LABEL_400110:
return v2;
}
|
static int
history_next_event(HistoryW *h, HistEventW *ev, int num)
{
int retval;
for (retval = (*(h)->h_curr)((h)->h_ref, ev); retval != -1; retval = (*(h)->h_next)((h)->h_ref, ev))
if (ev->num == num)
return 0;
{ ev->num = 9; ev->str = he_errlist[9]; };
return -1;
}
| int history_next_event(unsigned long long a0[7], struct_0 *a1, unsigned long a2) {
unsigned int v0;
unsigned int v2;
for (v0 = a0[6](a0[0], a1, a1, a0[6]); v0 != -1; v0 = a0[3](a0[0], a1, a1, a0[3])) {
if (a2 == a1->field_0) {
v2 = 0;
return v2;
}
}
a1->field_0 = 9;
a1->field_8 = "e";
v2 = -1;
return v2;
}
|
void
hash_walk (table, func)
HASH_TABLE *table;
hash_wfunc *func;
{
register int i;
BUCKET_CONTENTS *item;
if (table == 0 || ((table) ? (table)->nentries : 0) == 0)
return;
for (i = 0; i < table->nbuckets; i++)
{
for (item = ((table && (i < table->nbuckets)) ? table->bucket_array[i] : (BUCKET_CONTENTS *)
((void *)0)
); item; item = item->next)
if ((*func) (item) < 0)
return;
}
}
| long long hash_walk(struct_0 *a0, unsigned long a1) {
unsigned long v0;
void* v1;
unsigned long long v3;
unsigned long long v4;
void* v5;
v0 = a1;
if (a0) {
v3 = a0->field_c;
if (a0->field_c) {
v4 = 0;
do {
v3 = a0->field_8;
if (v4 >= a0->field_8)
break;
if (a0 && v4 < a0->field_8)
v5 = a0->field_0[v4].field_0;
if (!a0 || v4 >= a0->field_8)
v5 = 0;
v1 = v5;
while (true) {
if (v1) {
v3 = (stack_base)[56](v1);
if (v3 < 0)
break;
if (v3 >= 0)
v1 = *(v1);
} else {
v4 = 1;
break;
}
}
} while (!v1 || v3 >= 0);
}
}
return v3;
}
|
int
ssh_dss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp,
const u_char *data, size_t datalen, u_int compat)
{
DSA_SIG *sig =
((void *)0)
;
const BIGNUM *sig_r, *sig_s;
u_char digest[64], sigblob[(2*20)];
size_t rlen, slen, len, dlen = ssh_digest_bytes(1);
struct sshbuf *b =
((void *)0)
;
int ret = -10;
if (lenp !=
((void *)0)
)
*lenp = 0;
if (sigp !=
((void *)0)
)
*sigp =
((void *)0)
;
if (key ==
((void *)0)
|| key->dsa ==
((void *)0)
||
sshkey_type_plain(key->type) != KEY_DSA)
return -10;
if (dlen == 0)
return -1;
if ((ret = ssh_digest_memory(1, data, datalen,
digest, sizeof(digest))) != 0)
goto out;
if ((sig = DSA_do_sign(digest, dlen, key->dsa)) ==
((void *)0)
) {
ret = -22;
goto out;
}
DSA_SIG_get0(sig, &sig_r, &sig_s);
rlen =
((BN_num_bits(
sig_r
)+7)/8)
;
slen =
((BN_num_bits(
sig_s
)+7)/8)
;
if (rlen > 20 || slen > 20) {
ret = -1;
goto out;
}
explicit_bzero(sigblob, (2*20));
BN_bn2bin(sig_r, sigblob + (2*20) - 20 - rlen);
BN_bn2bin(sig_s, sigblob + (2*20) - slen);
if ((b = sshbuf_new()) ==
((void *)0)
) {
ret = -2;
goto out;
}
if ((ret = sshbuf_put_cstring(b, "ssh-dss")) != 0 ||
(ret = sshbuf_put_string(b, sigblob, (2*20))) != 0)
goto out;
len = sshbuf_len(b);
if (sigp !=
((void *)0)
) {
if ((*sigp = malloc(len)) ==
((void *)0)
) {
ret = -2;
goto out;
}
memcpy(*sigp, sshbuf_ptr(b), len);
}
if (lenp !=
((void *)0)
)
*lenp = len;
ret = 0;
out:
explicit_bzero(digest, sizeof(digest));
DSA_SIG_free(sig);
sshbuf_free(b);
return ret;
}
| long long ssh_dss_sign(struct_0 *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;
char v2;
char v3;
void* v4;
void* v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned int v9;
char v10;
char v11;
char v12;
char v13;
unsigned long long v15;
unsigned long long v16;
unsigned long long v17;
v0 = a5;
v4 = 0;
v6 = ssh_digest_bytes(0x1);
v5 = 0;
v1 = -10;
if (a2)
*(a2) = 0;
if (a1)
*(a1) = 0;
if (!a0) {
v15 = 4294967286;
return v15;
} else if (!a0->field_10) {
v15 = 4294967286;
return v15;
} else if (sshkey_type_plain(a0->field_0) != 1) {
v15 = 4294967286;
return v15;
} else if (v6) {
v1 = ssh_digest_memory(0x1, a3, a4, &v13, 0x40);
if (!v1) {
v4 = DSA_do_sign(&v13, v6, a0->field_10, v6);
if (!v4) {
v1 = -22;
} else {
DSA_SIG_get0(v4, &v2, &v3, &v2);
v16 = __addvsi3(BN_num_bits(*(&v2)), 0x7);
v7 = (v16 < 0 ? (v16 + 7) : v16) >> 3;
v17 = __addvsi3(BN_num_bits(*(&v3)), 0x7);
v8 = (v17 < 0 ? (v17 + 7) : v17) >> 3;
if (v7 > 20 || v8 > 20) {
v1 = -1;
} else {
explicit_bzero(&v10, 0x28);
BN_bn2bin(*(&v2), &(&v11)[-1 * v7], &(&v11)[-1 * v7]);
BN_bn2bin(*(&v3), &(&v12)[-1 * v8], &(&v12)[-1 * v8]);
v5 = sshbuf_new(a0, a1, a2, &v2, 0x40, a5);
if (!v5) {
v1 = -2;
} else {
v1 = sshbuf_put_cstring(v5, "ssh-dss");
if (!(v1 || (v1 = sshbuf_put_string(v5, &v10, 0x28, &v10), v1))) {
*(&v9) = sshbuf_len(v5);
if (a1) {
*(a1) = malloc(*(&v9));
if (!*(a1)) {
v1 = -2;
goto LABEL_400398;
} else {
memcpy(*(a1), sshbuf_ptr(v5), *(&v9));
}
}
if (a2)
*(a2) = *(&v9);
v1 = 0;
}
}
}
}
}
LABEL_400398:
explicit_bzero(&v13, 0x40);
DSA_SIG_free(v4);
sshbuf_free(v5);
v15 = v1;
return v15;
} else {
v15 = 4294967295;
return v15;
}
}
|
static int
_rl_vi_change_mbchar_case (int count)
{
wchar_t wc;
char mb[
16
+1];
int mlen, p;
size_t m;
mbstate_t ps;
memset (&ps, 0, sizeof (mbstate_t));
if (_rl_adjust_point (rl_line_buffer, rl_point, &ps) > 0)
count--;
while (count-- && rl_point < rl_end)
{
m = mbrtowc (&wc, rl_line_buffer + rl_point, rl_end - rl_point, &ps);
if (((m) == (size_t)-1 || (m) == (size_t)-2))
wc = (wchar_t)rl_line_buffer[rl_point];
else if (((m) == 0))
wc = L'\0';
if (iswupper (wc))
wc = towlower (wc);
else if (iswlower (wc))
wc = towupper (wc);
else
{
rl_forward_char (1, 0);
continue;
}
if (wc)
{
p = rl_point;
mlen = wcrtomb (mb, wc, &ps);
if (mlen >= 0)
mb[mlen] = '\0';
rl_begin_undo_group ();
rl_vi_delete (1, 0);
if (rl_point < p)
_rl_vi_advance_point ();
rl_insert_text (mb);
rl_end_undo_group ();
rl_vi_check ();
}
else
rl_forward_char (1, 0);
}
return 0;
}
| long long _rl_vi_change_mbchar_case(unsigned long a0, unsigned long long a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long v4;
char v5;
char v6;
char v7;
unsigned long long v8;
unsigned int v9;
v0 = a0;
memset(&v5, 0x0, 0x8);
if (_rl_adjust_point(rl_line_buffer, rl_point, &v5, rl_point) > 0)
v0 -= 1;
while (true) {
v9 = v0;
v0 -= 1;
if (!v9)
return 0;
if (rl_point >= rl_end)
return 0;
v4 = mbrtowc(&v1, rl_line_buffer + rl_point, rl_end - rl_point, &v5);
switch (v4) {
case 18446744073709551614:
v1 = *((rl_point + rl_line_buffer));
break;
case 0:
v1 = 0;
break;
default:
goto LABEL_401a7f;
}
LABEL_401a7f:
if (iswupper(v1)) {
v1 = towlower(v1);
} else if (iswlower(v1)) {
v1 = towupper(v1);
} else {
rl_forward_char(0x1, 0x0);
continue;
}
if (!v1) {
rl_forward_char(0x1, 0x0);
} else {
v2 = rl_point;
v3 = wcrtomb(&v6, v1, &v5, v1);
if (v3 >= 0)
(&v6)[v3] = 0;
rl_begin_undo_group(&v6, a1, &v5, a3, a4, a5, *(&v7), v8);
rl_vi_delete(0x1, 0x0);
if (v2 > rl_point)
_rl_vi_advance_point();
rl_insert_text(&v6);
rl_end_undo_group();
rl_vi_check();
}
}
}
|
void printcrontab(user *u) {
printf(" - user: \"%s\"\n", u->name);
printf(" crontab: %s\n", u->tabname);
printf(" system: %d\n", u->system);
printf(" entries:\n");
}
| void printcrontab(struct_0 *a0) {
unsigned long long v1;
printf(" - user: \"%s\"\n", a0->field_10);
printf(" crontab: %s\n", a0->field_18);
printf(" system: %d\n", a0->field_34);
v1 = printf(" entries:\n");
return;
}
|
static void request_info(void)
{
gnutls_ocsp_req_t req;
int ret;
gnutls_datum_t dat, rbuf;
size_t size;
ret = gnutls_ocsp_req_init(&req);
if (ret < 0) {
fprintf(
stderr
, "ocsp_req_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
if (ocsptool_options.present.load_request)
dat.data =
(void *) _gnutls_read_file(ocsptool_options.arg.load_request, 0x1, &size);
else
dat.data = (void *) _gnutls_fread_file(infile, 0, &size);
if (dat.data ==
((void *)0)
) {
fprintf(
stderr
, "error reading request\n");
app_exit(1);
}
dat.size = size;
ret = gnutls_ocsp_req_import(req, &dat);
free(dat.data);
if (ret < 0) {
fprintf(
stderr
, "error importing request: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
ret = gnutls_ocsp_req_print(req, GNUTLS_OCSP_PRINT_FULL, &dat);
if (ret != 0) {
fprintf(
stderr
, "ocsp_req_print: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (ocsptool_options.present.outfile) {
ret = gnutls_ocsp_req_export(req, &rbuf);
if (ret < 0) {
fprintf(
stderr
, "error exporting request: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (outcert_format == GNUTLS_X509_FMT_PEM) {
fprintf(
stderr
, "Cannot export requests into PEM form\n");
app_exit(1);
} else {
fwrite(rbuf.data, 1, rbuf.size, outfile);
}
gnutls_free((void *) (rbuf.data)), rbuf.data=
((void *)0)
;
} else {
printf("%.*s", dat.size, dat.data);
}
gnutls_free((void *) (dat.data)), dat.data=
((void *)0)
;
gnutls_ocsp_req_deinit(req);
}
| void request_info() {
unsigned int v0;
char v1;
char v2;
void* v3;
unsigned int v4;
void* v5;
char v6;
char v7;
unsigned long long *v9;
unsigned long long v10;
v0 = gnutls_ocsp_req_init(&v1);
if (v0 < 0) {
fprintf(*(&stderr), "ocsp_req_init: %s\n", gnutls_strerror(v0));
app_exit(0x1);
}
if (!g_50004a)
v3 = _gnutls_fread_file(infile, 0x0, &v2);
else
v3 = _gnutls_read_file(gnutls_ocsp_resp_import2, 0x1, &v2);
if (!v3) {
fprintf(*(&stderr), "error reading request\n");
app_exit(0x1);
}
v4 = *(&v2);
v0 = gnutls_ocsp_req_import(*(&v1), &v3, &v3);
free(v3);
if (v0 < 0) {
fprintf(*(&stderr), "error importing request: %s\n", gnutls_strerror(v0));
app_exit(0x1);
}
v0 = gnutls_ocsp_req_print(*(&v1), 0x0, &v3);
if (v0) {
fprintf(*(&stderr), "ocsp_req_print: %s\n", gnutls_strerror(v0));
app_exit(0x1);
}
if (!g_50003b) {
printf("%.*s", v4);
} else {
v0 = gnutls_ocsp_req_export(*(&v1), &v5, &v5);
if (v0 < 0) {
fprintf(*(&stderr), "error exporting request: %s\n", gnutls_strerror(v0));
app_exit(0x1);
} else if (outcert_format == 1) {
fprintf(*(&stderr), "Cannot export requests into PEM form\n");
app_exit(0x1);
} else {
fwrite(*(&v5), 0x1, *(&v6), outfile);
*(5243000)(*(&v5));
v5 = 0;
}
}
*(5243000)(v3);
v3 = 0;
gnutls_ocsp_req_deinit(*(&v1));
v10 = *(&v7) ^ v9[5];
return;
}
|
void
gzip_error (char const *m)
{
fprintf (
stderr
, "\n%s: %s: %s\n", program_name, ifname, m);
abort_gzip();
}
| long long gzip_error() {
char v0;
unsigned long long v1;
unsigned int v2;
unsigned int v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
v2 = program_name;
v3 = &ifname;
fprintf(stderr, "\n%s: %s: %s\n", program_name, &ifname, v4);
abort_gzip(v4, "\n%s: %s: %s\n", v5, v6, v4, v7, *(&v0), v1);
}
|
const char *
safe_directory_contents (struct directory *dir)
{
const char *ret = directory_contents (dir);
return ret ? ret : "\0\0\0\0";
}
| long long safe_directory_contents(void* a0) {
unsigned long long v0;
unsigned long long v2;
v0 = directory_contents(a0);
if (!v0)
v2 = &g_404cd8;
else
v2 = v0;
return v2;
}
|
static int flush_addrlabel(struct nlmsghdr *n, void *arg)
{
struct rtnl_handle rth2;
struct rtmsg *r = ((void *)(((char *)n) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))));
int len = n->nlmsg_len;
struct rtattr *tb[(__IFAL_MAX - 1)+1];
len -= ((sizeof(*r)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) )));
if (len < 0)
return -1;
parse_rtattr(tb, (__IFAL_MAX - 1), ((struct rtattr*)(((char*)(r)) + ( ((sizeof(struct rtmsg))+4U -1) & ~(4U -1) ))), len);
if (tb[IFAL_ADDRESS]) {
n->nlmsg_type = RTM_DELADDRLABEL;
n->nlmsg_flags = 0x01;
if (rtnl_open(&rth2, 0) < 0)
return -1;
if (rtnl_talk(&rth2, n,
((void *)0)
) < 0)
return -2;
rtnl_close(&rth2);
}
return 0;
}
| long flush_addrlabel(long a1)
{
int v2;
char v3[64];
char v4[8];
long v5;
unsigned long v6;
v6 = __readfsqword(0x28u);
v2 = *(_DWORD *)a1 - 28;
if ( v2 < 0 )
return 0xFFFFFFFFLL;
parse_rtattr(v4, 2LL, a1 + 28, (unsigned int)v2);
if ( v5 )
{
*(_WORD *)(a1 + 4) = 73;
*(_WORD *)(a1 + 6) = 1;
if ( (int)rtnl_open(v3, 0LL) < 0 )
return 0xFFFFFFFFLL;
if ( (int)rtnl_talk(v3, a1, 0LL) < 0 )
return 4294967294LL;
rtnl_close(v3);
}
return 0LL;
}
|
static void
complement_rp (void)
{
struct field_range_pair *c = frp;
size_t n = n_frp;
frp =
((void *)0)
;
n_frp = 0;
n_frp_allocated = 0;
if (c[0].lo > 1)
add_range_pair (1, c[0].lo - 1);
for (size_t i = 1; i < n; ++i)
{
if (c[i - 1].hi + 1 == c[i].lo)
continue;
add_range_pair (c[i - 1].hi + 1, c[i].lo - 1);
}
if (c[n - 1].hi <
(18446744073709551615UL)
)
add_range_pair (c[n - 1].hi + 1,
(18446744073709551615UL)
);
free (c);
}
| void complement_rp() {
unsigned long long v0;
unsigned long long v1;
unsigned long long v2;
unsigned long long v4;
v1 = -881757763951783940;
v2 = -881757763951783940;
n_frp = 0;
n_frp = 0;
n_frp_allocated = 0;
if (*(v1) > 1)
add_range_pair(0x1, *(v1) - 1);
for (v0 = 1; v0 < v2; v0 += 1) {
if (*((v1 + (v0 << 4) - 16 + 8)) + 1 != *((v1 + (v0 << 4))))
add_range_pair(*((v1 + v0 * 16 - 16 + 8)) + 1, *((v1 + v0 * 16)) - 1);
}
if (*((v1 + (v2 << 4) - 16 + 8)) != -1)
add_range_pair(*((v1 + v2 * 16 - 16 + 8)) + 1, 0xffffffffffffffff);
v4 = free(v1);
return;
}
|
int print_rule(struct nlmsghdr *n, void *arg)
{
FILE *fp = arg;
struct fib_rule_hdr *frh = ((void *)(((char *)n) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))));
int len = n->nlmsg_len;
int host_len = -1;
__u32 table, prio = 0;
struct rtattr *tb[(__FRA_MAX - 1)+1];
char b1[64];
if (n->nlmsg_type != RTM_NEWRULE && n->nlmsg_type != RTM_DELRULE)
return 0;
len -= ((sizeof(*frh)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) )));
if (len < 0)
return -1;
parse_rtattr(tb, (__FRA_MAX - 1), ((struct rtattr*)(((char*)(frh)) + ( ((sizeof(struct rtmsg))+4U -1) & ~(4U -1) ))), len);
host_len = af_bit_len(frh->family);
if (!filter_nlmsg(n, tb, host_len))
return 0;
open_json_object(
((void *)0)
);
if (n->nlmsg_type == RTM_DELRULE)
print_bool(PRINT_ANY, "deleted", "Deleted ",
1
);
if (tb[FRA_PRIORITY])
prio = rta_getattr_u32(tb[FRA_PRIORITY]);
print_uint(PRINT_ANY, "priority", "%u:\t", prio);
if (frh->flags & 0x00000002)
print_null(PRINT_ANY, "not", "not ",
((void *)0)
);
if (tb[FRA_SRC]) {
const char *src = rt_addr_n2a(frh->family, ((int)((tb[FRA_SRC])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), ((void*)(((char*)(tb[FRA_SRC])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))));
print_string(PRINT_FP,
((void *)0)
, "from ",
((void *)0)
);
print_color_string(PRINT_ANY, ifa_family_color(frh->family),
"src", "%s", src);
if (frh->src_len != host_len)
print_uint(PRINT_ANY, "srclen", "/%u", frh->src_len);
} else if (frh->src_len) {
print_string(PRINT_ANY, "src", "from %s", "0");
print_uint(PRINT_ANY, "srclen", "/%u", frh->src_len);
} else {
print_string(PRINT_ANY, "src", "from %s", "all");
}
if (tb[FRA_DST]) {
const char *dst = rt_addr_n2a(frh->family, ((int)((tb[FRA_DST])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), ((void*)(((char*)(tb[FRA_DST])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))));
print_string(PRINT_FP,
((void *)0)
, " to ",
((void *)0)
);
print_color_string(PRINT_ANY, ifa_family_color(frh->family),
"dst", "%s", dst);
if (frh->dst_len != host_len)
print_uint(PRINT_ANY, "dstlen", "/%u", frh->dst_len);
} else if (frh->dst_len) {
print_string(PRINT_ANY, "dst", " to %s", "0");
print_uint(PRINT_ANY, "dstlen", "/%u", frh->dst_len);
}
if (frh->tos) {
print_string(PRINT_ANY, "tos",
" tos %s",
rtnl_dsfield_n2a(frh->tos, b1, sizeof(b1)));
}
if (tb[FRA_FWMARK] || tb[FRA_FWMASK]) {
__u32 mark = 0, mask = 0;
if (tb[FRA_FWMARK])
mark = rta_getattr_u32(tb[FRA_FWMARK]);
if (tb[FRA_FWMASK] &&
(mask = rta_getattr_u32(tb[FRA_FWMASK])) != 0xFFFFFFFF) {
print_0xhex(PRINT_ANY, "fwmark", " fwmark %#llx", mark);
print_0xhex(PRINT_ANY, "fwmask", "/%#llx", mask);
} else {
print_0xhex(PRINT_ANY, "fwmark", " fwmark %#llx", mark);
}
}
if (tb[FRA_IIFNAME]) {
if (!is_json_context())
fprintf(fp, " iif ");
print_color_string(PRINT_ANY, COLOR_IFNAME,
"iif", "%s",
rta_getattr_str(tb[FRA_IIFNAME]));
if (frh->flags & 0x00000008)
print_null(PRINT_ANY, "iif_detached", " [detached]",
((void *)0)
);
}
if (tb[FRA_OIFNAME]) {
if (!is_json_context())
fprintf(fp, " oif ");
print_color_string(PRINT_ANY, COLOR_IFNAME, "oif", "%s",
rta_getattr_str(tb[FRA_OIFNAME]));
if (frh->flags & 0x00000010)
print_null(PRINT_ANY, "oif_detached", " [detached]",
((void *)0)
);
}
if (tb[FRA_L3MDEV]) {
__u8 mdev = rta_getattr_u8(tb[FRA_L3MDEV]);
if (mdev)
print_null(PRINT_ANY, "l3mdev",
" lookup [l3mdev-table]",
((void *)0)
);
}
if (tb[FRA_UID_RANGE]) {
struct fib_rule_uid_range *r = ((void*)(((char*)(tb[FRA_UID_RANGE])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
print_uint(PRINT_ANY, "uid_start", " uidrange %u", r->start);
print_uint(PRINT_ANY, "uid_end", "-%u", r->end);
}
if (tb[FRA_IP_PROTO]) {
char pbuf[64];
print_string(PRINT_ANY, "ipproto", " ipproto %s",
inet_proto_n2a(rta_getattr_u8(tb[FRA_IP_PROTO]),
pbuf, sizeof(pbuf)));
}
if (tb[FRA_SPORT_RANGE]) {
struct fib_rule_port_range *r = ((void*)(((char*)(tb[FRA_SPORT_RANGE])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
if (r->start == r->end) {
print_uint(PRINT_ANY, "sport", " sport %u", r->start);
} else {
print_uint(PRINT_ANY, "sport_start", " sport %u",
r->start);
print_uint(PRINT_ANY, "sport_end", "-%u", r->end);
}
}
if (tb[FRA_DPORT_RANGE]) {
struct fib_rule_port_range *r = ((void*)(((char*)(tb[FRA_DPORT_RANGE])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
if (r->start == r->end) {
print_uint(PRINT_ANY, "dport", " dport %u", r->start);
} else {
print_uint(PRINT_ANY, "dport_start", " dport %u",
r->start);
print_uint(PRINT_ANY, "dport_end", "-%u", r->end);
}
}
if (tb[FRA_TUN_ID]) {
__u64 tun_id = ((1==ntohl(1)) ? (rta_getattr_u64(tb[FRA_TUN_ID])) : ((uint64_t)ntohl((rta_getattr_u64(tb[FRA_TUN_ID])) & 0xFFFFFFFF) << 32) | ntohl((rta_getattr_u64(tb[FRA_TUN_ID])) >> 32));
print_u64(PRINT_ANY, "tun_id", " tun_id %llu", tun_id);
}
table = frh_get_table(frh, tb);
if (table) {
print_string(PRINT_ANY, "table",
" lookup %s",
rtnl_rttable_n2a(table, b1, sizeof(b1)));
if (tb[FRA_SUPPRESS_PREFIXLEN]) {
int pl = rta_getattr_u32(tb[FRA_SUPPRESS_PREFIXLEN]);
if (pl != -1)
print_int(PRINT_ANY, "suppress_prefixlen",
" suppress_prefixlength %d", pl);
}
if (tb[FRA_SUPPRESS_IFGROUP]) {
int group = rta_getattr_u32(tb[FRA_SUPPRESS_IFGROUP]);
if (group != -1) {
const char *grname
= rtnl_group_n2a(group, b1, sizeof(b1));
print_string(PRINT_ANY, "suppress_ifgroup",
" suppress_ifgroup %s", grname);
}
}
}
if (tb[FRA_FLOW]) {
__u32 to = rta_getattr_u32(tb[FRA_FLOW]);
__u32 from = to>>16;
to &= 0xFFFF;
if (from)
print_string(PRINT_ANY,
"flow_from", " realms %s/",
rtnl_rtrealm_n2a(from, b1, sizeof(b1)));
else
print_string(PRINT_FP,
((void *)0)
, " realms ",
((void *)0)
);
print_string(PRINT_ANY, "flow_to", "%s",
rtnl_rtrealm_n2a(to, b1, sizeof(b1)));
}
if (frh->action == RTN_NAT) {
if (tb[RTA_GATEWAY]) {
const char *gateway;
gateway = format_host(frh->family, ((int)((tb[RTA_GATEWAY])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), ((void*)(((char*)(tb[RTA_GATEWAY])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))));
print_string(PRINT_ANY, "nat_gateway",
" map-to %s", gateway);
} else {
print_null(PRINT_ANY, "masquerade", " masquerade",
((void *)0)
);
}
} else if (frh->action == FR_ACT_GOTO) {
if (tb[FRA_GOTO])
print_uint(PRINT_ANY, "goto", " goto %u",
rta_getattr_u32(tb[FRA_GOTO]));
else
print_string(PRINT_ANY, "goto", " goto %s", "none");
if (frh->flags & 0x00000004)
print_null(PRINT_ANY, "unresolved",
" [unresolved]",
((void *)0)
);
} else if (frh->action == FR_ACT_NOP) {
print_null(PRINT_ANY, "nop", " nop",
((void *)0)
);
} else if (frh->action != FR_ACT_TO_TBL) {
print_string(PRINT_ANY, "action", " %s",
rtnl_rtntype_n2a(frh->action, b1, sizeof(b1)));
}
if (tb[FRA_PROTOCOL]) {
__u8 protocol = rta_getattr_u8(tb[FRA_PROTOCOL]);
if ((protocol && protocol != 2) || show_details > 0) {
print_string(PRINT_ANY, "protocol", " proto %s",
rtnl_rtprot_n2a(protocol, b1, sizeof(b1)));
}
}
print_string(PRINT_FP,
((void *)0)
, "\n", "");
close_json_object();
fflush(fp);
return 0;
}
| long print_rule(long a1, FILE *a2)
{
unsigned int v3;
unsigned int v4;
long v5;
const char *v6;
const char *v7;
unsigned char v8;
long v9;
long v10;
uint32_t v11;
unsigned long v12;
long v13;
long v14;
unsigned int v15;
long v16;
long v17;
unsigned int v18;
long v19;
long v20;
unsigned char v21;
unsigned int v22;
unsigned int v23;
int v24;
int v25;
unsigned int v26;
unsigned int table;
unsigned int v28;
unsigned int v29;
unsigned int v30;
unsigned char *v31;
const char *v32;
const char *v33;
long v34;
unsigned short *v35;
unsigned short *v36;
long v37;
long v38;
long v39;
unsigned short *v40;
unsigned short *v41;
long v42;
long v43;
unsigned short *v44;
long v45;
long v46;
long v47;
long v48;
long v49;
long v50;
long v51;
long v52;
long v53;
long v54;
long v55;
long v56;
long v57;
long v58;
char v59[64];
char v60[72];
unsigned long v61;
v61 = __readfsqword(0x28u);
v31 = (unsigned char *)(a1 + 16);
v22 = 0;
if ( *(_WORD *)(a1 + 4) != 32 && *(_WORD *)(a1 + 4) != 33 )
return 0LL;
v24 = *(_DWORD *)a1 - 28;
if ( v24 < 0 )
return 0xFFFFFFFFLL;
parse_rtattr(&v39, 24LL, a1 + 28, (unsigned int)v24);
v25 = af_bit_len(*v31);
if ( !filter_nlmsg(a1, &v39) )
return 0LL;
open_json_object(0LL);
if ( *(_WORD *)(a1 + 4) == 33 )
print_bool(4u, (long)"deleted", (long)"Deleted ", 1u);
if ( v45 )
v22 = rta_getattr_u32(v45);
print_uint(4u, (long)"priority", (long)"%u:\t", v22);
if ( (*(_DWORD *)(a1 + 24) & 2) != 0 )
print_null(4u, (long)"not", (long)"not ", 0LL);
if ( v41 )
{
v32 = (const char *)rt_addr_n2a(*v31, (unsigned int)*v41 - 4, v41 + 2);
print_string(1u, 0LL, "from ", 0LL);
v3 = ifa_family_color(*v31);
print_color_string(4LL, v3, "src", "%s", v32);
if ( v25 != *(unsigned char *)(a1 + 18) )
print_uint(4u, (long)"srclen", (long)"/%u", *(unsigned char *)(a1 + 18));
}
else if ( *(_BYTE *)(a1 + 18) )
{
print_string(4u, (long)"src", "from %s", (long)"0");
print_uint(4u, (long)"srclen", (long)"/%u", *(unsigned char *)(a1 + 18));
}
else
{
print_string(4u, (long)"src", "from %s", (long)"all");
}
if ( v40 )
{
v33 = (const char *)rt_addr_n2a(*v31, (unsigned int)*v40 - 4, v40 + 2);
print_string(1u, 0LL, " to ", 0LL);
v4 = ifa_family_color(*v31);
print_color_string(4LL, v4, "dst", "%s", v33);
if ( v25 != *(unsigned char *)(a1 + 17) )
print_uint(4u, (long)"dstlen", (long)"/%u", *(unsigned char *)(a1 + 17));
}
else if ( *(_BYTE *)(a1 + 17) )
{
print_string(4u, (long)"dst", " to %s", (long)"0");
print_uint(4u, (long)"dstlen", (long)"/%u", *(unsigned char *)(a1 + 17));
}
if ( *(_BYTE *)(a1 + 19) )
{
v5 = rtnl_dsfield_n2a(*(unsigned char *)(a1 + 19), v59, 64LL);
print_string(4u, (long)"tos", " tos %s", v5);
}
if ( v46 || v51 )
{
v23 = 0;
if ( v46 )
v23 = rta_getattr_u32(v46);
if ( !v51 || (v26 = rta_getattr_u32(v51), v26 == -1) )
{
print_0xhex(4u, (long)"fwmark", (long)" fwmark %#llx", v23);
}
else
{
print_0xhex(4u, (long)"fwmark", (long)" fwmark %#llx", v23);
print_0xhex(4u, (long)"fwmask", (long)"/%#llx", v26);
}
}
if ( v42 )
{
if ( (unsigned char)is_json_context(4LL) != 1 )
fprintf(a2, " iif ");
v6 = (const char *)rta_getattr_str(v42);
print_color_string(4LL, 0LL, "iif", "%s", v6);
if ( (*(_DWORD *)(a1 + 24) & 8) != 0 )
print_null(4u, (long)"iif_detached", (long)" [detached]", 0LL);
}
if ( v52 )
{
if ( (unsigned char)is_json_context(4LL) != 1 )
fprintf(a2, " oif ");
v7 = (const char *)rta_getattr_str(v52);
print_color_string(4LL, 0LL, "oif", "%s", v7);
if ( (*(_DWORD *)(a1 + 24) & 0x10) != 0 )
print_null(4u, (long)"oif_detached", (long)" [detached]", 0LL);
}
if ( v53 && (unsigned char)rta_getattr_u8(v53) )
print_null(4u, (long)"l3mdev", (long)" lookup [l3mdev-table]", 0LL);
if ( v54 )
{
v34 = v54 + 4;
print_uint(4u, (long)"uid_start", (long)" uidrange %u", *(_DWORD *)(v54 + 4));
print_uint(4u, (long)"uid_end", (long)"-%u", *(_DWORD *)(v34 + 4));
}
if ( v56 )
{
v8 = rta_getattr_u8(v56);
v9 = inet_proto_n2a(v8, v60, 64LL);
print_string(4u, (long)"ipproto", " ipproto %s", v9);
}
if ( v57 )
{
v35 = (unsigned short *)(v57 + 4);
if ( *(_WORD *)(v57 + 4) == *(_WORD *)(v57 + 6) )
{
print_uint(4u, (long)"sport", (long)" sport %u", *v35);
}
else
{
print_uint(4u, (long)"sport_start", (long)" sport %u", *v35);
print_uint(4u, (long)"sport_end", (long)"-%u", v35[1]);
}
}
if ( v58 )
{
v36 = (unsigned short *)(v58 + 4);
if ( *(_WORD *)(v58 + 4) == *(_WORD *)(v58 + 6) )
{
print_uint(4u, (long)"dport", (long)" dport %u", *v36);
}
else
{
print_uint(4u, (long)"dport_start", (long)" dport %u", *v36);
print_uint(4u, (long)"dport_end", (long)"-%u", v36[1]);
}
}
if ( v48 )
{
if ( ntohl(1u) == 1 )
{
v10 = rta_getattr_u64(v48);
}
else
{
v11 = rta_getattr_u64(v48);
v12 = (unsigned long)ntohl(v11) << 32;
v13 = rta_getattr_u64(v48);
v10 = v12 | ntohl(HIDWORD(v13));
}
print_u64(4u, (long)"tun_id", (long)" tun_id %llu", v10);
}
table = frh_get_table((long)v31, (long)&v39);
if ( table )
{
v14 = rtnl_rttable_n2a(table, v59, 64LL);
print_string(4u, (long)"table", " lookup %s", v14);
if ( v50 )
{
v28 = rta_getattr_u32(v50);
if ( v28 != -1 )
print_int(4u, (long)"suppress_prefixlen", (long)" suppress_prefixlength %d", v28);
}
if ( v49 )
{
v29 = rta_getattr_u32(v49);
if ( v29 != -1 )
{
v37 = rtnl_group_n2a(v29, v59, 64LL);
print_string(4u, (long)"suppress_ifgroup", " suppress_ifgroup %s", v37);
}
}
}
if ( v47 )
{
v15 = rta_getattr_u32(v47);
v30 = (unsigned short)v15;
if ( HIWORD(v15) )
{
v16 = rtnl_rtrealm_n2a(HIWORD(v15), v59, 64LL);
print_string(4u, (long)"flow_from", " realms %s/", v16);
}
else
{
print_string(1u, 0LL, " realms ", 0LL);
}
v17 = rtnl_rtrealm_n2a(v30, v59, 64LL);
print_string(4u, (long)"flow_to", "%s", v17);
}
switch ( *(_BYTE *)(a1 + 23) )
{
case 0xA:
if ( v44 )
{
v38 = format_host(*v31, (unsigned int)*v44 - 4, v44 + 2);
print_string(4u, (long)"nat_gateway", " map-to %s", v38);
}
else
{
print_null(4u, (long)"masquerade", (long)" masquerade", 0LL);
}
break;
case 2:
if ( v43 )
{
v18 = rta_getattr_u32(v43);
print_uint(4u, (long)"goto", (long)" goto %u", v18);
}
else
{
print_string(4u, (long)"goto", " goto %s", (long)"none");
}
if ( (*(_DWORD *)(a1 + 24) & 4) != 0 )
print_null(4u, (long)"unresolved", (long)" [unresolved]", 0LL);
break;
case 3:
print_null(4u, (long)"nop", (long)" nop", 0LL);
break;
default:
if ( *(_BYTE *)(a1 + 23) != 1 )
{
v19 = rtnl_rtntype_n2a(*(unsigned char *)(a1 + 23), v59, 64LL);
print_string(4u, (long)"action", " %s", v19);
}
break;
}
if ( v55 )
{
if ( (v21 = rta_getattr_u8(v55)) != 0 && v21 != 2 || show_details > 0 )
{
v20 = rtnl_rtprot_n2a(v21, v59, 64LL);
print_string(4u, (long)"protocol", " proto %s", v20);
}
}
print_string(1u, 0LL, "\n", (long)&unk_40E3);
close_json_object(1LL);
fflush(a2);
return 0LL;
}
|
static int do_show_or_flush(int argc, char **argv, int flush)
{
char *filter_dev =
((void *)0)
;
int state_given = 0;
ipneigh_reset_filter(0);
if (!filter.family)
filter.family = preferred_family;
if (flush) {
if (argc <= 0) {
fprintf(
stderr
, "Flush requires arguments.\n");
return -1;
}
filter.state = ~(0x80|0x40);
} else
filter.state = 0xFF & ~0x40;
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (filter_dev)
duparg("dev", *argv);
filter_dev = *argv;
} else if (strcmp(*argv, "master") == 0) {
int ifindex;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
ifindex = ll_name_to_index(*argv);
if (!ifindex)
invarg("Device does not exist\n", *argv);
filter.master = ifindex;
} else if (strcmp(*argv, "vrf") == 0) {
int ifindex;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
ifindex = ll_name_to_index(*argv);
if (!ifindex)
invarg("Not a valid VRF name\n", *argv);
if (!name_is_vrf(*argv))
invarg("Not a valid VRF name\n", *argv);
filter.master = ifindex;
} else if (strcmp(*argv, "nomaster") == 0) {
filter.master = -1;
} else if (strcmp(*argv, "unused") == 0) {
filter.unused_only = 1;
} else if (strcmp(*argv, "nud") == 0) {
unsigned int state;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (!state_given) {
state_given = 1;
filter.state = 0;
}
if (nud_state_a2n(&state, *argv)) {
if (strcmp(*argv, "all") != 0)
invarg("nud state is bad", *argv);
state = ~0;
if (flush)
state &= ~0x40;
}
if (state == 0)
state = 0x100;
filter.state |= state;
} else if (strcmp(*argv, "proxy") == 0) {
filter.ndm_flags = (1 << 3);
} else if (matches(*argv, "protocol") == 0) {
__u32 prot;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (rtnl_rtprot_a2n(&prot, *argv)) {
if (strcmp(*argv, "all"))
invarg("invalid \"protocol\"\n", *argv);
prot = 0;
}
filter.protocol = prot;
} else {
if (strcmp(*argv, "to") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
}
if (matches(*argv, "help") == 0)
usage();
if (get_prefix(&filter.pfx, *argv, filter.family))
invarg("to value is invalid\n", *argv);
if (filter.family ==
0
)
filter.family = filter.pfx.family;
}
argc--; argv++;
}
ll_init_map(&rth);
if (filter_dev) {
filter.index = ll_name_to_index(filter_dev);
if (!filter.index)
return nodev(filter_dev);
}
if (flush) {
int round = 0;
char flushb[4096-512];
filter.flushb = flushb;
filter.flushp = 0;
filter.flushe = sizeof(flushb);
while (round < 10) {
if (rtnl_neighdump_req(&rth, filter.family,
ipneigh_dump_filter) < 0) {
perror("Cannot send dump request");
exit(1);
}
filter.flushed = 0;
if (rtnl_dump_filter_nc(&rth, print_neigh,
stdout
, 0) < 0) {
fprintf(
stderr
, "Flush terminated\n");
exit(1);
}
if (filter.flushed == 0) {
if (show_stats) {
if (round == 0)
printf("Nothing to flush.\n");
else
printf("*** Flush is complete after %d round%s ***\n", round, round > 1?"s":"");
}
fflush(
stdout
);
return 0;
}
round++;
if (flush_update() < 0)
exit(1);
if (show_stats) {
printf("\n*** Round %d, deleting %d entries ***\n", round, filter.flushed);
fflush(
stdout
);
}
filter.state &= ~0x20;
}
printf("*** Flush not complete bailing out after %d rounds\n",
10);
return 1;
}
if (rtnl_neighdump_req(&rth, filter.family, ipneigh_dump_filter) < 0) {
perror("Cannot send dump request");
exit(1);
}
new_json_obj(json);
if (rtnl_dump_filter_nc(&rth, print_neigh,
stdout
, 0) < 0) {
fprintf(
stderr
, "Dump terminated\n");
exit(1);
}
delete_json_obj();
return 0;
}
| void do_show_or_flush(unsigned long a0, unsigned long a1, unsigned long a2) {
unsigned long long *v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
void* v7;
char v8;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
unsigned int v16;
void* v17;
void* v18;
v1 = a0;
v0 = a1;
v7 = 0;
v3 = 0;
ipneigh_reset_filter(0x0);
if (!filter)
filter = preferred_family;
if (!a2) {
g_4027e8 = 191;
} else if (v1 > 0) {
g_4027e8 = -193;
} else {
fprintf(*(&stderr), "Flush requires arguments.\n");
v13 = 4294967295;
goto LABEL_4020f5;
}
for (; v1 > 0; v0 += 1) {
if (!strcmp(*(v0), "dev")) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (v7)
duparg("dev", *(v0));
v7 = *(v0);
} else if (!strcmp(*(v0), "master")) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
v6 = ll_name_to_index(*(v0));
if (!v6)
invarg("Device does not exist\n", *(v0));
g_402910 = v6;
} else if (!strcmp(*(v0), "vrf")) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
v5 = ll_name_to_index(*(v0));
if (!v5)
invarg("Not a valid VRF name\n", *(v0));
if (!name_is_vrf(*(v0)))
invarg("Not a valid VRF name\n", *(v0));
g_402910 = v5;
} else if (!strcmp(*(v0), "nomaster")) {
g_402910 = -1;
} else if (!strcmp(*(v0), "unused")) {
g_4027ec = 1;
} else if (!strcmp(*(v0), "nud")) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (!v3) {
v3 = 1;
g_4027e8 = 0;
}
if (nud_state_a2n(&v2, *(v0))) {
if (strcmp(*(v0), "all"))
invarg("nud state is bad", *(v0));
v2 = -1;
if (a2)
v2 &= -65;
}
if (!v2)
v2 = 0x100;
g_4027e8 = v2 | g_4027e8;
} else if (!strcmp(*(v0), "proxy")) {
g_402918 = 8;
} else if ((matches(*(v0), "protocol") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (rtnl_rtprot_a2n(&v2, *(v0), *(v0))) {
if (strcmp(*(v0), "all"))
invarg("invalid \"protocol\"\n", *(v0));
v2 = 0;
}
g_402914 = v2;
} else {
if (!strcmp(*(v0), "to")) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
}
if ((matches(*(v0), "help") ^ 1))
usage();
if (get_prefix(&g_4027f0, *(v0), filter))
invarg("to value is invalid\n", *(v0));
if (!filter)
filter = g_4027f6;
}
v1 -= 1;
}
ll_init_map(0x500060);
if (v7) {
g_4027e4 = ll_name_to_index(v7);
if (!g_4027e4) {
v14 = nodev(v7);
goto LABEL_4020f5;
}
}
if (a2) {
v4 = 0;
g_402900 = &v8;
g_402908 = 0;
g_40290c = 0xe00;
while (true) {
if (v4 > 9) {
printf("*** Flush not complete bailing out after %d rounds\n", 10);
v15 = 1;
break;
} else {
if (rtnl_neighdump_req(0x500060, filter, ipneigh_dump_filter) < 0) {
perror("Cannot send dump request");
exit(0x1);
}
g_4028f8 = 0;
if (rtnl_dump_filter_nc(0x500060, print_neigh, *(&stdout), 0x0) < 0) {
fprintf(*(&stderr), "Flush terminated\n");
exit(0x1);
}
if (!g_4028f8) {
if (show_stats) {
if (!v4) {
printf("Nothing to flush.\n");
} else {
if (v4 <= 1)
v16 = &g_402c5e;
else
v16 = "s";
printf("*** Flush is complete after %d round%s ***\n", v4, v16);
}
}
fflush(*(&stdout));
v18 = 0;
break;
} else {
v4 += 1;
if (flush_update() < 0)
exit(0x1);
if (show_stats) {
printf("\n*** Round %d, deleting %d entries ***\n", v4, g_4028f8);
fflush(*(&stdout));
}
g_4027e8 = g_4027e8 & -33;
}
}
}
} else if (rtnl_neighdump_req(0x500060, filter, ipneigh_dump_filter) < 0) {
perror("Cannot send dump request");
exit(0x1);
} else {
new_json_obj(json);
if (rtnl_dump_filter_nc(0x500060, print_neigh, *(&stdout), 0x0) >= 0) {
delete_json_obj();
v17 = 0;
} else {
fprintf(*(&stderr), "Dump terminated\n");
exit(0x1);
}
}
LABEL_4020f5:
return;
}
|
static const char *
compress_option (enum compress_type type)
{
struct zip_program const *zp;
int i = 0;
zp = find_zip_program (type, &i);
return zp ? zp->option :
((void *)0)
;
}
| int compress_option(unsigned long a0) {
unsigned int v0;
struct_0 *v1;
unsigned int v3;
v0 = 0;
v1 = find_zip_program(a0, &v0);
if (!v1)
v3 = 0;
else
v3 = v1->field_10;
return v3;
}
|
static void print_explain(FILE *f)
{
fprintf(f,
"Usage: ... ipoib [ pkey PKEY ]\n"
" [ mode {datagram | connected} ]\n"
" [ umcast {0|1} ]\n"
"\n"
"PKEY := 0x8001-0xffff\n"
);
}
| void print_explain(void* a0) {
unsigned long long v1;
v1 = fprintf(a0, "Usage: ... ipoib [ pkey PKEY ]\n\t\t [ mode {datagram | connected} ]\n\t\t [ umcast {0|1} ]\n\nPKEY := 0x8001-0xffff\n");
return;
}
|
static int lwtunnel_parse_vxlan_opts(char *str, size_t len, struct rtattr *rta)
{
struct rtattr *nest;
__u32 gbp;
int err;
nest = rta_nest(rta, len, LWTUNNEL_IP_OPTS_VXLAN | (1 << 15));
err = get_u32(&gbp, str, 0);
if (err)
return err;
rta_addattr32(rta, len, LWTUNNEL_IP_OPT_VXLAN_GBP, gbp);
rta_nest_end(rta, nest);
return 0;
}
| int lwtunnel_parse_vxlan_opts(undefined8 param_1,undefined4 param_2,undefined8 param_3)
{
int iVar1;
long in_FS_OFFSET;
undefined4 local_20;
int local_1c;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = rta_nest(param_3,param_2,0x8002);
local_1c = get_u32(&local_20,param_1,0);
iVar1 = local_1c;
if (local_1c == 0) {
rta_addattr32(param_3,param_2,1,local_20);
rta_nest_end(param_3,local_18);
iVar1 = 0;
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return iVar1;
}
__stack_chk_fail();
}
|
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 ("Write lines consisting of the sequentially corresponding lines from\neach FILE, separated by TABs, to standard output.\n"),
stdout
)
;
emit_stdin_note ();
emit_mandatory_arg_note ();
fputs_unlocked (gettext (" -d, --delimiters=LIST reuse characters from LIST instead of TABs\n -s, --serial paste one file at a time instead of in parallel\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
);
emit_ancillary_info ("paste");
}
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("Write lines consisting of the sequentially corresponding lines from\neach FILE, separated by TABs, to standard output.\n"), stdout);
emit_stdin_note();
emit_mandatory_arg_note();
fputs_unlocked(gettext(" -d, --delimiters=LIST reuse characters from LIST instead of TABs\n -s, --serial paste one file at a time instead of in parallel\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);
emit_ancillary_info("paste");
}
exit(a0);
}
|
static int
noclobber_open (filename, flags, mode, ri)
char *filename;
int flags, mode;
enum r_instruction ri;
{
int r, fd;
struct stat finfo, finfo2;
r = stat (filename, &finfo);
if (r == 0 && (
((((
finfo.st_mode
)) & 0170000) == (0100000))
))
return (-2);
flags &= ~
01000
;
if (r != 0)
{
fd = open (filename, flags|
0200
, mode);
return ((fd < 0 &&
(*__errno_location ())
==
17
) ? -2 : fd);
}
fd = open (filename, flags, mode);
if (fd < 0)
return (
(*__errno_location ())
==
17
? -2 : fd);
if ((fstat (fd, &finfo2) == 0) && (
((((
finfo2.st_mode
)) & 0170000) == (0100000))
== 0) &&
r == 0 && (
((((
finfo.st_mode
)) & 0170000) == (0100000))
== 0) &&
same_file (filename, filename, &finfo, &finfo2))
return fd;
close (fd);
(*__errno_location ())
=
17
;
return (-2);
}
| int noclobber_open(char *a0, unsigned long a1, unsigned long a2, unsigned long a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
char v4;
char v5;
char v6;
char v7;
unsigned int v9;
unsigned int v10;
unsigned int v11;
unsigned int v13;
unsigned int v14;
unsigned int v15;
unsigned int v16;
v1 = a1;
v0 = a3;
v2 = stat(a0, &v4);
if (!v2 && (*(&v5) & 0xf000) == 0x8000) {
v9 = -2;
goto LABEL_400f2b;
}
v1 &= -513;
if (!v2) {
v3 = open(a0, v1, a2);
if (v3 >= 0) {
if (!fstat(v3, &v6) && (*(&v7) & 0xf000) != 0x8000 && !v2 && (*(&v5) & 0xf000) != 0x8000 && same_file(a0, a0, &v4, &v6)) {
v15 = v3;
goto LABEL_400f2b;
}
close(v3);
*(__errno_location()) = 17;
v16 = -2;
} else if (*(__errno_location()) == 17) {
v13 = -2;
} else {
v14 = v3;
}
} else {
v10 = v1;
*(&v10) = v1 | 128;
v11 = open(a0, v10, a2);
v3 = v11;
if (v3 >= 0) {
LABEL_400e2f:
v11 = v3;
} else {
v11 = *(__errno_location());
if (!(v11 == 17))
goto LABEL_400e2f;
v11 = -2;
}
}
LABEL_400f2b:
return v3;
}
|
static const char *
rsa_hash_alg_ident(int hash_alg)
{
switch (hash_alg) {
case 1:
return "ssh-rsa";
case 2:
return "rsa-sha2-256";
case 4:
return "rsa-sha2-512";
}
return
((void *)0)
;
}
| int rsa_hash_alg_ident(unsigned long a0) {
unsigned int v1;
switch (a0) {
case 4:
v1 = &g_400f45;
return v1;
case 1:
v1 = &g_400f30;
return v1;
case 2:
v1 = &g_400f38;
return v1;
default:
v1 = 0;
return v1;
}
}
|
int
rl_backward (int count, int key)
{
return (rl_backward_char (count, key));
}
| long long rl_backward(unsigned long a0, unsigned long a1) {
return rl_backward_char(a0, a1);
}
|
void crypto_sign_ed25519_ref_sc25519_from_shortsc(crypto_sign_ed25519_ref_sc25519 *r, const crypto_sign_ed25519_ref_shortsc25519 *x)
{
int i;
for(i=0;i<16;i++)
r->v[i] = x->v[i];
for(i=0;i<16;i++)
r->v[16+i] = 0;
}
| void crypto_sign_ed25519_ref_sc25519_from_shortsc(unsigned int *a0, unsigned int *a1) {
unsigned int v0;
unsigned long long v3;
unsigned int *v4;
for (v0 = 0; v0 <= 15; v0 = __addvsi3(v0, 0x1, v0)) {
a0[v0] = a1[v0];
}
for (v0 = 0; v0 <= 15; v0 = __addvsi3(v0, 0x1, v4)) {
v4 = __addvsi3(v0, 0x10, v3);
*((a0 + 0x4 * v4)) = 0;
}
return;
}
|
u_int
dh_estimate(int bits)
{
if (bits <= 112)
return 2048;
if (bits <= 128)
return 3072;
if (bits <= 192)
return 7680;
return 8192;
}
| undefined8 dh_estimate(int param_1)
{
undefined8 uVar1;
if (param_1 < 0x71) {
uVar1 = 0x800;
}
else if (param_1 < 0x81) {
uVar1 = 0xc00;
}
else if (param_1 < 0xc1) {
uVar1 = 0x1e00;
}
else {
uVar1 = 0x2000;
}
return uVar1;
}
|
static int
executable_completion (filename, searching_path)
const char *filename;
int searching_path;
{
char *f, c;
int r;
c = 0;
f = bash_quote_filename ((char *)filename, 1, &c);
bash_directory_completion_hook (&f);
r = searching_path ? executable_file (f) : executable_or_directory (f);
sh_xfree((f), "bashline.c", 1956);
return r;
}
| int executable_completion(unsigned long long a0, unsigned long a1) {
char v0;
unsigned int v1;
unsigned long long v2;
unsigned long long v4;
v0 = 0;
v2 = bash_quote_filename(a0, 0x1, &v0);
bash_directory_completion_hook(&v2);
if (a1)
v4 = executable_file(v2);
else
v4 = executable_or_directory(v2);
v1 = v4;
sh_xfree(v2, "bashline.c", 0x7a4);
return v1;
}
|
void
rl_free_line_state (void)
{
register HIST_ENTRY *entry;
rl_free_undo_list ();
entry = current_history ();
if (entry)
entry->data = (char *)
((void *)0)
;
_rl_kill_kbd_macro ();
rl_clear_message ();
_rl_reset_argument ();
}
| long rl_free_line_state()
{
long v0;
rl_free_undo_list();
v0 = current_history();
if ( v0 )
*(_QWORD *)(v0 + 16) = 0LL;
rl_kill_kbd_macro();
rl_clear_message();
return rl_reset_argument();
}
|
static inline void
emit_mandatory_arg_note (void)
{
fputs_unlocked (gettext ("\nMandatory arguments to long options are mandatory for short options too.\n"),
stdout
)
;
}
| int emit_mandatory_arg_note()
{
FILE *v0;
char *v1;
v0 = stdout;
v1 = gettext("\nMandatory arguments to long options are mandatory for short options too.\n");
return fputs_unlocked(v1, v0);
}
|
static inline unsigned int ext2fs_dir_rec_len(__u8 name_len,
int extended)
{
int rec_len = (name_len + 8 + (4 - 1));
rec_len &= ~(4 - 1);
if (extended)
rec_len += 8;
return rec_len;
}
| int ext2fs_dir_rec_len(unsigned long a0, unsigned long a1) {
unsigned int v0;
v0 = a0 + 11;
v0 &= -0x4;
if (a1)
v0 += 8;
return v0;
}
|
vi_insert(EditLine *el, wint_t c __attribute__((__unused__)))
{
el->el_map.current = el->el_map.key;
cv_undo(el);
return 0;
}
| undefined8 vi_insert(long param_1)
{
*(undefined8 *)(param_1 + 0x400) = *(undefined8 *)(param_1 + 0x3f8);
cv_undo(param_1);
return 0;
}
|
static int
recv_msg(struct sshbuf *m)
{
u_int l, len;
u_char c, buf[1024];
int r;
if ((len = atomicio(read, fd, buf, 4)) != 4) {
sshlog("ssh-pkcs11-client.c", __func__, 79, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "read from helper failed: %u", len);
return (0);
}
len = (((u_int32_t)(((const u_char *)(buf))[0]) << 24) | ((u_int32_t)(((const u_char *)(buf))[1]) << 16) | ((u_int32_t)(((const u_char *)(buf))[2]) << 8) | (u_int32_t)(((const u_char *)(buf))[3]));
if (len > 256 * 1024)
sshfatal("ssh-pkcs11-client.c", __func__, 84, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "response too long: %u", len);
sshbuf_reset(m);
while (len > 0) {
l = len;
if (l > sizeof(buf))
l = sizeof(buf);
if (atomicio(read, fd, buf, l) != l) {
sshlog("ssh-pkcs11-client.c", __func__, 92, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "response from helper failed.");
return (0);
}
if ((r = sshbuf_put(m, buf, l)) != 0)
sshfatal("ssh-pkcs11-client.c", __func__, 96, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_put");
len -= l;
}
if ((r = sshbuf_get_u8(m, &c)) != 0)
sshfatal("ssh-pkcs11-client.c", __func__, 100, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse type");
return c;
}
| undefined recv_msg(undefined8 param_1)
{
ulong uVar1;
undefined8 uVar2;
char **ppcVar3;
undefined *puVar4;
undefined *puVar5;
long in_FS_OFFSET;
char *pcStack1096;
ulong uStack1088;
undefined auStack1080 [8];
undefined8 local_430;
undefined local_425;
uint local_424;
uint local_420;
int local_41c;
byte local_418;
byte local_417;
byte local_416;
byte local_415;
long local_10;
ppcVar3 = (char **)auStack1080;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
uStack1088 = 0x1001c8;
local_430 = param_1;
local_420 = atomicio(uRam00000000001001c0,fd,&local_418,4);
if (local_420 == 4) {
local_420 = (uint)local_415 |
(uint)local_418 << 0x18 | (uint)local_417 << 0x10 | (uint)local_416 << 8;
if (0x40000 < local_420) {
uStack1088 = (ulong)local_420;
ppcVar3 = &pcStack1096;
pcStack1096 = "response too long: %u";
sshfatal("ssh-pkcs11-client.c",__func___18327,0x54,0,1,0);
}
*(undefined8 *)((long)ppcVar3 + -8) = 0x1002d1;
sshbuf_reset(local_430);
puVar5 = (undefined *)ppcVar3;
for (; puVar4 = puVar5, local_420 != 0; local_420 = local_420 - local_424) {
local_424 = local_420;
if (0x400 < local_420) {
local_424 = 0x400;
}
*(undefined8 *)(puVar5 + -8) = 0x10031c;
uVar1 = atomicio(uRam0000000000100314,fd,&local_418,local_424);
if (uVar1 != local_424) {
*(char **)(puVar5 + -0x10) = "response from helper failed.";
*(undefined8 *)(puVar5 + -0x18) = 0x100361;
sshlog("ssh-pkcs11-client.c",__func___18327,0x5c,0,2,0);
local_425 = 0;
goto LAB_00100470;
}
*(undefined8 *)(puVar5 + -8) = 0x10038e;
local_41c = sshbuf_put(local_430,&local_418,local_424);
if (local_41c != 0) {
*(undefined8 *)(puVar5 + -8) = 0x1003aa;
uVar2 = ssh_err(local_41c);
puVar4 = puVar5 + -0x10;
*(char **)(puVar5 + -0x10) = "sshbuf_put";
*(undefined8 *)(puVar5 + -0x18) = 0x1003e1;
sshfatal("ssh-pkcs11-client.c",__func___18327,0x60,1,1,uVar2);
}
puVar5 = puVar4;
}
*(undefined8 *)(puVar5 + -8) = 0x100413;
local_41c = sshbuf_get_u8(local_430,&local_425);
if (local_41c != 0) {
*(undefined8 *)(puVar5 + -8) = 0x10042f;
uVar2 = ssh_err(local_41c);
puVar4 = puVar5 + -0x10;
*(char **)(puVar5 + -0x10) = "parse type";
*(undefined8 *)(puVar5 + -0x18) = 0x100466;
sshfatal("ssh-pkcs11-client.c",__func___18327,100,1,1,uVar2);
}
}
else {
uStack1088 = (ulong)local_420;
pcStack1096 = "read from helper failed: %u";
sshlog("ssh-pkcs11-client.c",__func___18327,0x4f,0,2,0);
local_425 = 0;
puVar4 = auStack1080;
}
LAB_00100470:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_425;
}
*(undefined8 *)(puVar4 + -8) = 0x100484;
__stack_chk_fail();
}
|
static int try_resume(socket_st * hd)
{
int ret, socket_flags = (1<<6);
gnutls_datum_t rdata = {
((void *)0)
, 0};
gnutls_datum_t edata = {
((void *)0)
, 0};
if (gnutls_session_is_resumed(hd->session) == 0) {
do {
ret = gnutls_session_get_data2(hd->session, &rdata);
if (ret < 0) {
rdata.data =
((void *)0)
;
}
if ((gnutls_protocol_get_version(hd->session) != GNUTLS_TLS1_3) ||
((gnutls_session_get_flags(hd->session) &
GNUTLS_SFLAGS_SESSION_TICKET))) {
break;
}
} while (waitresumption);
} else {
rdata.data = hd->rdata.data;
rdata.size = hd->rdata.size;
hd->rdata.data =
((void *)0)
;
}
log_msg(
stdout
, "- Disconnecting\n");
socket_bye(hd, 1);
canonicalize_host(hostname, service, sizeof(service));
log_msg
(
stdout
, "\n\n- Connecting again- trying to resume previous session\n");
if (gnutls_cli_options.present.starttls_proto)
socket_flags |= (1<<2);
else if (fastopen)
socket_flags |= (1<<1);
if (udp)
socket_flags |= 1;
if (gnutls_cli_options.present.earlydata) {
FILE *fp;
size_t size;
fp = fopen(gnutls_cli_options.arg.earlydata, "r");
if (fp ==
((void *)0)
) {
fprintf(
stderr
, "could not open %s\n", gnutls_cli_options.arg.earlydata);
exit(1);
}
edata.data = (void *) _gnutls_fread_file(fp, 0, &size);
edata.size = size;
fclose(fp);
}
socket_open2(hd, hostname, service, gnutls_cli_options.arg.starttls_proto, socket_flags, "Connecting to", &rdata, &edata,
((void *)0)
,
((void *)0)
)
;
log_msg(
stdout
, "- Resume Handshake was completed\n");
if (gnutls_session_is_resumed(hd->session) != 0)
log_msg(
stdout
, "*** This is a resumed session\n");
return 0;
}
| int try_resume(struct_0 *a0) {
void* v0;
unsigned int v1;
unsigned int v2;
char v3;
void* v4;
void* v5;
unsigned int v6;
unsigned long v7;
unsigned int v8;
v1 = 64;
v5 = 0;
v6 = 0;
v7 = 0;
v8 = 0;
if (gnutls_session_is_resumed(a0->field_8)) {
v5 = a0->field_e8;
v6 = a0->field_f0;
a0->field_e8 = 0;
} else {
while (true) {
v2 = gnutls_session_get_data2(a0->field_8, &v5, &v5);
if (v2 < 0)
v5 = 0;
if (gnutls_protocol_get_version(a0->field_8) != 5)
break;
if ((gnutls_session_get_flags(a0->field_8) & 128))
break;
if (!waitresumption)
break;
}
}
log_msg(stdout, "- Disconnecting\n", &v5);
socket_bye(a0, 0x1);
canonicalize_host(hostname, &service, 0x20);
log_msg(stdout, "\n\n- Connecting again- trying to resume previous session\n", 0x20);
if (g_500106) {
v1 |= 4;
} else if (fastopen) {
v1 |= 2;
}
if (udp)
v1 |= 1;
if (g_500101) {
v4 = fopen(gnutls_ocsp_status_request_is_checked, "r");
if (!v4) {
fprintf(stderr, "could not open %s\n", gnutls_ocsp_status_request_is_checked);
exit(0x1);
}
v7 = _gnutls_fread_file(v4, 0x0, &v3);
v8 = *(&v3);
fclose(v4);
}
v0 = 0;
socket_open2(a0, hostname, &service, dane_strerror, v1, "Connecting to", &v5, &v7, 0x0);
log_msg(stdout, "- Resume Handshake was completed\n", &service);
if (gnutls_session_is_resumed(a0->field_8))
log_msg(stdout, "*** This is a resumed session\n", &service);
return 0;
}
|
static void
initSigprov(instanceData *__restrict__ const pData, struct nvlst *lst)
{
uchar szDrvrName[1024];
if(snprintf((char*)szDrvrName, sizeof(szDrvrName), "lmsig_%s", pData->sigprovName)
== sizeof(szDrvrName)) {
parser_errmsg("omfile: signature provider "
"name is too long: '%s' - signatures disabled",
pData->sigprovName);
goto done;
}
pData->sigprovNameFull = (uchar*)strdup((char*)(szDrvrName));
pData->sigprov.ifVersion = 1;
if(obj.UseObj("omfile.c", szDrvrName, szDrvrName, (void*) &pData->sigprov)
!= RS_RET_OK) {
parser_errmsg("omfile: could not load "
"signature provider '%s' - signatures disabled",
szDrvrName);
goto done;
}
if(pData->sigprov.Construct(&pData->sigprovData) != RS_RET_OK) {
parser_errmsg("omfile: error constructing "
"signature provider %s dataset - signatures disabled",
szDrvrName);
goto done;
}
pData->sigprov.SetCnfParam(pData->sigprovData, lst);
r_dbgprintf("omfile.c", "loaded signature provider %s, data instance at %p\n", szDrvrName, pData->sigprovData)
;
pData->useSigprov = 1;
done: return;
}
| void initSigprov(struct_0 *a0, unsigned long long a1) {
char v0;
char v1;
unsigned long long *v6;
unsigned long long v7;
if (snprintf(&v0, 0x400, "lmsig_%s", a0->field_70) == 0x400) {
parser_errmsg("omfile: signature provider name is too long: '%s' - signatures disabled");
} else {
a0->field_78 = strdup(&v0);
a0->field_80 = 1;
if (g_405368("omfile.c", &v0, &v0, &a0->field_80, g_405368)) {
parser_errmsg("omfile: could not load signature provider '%s' - signatures disabled");
} else if (*(&a0->padding_84[4])(&a0->field_b8)) {
parser_errmsg("omfile: error constructing signature provider %s dataset - signatures disabled");
} else {
a0->field_90(a0->field_b8, a1, a1, a0->field_90);
r_dbgprintf("omfile.c", "loaded signature provider %s, data instance at %p\n");
a0->field_c8 = 1;
}
}
v7 = *(&v1) ^ v6[5];
return;
}
|
static int
tty_setup(EditLine *el)
{
int rst = (el->el_flags & 0x080) == 0;
if (el->el_flags & 0x004)
return 0;
if (el->el_tty.t_initialized)
return -1;
if (!isatty(el->el_outfd)) {
return -1;
}
if (tty_getty(el, &el->el_tty.t_or) == -1) {
return -1;
}
el->el_tty.t_ts = el->el_tty.t_ex = el->el_tty.t_ed = el->el_tty.t_or;
el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ex);
el->el_tty.t_tabs = ((((&el->el_tty.t_ex)->c_oflag &
0014000
) ==
0014000
) ? 0 : 1);
el->el_tty.t_eight = (((&el->el_tty.t_ex)->c_cflag &
0000060
) ==
0000060
);
tty_setup_flags(el, &el->el_tty.t_ex, 0);
if (rst) {
if (((&el->el_tty.t_ts)->c_lflag &
0000002
)) {
tty__getchar(&el->el_tty.t_ts, el->el_tty.t_c[2]);
for (rst = 0; rst < 25 - 2; rst++)
if (el->el_tty.t_c[2][rst] !=
el->el_tty.t_vdisable
&& el->el_tty.t_c[1][rst] !=
el->el_tty.t_vdisable)
el->el_tty.t_c[1][rst] =
el->el_tty.t_c[2][rst];
for (rst = 0; rst < 25; rst++)
if (el->el_tty.t_c[2][rst] !=
el->el_tty.t_vdisable)
el->el_tty.t_c[0][rst] =
el->el_tty.t_c[2][rst];
}
tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[0]);
if (tty_setty(el,
1
, &el->el_tty.t_ex) == -1) {
return -1;
}
}
tty_setup_flags(el, &el->el_tty.t_ed, 1);
tty__setchar(&el->el_tty.t_ed, el->el_tty.t_c[1]);
tty_bind_char(el, 1);
el->el_tty.t_initialized = 1;
return 0;
}
| long tty_setup(long a1)
{
long v2;
long v3;
long v4;
long v5;
long v6;
long v7;
long v8;
long v9;
long v10;
_BOOL4 v11;
int i;
int j;
v11 = (*(_DWORD *)(a1 + 44) & 0x80) == 0;
if ( (*(_DWORD *)(a1 + 44) & 4) != 0 )
return 0LL;
if ( *(_BYTE *)(a1 + 778) )
return 0xFFFFFFFFLL;
if ( !isatty(*(_DWORD *)(a1 + 36)) )
return 0xFFFFFFFFLL;
if ( (unsigned int)tty_getty(a1, (struct termios *)(a1 + 524)) == -1 )
return 0xFFFFFFFFLL;
v2 = *(_QWORD *)(a1 + 532);
*(_QWORD *)(a1 + 644) = *(_QWORD *)(a1 + 524);
*(_QWORD *)(a1 + 652) = v2;
v3 = *(_QWORD *)(a1 + 548);
*(_QWORD *)(a1 + 660) = *(_QWORD *)(a1 + 540);
*(_QWORD *)(a1 + 668) = v3;
v4 = *(_QWORD *)(a1 + 564);
*(_QWORD *)(a1 + 676) = *(_QWORD *)(a1 + 556);
*(_QWORD *)(a1 + 684) = v4;
*(_QWORD *)(a1 + 692) = *(_QWORD *)(a1 + 572);
*(_DWORD *)(a1 + 700) = *(_DWORD *)(a1 + 580);
v5 = *(_QWORD *)(a1 + 652);
*(_QWORD *)(a1 + 584) = *(_QWORD *)(a1 + 644);
*(_QWORD *)(a1 + 592) = v5;
v6 = *(_QWORD *)(a1 + 668);
*(_QWORD *)(a1 + 600) = *(_QWORD *)(a1 + 660);
*(_QWORD *)(a1 + 608) = v6;
v7 = *(_QWORD *)(a1 + 684);
*(_QWORD *)(a1 + 616) = *(_QWORD *)(a1 + 676);
*(_QWORD *)(a1 + 624) = v7;
*(_QWORD *)(a1 + 632) = *(_QWORD *)(a1 + 692);
*(_DWORD *)(a1 + 640) = *(_DWORD *)(a1 + 700);
v8 = *(_QWORD *)(a1 + 592);
*(_QWORD *)(a1 + 704) = *(_QWORD *)(a1 + 584);
*(_QWORD *)(a1 + 712) = v8;
v9 = *(_QWORD *)(a1 + 608);
*(_QWORD *)(a1 + 720) = *(_QWORD *)(a1 + 600);
*(_QWORD *)(a1 + 728) = v9;
v10 = *(_QWORD *)(a1 + 624);
*(_QWORD *)(a1 + 736) = *(_QWORD *)(a1 + 616);
*(_QWORD *)(a1 + 744) = v10;
*(_QWORD *)(a1 + 752) = *(_QWORD *)(a1 + 632);
*(_DWORD *)(a1 + 760) = *(_DWORD *)(a1 + 640);
*(_DWORD *)(a1 + 772) = tty__getspeed((const struct termios *)(a1 + 584));
*(_DWORD *)(a1 + 764) = (*(_DWORD *)(a1 + 588) & 0x1800) != 6144;
*(_DWORD *)(a1 + 768) = (*(_DWORD *)(a1 + 592) & 0x30) == 48;
tty_setup_flags(a1, a1 + 584, 0);
if ( v11 )
{
if ( (*(_DWORD *)(a1 + 716) & 2) != 0 )
{
tty__getchar((_BYTE *)(a1 + 704), (_BYTE *)(a1 + 498));
for ( i = 0; i <= 22; ++i )
{
if ( *(_BYTE *)(a1 + i + 498) != *(_BYTE *)(a1 + 777) && *(_BYTE *)(a1 + i + 473) != *(_BYTE *)(a1 + 777) )
*(_BYTE *)(a1 + i + 473) = *(_BYTE *)(a1 + i + 498);
}
for ( j = 0; j <= 24; ++j )
{
if ( *(_BYTE *)(a1 + j + 498) != *(_BYTE *)(a1 + 777) )
*(_BYTE *)(a1 + j + 448) = *(_BYTE *)(a1 + j + 498);
}
}
tty__setchar((_BYTE *)(a1 + 584), (_BYTE *)(a1 + 448));
if ( (unsigned int)tty_setty(a1, 1, (const struct termios *)(a1 + 584)) == -1 )
return 0xFFFFFFFFLL;
}
tty_setup_flags(a1, a1 + 644, 1);
tty__setchar((_BYTE *)(a1 + 644), (_BYTE *)(a1 + 473));
tty_bind_char(a1, 1);
*(_BYTE *)(a1 + 778) = 1;
return 0LL;
}
|
static int
client_converse(struct sshbuf *msg, struct sshbuf **respp, u_int type)
{
int oerrno, fd, r2, ll, r = -1;
u_int rtype, rerr;
pid_t pid;
u_char version;
void (*osigchld)(int);
struct sshbuf *req =
((void *)0)
, *resp =
((void *)0)
;
*respp =
((void *)0)
;
if ((r = start_helper(&fd, &pid, &osigchld)) != 0)
return r;
if ((req = sshbuf_new()) ==
((void *)0)
|| (resp = sshbuf_new()) ==
((void *)0)
) {
r = -2;
goto out;
}
ll = log_level_get();
if ((r = sshbuf_put_u32(req, type)) != 0 ||
(r = sshbuf_put_u8(req, log_is_on_stderr() != 0)) != 0 ||
(r = sshbuf_put_u32(req, ll < 0 ? 0 : ll)) != 0 ||
(r = sshbuf_putb(req, msg)) != 0) {
sshlog("ssh-sk-client.c", __func__, 163, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "compose");
goto out;
}
if ((r = ssh_msg_send(fd, 5, req)) != 0) {
sshlog("ssh-sk-client.c", __func__, 167, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "send");
goto out;
}
if ((r = ssh_msg_recv(fd, resp)) != 0) {
sshlog("ssh-sk-client.c", __func__, 171, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "receive");
goto out;
}
if ((r = sshbuf_get_u8(resp, &version)) != 0) {
sshlog("ssh-sk-client.c", __func__, 175, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse version");
goto out;
}
if (version != 5) {
sshlog("ssh-sk-client.c", __func__, 179, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "unsupported version: got %u, expected %u", version, 5)
;
r = -4;
goto out;
}
if ((r = sshbuf_get_u32(resp, &rtype)) != 0) {
sshlog("ssh-sk-client.c", __func__, 185, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse message type");
goto out;
}
if (rtype == 0) {
if ((r = sshbuf_get_u32(resp, &rerr)) != 0) {
sshlog("ssh-sk-client.c", __func__, 190, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse");
goto out;
}
sshlog("ssh-sk-client.c", __func__, 193, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "helper returned error -%u", rerr);
if (rerr == 0 || rerr >= 0x7fffffff)
r = -1;
else
r = -(int)rerr;
goto out;
} else if (rtype != type) {
sshlog("ssh-sk-client.c", __func__, 201, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "helper returned incorrect message type %u, " "expecting %u", rtype, type)
;
r = -1;
goto out;
}
r = 0;
out:
oerrno =
(*__errno_location ())
;
close(fd);
if ((r2 = reap_helper(pid)) != 0) {
if (r == 0) {
r = r2;
oerrno =
(*__errno_location ())
;
}
}
if (r == 0) {
*respp = resp;
resp =
((void *)0)
;
}
sshbuf_free(req);
sshbuf_free(resp);
ssh_signal(
17
, osigchld);
(*__errno_location ())
= oerrno;
return r;
}
| int client_converse(unsigned long long a0, unsigned long long *a1, unsigned long a2) {
char v0;
unsigned long long v1;
char v2;
char v3;
char v4;
char v5;
char v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
char v11;
void* v12;
void* v13;
unsigned int v15;
v1 = a0;
v8 = -1;
v13 = 0;
v12 = 0;
*(a1) = 0;
v8 = start_helper(&v3, &v6, &v11);
if (v8) {
v15 = v8;
return v15;
}
v13 = sshbuf_new();
if (!v13 || (v12 = sshbuf_new(), !v12)) {
v8 = -2;
} else {
v9 = log_level_get();
v8 = sshbuf_put_u32(v13, a2, a2);
if (v8) {
sshlog("ssh-sk-client.c", "client_converse", 0xa3, 0x1, 0x2, ssh_err(v8), "compose", *(&v0));
} else {
v15 = log_is_on_stderr();
v8 = sshbuf_put_u8(v13, v15, v15);
if (v8) {
sshlog("ssh-sk-client.c", "client_converse", 0xa3, 0x1, 0x2, ssh_err(v8), "compose", *(&v0));
} else {
v15 = (!(v9 - 0 >> 31 & 1) ? 0 : v9);
v8 = sshbuf_put_u32(v15, v15, v15);
if (v8) {
sshlog("ssh-sk-client.c", "client_converse", 0xa3, 0x1, 0x2, ssh_err(v8), "compose", *(&v0));
} else {
v8 = sshbuf_putb(v13, v1, v1);
if (v8) {
sshlog("ssh-sk-client.c", "client_converse", 0xa3, 0x1, 0x2, ssh_err(v8), "compose", *(&v0));
} else {
v8 = ssh_msg_send(*(&v3), 0x5, v13);
if (v8) {
sshlog("ssh-sk-client.c", "client_converse", 0xa7, 0x1, 0x2, ssh_err(v8), "send", *(&v0));
} else {
v8 = ssh_msg_recv(*(&v3), v12, v12);
if (v8) {
sshlog("ssh-sk-client.c", "client_converse", 0xab, 0x1, 0x2, ssh_err(v8), "receive", *(&v0));
} else {
v8 = sshbuf_get_u8(v12, &v2, &v2);
if (v8) {
sshlog("ssh-sk-client.c", "client_converse", 0xaf, 0x1, 0x2, ssh_err(v8), "parse version", *(&v0));
} else if (v2 != 5) {
sshlog("ssh-sk-client.c", "client_converse", 0xb3, 0x1, 0x2, 0x0, "unsupported version: got %u, expected %u", v2);
v8 = -0x4;
} else {
v8 = sshbuf_get_u32(v12, &v4, &v4);
if (v8) {
sshlog("ssh-sk-client.c", "client_converse", 0xb9, 0x1, 0x2, ssh_err(v8), "parse message type", *(&v0));
} else if (!*(&v4)) {
v8 = sshbuf_get_u32(v12, &v5, &v5);
if (v8) {
sshlog("ssh-sk-client.c", "client_converse", 0xbe, 0x1, 0x2, ssh_err(v8), "parse", *(&v0));
} else {
sshlog("ssh-sk-client.c", "client_converse", 0xc1, 0x1, 0x5, 0x0, "helper returned error -%u", *(&v5));
if (!*(&v5) || *(&v5) > 2147483646)
v8 = -1;
else
v8 = __negvsi2(*(&v5));
}
} else if (a2 == *(&v4)) {
v8 = 0;
} else {
sshlog("ssh-sk-client.c", "client_converse", 0xc9, 0x1, 0x2, 0x0, "helper returned incorrect message type %u, expecting %u", *(&v4));
v8 = -1;
}
}
}
}
}
}
}
}
}
v7 = *(__errno_location());
close(*(&v3));
v10 = reap_helper(*(&v6));
if (v10 && !v8) {
v8 = v10;
v15 = *(__errno_location());
v7 = v15;
}
if (!v8) {
*(a1) = v12;
v12 = 0;
}
sshbuf_free(v13);
sshbuf_free(v12);
ssh_signal(0x11, *(&v11));
*(__errno_location()) = v7;
v15 = v8;
return v15;
}
|
static void kdf(void *bufp, aes_int_key key, UINT8 ndx, int nbytes)
{
UINT8 in_buf[16] = {0};
UINT8 out_buf[16];
UINT8 *dst_buf = (UINT8 *)bufp;
int i;
in_buf[16 -9] = ndx;
in_buf[16 -1] = i = 1;
while (nbytes >= 16) {
AES_encrypt((u_char *)(in_buf),(u_char *)(out_buf),(AES_KEY *)key);
memcpy(dst_buf,out_buf,16);
in_buf[16 -1] = ++i;
nbytes -= 16;
dst_buf += 16;
}
if (nbytes) {
AES_encrypt((u_char *)(in_buf),(u_char *)(out_buf),(AES_KEY *)key);
memcpy(dst_buf,out_buf,nbytes);
}
explicit_bzero(in_buf, sizeof(in_buf));
explicit_bzero(out_buf, sizeof(out_buf));
}
| void kdf(void* a0, unsigned long long a1, unsigned long a2, unsigned long a3) {
unsigned int v0;
unsigned int v1;
void* v2;
void* v3;
char v4;
void* v5;
char v6;
char v7;
char v8;
unsigned long long *v10;
unsigned long long v11;
v0 = a3;
v3 = 0;
v5 = 0;
v2 = a0;
v4 = a2;
v1 = 1;
for (v6 = 1; v0 > 15; v2 += 16) {
AES_encrypt(&v3, &v7, a1, &v7);
memcpy(v2, &v7, 0x10);
v1 = __addvsi3(v1, 0x1);
v6 = v1;
v0 = __addvsi3(v0, 0xfffffff0);
}
if (v0) {
AES_encrypt(&v3, &v7, a1, &v7);
memcpy(v2, &v7, v0);
}
explicit_bzero(&v3, 0x10);
explicit_bzero(&v7, 0x10);
v11 = *(&v8) ^ v10[5];
return;
}
|
static int check_dir_block2(ext2_filsys fs,
struct ext2_db_entry2 *db,
void *priv_data)
{
int err;
struct check_dir_struct *cd = priv_data;
if (cd->ra_entries && cd->list_offset >= cd->next_ra_off) {
err = e2fsck_readahead_dblist(fs,
(0x01),
fs->dblist,
cd->list_offset + cd->ra_entries / 8,
cd->ra_entries);
if (err)
cd->ra_entries = 0;
cd->next_ra_off = cd->list_offset + (cd->ra_entries * 7 / 8);
}
err = check_dir_block(fs, db, priv_data);
cd->list_offset++;
return err;
}
| long check_dir_block2(long a1, long a2, _QWORD *a3)
{
long result;
if ( a3[17] && a3[16] >= a3[18] )
{
if ( (unsigned int)e2fsck_readahead_dblist(a1, 1LL, *(_QWORD *)(a1 + 144), a3[16] + (a3[17] >> 3), a3[17]) )
a3[17] = 0LL;
a3[18] = a3[16] + ((unsigned long)(7LL * a3[17]) >> 3);
}
LODWORD(result) = check_dir_block(a1, a2, (long)a3);
++a3[16];
return (unsigned int)result;
}
|
test_code_t test_tls_disable2(gnutls_session_t session)
{
int ret;
if (tls1_2_ok != 0)
return TEST_IGNORE;
sprintf(prio_str,
"NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:"
"+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%s", protocol_str, rest);
{ int _ret; if ((_ret=__gnutls_priority_set_direct(session, prio_str, 1282)) != TEST_SUCCEED) { return _ret; } };
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret == TEST_FAILED) {
snprintf(protocol_str, sizeof(protocol_str), "+VERS-TLS1.1:+VERS-TLS1.0:+VERS-SSL3.0");
}
return ret;
}
| int test_tls_disable2(undefined8 param_1)
{
int iVar1;
if (tls1_2_ok == 0) {
sprintf(prio_str,
"NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s"
,protocol_str,rest);
iVar1 = __gnutls_priority_set_direct(param_1,prio_str,0x502);
if (iVar1 == 0) {
gnutls_credentials_set(param_1,1,xcred);
iVar1 = test_do_handshake(param_1);
if (iVar1 == 1) {
snprintf(protocol_str,0x34,"+VERS-TLS1.1:+VERS-TLS1.0:+VERS-SSL3.0");
}
}
}
else {
iVar1 = 3;
}
return iVar1;
}
|
_Bool
pred_used (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
struct timespec delta, at, ct;
(void) pathname;
at = get_stat_atime (stat_buf);
ct = get_stat_ctime (stat_buf);
if (compare_ts (at, ct) < 0)
return
0
;
delta.tv_sec = ct.tv_sec - at.tv_sec;
delta.tv_nsec = ct.tv_nsec - at.tv_nsec;
if (delta.tv_nsec < 0)
{
delta.tv_nsec += 1000000000;
delta.tv_sec -= 1;
}
return pred_timewindow (delta, pred_ptr, 86400);
}
| char pred_used(long a1, long a2, long a3)
{
long v3;
long v4;
time_t v7;
long v8;
time_t stat_atime;
long v10;
time_t stat_ctime;
long v12;
stat_atime = get_stat_atime(a2);
v10 = v3;
stat_ctime = get_stat_ctime(a2);
v12 = v4;
if ( (int)compare_ts(stat_atime, v10, stat_ctime, v4) < 0 )
return 0;
v7 = stat_ctime - stat_atime;
v8 = v12 - v10;
if ( v12 - v10 < 0 )
{
v8 += 1000000000LL;
--v7;
}
return pred_timewindow(v7, v8, a3, 86400);
}
|
static
void compressedStreamEOF ( void )
{
if (noisy) {
fprintf (
stderr
,
"\n%s: Compressed file ends unexpectedly;\n\t"
"perhaps it is corrupted? *Possible* reason follows.\n",
progName );
perror ( progName );
showFileNames();
cadvise();
}
cleanUpAndFail( 2 );
}
| void compressedStreamEOF() {
if (noisy) {
fprintf(stderr, "\n%s: Compressed file ends unexpectedly;\n\tperhaps it is corrupted? *Possible* reason follows.\n", progName);
perror(progName);
showFileNames();
cadvise();
}
cleanUpAndFail(0x2);
}
|
int do_handshake(socket_st * socket)
{
int ret;
if (fastopen && socket->connect_addrlen) {
gnutls_transport_set_fastopen(socket->session, socket->fd,
(struct sockaddr*)&socket->connect_addr,
socket->connect_addrlen, 0);
socket->connect_addrlen = 0;
} else {
;
}
do {
gnutls_handshake_set_timeout(socket->session,
((unsigned int)-1));
ret = gnutls_handshake(socket->session);
if (ret < 0) {
handle_error(socket, ret);
}
}
while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret == 0) {
print_info(socket->session, verbose, gnutls_cli_options.present.x509certfile?(1<<1):0);
if (gnutls_cli_options.present.keymatexport)
print_key_material(socket->session,
gnutls_cli_options.arg.keymatexport,
gnutls_cli_options.present.keymatexportsize ?
gnutls_cli_options.value.keymatexportsize : 20);
socket->secure = 1;
} else {
gnutls_alert_send_appropriate(socket->session, ret);
shutdown(socket->fd,
SHUT_RDWR
);
}
return ret;
}
| int do_handshake(struct_0 *a0) {
unsigned int v0;
unsigned long long v2;
if (fastopen && a0->field_d0) {
gnutls_transport_set_fastopen(a0->field_8, a0->field_0, &a0->padding_14[60], a0->field_d0, 0x0);
a0->field_d0 = 0;
}
while (true) {
gnutls_handshake_set_timeout(a0->field_8, 0xffffffff);
v0 = gnutls_handshake(a0->field_8);
if (v0 < 0)
handle_error(a0, v0);
if (v0 >= 0)
break;
if (gnutls_error_is_fatal(v0))
break;
}
if (v0) {
gnutls_alert_send_appropriate(a0->field_8, v0, v0);
shutdown(a0->field_0, 0x2);
} else {
print_info(a0->field_8, verbose);
if (g_500137) {
if (!print_cert_info)
v2 = 20;
else
v2 = gnutls_session_key_update;
print_key_material(a0->field_8, gnutls_alert_get_name, v2, a0->field_8);
}
a0->field_10 = 1;
}
return v0;
}
|
static rsRetVal
setLegacyDfltTpl(void __attribute__((unused)) *pVal, uchar* newVal)
{
rsRetVal iRet = RS_RET_OK;
if(loadModConf !=
((void *)0)
&& loadModConf->tplName !=
((void *)0)
) {
free(newVal);
LogError(0, RS_RET_ERR, "omfwd default template already set via module "
"global parameter - can no longer be changed");
do { iRet = RS_RET_ERR; goto finalize_it; } while (0);
}
free(cs.pszTplName);
cs.pszTplName = newVal;
finalize_it:
return iRet;
}
| long long setLegacyDfltTpl(unsigned long a0, void* a1) {
unsigned long v0;
unsigned int v1;
v0 = a0;
v1 = 0;
if (loadModConf && *((loadModConf + 8))) {
free(a1);
LogError(0x0, 0xfffff448, "omfwd default template already set via module global parameter - can no longer be changed");
v1 = -3000;
return v1;
}
free(cs);
cs = a1;
return v1;
}
|
int get_latch_flags(int mask, int *value)
{
struct latch_descr *ldesc;
ldesc = find_latch(mask);
if (!ldesc)
return -1;
*value = ldesc->flags;
return 0;
}
| long long get_latch_flags(unsigned long a0, unsigned int *a1) {
struct_0 *v0;
unsigned long long v2;
v0 = find_latch(a0);
if (!v0) {
v2 = 4294967295;
} else {
*(a1) = v0->field_c;
v2 = 0;
}
return v2;
}
|
static int netns_add(int argc, char **argv,
_Bool
create)
{
char netns_path[
4096
], proc_path[
4096
];
const char *name;
pid_t pid;
int fd;
int lock;
int made_netns_run_dir_mount = 0;
if (create) {
if (argc < 1) {
fprintf(
stderr
, "No netns name specified\n");
return -1;
}
} else {
if (argc < 2) {
fprintf(
stderr
, "No netns name and PID specified\n");
return -1;
}
if (get_s32(&pid, argv[1], 0) || !pid) {
fprintf(
stderr
, "Invalid PID: %s\n", argv[1]);
return -1;
}
}
name = argv[0];
snprintf(netns_path, sizeof(netns_path), "%s/%s", "/var/run/netns", name);
if (create_netns_dir())
return -1;
lock = open("/var/run/netns",
00
|
0200000
, 0);
if (lock < 0) {
fprintf(
stderr
, "Cannot open netns runtime directory \"%s\": %s\n",
"/var/run/netns", strerror(
(*__errno_location ())
));
return -1;
}
if (flock(lock,
2
) < 0) {
fprintf(
stderr
, "Warning: could not flock netns runtime directory \"%s\": %s\n",
"/var/run/netns", strerror(
(*__errno_location ())
));
close(lock);
lock = -1;
}
while (mount("", "/var/run/netns", "none",
MS_SHARED
|
MS_REC
,
((void *)0)
)) {
if (
(*__errno_location ())
!=
22
|| made_netns_run_dir_mount) {
fprintf(
stderr
, "mount --make-shared %s failed: %s\n",
"/var/run/netns", strerror(
(*__errno_location ())
));
if (lock != -1) {
flock(lock,
8
);
close(lock);
}
return -1;
}
if (mount("/var/run/netns", "/var/run/netns", "none",
MS_BIND
|
MS_REC
,
((void *)0)
)) {
fprintf(
stderr
, "mount --bind %s %s failed: %s\n",
"/var/run/netns", "/var/run/netns", strerror(
(*__errno_location ())
));
if (lock != -1) {
flock(lock,
8
);
close(lock);
}
return -1;
}
made_netns_run_dir_mount = 1;
}
if (lock != -1) {
flock(lock,
8
);
close(lock);
}
fd = open(netns_path,
00
|
0100
|
0200
, 0);
if (fd < 0) {
fprintf(
stderr
, "Cannot create namespace file \"%s\": %s\n",
netns_path, strerror(
(*__errno_location ())
));
return -1;
}
close(fd);
if (create) {
netns_save();
if (unshare(
0x40000000
) < 0) {
fprintf(
stderr
, "Failed to create a new network namespace \"%s\": %s\n",
name, strerror(
(*__errno_location ())
));
goto out_delete;
}
strcpy(proc_path, "/proc/self/ns/net");
} else {
snprintf(proc_path, sizeof(proc_path), "/proc/%d/ns/net", pid);
}
if (mount(proc_path, netns_path, "none",
MS_BIND
,
((void *)0)
) < 0) {
fprintf(
stderr
, "Bind %s -> %s failed: %s\n",
proc_path, netns_path, strerror(
(*__errno_location ())
));
goto out_delete;
}
netns_restore();
return 0;
out_delete:
if (create) {
netns_restore();
netns_delete(argc, argv);
} else if (unlink(netns_path) < 0) {
fprintf(
stderr
, "Cannot remove namespace file \"%s\": %s\n",
netns_path, strerror(
(*__errno_location ())
));
}
return -1;
}
| void netns_add(unsigned long a0, unsigned long a1, unsigned long a2) {
unsigned long long v0[2];
char v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned long v5;
char v6;
unsigned long long v7;
char v8;
unsigned long long v9;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v15;
unsigned long long v16;
unsigned long long v18;
unsigned long long v19;
unsigned int v21;
unsigned long long v22;
unsigned long long v23;
unsigned long long v24;
unsigned long long v25;
unsigned long long v26;
void* v27;
unsigned long long v29;
v9 = *(&v9);
v7 = *(&v7);
v0[0] = a1;
v3 = 0;
if (a2) {
if (a0 <= 0) {
fprintf(*(&stderr), "No netns name specified\n");
v13 = 4294967295;
}
} else {
if (a0 <= 1) {
fprintf(*(&stderr), "No netns name and PID specified\n");
v12 = 4294967295;
} else {
v11 = get_s32(&v1, v0[1], 0x0, v0[1]);
if (!*(&v1) || v11) {
fprintf(*(&stderr), "Invalid PID: %s\n", v0[1]);
v15 = 4294967295;
}
}
}
if ((!v11 || a2) && (!a2 || a0 > 0) && (*(&v1) || a2) && (a0 > 1 || a2)) {
v5 = v0[0];
snprintf(&v6, 0x1000, "%s/%s", &g_40385e, v5);
if (create_netns_dir()) {
v16 = 4294967295;
} else {
v2 = open64("/var/run/netns", 0x10000, 0x0);
if (v2 < 0) {
fprintf(*(&stderr), "Cannot open netns runtime directory \"%s\": %s\n", &g_40385e, strerror(*(__errno_location())));
v18 = 4294967295;
} else {
if (flock(v2, 0x2) < 0) {
fprintf(*(&stderr), "Warning: could not flock netns runtime directory \"%s\": %s\n", &g_40385e, strerror(*(__errno_location())));
close(v2);
v2 = -1;
}
while (true) {
v19 = mount(&g_403ca7, "/var/run/netns", "none", 0x104000, NULL);
if (v19) {
*(&v19) = *(__errno_location());
if (v19 == 22 && !v3) {
if (mount("/var/run/netns", "/var/run/netns", "none", 0x5000, NULL)) {
fprintf(*(&stderr), "mount --bind %s %s failed: %s\n", &g_40385e, &g_40385e, strerror(*(__errno_location())));
if (v2 != -1) {
flock(v2, 0x8);
close(v2);
}
v23 = 4294967295;
break;
} else {
v3 = 1;
continue;
}
}
if (v3 || v19 != 22) {
fprintf(*(&stderr), "mount --make-shared %s failed: %s\n", &g_40385e, strerror(*(__errno_location())));
if (v2 != -1) {
flock(v2, 0x8);
close(v2);
}
v22 = 4294967295;
break;
}
} else {
if (v2 != -1) {
flock(v2, 0x8);
close(v2);
}
v21 = 192;
v4 = open64(&v6, 0xc0, 0x0);
if (v4 < 0) {
fprintf(*(&stderr), "Cannot create namespace file \"%s\": %s\n", &v6, strerror(*(__errno_location())));
v24 = 4294967295;
break;
} else {
close(v4);
if (a2) {
netns_save(v4, reg_64, 64 CONCAT 0);
v25 = unshare(0x40000000);
if (v25 < 0)
fprintf(*(&stderr), "Failed to create a new network namespace \"%s\": %s\n", v5, strerror(*(__errno_location())));
else
strcpy(&v8, "/proc/self/ns/net");
} else {
snprintf(&v8, 0x1000, "/proc/%d/ns/net", *(&v1));
}
if (!a2 || v25 >= 0) {
v26 = mount(&v8, &v6, "none", 0x1000, NULL);
if (v26 < 0) {
fprintf(*(&stderr), "Bind %s -> %s failed: %s\n", &v8, &v6, strerror(*(__errno_location())));
} else {
netns_restore();
v27 = 0;
break;
}
}
if (v26 < 0 || v25 < 0 && a2) {
if (a2) {
netns_restore();
netns_delete(a0, v0);
} else if (unlink(&v6) < 0) {
fprintf(*(&stderr), "Cannot remove namespace file \"%s\": %s\n", &v6, strerror(*(__errno_location())));
}
v29 = 4294967295;
break;
}
}
}
}
}
}
}
return;
}
|
int
assert_protected(const char *const *argv)
{
struct dpkg_version version = { 0, "1.20.1",
((void *)0)
};
return assert_version_support(argv, &version, gettext("Protected field"));
}
| void assert_protected(undefined8 param_1)
{
undefined8 uVar1;
long in_FS_OFFSET;
undefined4 local_28 [2];
char *local_20;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_28[0] = 0;
local_20 = "1.20.1";
local_18 = 0;
uVar1 = gettext("Protected field");
assert_version_support(param_1,local_28,uVar1);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
static int
token_callback(void *user, const char *label, const unsigned retry)
{
char buf[32];
common_info_st *info = user;
if (retry > 0 || (info !=
((void *)0)
&& info->batch != 0)) {
fprintf(
stderr
, "Could not find token %s\n", label);
return -1;
}
log_msg(
stdout
, "Please insert token '%s' in slot and press enter\n",
label);
if (fgets(buf, sizeof(buf),
stdin
) ==
((void *)0)
) {
fprintf(
stderr
, "error reading input\n");
return -1;
}
return 0;
}
| undefined8 token_callback(long param_1,undefined8 param_2,int param_3)
{
undefined8 uVar1;
char *pcVar2;
long in_FS_OFFSET;
char local_38 [40];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if ((param_3 == 0) && ((param_1 == 0 || (*(int *)(param_1 + 0xbc) == 0)))) {
log_msg(stdout,"Please insert token \'%s\' in slot and press enter\n",param_2);
pcVar2 = fgets(local_38,0x20,stdin);
if (pcVar2 == (char *)0x0) {
fprintf(stderr,"error reading input\n");
uVar1 = 0xffffffff;
}
else {
uVar1 = 0;
}
}
else {
fprintf(stderr,"Could not find token %s\n",param_2);
uVar1 = 0xffffffff;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar1;
}
|
static char *
skiparith (substr, delim)
char *substr;
int delim;
{
int i;
char delims[2];
delims[0] = delim;
delims[1] = '\0';
i = skip_to_delim (substr, 0, delims, 0x400);
return (substr + i);
}
| int skiparith(char *a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
char v1;
char v2;
v1 = a1;
v2 = 0;
v0 = skip_to_delim(a0, 0x0, &v1, 0x400, a4, a5);
return &a0[v0];
}
|
char *
line_abbrevname(char *dst, const char *src, int dstsize)
{
size_t len;
memset(dst, '\0', dstsize);
if (strncmp(src, "/dev/", 5) == 0)
src += 5;
len = strlen(src);
if (len > 0) {
if (((int)len - dstsize) > 0)
src += ((int)len - dstsize);
strncpy(dst, src, (size_t)dstsize);
}
return (dst);
}
| void line_abbrevname(void* a0, char *a1, unsigned long a2) {
char *v0;
unsigned long long v1;
unsigned long long v5;
v0 = a1;
memset(a0, 0x0, a2);
if (!strncmp(v0, "/dev/", 0x5))
v0 += 5;
v1 = strlen(v0);
if (v1) {
if (__subvsi3(v1, a2) > 0)
v0 = &v0[__subvsi3(v1, a2)];
strncpy(a0, v0, a2);
}
v5 = a0;
return;
}
|
static int
evalcommand(union node *cmd, int flags)
{
struct localvar_list *localvar_stop;
struct parsefile *file_stop;
struct redirtab *redir_stop;
union node *argp;
struct arglist arglist;
struct arglist varlist;
char **argv;
int argc;
struct strlist *osp;
struct strlist *sp;
struct cmdentry cmdentry;
struct job *jp;
char *lastarg;
const char *path;
int spclbltin;
int cmd_flag;
int execcmd;
int status;
char **nargv;
int vflags;
int vlocal;
errlinno = lineno = cmd->ncmd.linno;
if (funcline)
lineno -= funcline - 1;
;
file_stop = parsefile;
back_exitstatus = 0;
cmdentry.cmdtype = 2;
cmdentry.u.cmd = &bltin;
varlist.lastp = &varlist.list;
*varlist.lastp =
((void *)0)
;
arglist.lastp = &arglist.list;
*arglist.lastp =
((void *)0)
;
cmd_flag = 0;
execcmd = 0;
spclbltin = -1;
vflags = 0;
vlocal = 0;
path =
((void *)0)
;
argc = 0;
argp = cmd->ncmd.args;
if ((osp = fill_arglist(&arglist, &argp))) {
int pseudovarflag = 0;
for (;;) {
find_command(arglist.list->text, &cmdentry,
cmd_flag | 0x10, ((&(&(&varinit[0])[1])[1])[1].text + 5));
vlocal++;
if (cmdentry.cmdtype != 2)
break;
pseudovarflag = cmdentry.u.cmd->flags & 0x4;
if (__builtin_expect(!!(spclbltin < 0),1)) {
spclbltin =
cmdentry.u.cmd->flags &
0x1
;
vlocal = spclbltin ^ 0x1;
}
execcmd = cmdentry.u.cmd == (builtincmd + 12);
if (__builtin_expect(!!(cmdentry.u.cmd != (builtincmd + 8)),1))
break;
cmd_flag = parse_command_args(&arglist, &argp, &path);
if (!cmd_flag)
break;
}
for (; argp; argp = argp->narg.next)
expandarg(argp, &arglist,
pseudovarflag &&
isassignment(argp->narg.text) ?
0x4 : 0x1 | 0x2);
for (sp = arglist.list; sp; sp = sp->next)
argc++;
if (execcmd && argc > 1)
vflags = 0x01;
}
localvar_stop = pushlocalvars(vlocal);
nargv = stalloc(sizeof (char *) * (argc + 2));
argv = ++nargv;
for (sp = arglist.list ; sp ; sp = sp->next) {
;
*nargv++ = sp->text;
}
*nargv =
((void *)0)
;
lastarg =
((void *)0)
;
if (optlist[3] && funcline == 0 && argc > 0)
lastarg = nargv[-1];
preverrout.fd = 2;
expredir(cmd->ncmd.redirect);
redir_stop = pushredir(cmd->ncmd.redirect);
status = redirectsafe(cmd->ncmd.redirect, 01|03);
if (__builtin_expect(!!(status),0)) {
bail:
exitstatus = status;
if (spclbltin > 0)
exraise(1);
goto out;
}
for (argp = cmd->ncmd.assign; argp; argp = argp->narg.next) {
struct strlist **spp;
spp = varlist.lastp;
expandarg(argp, &varlist, 0x4);
if (vlocal)
mklocal((*spp)->text, 0x01);
else
setvareq((*spp)->text, vflags);
}
if (optlist[7] && !inps4) {
struct output *out;
int sep;
out = &preverrout;
inps4 = 1;
outstr(expandstr(((&(&(&(&(&(&varinit[0])[1])[1])[1])[1])[1])[1].text + 4)), out);
inps4 = 0;
sep = 0;
sep = eprintlist(out, varlist.list, sep);
eprintlist(out, osp, sep);
outcslow('\n', out);
}
if (cmdentry.cmdtype != 2 ||
!(cmdentry.u.cmd->flags & 0x2)) {
path = __builtin_expect(!!(path),0) ? path : ((&(&(&varinit[0])[1])[1])[1].text + 5);
find_command(argv[0], &cmdentry, cmd_flag | 0x01, path);
}
jp =
((void *)0)
;
switch (cmdentry.cmdtype) {
case -1:
status = 127;
goto bail;
default:
if (!(flags & 01) || have_traps()) {
({ suppressint++; ({ __asm__ __volatile__ ("": : :"memory"); }); 0; });
jp = vforkexec(cmd, argv, path, cmdentry.u.index);
break;
}
shellexec(argv, path, cmdentry.u.index);
case 2:
if (evalbltin(cmdentry.u.cmd, argc, argv, flags) &&
!(exception == 1 && spclbltin <= 0)) {
raise:
longjmp(handler->loc, 1);
}
break;
case 1:
if (evalfun(cmdentry.u.func, argc, argv, flags))
goto raise;
break;
}
status = waitforjob(jp);
({ ({ __asm__ __volatile__ ("": : :"memory"); }); suppressint = 0; if (intpending) onint(); 0; });
out:
if (cmd->ncmd.redirect)
popredir(execcmd);
unwindredir(redir_stop);
unwindfiles(file_stop);
unwindlocalvars(localvar_stop);
if (lastarg)
setvar("_", lastarg, 0);
return status;
}
| long long evalcommand(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
int tmp_11;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
struct_1 *v9;
void* v10;
unsigned long long v11;
void* v12;
void* v13;
unsigned long long *v14;
unsigned long long v15;
unsigned long long v16;
unsigned long long v17;
unsigned long long *v18;
unsigned long long v19;
unsigned long long v20;
struct struct_1 **v21;
char v22;
unsigned long long *v23;
char v24;
unsigned long long *v25;
unsigned int v26;
unsigned long long v27;
unsigned long long v29;
unsigned long long v30;
void* v31;
lineno = a0->field_4;
errlinno = lineno;
if (funcline)
lineno = lineno - (funcline - 1);
v15 = parsefile;
inps4 = 0;
v26 = 2;
v27 = &bltin;
v25 = &v24;
*(v25) = 0;
v23 = &v22;
*(v23) = 0;
v2 = 0;
v3 = 0;
v1 = -1;
v5 = 0;
v6 = 0;
v10 = 0;
v0 = 0;
v9[0] = a0->field_10;
v16 = fill_arglist(&v22, v9);
if (v16) {
v7 = 0;
while (true) {
find_command(*((*(&v22) + 8)), &v26, v2 | 16, handler + 5);
v6 += 1;
if (v26 != 2)
break;
v7 = *((v27 + 16)) & 4;
if ((v1 >> 31)) {
v1 = *((v27 + 16)) & 1;
v6 = v1 ^ 1;
}
v3 = v27 == 5243560;
if (v27 != freefunc)
break;
v2 = parse_command_args(&v22, v9, &v10);
if (!v2)
break;
}
while (true) {
if (!v9)
break;
if (v7 && isassignment(v9[2])) {
v29 = 4;
goto LABEL_40136a;
}
v29 = 3;
LABEL_40136a:
expandarg(v9, &v22, v29, &v22);
v9[0] = v9[1];
}
for (v11 = *(&v22); v11; v11 = *(v11)) {
v0 += 1;
}
if (v3 && v0 > 1)
v5 = 1;
}
v17 = pushlocalvars(v6);
v14 = stalloc((v0 + 2) * 8);
v14 += 8;
v18 = v14;
for (v11 = *(&v22); v11; v11 = *(v11)) {
tmp_11 = v14;
v14 += 8;
*(tmp_11) = *((v11 + 8));
}
*(v14) = 0;
v13 = 0;
if (g_500093 && !funcline && v0 > 0)
v13 = v14[1];
outstr = 2;
expredir(a0->field_18);
v19 = pushredir(a0->field_18);
v4 = redirectsafe(a0->field_18, 0x3);
if (!v4)
goto LABEL_40152f;
while (true) {
inps4 = v4;
if (v1 <= 0) {
LABEL_40182d:
break;
}
exraise(0x1);
LABEL_40152f:
for (v9 = a0->field_8; v9; v9 = v9->field_8) {
v21 = v25;
expandarg(v9, &v24, 0x4, &v24);
if (!v6)
setvareq(*(v21)->field_8, v5, v5);
else
mklocal(*(v21)->field_8, 0x1);
}
if (g_500097 && false) {
v20 = &preverrout;
inps4 = 1;
v30 = expandstr(freefunc + 4);
outstr(v30, v20, v30);
inps4 = 0;
v8 = 0;
v8 = eprintlist(v20, *(&v24), v8);
eprintlist(v20, v16, v8);
outcslow(0xa, v20);
}
if (v26 == 2 && !(!(*((v27 + 16)) & 2)))
goto LABEL_4016ee;
if (!v10)
v31 = handler + 5;
else
v31 = v10;
v10 = v31;
find_command(*(v18), &v26, v2 | 1, v10);
LABEL_4016ee:
v12 = 0;
if (v26 == 2) {
LABEL_401790:
if (evalbltin(v27, v0, v18, a1, a4, a5)) {
if (exception != 1) {
LABEL_4017c4:
do {
longjmp(handler, 0x1);
LABEL_4017dc:
} while (evalfun(v27, v0, v18, a1));
goto LABEL_4017ff;
} else if (!(v1 <= 0)) {
goto LABEL_4017c4;
}
}
LABEL_4017ff:
v4 = waitforjob(v12);
suppressint = 0;
if (!intpending)
break;
onint();
goto LABEL_40182d;
}
if (v26 > 2) {
LABEL_401729:
if ((a1 & 1) && !have_traps()) {
shellexec(v18, v10, v27, v10);
goto LABEL_401790;
}
suppressint = suppressint + 1;
v12 = vforkexec(a0, v18, v10, v27);
goto LABEL_4017ff;
} else if (v26 == -1) {
v4 = 127;
} else {
if (!(v26 == 1))
goto LABEL_401729;
goto LABEL_4017dc;
}
}
if (a0->field_18)
popredir(v3);
unwindredir(v19);
unwindfiles(v15);
unwindlocalvars(v17);
if (v13)
setvar("_", v13, 0x0, a3);
return v4;
}
|
static void
specify_nmerge (int oi, char c, char const *s)
{
uintmax_t n;
struct rlimit rlimit;
enum strtol_error e = xstrtoumax (s,
((void *)0)
, 10, &n, "");
unsigned int max_nmerge = ((getrlimit (
RLIMIT_NOFILE
, &rlimit) == 0
? rlimit.rlim_cur
: 20)
- 3);
if (e == LONGINT_OK)
{
nmerge = n;
if (nmerge != n)
e = LONGINT_OVERFLOW;
else
{
if (nmerge < 2)
{
error (0, 0, gettext ("invalid --%s argument %s"),
long_options[oi].name, quote (s));
((!!sizeof (struct { _Static_assert (SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"minimum --%s argument is %s\"), long_options[oi].name, quote (\"2\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (SORT_FAILURE, 0, gettext ("minimum --%s argument is %s"), long_options[oi].name, quote ("2")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (SORT_FAILURE, 0, gettext ("minimum --%s argument is %s"), long_options[oi].name, quote ("2")), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
else if (max_nmerge < nmerge)
{
e = LONGINT_OVERFLOW;
}
else
return;
}
}
if (e == LONGINT_OVERFLOW)
{
char max_nmerge_buf[((((((sizeof (max_nmerge) * 8) - (! ((__typeof__ (max_nmerge)) 0 < (__typeof__ (max_nmerge)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (max_nmerge)) 0 < (__typeof__ (max_nmerge)) -1))) + 1)];
error (0, 0, gettext ("--%s argument %s too large"),
long_options[oi].name, quote (s));
((!!sizeof (struct { _Static_assert (SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"maximum --%s argument with current rlimit is %s\"), long_options[oi].name, uinttostr (max_nmerge, max_nmerge_buf)), assume (false))" ")"); int _gl_dummy; })) ? ((error (SORT_FAILURE, 0, gettext ("maximum --%s argument with current rlimit is %s"), long_options[oi].name, uinttostr (max_nmerge, max_nmerge_buf)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (SORT_FAILURE, 0, gettext ("maximum --%s argument with current rlimit is %s"), long_options[oi].name, uinttostr (max_nmerge, max_nmerge_buf)), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
else
xstrtol_fatal (e, oi, c, long_options, s);
}
| void specify_nmerge(unsigned long a0, unsigned long a1, unsigned long long a2) {
unsigned int v0;
unsigned int v1;
char v2;
char v3;
char v4;
char v5;
unsigned long long *v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
v0 = xstrtoumax(a2, 0x0, 0xa, &v2, &g_40bb5b);
v1 = (!getrlimit(0x7, &v3) ? 17 : *(&v3) - 3);
if (!v0) {
nmerge = *(&v2);
if (nmerge != *(&v2)) {
v0 = 1;
} else if (nmerge <= 1) {
v10 = quote(a2);
error(0x0, 0x0, gettext("invalid --%s argument %s"));
v12 = quote("2");
error(0x2, 0x0, gettext("minimum --%s argument is %s"));
} else if (v1 < nmerge) {
v0 = 1;
} else {
v9 = *(&v5) ^ v8[5];
return;
}
}
if (v0 != 1)
xstrtol_fatal(v0, a0, a1, &long_options, a2);
v11 = quote(a2);
error(0x0, 0x0, gettext("--%s argument %s too large"));
v13 = uinttostr(v1, &v4, &v4);
error(0x2, 0x0, gettext("maximum --%s argument with current rlimit is %s"));
}
|
int
chdir_arg (char const *dir)
{
if (wd_count == wd_alloc)
{
if (wd_alloc == 0)
wd_alloc = 2;
wd = x2nrealloc (wd, &wd_alloc, sizeof *wd);
if (! wd_count)
{
wd[wd_count].name = ".";
wd[wd_count].abspath =
((void *)0)
;
wd[wd_count].fd =
-100
;
wd_count++;
}
}
if (dir[0])
{
while (dir[0] == '.' &&
((
dir[1]
) == '/')
)
for (dir += 2;
((
*dir
) == '/')
; dir++)
continue;
if (! dir[dir[0] == '.'])
return wd_count - 1;
}
wd[wd_count].name = dir;
wd[wd_count].abspath =
((void *)0)
;
wd[wd_count].fd = 0;
return wd_count++;
}
| long long chdir_arg(unsigned long a0) {
char v0[2];
unsigned long long v2;
*(&v0) = a0;
if (wd_count == wd_alloc) {
if (!wd_alloc)
wd_alloc = 2;
wd = x2nrealloc(wd, &wd_alloc, 0x18);
if (!wd_count) {
*((wd_count * 24 + wd)) = ".";
*((wd_count * 24 + wd + 8)) = 0;
*((wd_count * 24 + wd + 16)) = -100;
wd_count = wd_count + 1;
}
}
if (v0[0]) {
while (v0[0] == 46) {
if (v0[1] != 47)
break;
if (v0[1] == 47)
*(&v0) = v0 + 1;
for (; v0[0] == 47; *(&v0) = &v0[1]);
}
if (!v0[v0[0] == 46])
v2 = wd_count - 1;
}
if (!v0[0] || v0[v0[0] == 46]) {
*((wd + wd_count * 24)) = v0;
*((wd_count * 24 + wd + 8)) = 0;
*((wd_count * 24 + wd + 16)) = 0;
v2 = wd_count;
wd_count = wd_count + 1;
}
return v2;
}
|
static void
replace(char **tmp, int c)
{
char *aptr;
if ((aptr = strrchr(*tmp, c)) ==
((void *)0)
)
return;
aptr = strdup(aptr + 1);
free(*tmp);
*tmp = aptr;
}
| void replace(unsigned long long *a0, unsigned long a1) {
unsigned long v0;
unsigned long long *v3;
v0 = strrchr(*(a0), a1);
if (v0) {
v0 = strdup(v0 + 1);
free(*(a0));
v3 = a0;
*(a0) = v0;
return;
}
return;
}
|
int
do_exec_no_pty(struct ssh *ssh, Session *s, const char *command)
{
pid_t pid;
int pin[2], pout[2], perr[2];
if (s ==
((void *)0)
)
sshfatal("session.c", __func__, 396, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "do_exec_no_pty: no session");
if (pipe(pin) == -1) {
sshlog("session.c", __func__, 400, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "pipe in: %.100s", strerror(
(*__errno_location ())
));
return -1;
}
if (pipe(pout) == -1) {
sshlog("session.c", __func__, 404, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "pipe out: %.100s", strerror(
(*__errno_location ())
));
close(pin[0]);
close(pin[1]);
return -1;
}
if (pipe(perr) == -1) {
sshlog("session.c", __func__, 410, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "pipe err: %.100s", strerror(
(*__errno_location ())
));
close(pin[0]);
close(pin[1]);
close(pout[0]);
close(pout[1]);
return -1;
}
session_proctitle(s);
switch ((pid = fork())) {
case -1:
sshlog("session.c", __func__, 441, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "fork: %.100s", strerror(
(*__errno_location ())
));
close(pin[0]);
close(pin[1]);
close(pout[0]);
close(pout[1]);
close(perr[0]);
close(perr[1]);
return -1;
case 0:
is_child = 1;
if (setsid() == -1)
sshlog("session.c", __func__, 464, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "setsid failed: %.100s", strerror(
(*__errno_location ())
));
close(pin[1]);
if (dup2(pin[0], 0) == -1)
perror("dup2 stdin");
close(pin[0]);
close(pout[0]);
if (dup2(pout[1], 1) == -1)
perror("dup2 stdout");
close(pout[1]);
close(perr[0]);
if (dup2(perr[1], 2) == -1)
perror("dup2 stderr");
close(perr[1]);
do_child(ssh, s, command);
default:
break;
}
s->pid = pid;
ssh_packet_set_interactive(ssh, s->display !=
((void *)0)
,
options.ip_qos_interactive, options.ip_qos_bulk);
sshbuf_reset(loginmsg);
close(pin[0]);
close(pout[1]);
close(perr[1]);
session_set_fds(ssh, s, pin[1], pout[0], perr[0],
s->is_subsystem, 0);
return 0;
}
| long do_exec_no_pty(long a1, long a2, const char *a3)
{
int *v3;
char *v4;
int *v6;
char *v7;
int *v8;
char *v9;
int *v10;
char *v11;
int *v12;
char *v13;
__pid_t v15;
int pipedes[2];
int v17[2];
int v18[2];
unsigned long v19;
v19 = __readfsqword(0x28u);
if ( !a2 )
sshfatal("session.c", "do_exec_no_pty", 396LL, 0LL, 1LL, 0LL, "do_exec_no_pty: no session");
if ( pipe(pipedes) == -1 )
{
v3 = _errno_location();
v4 = strerror(*v3);
sshlog("session.c", "do_exec_no_pty", 400LL, 1LL, 2LL, 0LL, "pipe in: %.100s", v4);
return 0xFFFFFFFFLL;
}
else if ( pipe(v17) == -1 )
{
v6 = _errno_location();
v7 = strerror(*v6);
sshlog("session.c", "do_exec_no_pty", 404LL, 1LL, 2LL, 0LL, "pipe out: %.100s", v7);
close(pipedes[0]);
close(pipedes[1]);
return 0xFFFFFFFFLL;
}
else if ( pipe(v18) == -1 )
{
v8 = _errno_location();
v9 = strerror(*v8);
sshlog("session.c", "do_exec_no_pty", 410LL, 1LL, 2LL, 0LL, "pipe err: %.100s", v9);
close(pipedes[0]);
close(pipedes[1]);
close(v17[0]);
close(v17[1]);
return 0xFFFFFFFFLL;
}
else
{
session_proctitle(a2);
v15 = fork();
if ( v15 == -1 )
{
v10 = _errno_location();
v11 = strerror(*v10);
sshlog("session.c", "do_exec_no_pty", 441LL, 1LL, 2LL, 0LL, "fork: %.100s", v11);
close(pipedes[0]);
close(pipedes[1]);
close(v17[0]);
close(v17[1]);
close(v18[0]);
close(v18[1]);
return 0xFFFFFFFFLL;
}
else
{
if ( !v15 )
{
is_child = 1;
if ( setsid() == -1 )
{
v12 = _errno_location();
v13 = strerror(*v12);
sshlog("session.c", "do_exec_no_pty", 464LL, 0LL, 2LL, 0LL, "setsid failed: %.100s", v13);
}
close(pipedes[1]);
if ( dup2(pipedes[0], 0) == -1 )
perror("dup2 stdin");
close(pipedes[0]);
close(v17[0]);
if ( dup2(v17[1], 1) == -1 )
perror("dup2 stdout");
close(v17[1]);
close(v18[0]);
if ( dup2(v18[1], 2) == -1 )
perror("dup2 stderr");
close(v18[1]);
do_child(a1, a2, a3);
}
*(_DWORD *)(a2 + 32) = v15;
ssh_packet_set_interactive(a1, *(_QWORD *)(a2 + 144) != 0LL, options[300], options[301]);
sshbuf_reset(loginmsg);
close(pipedes[0]);
close(v17[1]);
close(v18[1]);
session_set_fds(a1, a2, pipedes[1], v17[0], v18[0], *(_DWORD *)(a2 + 200), 0);
return 0LL;
}
}
}
|
void
vwarnc(int code, const char *format, va_list ap)
{
fprintf(
stderr
, "%s: ", getprogname());
if (format) {
vfprintf(
stderr
, format, ap);
fprintf(
stderr
, ": ");
}
fprintf(
stderr
, "%s\n", strerror(code));
}
| void vwarnc(unsigned long a0, char *a1, unsigned long a2) {
unsigned long long v1;
fprintf(*(got.stderr), "%s: ", getprogname());
if (a1) {
vfprintf(*(got.stderr), a1, a2);
fprintf(*(got.stderr), ": ");
}
v1 = fprintf(*(got.stderr), "%s\n", strerror(a0));
return;
}
|
int
addr_netmatch(const struct xaddr *host, const struct xaddr *net, u_int masklen)
{
struct xaddr tmp_mask, tmp_result;
if (host->af != net->af)
return -1;
if (addr_netmask(host->af, masklen, &tmp_mask) == -1)
return -1;
if (addr_and(&tmp_result, host, &tmp_mask) == -1)
return -1;
return addr_cmp(&tmp_result, net);
}
| int addr_netmatch(unsigned short *a1, _WORD *a2, unsigned int a3)
{
int v4[8];
short v5[12];
unsigned long v6;
v6 = __readfsqword(0x28u);
if ( *a1 != *a2 )
return -1;
if ( (unsigned int)addr_netmask(*a1, a3, v4) == -1 )
return -1;
if ( (unsigned int)addr_and(v5, a1, (long)v4) == -1 )
return -1;
return addr_cmp((unsigned short *)v5, (long)a2);
}
|
void
do_authentication2(struct ssh *ssh)
{
Authctxt *authctxt = ssh->authctxt;
ssh_dispatch_init(ssh, &dispatch_protocol_error);
ssh_dispatch_set(ssh, 5, &input_service_request);
ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt->success);
ssh->authctxt =
((void *)0)
;
}
| long do_authentication2(long a1)
{
long result;
long v2;
v2 = *(_QWORD *)(a1 + 2144);
ssh_dispatch_init(a1, &dispatch_protocol_error);
ssh_dispatch_set(a1, 5LL, input_service_request);
ssh_dispatch_run_fatal(a1, 0LL, v2);
result = a1;
*(_QWORD *)(a1 + 2144) = 0LL;
return result;
}
|
_Bool
following_links(void)
{
switch (options.symlink_handling)
{
case SYMLINK_ALWAYS_DEREF:
return
1
;
case SYMLINK_DEREF_ARGSONLY:
return (state.curdepth == 0);
case SYMLINK_NEVER_DEREF:
default:
return
0
;
}
}
| int following_links() {
unsigned int v1;
if (bc_do_exec == 1) {
v1 = 1;
} else if (bc_do_exec == 2) {
v1 = state;
*(&v1) = !state;
} else {
v1 = 0;
}
return v1;
}
|
void
save_posix_options ()
{
saved_posix_vars = get_posix_options (saved_posix_vars);
}
| void save_posix_options(void)
{
saved_posix_vars = get_posix_options(saved_posix_vars);
return;
}
|
static void
note_key(struct pkcs11_provider *p, CK_ULONG slotidx, const char *context,
struct sshkey *key)
{
char *fp;
if ((fp = sshkey_fingerprint(key, 2,
SSH_FP_DEFAULT)) ==
((void *)0)
) {
sshlog("ssh-pkcs11.c", __func__, 1091, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "sshkey_fingerprint failed");
return;
}
sshlog("ssh-pkcs11.c", __func__, 1094, 0, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "%s: provider %s slot %lu: %s %s", context, p->name, (u_long)slotidx, sshkey_type(key), fp)
;
free(fp);
}
| void note_key(const char **a1, long a2, const char *a3, long a4)
{
const char *v4;
char *ptr;
ptr = (char *)sshkey_fingerprint(a4, 2LL, 0LL);
if ( ptr )
{
v4 = (const char *)sshkey_type(a4);
sshlog("ssh-pkcs11.c", "note_key", 1094LL, 0LL, 6LL, 0LL, "%s: provider %s slot %lu: %s %s", a3, *a1, a2, v4, ptr);
free(ptr);
}
else
{
sshlog("ssh-pkcs11.c", "note_key", 1091LL, 1LL, 2LL, 0LL, "sshkey_fingerprint failed");
}
}
|
static int
compare (struct line const *a, struct line const *b)
{
int diff;
size_t alen, blen;
if (keylist)
{
diff = keycompare (a, b);
if (diff || unique || stable)
return diff;
}
alen = a->length - 1, blen = b->length - 1;
if (alen == 0)
diff = - ((blen) != 0);
else if (blen == 0)
diff = 1;
else if (hard_LC_COLLATE)
{
diff = xmemcoll0 (a->text, alen + 1, b->text, blen + 1);
}
else if (! (diff = memcmp (a->text, b->text,
(((
alen
)<(
blen
))?(
alen
):(
blen
))
)))
diff = alen < blen ? -1 : alen != blen;
return reverse ? -diff : diff;
}
| uint compare(void **param_1,void **param_2)
{
ulong uVar1;
ulong uVar2;
ulong __n;
uint local_1c;
if ((keylist == 0) ||
(((local_1c = keycompare(param_1,param_2), local_1c == 0 && (unique == '\0')) &&
(stable == '\0')))) {
uVar1 = (long)param_1[1] - 1;
uVar2 = (long)param_2[1] - 1;
if (uVar1 == 0) {
local_1c = -(uint)(uVar2 != 0);
}
else if (uVar2 == 0) {
local_1c = 1;
}
else if (hard_LC_COLLATE == '\0') {
__n = uVar1;
if (uVar2 <= uVar1) {
__n = uVar2;
}
local_1c = memcmp(*param_1,*param_2,__n);
if (local_1c == 0) {
if (uVar1 < uVar2) {
local_1c = 0xffffffff;
}
else {
local_1c = (uint)(uVar1 != uVar2);
}
}
}
else {
local_1c = xmemcoll0(*param_1,param_1[1],*param_2,param_2[1]);
}
if (reverse != '\0') {
local_1c = -local_1c;
}
}
return local_1c;
}
|
static void close_files (void)
{
if (is_shadow_pwd) {
if (spw_close () == 0) {
fprintf (
stderr
,
gettext ("%s: failure while writing changes to %s\n"),
Prog, spw_dbname ());
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 (
3
, "failure while writing changes to %s", spw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
fail_exit (1);
}
if (spw_unlock () == 0) {
fprintf (
stderr
, gettext ("%s: failed to unlock %s\n"), Prog, spw_dbname ());
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 (
3
, "failed to unlock %s", spw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
spw_locked =
0
;
}
if (pw_close () == 0) {
fprintf (
stderr
,
gettext ("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());
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 (
3
, "failure while writing changes to %s", pw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
fail_exit (1);
}
if (pw_unlock () == 0) {
fprintf (
stderr
, gettext ("%s: failed to unlock %s\n"), Prog, pw_dbname ());
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 (
3
, "failed to unlock %s", pw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
pw_locked =
0
;
}
| void close_files()
{
long v0;
long v1;
char *v2;
const char *v3;
long v4;
long v5;
char *v6;
const char *v7;
long v8;
long v9;
char *v10;
const char *v11;
long v12;
long v13;
char *v14;
const char *v15;
char *locale;
char *v17;
char *v18;
char *v19;
const char *s;
const char *v21;
const char *v22;
const char *v23;
if ( is_shadow_pwd )
{
if ( !(unsigned int)spw_close() )
{
v0 = spw_dbname();
v1 = Prog;
v2 = gettext("%s: failure while writing changes to %s\n");
fprintf(stderr, v2, v1, v0);
s = setlocale(6, 0LL);
locale = 0LL;
if ( s )
locale = strdup(s);
if ( locale )
setlocale(6, "C");
v3 = (const char *)spw_dbname();
syslog(3, "failure while writing changes to %s", v3);
if ( locale )
{
setlocale(6, locale);
free(locale);
}
fail_exit(1);
}
if ( !(unsigned int)spw_unlock() )
{
v4 = spw_dbname();
v5 = Prog;
v6 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v6, v5, v4);
v21 = setlocale(6, 0LL);
v17 = 0LL;
if ( v21 )
v17 = strdup(v21);
if ( v17 )
setlocale(6, "C");
v7 = (const char *)spw_dbname();
syslog(3, "failed to unlock %s", v7);
if ( v17 )
{
setlocale(6, v17);
free(v17);
}
}
spw_locked = 0;
}
if ( !(unsigned int)pw_close() )
{
v8 = pw_dbname();
v9 = Prog;
v10 = gettext("%s: failure while writing changes to %s\n");
fprintf(stderr, v10, v9, v8);
v22 = setlocale(6, 0LL);
v18 = 0LL;
if ( v22 )
v18 = strdup(v22);
if ( v18 )
setlocale(6, "C");
v11 = (const char *)pw_dbname();
syslog(3, "failure while writing changes to %s", v11);
if ( v18 )
{
setlocale(6, v18);
free(v18);
}
fail_exit(1);
}
if ( !(unsigned int)pw_unlock() )
{
v12 = pw_dbname();
v13 = Prog;
v14 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v14, v13, v12);
v23 = setlocale(6, 0LL);
v19 = 0LL;
if ( v23 )
v19 = strdup(v23);
if ( v19 )
setlocale(6, "C");
v15 = (const char *)pw_dbname();
syslog(3, "failed to unlock %s", v15);
if ( v19 )
{
setlocale(6, v19);
free(v19);
}
}
pw_locked = 0;
}
|
int
sh_validfd (fd)
int fd;
{
return (fcntl (fd,
1
, 0) >= 0);
}
| _BOOL8 sh_validfd(int a1)
{
return fcntl(a1, 1, 0LL) >= 0;
}
|
static void usage(void)
{
fprintf(
stderr
,
"Usage: ip maddr [ add | del ] MULTIADDR dev STRING\n"
" ip maddr show [ dev STRING ]\n");
exit(-1);
}
| void usage() {
fprintf(stderr, "Usage: ip maddr [ add | del ] MULTIADDR dev STRING\n ip maddr show [ dev STRING ]\n");
exit(0xffffffff);
}
|
vi_history_word(EditLine *el, wint_t c __attribute__((__unused__)))
{
const wchar_t *wp = (((el)->el_flags & 0x040) ? hist_convert(el, 3,
((void *)0)
) : ((((*(el)->el_history.fun) ((el)->el_history.ref, &(el)->el_history.ev, 3,
((void *)0)
)) == -1) ?
((void *)0)
: (el)->el_history.ev.str));
const wchar_t *wep, *wsp;
int len;
wchar_t *cp;
const wchar_t *lim;
if (wp ==
((void *)0)
)
return 6;
wep = wsp =
((void *)0)
;
do {
while (iswspace(*wp))
wp++;
if (*wp == 0)
break;
wsp = wp;
while (*wp && !iswspace(*wp))
wp++;
wep = wp;
} while ((!el->el_state.doingarg || --el->el_state.argument > 0)
&& *wp != 0);
if (wsp ==
((void *)0)
|| (el->el_state.doingarg && el->el_state.argument != 0))
return 6;
cv_undo(el);
len = (int)(wep - wsp);
if (el->el_line.cursor < el->el_line.lastchar)
el->el_line.cursor++;
c_insert(el, len + 1);
cp = el->el_line.cursor;
lim = el->el_line.limit;
if (cp < lim)
*cp++ = ' ';
while (wsp < wep && cp < lim)
*cp++ = *wsp++;
el->el_line.cursor = cp;
el->el_map.current = el->el_map.key;
return 4;
}
| long vi_history_word(long a1)
{
long v1;
wint_t *v3;
wint_t *v4;
wint_t *v5;
wint_t *v6;
wint_t *v7;
wint_t *v8;
unsigned long v9;
if ( (*(_DWORD *)(a1 + 44) & 0x40) != 0 )
{
v1 = hist_convert(a1, 3LL, 0LL);
}
else if ( (*(unsigned int ( **)(_QWORD, long, long, _QWORD))(a1 + 1152))(
*(_QWORD *)(a1 + 1144),
a1 + 1160,
3LL,
0LL) == -1 )
{
v1 = 0LL;
}
else
{
v1 = *(_QWORD *)(a1 + 1168);
}
v5 = (wint_t *)v1;
if ( !v1 )
return 6LL;
v7 = 0LL;
v6 = 0LL;
do
{
while ( iswspace(*v5) )
++v5;
if ( !*v5 )
break;
v7 = v5;
while ( *v5 && !iswspace(*v5) )
++v5;
v6 = v5;
if ( *(_DWORD *)(a1 + 116) )
{
if ( (int)--*(_DWORD *)(a1 + 120) <= 0 )
break;
}
}
while ( *v5 );
if ( !v7 || *(_DWORD *)(a1 + 116) && *(_DWORD *)(a1 + 120) )
return 6LL;
cv_undo(a1);
if ( *(_QWORD *)(a1 + 88) < *(_QWORD *)(a1 + 96) )
*(_QWORD *)(a1 + 88) += 4LL;
c_insert(a1, (unsigned int)(v6 - v7) + 1);
v8 = *(wint_t **)(a1 + 88);
v9 = *(_QWORD *)(a1 + 104);
if ( (unsigned long)v8 < v9 )
{
++v8;
**(_DWORD **)(a1 + 88) = 32;
}
while ( v7 < v6 && (unsigned long)v8 < v9 )
{
v3 = v7++;
v4 = v8++;
*v4 = *v3;
}
*(_QWORD *)(a1 + 88) = v8;
*(_QWORD *)(a1 + 1024) = *(_QWORD *)(a1 + 1016);
return 4LL;
}
|
void issue_shutdown(char *halttype)
{
char *args[8];
int argp = 0;
int do_halt = (down_level[0] == '0');
issue_warn(0);
if (dontshut) {
hardsleep(1);
stopit(0);
}
openlog("shutdown",
0x01
,
(1<<3)
);
if (do_halt)
syslog(
5
, "shutting down for system halt");
else
syslog(
5
, "shutting down for system reboot");
closelog();
if (doself) fastdown();
args[argp++] = "/sbin/init";
if (sltime) {
args[argp++] = "-t";
args[argp++] = sltime;
}
args[argp++] = down_level;
args[argp] = (char *)
((void *)0)
;
unlink("/var/run/shutdown.pid");
unlink("/etc/nologin");
sync();
init_setenv("INIT_HALT", halttype);
execv("/sbin/init", args);
fprintf(
stderr
, "\rshutdown: cannot execute %s\r\n", "/sbin/init");
unlink("/fastboot");
unlink("/forcefsck");
init_setenv("INIT_HALT",
((void *)0)
);
openlog("shutdown",
0x01
,
(1<<3)
);
syslog(
5
, "shutdown failed");
closelog();
exit(1);
}
| void issue_shutdown(void* a0) {
unsigned int v0;
int tmp_11;
int tmp_12;
int tmp_33;
unsigned int v1;
char v2;
unsigned long v3;
unsigned long long *v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
v3 = v5[5];
v0 = 0;
v1 = 9892416630128516623 == 48;
issue_warn(0x0);
if (dontshut) {
hardsleep(0x1);
stopit(0x0);
}
openlog("shutdown", 0x1, 0x8);
if (!v1)
syslog(0x5, "shutting down for system reboot");
else
syslog(0x5, "shutting down for system halt");
closelog();
if (doself)
fastdown(0x5, v6, v7, v8, v9, v10);
tmp_11 = v0;
v0 += 1;
*(&(&v2)[8 * tmp_11]) = "/sbin/init";
if (sltime) {
tmp_12 = v0;
v0 += 1;
*(&(&v2)[8 * tmp_12]) = "-t";
tmp_33 = v0;
v0 += 1;
*(&(&v2)[8 * tmp_33]) = sltime;
}
tmp_12 = v0;
v0 += 1;
*(&(&v2)[8 * tmp_12]) = &down_level;
*(&(&v2)[8 * v0]) = 0;
unlink("/var/run/shutdown.pid");
unlink("/etc/nologin");
sync();
init_setenv("INIT_HALT", a0);
execv("/sbin/init", &v2);
fprintf(stderr, "\rshutdown: cannot execute %s\r\n", &g_402280);
unlink("/fastboot");
unlink("/forcefsck");
init_setenv("INIT_HALT", NULL);
openlog("shutdown", 0x1, 0x8);
syslog(0x5, "shutdown failed");
closelog();
exit(0x1);
}
|
void
cleanup_exit(int i)
{
leave_raw_mode(options.request_tty == 3);
if (options.control_path !=
((void *)0)
&& muxserver_sock != -1)
unlink(options.control_path);
ssh_kill_proxy_command();
_exit(i);
}
| void cleanup_exit(unsigned long a0) {
leave_raw_mode(*(5247956) == 3);
if (*(5247888) && muxserver_sock != -1)
unlink(*(5247888));
ssh_kill_proxy_command();
_exit(a0);
}
|
static void
siginfo_handler (int sig)
{
if (!
1
)
signal (sig, siginfo_handler);
info_signal_count++;
}
| long long siginfo_handler(unsigned long a0) {
unsigned int v0;
unsigned long long v2;
v0 = a0;
v2 = info_signal_count + 1;
info_signal_count = info_signal_count + 1;
return v2;
}
|
static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
__u16 flags = 0;
_Bool
mflag_given =
0
;
while (argc > 0) {
if (matches(*argv, "mode") == 0) {
__u16 mode = 0;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (strcmp(*argv, "l2") == 0)
mode = IPVLAN_MODE_L2;
else if (strcmp(*argv, "l3") == 0)
mode = IPVLAN_MODE_L3;
else if (strcmp(*argv, "l3s") == 0)
mode = IPVLAN_MODE_L3S;
else {
fprintf(
stderr
, "Error: argument of \"mode\" must be either \"l2\", \"l3\" or \"l3s\"\n");
return -1;
}
addattr16(n, 1024, IFLA_IPVLAN_MODE, mode);
} else if (matches(*argv, "private") == 0 && !mflag_given) {
flags |= 0x01;
mflag_given =
1
;
} else if (matches(*argv, "vepa") == 0 && !mflag_given) {
flags |= 0x02;
mflag_given =
1
;
} else if (matches(*argv, "bridge") == 0 && !mflag_given) {
mflag_given =
1
;
} else if (matches(*argv, "help") == 0) {
print_explain(lu,
stderr
);
return -1;
} else {
fprintf(
stderr
, "%s: unknown option \"%s\"?\n",
lu->id, *argv);
print_explain(lu,
stderr
);
return -1;
}
argc--;
argv++;
}
addattr16(n, 1024, IFLA_IPVLAN_FLAGS, flags);
return 0;
}
| long long ipvlan_parse_opt(void* a0, unsigned long a1, unsigned long a2, unsigned long long a3) {
unsigned long long *v0;
unsigned int v1;
char v2;
unsigned short v3;
unsigned short v4;
unsigned long long v12;
v1 = a1;
v0 = a2;
v3 = 0;
v2 = 0;
while (true) {
if (v1 <= 0) {
addattr16(a3, 0x400, 0x2, v3);
v12 = 0;
break;
}
if ((matches(*(v0), "mode") ^ 1)) {
v4 = 0;
v0 += 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (!strcmp(*(v0), "l2")) {
v4 = 0;
} else if (!strcmp(*(v0), "l3")) {
v4 = 1;
} else if (!strcmp(*(v0), "l3s")) {
v4 = 2;
} else {
fprintf(*(&stderr), "Error: argument of \"mode\" must be either \"l2\", \"l3\" or \"l3s\"\n");
v12 = 4294967295;
break;
}
addattr16(a3, 0x400, 0x1, v4);
goto LABEL_4002e7;
}
if ((matches(*(v0), "private") ^ 1) && (v2 ^ 1)) {
v3 |= 1;
v2 = 1;
goto LABEL_4002e7;
}
if ((matches(*(v0), "vepa") ^ 1) && (v2 ^ 1)) {
v3 |= 2;
v2 = 1;
goto LABEL_4002e7;
}
if (!(matches(*(v0), "bridge") ^ 1)) {
LABEL_400266:
if ((matches(*(v0), "help") ^ 1)) {
print_explain(a0, *(&stderr));
v12 = 4294967295;
break;
} else {
fprintf(*(&stderr), "%s: unknown option \"%s\"?\n", a0[8], *(v0));
print_explain(a0, *(&stderr));
v12 = 4294967295;
break;
}
} else {
if (!(v2 ^ 1))
goto LABEL_400266;
v2 = 1;
LABEL_4002e7:
v1 -= 1;
v0 += 1;
}
}
return v12;
}
|
int
where_history(void)
{
return history_offset;
}
| long long where_history() {
return *(got.history_offset);
}
|
static char *
read_comsub (fd, quoted, flags, rflag)
int fd, quoted, flags;
int *rflag;
{
char *istring, buf[4096], *bufp;
int c, tflag, skip_ctlesc, skip_ctlnul;
int mb_cur_max;
size_t istring_index;
size_t istring_size;
ssize_t bufn;
int nullbyte;
mbstate_t ps;
wchar_t wc;
size_t mblen;
int i;
istring = (char *)
((void *)0)
;
istring_index = istring_size = bufn = tflag = 0;
skip_ctlesc = ifs_cmap['\001'];
skip_ctlnul = ifs_cmap['\177'];
mb_cur_max =
(__ctype_get_mb_cur_max ())
;
nullbyte = 0;
while (1)
{
if (fd < 0)
break;
if (--bufn <= 0)
{
bufn = zread (fd, buf, sizeof (buf));
if (bufn <= 0)
break;
bufp = buf;
}
c = *bufp++;
if (c == 0)
{
if (nullbyte == 0)
{
internal_warning ("%s", gettext("command substitution: ignored null byte in input"));
nullbyte = 1;
}
continue;
}
do { if ((istring_index) + (mb_cur_max+1) >= istring_size) { while ((istring_index) + (mb_cur_max+1) >= istring_size) istring_size += (512); istring = sh_xrealloc((istring), (istring_size), "subst.c", 6826); } } while (0);
if ((quoted & (0x002|0x001)) )
istring[istring_index++] = '\001';
else if ((flags & 0x08) && skip_ctlesc && c == '\001')
istring[istring_index++] = '\001';
else if (skip_ctlesc == 0 && c == '\001')
istring[istring_index++] = '\001';
else if ((skip_ctlnul == 0 && c == '\177') || (c == ' ' && (ifs_value && *ifs_value == 0)))
istring[istring_index++] = '\001';
if ((locale_utf8locale && (c & 0x80)) ||
(locale_utf8locale == 0 && mb_cur_max > 1 && (unsigned char)c > 127))
{
memset (&ps, '\0', sizeof (mbstate_t));
mblen = mbrtowc (&wc, bufp-1, bufn, &ps);
if (((mblen) == (size_t)-1 || (mblen) == (size_t)-2) || mblen == 0 || mblen == 1)
istring[istring_index++] = c;
else
{
istring[istring_index++] = c;
for (i = 0; i < mblen-1; i++)
istring[istring_index++] = *bufp++;
bufn -= mblen - 1;
}
continue;
}
istring[istring_index++] = c;
}
if (istring)
istring[istring_index] = '\0';
if (istring_index == 0)
{
do { if (istring) sh_xfree((istring), "subst.c", 6872); } while (0);
if (rflag)
*rflag = tflag;
return (char *)
((void *)0)
;
}
if (quoted & (0x002|0x001))
{
while (istring_index > 0)
{
if (istring[istring_index - 1] == '\n')
{
--istring_index;
if (istring[istring_index - 1] == '\001')
--istring_index;
}
else
break;
}
istring[istring_index] = '\0';
}
else
strip_trailing (istring, istring_index - 1, 1);
if (rflag)
*rflag = tflag;
return istring;
}
| int read_comsub(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned int *a3, unsigned long long a4, unsigned long long a5) {
char v0;
int tmp_11;
int tmp_10;
int tmp_12;
int tmp_18;
int tmp_26;
char v1;
char v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
void* v10;
char *v11;
void* v12;
void* v13;
void* v14;
unsigned long v15;
char v16;
char v17;
char v18;
unsigned int v20;
unsigned int v21;
v18 = *(&v18);
v10 = 0;
v5 = 0;
v14 = 0;
v13 = v14;
v12 = v13;
v6 = 2332037119;
v7 = 45618155;
v8 = __ctype_get_mb_cur_max(a0, a1, a2, a3, a4, a5, *(&v0), a3, *(&v1));
v3 = 0;
while (true) {
if (a0 < 0)
break;
v14 -= 1;
if (v14 <= 0) {
v14 = zread(a0, &v17, 0x1000, &v17);
if (v14 <= 0)
break;
v11 = &v17;
}
tmp_11 = v11;
v11 += 1;
v20 = *(tmp_11);
v9 = v20;
if (!v9) {
if (!v3) {
internal_warning("%s", gettext("command substitution: ignored null byte in input"));
v3 = 1;
}
goto LABEL_40fcc9;
}
if (v13 <= v12 + v8 + 1) {
for (; v13 <= v12 + v8 + 1; v13 += 0x200);
v10 = sh_xrealloc(v10, v13, "subst.c", 0x1aaa);
}
if ((a1 & 3)) {
tmp_10 = v12;
v12 += 1;
*(tmp_10 + v10) = 1;
goto LABEL_40fb27;
}
if ((a2 & 8) && v6 && v9 == 1) {
tmp_10 = v12;
v12 += 1;
*(tmp_10 + v10) = 1;
goto LABEL_40fb27;
}
if (!v6 && v9 == 1) {
tmp_10 = v12;
v12 += 1;
*(tmp_10 + v10) = 1;
goto LABEL_40fb27;
}
if (!v7 && v9 == 127)
goto LABEL_40fb08;
if (!(v9 == 32))
goto LABEL_40fb27;
if (!425802354520363004)
goto LABEL_40fb27;
if (!(!*(425802354520363004)))
goto LABEL_40fb27;
LABEL_40fb08:
tmp_10 = v12;
v12 += 1;
*(tmp_10 + v10) = 1;
LABEL_40fb27:
if (locale_utf8locale && !(!(v9 & 128)))
goto LABEL_40fb69;
if (locale_utf8locale) {
LABEL_40fc9f:
tmp_11 = v12;
v12 += 1;
*(tmp_11 + v10) = v9;
} else {
if (v8 <= 1)
goto LABEL_40fc9f;
if (!(v9 < 0))
goto LABEL_40fc9f;
LABEL_40fb69:
memset(&v16, 0x0, 0x8);
v15 = mbrtowc(&v2, v11 + 1, v14, &v16);
if (v15 == -1) {
LABEL_40fbd9:
tmp_11 = v12;
v12 += 1;
*(tmp_11 + v10) = v9;
goto LABEL_40fcc9;
} else {
if (v15 == -2)
goto LABEL_40fbd9;
if (!v15)
goto LABEL_40fbd9;
if (v15 == 1)
goto LABEL_40fbd9;
tmp_12 = v12;
v12 += 1;
*(tmp_12 + v10) = v9;
for (v4 = 0; v4 < v15 - 1; v4 += 1) {
tmp_18 = v11;
v11 += 1;
tmp_26 = v12;
v12 += 1;
*(&v20) = *(tmp_18);
*(tmp_26 + v10) = v20;
}
v14 = v14 - v15 + 1;
LABEL_40fcc9:
}
}
}
if (v10)
*((v12 + v10)) = 0;
if (v12) {
if (!(a1 & 3)) {
strip_trailing(v10, v12 - 1, 0x1, v12 - 1);
} else {
while (true) {
if (!v12)
break;
if (*((v10 + v12 - 1)) != 10)
break;
v12 -= 1;
if (!(*((v10 + v12 - 1)) == 1))
continue;
v12 -= 1;
}
*((v12 + v10)) = 0;
}
if (a3)
*(a3) = v5;
v21 = v10;
} else {
if (v10)
sh_xfree(v10, "subst.c", 0x1ad8);
if (a3)
*(a3) = v5;
v21 = 0;
}
return v21;
}
|
void
vwarnc(int code, const char *format, va_list ap)
{
fprintf(
stderr
, "%s: ", getprogname());
if (format) {
vfprintf(
stderr
, format, ap);
fprintf(
stderr
, ": ");
}
fprintf(
stderr
, "%s\n", strerror(code));
}
| int vwarnc(int a1, const char *a2, void *a3)
{
const char *v3;
char *v4;
v3 = (const char *)getprogname();
fprintf(stderr, "%s: ", v3);
if ( a2 )
{
vfprintf(stderr, a2, a3);
fprintf(stderr, ": ");
}
v4 = strerror(a1);
return fprintf(stderr, "%s\n", v4);
}
|
static void license()
{
char const *const *p = license_msg;
printf ("%s %s\n", program_name, Version);
while (*p) printf ("%s\n", *p++);
}
| char *license()
{
const char **v0;
char *result;
char **v2;
v2 = license_msg;
printf("%s %s\n", program_name, Version);
while ( 1 )
{
result = *v2;
if ( !*v2 )
break;
v0 = (const char **)v2++;
printf("%s\n", *v0);
}
return result;
}
|
_Bool
pred_openparen (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) pathname;
(void) stat_buf;
(void) pred_ptr;
return
1
;
}
| long long pred_openparen(unsigned long a0, unsigned long a1, unsigned long a2) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
v2 = a0;
v1 = a1;
v0 = a2;
return 1;
}
|
static crypto_uint32 times38(crypto_uint32 a)
{
return (a << 5) + (a << 2) + (a << 1);
}
| int times38(unsigned long a0) {
return a0 * 2 + (a0 * 36);
}
|
static inline void
emit_mandatory_arg_note (void)
{
fputs_unlocked (gettext ("\nMandatory arguments to long options are mandatory for short options too.\n"),
stdout
)
;
}
| int emit_mandatory_arg_note()
{
FILE *v0;
char *v1;
v0 = stdout;
v1 = gettext("\nMandatory arguments to long options are mandatory for short options too.\n");
return fputs_unlocked(v1, v0);
}
|
void jbd2_journal_destroy_revoke(journal_t *journal)
{
journal->j_revoke =
((void *)0)
;
if (journal->j_revoke_table[0])
jbd2_journal_destroy_revoke_table(journal->j_revoke_table[0]);
if (journal->j_revoke_table[1])
jbd2_journal_destroy_revoke_table(journal->j_revoke_table[1]);
}
| void jbd2_journal_destroy_revoke(long a1)
{
*(_QWORD *)(a1 + 168) = 0LL;
if ( *(_QWORD *)(a1 + 176) )
jbd2_journal_destroy_revoke_table(*(void **)(a1 + 176));
if ( *(_QWORD *)(a1 + 184) )
jbd2_journal_destroy_revoke_table(*(void **)(a1 + 184));
}
|
static void print_headers(FILE *fp, char *label, struct rtnl_ctrl_data *ctrl)
{
if (timestamp)
print_timestamp(fp);
if (listen_all_nsid) {
if (ctrl ==
((void *)0)
|| ctrl->nsid < 0)
fprintf(fp, "[nsid current]");
else
fprintf(fp, "[nsid %d]", ctrl->nsid);
}
if (prefix_banner)
fprintf(fp, "%s", label);
}
| void print_headers(void* a0, unsigned long a1, unsigned int *a2) {
unsigned long long v1;
unsigned long long v2;
if (timestamp)
print_timestamp(a0);
if (a2 && *(a2) >= 0)
fprintf(a0, "[nsid %d]", *(a2));
if (!a2 || *(a2) < 0)
fprintf(a0, "[nsid current]");
v1 = prefix_banner;
if (prefix_banner)
v2 = fprintf(a0, "%s", a1);
return;
}
|
static void
send_data_or_handle(char type, u_int32_t id, const u_char *data, int dlen)
{
struct sshbuf *msg;
int r;
if ((msg = sshbuf_new()) ==
((void *)0)
)
sshfatal("sftp-server.c", __func__, 587, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
if ((r = sshbuf_put_u8(msg, type)) != 0 ||
(r = sshbuf_put_u32(msg, id)) != 0 ||
(r = sshbuf_put_string(msg, data, dlen)) != 0)
sshfatal("sftp-server.c", __func__, 591, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose");
send_msg(msg);
sshbuf_free(msg);
}
| void send_data_or_handle(unsigned long a0, unsigned long a1, unsigned long long a2, unsigned long a3) {
unsigned long long v0;
unsigned int v1;
unsigned long long v2;
unsigned long long v4;
v2 = sshbuf_new();
if (!v2) {
v0 = "sshbuf_new failed";
sshfatal("sftp-server.c", "send_data_or_handle", 0x24b, 0x1, 0x1, 0x0);
}
v1 = sshbuf_put_u8(v2, a0);
if (v1) {
LABEL_4012ad:
v2 = "compose";
sshfatal("sftp-server.c", "send_data_or_handle", 0x24f, 0x1, 0x1, ssh_err(v1));
} else {
v1 = sshbuf_put_u32(v2, a1, a1);
if (v1 || (v1 = sshbuf_put_string(v2, a2, a3, a2), v1))
goto LABEL_4012ad;
}
send_msg(v2);
v4 = sshbuf_free(v2);
return;
}
|
static HostkeyMarker
check_markers(char **cpp)
{
char marker[32], *sp, *cp = *cpp;
int ret = MRK_NONE;
while (*cp == '@') {
if (ret != MRK_NONE)
return MRK_ERROR;
if ((sp = strchr(cp, ' ')) ==
((void *)0)
&&
(sp = strchr(cp, '\t')) ==
((void *)0)
)
return MRK_ERROR;
if (sp <= cp + 1 || sp >= cp + sizeof(marker))
return MRK_ERROR;
memcpy(marker, cp, sp - cp);
marker[sp - cp] = '\0';
if (strcmp(marker, "@cert-authority") == 0)
ret = MRK_CA;
else if (strcmp(marker, "@revoked") == 0)
ret = MRK_REVOKE;
else
return MRK_ERROR;
cp = sp;
for (; *cp == ' ' || *cp == '\t'; cp++)
;
}
*cpp = cp;
return ret;
}
| int check_markers(unsigned long long *a0) {
unsigned int v0;
void* v1;
char *v2;
char v3;
unsigned int v5;
v2 = *(a0);
v0 = 1;
while (true) {
if (*(v2) != 64) {
*(a0) = v2;
v5 = v0;
break;
}
if (v0 != 1) {
v5 = 0;
break;
}
v1 = strchr(v2, 0x20);
if (!v1) {
v1 = strchr(v2, 0x9);
if (!v1) {
v5 = 0;
break;
}
}
if (v1 <= v2 + 1) {
LABEL_400687:
v5 = 0;
break;
} else {
if (!(v1 < v2 + 32))
goto LABEL_400687;
memcpy(&v3, v2, __subvdi3(v1, v2));
(&v3)[__subvdi3(v1, v2)] = 0;
if (!strcmp(&v3, "@cert-authority")) {
v0 = 3;
} else if (!strcmp(&v3, "@revoked")) {
v0 = 2;
} else {
v5 = 0;
break;
}
v2 = v1;
while (true) {
if (*(v2) != 32 && *(v2) != 9)
break;
v2 += 1;
}
}
}
return v5;
}
|
struct fd_bitmap *
new_fd_bitmap (size)
int size;
{
struct fd_bitmap *ret;
ret = (struct fd_bitmap *)sh_xmalloc((sizeof (struct fd_bitmap)), "execute_cmd.c", 327);
ret->size = size;
if (size)
{
ret->bitmap = (char *)sh_xmalloc((size), "execute_cmd.c", 333);
memset (ret->bitmap, '\0', size);
}
else
ret->bitmap = (char *)
((void *)0)
;
return (ret);
}
| int * new_fd_bitmap(int param_1)
{
int *piVar1;
undefined8 uVar2;
piVar1 = (int *)sh_xmalloc(0x10,"execute_cmd.c",0x147);
*piVar1 = param_1;
if (param_1 == 0) {
*(undefined8 *)(piVar1 + 2) = 0;
}
else {
uVar2 = sh_xmalloc((long)param_1,"execute_cmd.c",0x14d);
*(undefined8 *)(piVar1 + 2) = uVar2;
memset(*(void **)(piVar1 + 2),0,(long)param_1);
}
return piVar1;
}
|
static void handler(int arg __attribute__((unused)))
{
siglongjmp(jbuf, 1);
}
| long long handler(unsigned long a0) {
unsigned int v0;
v0 = a0;
siglongjmp(&jbuf, 0x1);
}
|
void crypto_sign_ed25519_ref_fe25519_pack(unsigned char r[32], const crypto_sign_ed25519_ref_fe25519 *x)
{
int i;
crypto_sign_ed25519_ref_fe25519 y = *x;
crypto_sign_ed25519_ref_fe25519_freeze(&y);
for(i=0;i<32;i++)
r[i] = y.v[i];
}
| long long crypto_sign_ed25519_ref_fe25519_pack(char *a0, unsigned long long a1[16]) {
unsigned int 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 long v12;
unsigned long v13;
unsigned long v14;
unsigned long v15;
unsigned long v16;
v1 = a1[0];
v2 = a1[1];
v3 = a1[2];
v4 = a1[3];
v5 = a1[4];
v6 = a1[5];
v7 = a1[6];
v8 = a1[7];
v9 = a1[8];
v10 = a1[9];
v11 = a1[10];
v12 = a1[11];
v13 = a1[12];
v14 = a1[13];
v15 = a1[14];
v16 = a1[15];
crypto_sign_ed25519_ref_fe25519_freeze(&v1);
for (v0 = 0; v0 <= 31; v0 = __addvsi3(v0, 0x1, *((&v1 + 4 * v0)))) {
a0[v0] = *((&v1 + 4 * v0));
}
return 0;
}
|
int hddown(void)
{
unsigned int flags;
char *disk;
DIR *blk;
if ((blk = opendir("/sys/block")) == (DIR*)0)
return -1;
while ((disk = list_disks(blk, &flags)))
do_standby_disk(disk, flags);
return closedir(blk);
}
| int hddown(void)
{
int iVar1;
long in_FS_OFFSET;
undefined4 local_24;
DIR *local_20;
long local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_20 = opendir("/sys/block");
if (local_20 == (DIR *)0x0) {
iVar1 = -1;
}
else {
while( true ) {
local_18 = list_disks(local_20,&local_24);
if (local_18 == 0) break;
do_standby_disk(local_18,local_24);
}
iVar1 = closedir(local_20);
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return iVar1;
}
|
static int quota_inum_is_reserved(ext2_filsys fs, ext2_ino_t ino)
{
enum quota_type qtype;
for (qtype = 0; qtype < MAXQUOTAS; qtype++)
if (quota_type2inum(qtype, fs->super) == ino)
return 1;
return 0;
}
| int quota_inum_is_reserved(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned int v2;
v0 = 0;
while (true) {
if (v0 > 2) {
v2 = 0;
return v2;
} else if (a1 != quota_type2inum(v0, a0->field_20, a0->field_20)) {
v0 += 1;
} else {
v2 = 1;
return v2;
}
}
}
|
int
bitmap_from_string(struct bitmap *b, const void *p, size_t l)
{
int r;
size_t i, offset, shift;
const u_char *s = (const u_char *)p;
if (l > (1<<24) / 8)
return -1;
if ((r = reserve(b, l * 8)) != 0)
return r;
bitmap_zero(b);
if (l == 0)
return 0;
b->top = offset = ((l + ((sizeof(u_int)) - 1)) / (sizeof(u_int))) - 1;
shift = ((l + ((sizeof(u_int)) - 1)) % (sizeof(u_int))) * 8;
for (i = 0; i < l; i++) {
b->d[offset] |= (u_int)s[i] << shift;
if (shift == 0) {
offset--;
shift = (sizeof(u_int) * 8) - 8;
} else
shift -= 8;
}
retop(b);
return 0;
}
| long long bitmap_from_string(unsigned long long a0[3], void* a1, unsigned int a2) {
unsigned int v0;
void* v1;
unsigned int *v2;
unsigned long v3;
unsigned long long v5;
if (a2 > 0x200000) {
v5 = 4294967295;
return v5;
}
v0 = reserve(a0, a2 * 8);
if (v0) {
v5 = v0;
return v5;
}
bitmap_zero(a0);
if (!a2) {
v5 = 0;
return v5;
}
v2 = (a2 + 3 >> 2) - 1;
a0[2] = v2;
v3 = (a2 + 3 & 3) * 8;
for (v1 = 0; v1 < a2; v1 += 1) {
*((a0[0] + v2 * 4)) = *((a0[0] + v2 * 4)) | (*((v1 + a1)) << (v3 & 31));
if (!v3) {
v2 = v2 + 1;
v3 = 24;
} else {
v3 -= 8;
}
}
retop(a0);
v5 = 0;
return v5;
}
|
static WORD_LIST *
assoc_to_word_list_internal (h, t)
HASH_TABLE *h;
int t;
{
WORD_LIST *list;
int i;
BUCKET_CONTENTS *tlist;
char *w;
if (h == 0 || ((h)->nentries == 0))
return((WORD_LIST *)
((void *)0)
);
list = (WORD_LIST *)
((void *)0)
;
for (i = 0; i < h->nbuckets; i++)
for (tlist = ((h && (i < h->nbuckets)) ? h->bucket_array[i] : (BUCKET_CONTENTS *)
((void *)0)
); tlist; tlist = tlist->next)
{
w = (t == 0) ? (char *)tlist->data : (char *)tlist->key;
list = make_word_list (make_bare_word(w), list);
}
return (((list && list->next) ? (WORD_LIST *)list_reverse ((GENERIC_LIST *)list) : (WORD_LIST *)(list)));
}
| void assoc_to_word_list_internal(struct_0 *a0, unsigned long a1) {
unsigned int v0;
void* v1;
void* v2;
unsigned long long v3;
void* v5;
void* v6;
unsigned long long v7;
unsigned long long v8;
void* v10;
unsigned long long v11;
if (!a0) {
LABEL_4014de:
v5 = 0;
} else {
if (!a0->field_c)
goto LABEL_4014de;
v1 = 0;
v0 = 0;
while (true) {
if (v0 >= a0->field_8)
break;
if (a0 && v0 < a0->field_8) {
v6 = *((a0->field_0 + v0 * 8));
goto LABEL_40152d;
}
v6 = 0;
LABEL_40152d:
for (v2 = v6; v2; v2 = *(v2)) {
if (!a1)
v7 = v2[16];
else
v7 = v2[8];
v3 = v7;
v8 = make_bare_word(v3);
*(&v1) = make_word_list(v8, v1, v8);
}
v0 += 1;
}
if (v1 && *(v1)) {
v11 = list_reverse(v1);
goto LABEL_4015c1;
}
v10 = v1;
}
LABEL_4015c1:
return;
}
|
static lin
guess_lines (lin n, size_t s, size_t t)
{
size_t guessed_bytes_per_line = n < 10 ? 32 : s / (n - 1);
lin guessed_lines = ((1) >= (t / guessed_bytes_per_line) ? (1) : (t / guessed_bytes_per_line));
return ((guessed_lines) <= (
(9223372036854775807L)
/ (2 * sizeof (char *) + 1) - 5) ? (guessed_lines) : (
(9223372036854775807L)
/ (2 * sizeof (char *) + 1) - 5)) + 5;
}
| unsigned long guess_lines(long a1, unsigned long a2, unsigned long a3)
{
unsigned long v3;
unsigned long v4;
if ( a1 <= 9 )
v3 = 32LL;
else
v3 = a2 / (a1 - 1);
v4 = a3 / v3;
if ( !v4 )
v4 = 1LL;
if ( v4 > 0x787878787878782LL )
v4 = 0x787878787878782LL;
return v4 + 5;
}
|
static void
sshbuf_maybe_pack(struct sshbuf *buf, int force)
{
;
;
if (buf->off == 0 || buf->readonly || buf->refcount > 1)
return;
if (force ||
(buf->off >= 8192 && buf->off >= buf->size / 2)) {
memmove(buf->d, buf->d + buf->off, buf->size - buf->off);
buf->size -= buf->off;
buf->off = 0;
;
}
}
| void sshbuf_maybe_pack(struct_0 *a0, unsigned long a1) {
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
struct_0 *v6;
v1 = a0->field_10;
if (a0->field_10) {
v2 = a0->field_30;
if (!a0->field_30) {
v3 = a0->field_38;
if (a0->field_38 <= 1) {
if (!a1) {
v4 = a0->field_10;
v5 = a0->field_18 >> 1;
}
memmove(a0->field_0, a0->field_0 + a0->field_10, a0->field_18 - a0->field_10);
a0->field_18 = a0->field_18 - a0->field_10;
v6 = a0;
a0->field_10 = 0;
}
}
}
return;
}
|
inline gl_list_t
gl_list_create_empty (gl_list_implementation_t implementation,
gl_listelement_equals_fn equals_fn,
gl_listelement_hashcode_fn hashcode_fn,
gl_listelement_dispose_fn dispose_fn,
_Bool
allow_duplicates)
{
gl_list_t result =
gl_list_nx_create_empty (implementation, equals_fn, hashcode_fn, dispose_fn,
allow_duplicates);
if (result ==
((void *)0)
)
xalloc_die ();
return result;
}
| void gl_list_create_empty(void)
{
halt_baddata();
}
|
static int print_af_stats(struct nlmsghdr *n, void *arg)
{
struct if_stats_msg *ifsm = ((void *)(((char *)n) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))));
struct rtattr *tb[(__IFLA_STATS_MAX - 1)+1];
int len = n->nlmsg_len;
struct af_stats_ctx *ctx = arg;
FILE *fp = ctx->fp;
len -= ((sizeof(*ifsm)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) )));
if (len < 0) {
fprintf(
stderr
, "BUG: wrong nlmsg len %d\n", len);
return -1;
}
if (ctx->ifindex && ifsm->ifindex != ctx->ifindex)
return 0;
parse_rtattr(tb, (__IFLA_STATS_MAX - 1), ((struct rtattr *)(((char *)(ifsm)) + ( ((sizeof(struct if_stats_msg))+4U -1) & ~(4U -1) ))), len);
if (tb[IFLA_STATS_AF_SPEC])
print_af_stats_attr(fp, ifsm->ifindex, tb[IFLA_STATS_AF_SPEC]);
fflush(fp);
return 0;
}
| long long print_af_stats(unsigned int *a0, struct_0 *a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
struct_1 *v1;
void* v2;
char v3;
char v4;
unsigned long long v6;
v1 = &a0[4];
v0 = *(a0);
v2 = a1->field_0;
v0 -= 28;
if (v0 < 0) {
fprintf(stderr, "BUG: wrong nlmsg len %d\n", v0);
v6 = 4294967295;
} else {
if (a1->field_8 && v1->field_4 != a1->field_8)
v6 = 0;
if (v1->field_4 == a1->field_8 || !a1->field_8) {
parse_rtattr(&v3, 0x5, &v1[1].field_4, v0);
if (*(&v4))
print_af_stats_attr(v2, v1->field_4, *(&v4), v1->field_4, a4, a5);
fflush(v2);
v6 = 0;
}
}
return v6;
}
|
int
_rl_arg_callback (_rl_arg_cxt cxt)
{
int c, r;
c = _rl_arg_getchar ();
if (c < 0)
return (1);
if (_rl_argcxt & 0x04)
{
_rl_argcxt &= ~0x04;
rl_restore_prompt ();
rl_clear_message ();
(rl_readline_state &= ~(0x0000400));
rl_execute_next (c);
return 0;
}
r = _rl_arg_dispatch (cxt, c);
if (r > 0)
rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
return (r != 1);
}
| long long _rl_arg_callback(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;
int tmp_10;
unsigned int v1;
unsigned long long v3;
unsigned long long v4;
v0 = _rl_arg_getchar(a0, a1, a2, a3, a4, a5);
if (v0 < 0) {
v3 = 1;
return v3;
} else if (false) {
v1 = _rl_arg_dispatch(a0, v0, v0, a3, a4, a5);
if (v1 > 0)
rl_message("(arg: %d) ", rl_arg_sign * rl_numeric_arg, rl_arg_sign);
v3 = v1 != 1;
return v3;
} else {
_rl_argcxt = 3850979409;
rl_restore_prompt(a0, a1, a2, a3, a4, a5);
rl_clear_message(a0, a1, a2, a3, a4, a5);
v4 = rl_readline_state;
*(&v4) = (rl_readline_state >> 8) & 251;
tmp_10 = v4;
rl_readline_state = tmp_10;
rl_execute_next(v0);
v3 = 0;
return v3;
}
}
|
static
void saveInputFileMetaInfo ( Char *srcName )
{
IntNative retVal;
retVal = stat( srcName, &fileMetaInfo );
{ if ((retVal) != 0) ioError(); };
}
| void saveInputFileMetaInfo(char *a0) {
unsigned int v0;
v0 = stat(a0, &fileMetaInfo);
if (v0)
ioError();
return;
}
|
static int do_read(int fd)
{
int c;
char buffer[4096], *cp, *sep;
c = read(fd, buffer, sizeof(buffer)-1);
if (c <= 0)
return c;
if (do_skip) {
send_output(buffer, c, 0x02);
buffer[c] = 0;
cp = buffer;
while (*cp) {
if (skip_mode) {
cp = strchr(cp, '\002');
if (!cp)
return 0;
cp++;
skip_mode = 0;
continue;
}
sep = strchr(cp, '\001');
if (sep)
*sep = 0;
send_output(cp, 0, 0x01);
if (sep) {
cp = sep + 1;
skip_mode = 1;
} else
break;
}
} else
send_output(buffer, c, 0x03);
return c;
}
| ulong do_read(int param_1)
{
ulong uVar1;
char *pcVar2;
long in_FS_OFFSET;
char *local_1028;
char local_1018 [4104];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
uVar1 = read(param_1,local_1018,0xfff);
if ((int)uVar1 < 1) {
uVar1 = uVar1 & 0xffffffff;
}
else {
if (do_skip == 0) {
send_output(local_1018,uVar1 & 0xffffffff,3);
}
else {
send_output(local_1018,uVar1 & 0xffffffff,2);
local_1018[(int)uVar1] = '\0';
local_1028 = local_1018;
while (*local_1028 != '\0') {
if (skip_mode == 0) {
pcVar2 = strchr(local_1028,1);
if (pcVar2 != (char *)0x0) {
*pcVar2 = '\0';
}
send_output(local_1028,0,1);
if (pcVar2 == (char *)0x0) break;
local_1028 = pcVar2 + 1;
skip_mode = 1;
}
else {
local_1028 = strchr(local_1028,2);
if (local_1028 == (char *)0x0) {
uVar1 = 0;
goto LAB_001003df;
}
local_1028 = local_1028 + 1;
skip_mode = 0;
}
}
}
uVar1 = uVar1 & 0xffffffff;
}
LAB_001003df:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar1;
}
__stack_chk_fail();
}
|
inline void do_cache_destroy(kmem_cache_t *cache)
{
free(cache);
}
| void do_cache_destroy(void)
{
halt_baddata();
}
|
static void
print_context_number_range (struct file_data const *file, lin a, lin b)
{
printint trans_a, trans_b;
translate_range (file, a, b, &trans_a, &trans_b);
if (trans_b <= trans_a)
fprintf (outfile, "%""l""d", trans_b);
else
fprintf (outfile, "%""l""d,%""l""d", trans_a, trans_b);
}
| void print_context_number_range(undefined8 param_1,undefined8 param_2,undefined8 param_3)
{
long in_FS_OFFSET;
long local_20;
long local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
translate_range(param_1,param_2,param_3,&local_20,&local_18);
if (local_20 < local_18) {
fprintf(outfile,"%ld,%ld",local_20,local_18);
}
else {
fprintf(outfile,"%ld",local_18);
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
static inline char *_STPUTC(int c, char *p) {
if (p == sstrend)
p = growstackstr();
*p++ = c;
return p;
}
| undefined * _STPUTC(undefined param_1,undefined *param_2)
{
undefined *local_18;
local_18 = param_2;
if (param_2 == sstrend) {
local_18 = (undefined *)growstackstr();
}
*local_18 = param_1;
return local_18 + 1;
}
|
static off_t
cache_round (int fd, off_t len)
{
static off_t i_pending, o_pending;
off_t *pending = (fd ==
0
? &i_pending : &o_pending);
if (len)
{
intmax_t c_pending;
if (__builtin_add_overflow (*pending, len, &c_pending))
c_pending =
(9223372036854775807L)
;
*pending = c_pending % IO_BUFSIZE;
if (c_pending > *pending)
len = c_pending - *pending;
else
len = 0;
}
else
len = *pending;
return len;
}
| long cache_round(int a1, long a2)
{
long *v2;
long v5;
if ( a1 )
v2 = (long *)&o_pending_6057;
else
v2 = (long *)&i_pending_6056;
if ( !a2 )
return *v2;
v5 = *v2 + a2;
if ( __OFADD__(*v2, a2) )
v5 = 0x7FFFFFFFFFFFFFFFLL;
*v2 = v5 % 0x20000;
if ( *v2 >= v5 )
return 0LL;
else
return v5 - *v2;
}
|
void cfg_init(void)
{
memset(&cfg, 0, sizeof(cfg));
cfg.path_len = -1;
cfg.skip_certs = -1;
}
| long long cfg_init() {
memset(got.cfg, 0x0, 0x2a8);
*((got.cfg + 544)) = -1;
*((got.cfg + 536)) = -1;
return got.cfg;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.