input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
static int
eprintlist(struct output *out, struct strlist *sp, int sep)
{
while (sp) {
const char *p;
p = " %s";
p += (1 - sep);
sep |= 1;
outfmt(out, p, sp->text);
sp = sp->next;
}
return sep;
}
| int eprintlist(unsigned long long a0, unsigned long a1, unsigned long a2) {
unsigned int v0;
unsigned long long v1[2];
unsigned long long v2;
v1[0] = a1;
for (v0 = a2; v1; v1[0] = v1[0]) {
v2 = " %s";
v2 += 1 - v0;
v0 |= 1;
outfmt(a0, v2, v1[1], v2);
}
return v0;
}
|
STRINGLIST *
completions_to_stringlist (matches)
char **matches;
{
STRINGLIST *sl;
int mlen, i, n;
mlen = (matches == 0) ? 0 : strvec_len (matches);
sl = strlist_create (mlen + 1);
if (matches == 0 || matches[0] == 0)
return sl;
if (matches[1] == 0)
{
sl->list[0] = ((matches[0]) ? (char *)strcpy (sh_xmalloc((1 + strlen (matches[0])), "pcomplete.c", 349), (matches[0])) : (char *)
((void *)0)
);
sl->list[sl->list_len = 1] = (char *)
((void *)0)
;
return sl;
}
for (i = 1, n = 0; i < mlen; i++, n++)
sl->list[n] = ((matches[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (matches[i])), "pcomplete.c", 355), (matches[i])) : (char *)
((void *)0)
);
sl->list_len = n;
sl->list[n] = (char *)
((void *)0)
;
return sl;
}
| int completions_to_stringlist(unsigned long long a0[2]) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
struct_0 *v3;
unsigned long v5;
if (!a0)
v5 = 0;
else
v5 = strvec_len(a0);
v2 = v5;
v3 = strlist_create(v2 + 1);
if (!a0) {
LABEL_4003dd:
*(&v5) = v3;
} else {
if (!a0[0])
goto LABEL_4003dd;
if (!a0[1]) {
if (!a0[0])
v5 = 0;
else
v5 = strcpy(sh_xmalloc(strlen(a0[0]) + 1, "pcomplete.c", 0x15d), a0[0]);
v3->field_0->field_0 = v5;
v3->field_c = 1;
v3->field_0->field_8 = 0;
*(&v5) = v3;
} else {
v0 = 1;
for (v1 = 0; v0 < v2; v1 += 1) {
if (!a0[v0])
v5 = 0;
else
v5 = strcpy(sh_xmalloc(strlen(a0[v0]) + 1, "pcomplete.c", 0x163), a0[v0]);
(&v3->field_0->field_0)[v1] = v5;
v0 += 1;
}
v3->field_c = v1;
(&v3->field_0->field_0)[v1] = 0;
*(&v5) = v3;
}
}
return v5;
}
|
static int cfg_files_filter_out(DIR *d, const char *dir, const char *name)
{
size_t len = strlen(name);
struct stat st;
if (name[0] == '.')
return 1;
if (len < 6 || !(strcmp((name + len - 5), (".conf")) == 0)) {
log_printf(
6
, "All cfg files need .conf: %s/%s\n", dir, name);
return 1;
}
fstatat(dirfd(d), name, &st, 0);
if (
((((
st.st_mode
)) & 0170000) == (0040000))
) {
log_printf(
3
, "Directories inside directories are not supported: %s/%s\n", dir, name)
;
return 1;
}
return 0;
}
| int cfg_files_filter_out(unsigned long long a0, unsigned long long a1, char *a2, unsigned long a3, unsigned long long a4) {
unsigned long v0;
char v1;
char v2;
unsigned int v4;
v0 = strlen(a2);
if (*(a2) == 46) {
v4 = 1;
return v4;
}
if (v0 > 5 && !strcmp(&a2[5 + v0], ".conf")) {
fstatat(dirfd(a0), a2, &v1, 0x0);
if ((*(&v2) & 0xf000) != 0x4000) {
v4 = 0;
return v4;
}
log_printf(0x3, "Directories inside directories are not supported: %s/%s\n", a1, a2, a4);
v4 = 1;
return v4;
}
log_printf(0x6, "All cfg files need .conf: %s/%s\n", a1, a2, a4);
v4 = 1;
return v4;
}
|
static char *
expand_string(int nr)
{
STRDEF *h = strdef;
if (!nr)
return
((void *)0)
;
while (h)
if (h->nr == nr) {
curpos += h->slen;
return h->st;
} else
h = h->next;
return
((void *)0)
;
}
| long expand_string(int a1)
{
long v2;
v2 = strdef;
if ( !a1 )
return 0LL;
while ( v2 )
{
if ( a1 == *(_DWORD *)v2 )
{
curpos += *(_DWORD *)(v2 + 4);
return *(_QWORD *)(v2 + 8);
}
v2 = *(_QWORD *)(v2 + 16);
}
return 0LL;
}
|
int
sh_closepipe (pv)
int *pv;
{
if (pv[0] >= 0)
close (pv[0]);
if (pv[1] >= 0)
close (pv[1]);
pv[0] = pv[1] = -1;
return 0;
}
| long sh_closepipe(int *a1)
{
if ( *a1 >= 0 )
close(*a1);
if ( a1[1] >= 0 )
close(a1[1]);
a1[1] = -1;
*a1 = a1[1];
return 0LL;
}
|
static void
tok_finish(Tokenizer *tok)
{
*tok->wptr = '\0';
if ((tok->flags & 1) || tok->wptr != tok->wstart) {
tok->argv[tok->argc++] = tok->wstart;
tok->argv[tok->argc] =
((void *)0)
;
tok->wstart = ++tok->wptr;
}
tok->flags &= ~1;
}
| long tok_finish(long a1)
{
long v1;
long v2;
long result;
**(_BYTE **)(a1 + 32) = 0;
if ( (*(_DWORD *)(a1 + 68) & 1) != 0 || *(_QWORD *)(a1 + 32) != *(_QWORD *)(a1 + 48) )
{
v1 = *(_QWORD *)(a1 + 24);
v2 = *(_QWORD *)(a1 + 8);
*(_QWORD *)(a1 + 8) = v2 + 1;
*(_QWORD *)(v1 + 8 * v2) = *(_QWORD *)(a1 + 48);
*(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * *(_QWORD *)(a1 + 8)) = 0LL;
*(_QWORD *)(a1 + 48) = ++*(_QWORD *)(a1 + 32);
}
result = a1;
*(_DWORD *)(a1 + 68) &= ~1u;
return result;
}
|
tty_rawmode(EditLine *el)
{
if (el->el_tty.t_mode == 1 || el->el_tty.t_mode == 2)
return 0;
if (el->el_flags & 0x004)
return 0;
if (tty_getty(el, &el->el_tty.t_ts) == -1) {
return -1;
}
el->el_tty.t_eight = (((&el->el_tty.t_ts)->c_cflag &
0000060
) ==
0000060
);
el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ts);
if (tty__getspeed(&el->el_tty.t_ex) != el->el_tty.t_speed ||
tty__getspeed(&el->el_tty.t_ed) != el->el_tty.t_speed) {
(void) cfsetispeed(&el->el_tty.t_ex, el->el_tty.t_speed);
(void) cfsetospeed(&el->el_tty.t_ex, el->el_tty.t_speed);
(void) cfsetispeed(&el->el_tty.t_ed, el->el_tty.t_speed);
(void) cfsetospeed(&el->el_tty.t_ed, el->el_tty.t_speed);
}
if (((&el->el_tty.t_ts)->c_lflag &
0000002
)) {
int i;
for (i = 0; i <= 3; i++)
tty_update_flags(el, i);
if (((((&el->el_tty.t_ex)->c_oflag &
0014000
) ==
0014000
) ? 0 : 1) == 0)
el->el_tty.t_tabs = 0;
else
el->el_tty.t_tabs = ((el)->el_terminal.t_flags & 0x008) ? 1 : 0;
tty__getchar(&el->el_tty.t_ts, el->el_tty.t_c[2]);
for (i = 0; i < 25; i++)
if (el->el_tty.t_c[2][i] !=
el->el_tty.t_c[0][i])
break;
if (i != 25) {
for (i = 0; i < 25; i++)
tty_update_char(el, 1, i);
tty_bind_char(el, 0);
tty__setchar(&el->el_tty.t_ed, el->el_tty.t_c[1]);
for (i = 0; i < 25; i++)
tty_update_char(el, 0, i);
tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[0]);
}
}
if (tty_setty(el,
1
, &el->el_tty.t_ed) == -1) {
return -1;
}
el->el_tty.t_mode = 1;
return 0;
}
| long tty_rawmode(long a1)
{
int i;
int j;
int k;
int m;
if ( *(_BYTE *)(a1 + 776) == 1 || *(_BYTE *)(a1 + 776) == 2 )
return 0LL;
if ( (*(_DWORD *)(a1 + 44) & 4) != 0 )
return 0LL;
if ( (unsigned int)tty_getty(a1, (struct termios *)(a1 + 704)) == -1 )
return 0xFFFFFFFFLL;
*(_DWORD *)(a1 + 768) = (*(_DWORD *)(a1 + 712) & 0x30) == 48;
*(_DWORD *)(a1 + 772) = tty__getspeed((const struct termios *)(a1 + 704));
if ( (unsigned int)tty__getspeed((const struct termios *)(a1 + 584)) != *(_DWORD *)(a1 + 772)
|| (unsigned int)tty__getspeed((const struct termios *)(a1 + 644)) != *(_DWORD *)(a1 + 772) )
{
cfsetispeed((struct termios *)(a1 + 584), *(_DWORD *)(a1 + 772));
cfsetospeed((struct termios *)(a1 + 584), *(_DWORD *)(a1 + 772));
cfsetispeed((struct termios *)(a1 + 644), *(_DWORD *)(a1 + 772));
cfsetospeed((struct termios *)(a1 + 644), *(_DWORD *)(a1 + 772));
}
if ( (*(_DWORD *)(a1 + 716) & 2) != 0 )
{
for ( i = 0; i <= 3; ++i )
tty_update_flags(a1, i);
if ( (*(_DWORD *)(a1 + 588) & 0x1800) == 6144 )
*(_DWORD *)(a1 + 764) = 0;
else
*(_DWORD *)(a1 + 764) = (*(int *)(a1 + 152) >> 3) & 1;
tty__getchar((_BYTE *)(a1 + 704), (_BYTE *)(a1 + 498));
for ( j = 0; j <= 24 && *(_BYTE *)(a1 + j + 498) == *(_BYTE *)(a1 + j + 448); ++j )
;
if ( j != 25 )
{
for ( k = 0; k <= 24; ++k )
tty_update_char(a1, 1, k);
tty_bind_char(a1, 0);
tty__setchar((_BYTE *)(a1 + 644), (_BYTE *)(a1 + 473));
for ( m = 0; m <= 24; ++m )
tty_update_char(a1, 0, m);
tty__setchar((_BYTE *)(a1 + 584), (_BYTE *)(a1 + 448));
}
}
if ( (unsigned int)tty_setty(a1, 1, (const struct termios *)(a1 + 644)) == -1 )
return 0xFFFFFFFFLL;
*(_BYTE *)(a1 + 776) = 1;
return 0LL;
}
|
static int lwtunnel_parse_geneve_opts(char *str, size_t len, struct rtattr *rta)
{
char *token;
int err;
token = strsep(&str, ",");
while (token) {
err = lwtunnel_parse_geneve_opt(token, len, rta);
if (err)
return err;
token = strsep(&str, ",");
}
return 0;
}
| int lwtunnel_parse_geneve_opts(unsigned long a0, unsigned long long a1, unsigned long long a2) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned int v4;
v0 = a0;
*(&v2) = strsep(&v0, ",");
while (true) {
if (*(&v2)) {
v1 = lwtunnel_parse_geneve_opt(*(&v2), a1, a2);
if (v1) {
v4 = v1;
break;
} else {
*(&v2) = strsep(&v0, ",");
}
} else {
v4 = 0;
break;
}
}
return v4;
}
|
void
rl_resize_terminal(void)
{
el_resize(e);
}
| long long rl_resize_terminal() {
return el_resize(e);
}
|
void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned long size,
const char *description)
{
void *ret;
char buf[256];
if (ext2fs_get_memzero(size, &ret)) {
sprintf(buf, "Can't allocate %lu bytes for %s\n",
size, description);
fatal_error(ctx, buf);
}
return ret;
}
| long long e2fsck_allocate_memory(unsigned long a0, unsigned long long a1, unsigned long a2) {
unsigned long v0;
char v1;
char v2;
v0 = a0;
if (ext2fs_get_memzero(a1, &v1, &v1)) {
sprintf(&v2, "Can't allocate %lu bytes for %s\n", a1, a2);
fatal_error();
}
return *(&v1);
}
|
void
set_procsub_status (ind, pid, status)
int ind;
pid_t pid;
int status;
{
if (ind >= 0 && ind < totfds)
dev_fd_list[ind] = (pid_t)-1;
}
| void set_procsub_status(int param_1)
{
if ((-1 < param_1) && (param_1 < totfds)) {
*(undefined4 *)(dev_fd_list + (long)param_1 * 4) = 0xffffffff;
}
return;
}
|
int
ga_match(char * const *groups, int n)
{
int i, j;
for (i = 0; i < ngroups; i++)
for (j = 0; j < n; j++)
if (match_pattern(groups_byname[i], groups[j]))
return 1;
return 0;
}
| long long ga_match(unsigned long long *a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
v0 = 0;
while (true) {
if (v0 < ngroups) {
v1 = 0;
while (true) {
if (v1 >= a1) {
v0 = __addvsi3(v0, 0x1);
break;
} else if (!match_pattern(*((groups_byname + (v0 << 3))), a0[v1], a0[v1], v0 << 3)) {
v1 = __addvsi3(v1, 0x1);
} else {
v3 = 1;
goto LABEL_40027d;
}
}
} else {
v3 = 0;
break;
}
}
LABEL_40027d:
return v3;
}
|
static int pgetc_top(struct synstack *stack)
{
return stack->syntax == (sqsyntax + 129) ? pgetc() : pgetc_eatbnl();
}
| int pgetc_top(unsigned long long *a0) {
unsigned long long v1;
if (*(a0) == 5243073)
v1 = pgetc();
else
v1 = pgetc_eatbnl();
return v1;
}
|
static void
removal_bulk_remove_files(struct pkginfo *pkg)
{
struct fsys_hash_rev_iter rev_iter;
struct fsys_namenode_list *leftover;
struct fsys_namenode *namenode;
static struct varbuf fnvb;
struct varbuf_state fnvb_state;
struct stat stab;
pkg_set_status(pkg, PKG_STAT_HALFINSTALLED);
modstatdb_note(pkg);
push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
fsys_hash_rev_iter_init(&rev_iter, pkg->files);
leftover =
((void *)0)
;
while ((namenode = fsys_hash_rev_iter_next(&rev_iter))) {
struct fsys_namenode *usenode;
_Bool
is_dir;
debug(dbg_eachfile, "removal_bulk '%s' flags=%o",
namenode->name, namenode->flags);
usenode = namenodetouse(namenode, pkg, &pkg->installed);
varbuf_reset(&fnvb);
varbuf_add_buf(&fnvb, instdir, strlen(instdir));
varbuf_add_buf(&fnvb, usenode->name, strlen(usenode->name));
varbuf_end_str(&fnvb);
varbuf_snapshot(&fnvb, &fnvb_state);
is_dir = stat(fnvb.buf, &stab) == 0 &&
((((
stab.st_mode
)) & 0170000) == (0040000))
;
if (!is_dir && removal_bulk_file_is_shared(pkg, namenode))
continue;
if (namenode->flags & FNNF_OLD_CONFF) {
push_leftover(&leftover, namenode);
continue;
}
if (is_dir) {
debug(dbg_eachfiledetail, "removal_bulk is a directory");
if (dir_has_conffiles(namenode, pkg)) {
push_leftover(&leftover,namenode);
continue;
}
if (dir_is_used_by_pkg(namenode, pkg, leftover)) {
push_leftover(&leftover, namenode);
continue;
}
if (dir_is_used_by_others(namenode, pkg))
continue;
if (strcmp(usenode->name, "/.") == 0) {
debug(dbg_eachfiledetail,
"removal_bulk '%s' root directory, cannot remove", fnvb.buf);
push_leftover(&leftover, namenode);
continue;
}
}
trig_path_activate(usenode, pkg);
varbuf_rollback(&fnvb, &fnvb_state);
varbuf_add_buf(&fnvb, ".dpkg-tmp", strlen(".dpkg-tmp"));
varbuf_end_str(&fnvb);
debug(dbg_eachfiledetail, "removal_bulk cleaning temp '%s'", fnvb.buf);
path_remove_tree(fnvb.buf);
varbuf_rollback(&fnvb, &fnvb_state);
varbuf_add_buf(&fnvb, ".dpkg-new", strlen(".dpkg-new"));
varbuf_end_str(&fnvb);
debug(dbg_eachfiledetail, "removal_bulk cleaning new '%s'", fnvb.buf);
path_remove_tree(fnvb.buf);
varbuf_rollback(&fnvb, &fnvb_state);
varbuf_end_str(&fnvb);
debug(dbg_eachfiledetail, "removal_bulk removing '%s'", fnvb.buf);
if (!rmdir(fnvb.buf) ||
(*__errno_location ())
==
2
||
(*__errno_location ())
==
40
) continue;
if (
(*__errno_location ())
==
39
||
(*__errno_location ())
==
17
) {
debug(dbg_eachfiledetail,
"removal_bulk '%s' was not empty, will try again later",
fnvb.buf);
push_leftover(&leftover,namenode);
continue;
} else if (
(*__errno_location ())
==
16
||
(*__errno_location ())
==
1
) {
warning(gettext("while removing %.250s, unable to remove directory '%.250s': " "%s - directory may be a mount point?")
,
pkg_name(pkg, pnaw_nonambig), namenode->name, strerror(
(*__errno_location ())
));
push_leftover(&leftover,namenode);
continue;
}
if (
(*__errno_location ())
!=
20
)
ohshite(gettext("cannot remove '%.250s'"), fnvb.buf);
debug(dbg_eachfiledetail, "removal_bulk unlinking '%s'", fnvb.buf);
if (secure_unlink(fnvb.buf))
ohshite(gettext("unable to securely remove '%.250s'"), fnvb.buf);
}
write_filelist_except(pkg, &pkg->installed, leftover, 0);
maintscript_installed(pkg, "postrm", "post-removal", "remove",
((void *)0)
);
trig_parse_ci(pkg_infodb_get_file(pkg, &pkg->installed, "triggers"),
trig_cicb_interest_delete,
((void *)0)
, pkg, &pkg->installed);
trig_file_interests_save();
debug(dbg_general, "removal_bulk cleaning info directory");
pkg_infodb_foreach(pkg, &pkg->installed, removal_bulk_remove_file);
dir_sync_path(pkg_infodb_get_dir());
pkg_set_status(pkg, PKG_STAT_CONFIGFILES);
pkg->installed.essential =
0
;
pkg->installed.is_protected =
0
;
modstatdb_note(pkg);
push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
}
| void removal_bulk_remove_files(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
char v0;
char v1;
void* v2;
char v3;
struct_2 *v4;
struct_1 *v5;
char v6;
char v7;
char v8;
char v10;
unsigned long long *v18;
unsigned long long v19;
pkg_set_status(a0, 0x2);
modstatdb_note(a0);
push_checkpoint(0xfffffffd, 0x1);
fsys_hash_rev_iter_init(&v1, a0->field_168, a0->field_168);
v2 = 0;
while (true) {
while (true) {
while (true) {
v4 = fsys_hash_rev_iter_next(&v1);
if (!v4) {
write_filelist_except(a0, &a0->padding_0[72], v2, 0x0);
maintscript_installed(a0, "postrm", "post-removal", "remove", 0x0);
trig_parse_ci(pkg_infodb_get_file(a0, &a0->padding_0[72], "triggers", &a0->padding_0[72]), got.trig_cicb_interest_delete, 0x0, a0, &a0->padding_0[72]);
trig_file_interests_save(a0, a1, 0x0, a3, a4, a5);
debug(0x1, "removal_bulk cleaning info directory", 0x0);
pkg_infodb_foreach(a0, &a0->padding_0[72], removal_bulk_remove_file, &a0->padding_0[72]);
dir_sync_path(pkg_infodb_get_dir(a0, a1, removal_bulk_remove_file, a3, a4, a5));
pkg_set_status(a0, 0x1);
a0->field_50 = 0;
a0->field_51 = 0;
modstatdb_note(a0);
push_checkpoint(0xfffffffd, 0x1);
v19 = *(&v8) ^ v18[5];
return;
}
debug(0x8, "removal_bulk '%s' flags=%o", v4->field_8);
v5 = namenodetouse(v4, a0, &a0->padding_0[72], a0);
varbuf_reset(&fnvb.5628);
varbuf_add_buf(&fnvb.5628, instdir, strlen(instdir));
varbuf_add_buf(&fnvb.5628, v5->field_8, strlen(v5->field_8));
varbuf_end_str(&fnvb.5628);
varbuf_snapshot(&fnvb.5628, &v3, a2);
if (!stat(g_4021d0, &v6) && (*(&v7) & 0xf000) == 0x4000) {
v10 = 1;
goto LABEL_400b1b;
}
v10 = 0;
LABEL_400b1b:
v0 = v10;
v0 &= 1;
if ((v0 ^ 1) && !(!removal_bulk_file_is_shared(a0, v4)))
continue;
if ((v4->field_30 & 4)) {
push_leftover(&v2, v4);
} else {
if (v0) {
debug(0x40, "removal_bulk is a directory", a2);
if (dir_has_conffiles(v4, a0, a0)) {
push_leftover(&v2, v4);
continue;
} else if (dir_is_used_by_pkg(v4, a0, v2, a0)) {
push_leftover(&v2, v4);
continue;
} else {
if (!(!dir_is_used_by_others(v4, a0, a0)))
continue;
if (!strcmp(v5->field_8, "/.")) {
debug(0x40, "removal_bulk '%s' root directory, cannot remove", g_4021d0);
push_leftover(&v2, v4);
continue;
}
}
}
trig_path_activate(v5, a0, a0);
varbuf_rollback(&fnvb.5628, &v3, a2);
varbuf_add_buf(&fnvb.5628, ".dpkg-tmp", strlen(".dpkg-tmp"));
varbuf_end_str(&fnvb.5628);
debug(0x40, "removal_bulk cleaning temp '%s'", g_4021d0);
path_remove_tree(g_4021d0);
varbuf_rollback(&fnvb.5628, &v3, a2);
varbuf_add_buf(&fnvb.5628, ".dpkg-new", strlen(".dpkg-new"));
varbuf_end_str(&fnvb.5628);
debug(0x40, "removal_bulk cleaning new '%s'", g_4021d0);
path_remove_tree(g_4021d0);
varbuf_rollback(&fnvb.5628, &v3, a2);
varbuf_end_str(&fnvb.5628);
debug(0x40, "removal_bulk removing '%s'", g_4021d0);
if (!rmdir(g_4021d0))
continue;
if (*(__errno_location()) == 2)
continue;
if (*(__errno_location()) != 40)
break;
}
}
if (*(__errno_location()) == 39) {
LABEL_400e36:
debug(0x40, "removal_bulk '%s' was not empty, will try again later", g_4021d0);
push_leftover(&v2, v4);
} else {
if (*(__errno_location()) == 17)
goto LABEL_400e36;
if (*(__errno_location()) == 16) {
LABEL_400e8c:
strerror(*(__errno_location()));
warning(gettext("while removing %.250s, unable to remove directory '%.250s': %s - directory may be a mount point?"), pkg_name(a0, 0x1));
push_leftover(&v2, v4);
} else {
if (*(__errno_location()) == 1)
goto LABEL_400e8c;
if (*(__errno_location()) != 20)
ohshite(gettext("cannot remove '%.250s'"), g_4021d0, a2);
debug(0x40, "removal_bulk unlinking '%s'", g_4021d0);
if (secure_unlink(g_4021d0))
break;
}
}
}
ohshite(gettext("unable to securely remove '%.250s'"), g_4021d0, a2);
}
}
|
static void
free_progcomp (data)
void * data;
{
COMPSPEC *cs;
cs = (COMPSPEC *)data;
compspec_dispose (cs);
}
| void free_progcomp(void* a0) {
unsigned long long v1;
v1 = compspec_dispose(a0);
return;
}
|
static int
history_expand_line (count, ignore)
int count, ignore;
{
char *new_line;
new_line = history_expand_line_internal (rl_line_buffer);
if (new_line)
{
set_up_new_line (new_line);
return (0);
}
else
{
cleanup_expansion_error ();
return (1);
}
}
| int history_expand_line(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned long long v2;
unsigned int v4;
v1 = a0;
v0 = a1;
v2 = history_expand_line_internal(rl_line_buffer);
if (!v2) {
cleanup_expansion_error();
v4 = 1;
} else {
set_up_new_line(v2);
v4 = 0;
}
return v4;
}
|
c_hpos(EditLine *el)
{
wchar_t *ptr;
if (el->el_line.cursor == el->el_line.buffer)
return 0;
else {
for (ptr = el->el_line.cursor - 1;
ptr >= el->el_line.buffer && *ptr != '\n';
ptr--)
continue;
return (int)(el->el_line.cursor - ptr - 1);
}
}
| long long c_hpos(unsigned long long a0[12]) {
unsigned int *v0;
void* v2;
if (a0[11] == a0[10]) {
v2 = 0;
} else {
v0 = a0[11] - 4;
while (true) {
if (v0 < a0[10])
break;
if (*(v0) == 10)
break;
v0 += 1;
}
v2 = (a0[11] + -0x1 * v0 >> 2) - 1;
}
return v2;
}
|
static
_Bool
iswheel (const char *username)
{
struct group *grp;
grp = getgrnam ("wheel");
if ( (
((void *)0)
==grp)
|| (
((void *)0)
== grp->gr_mem)) {
return
0
;
}
return is_on_list (grp->gr_mem, username);
}
| int iswheel(unsigned long long a0) {
struct_0 *v0;
unsigned int v2;
v0 = &getgrnam("wheel")->gr_name;
if (!v0) {
LABEL_400088:
v2 = 0;
} else {
if (!v0->field_18)
goto LABEL_400088;
v2 = is_on_list(v0->field_18, a0, a0);
}
return v2;
}
|
void
arc4random_addrandom(unsigned char *dat, int datlen)
{
pthread_mutex_lock(&arc4random_mtx);
_rs_stir_if_needed(datlen);
_rs_rekey(dat, datlen);
pthread_mutex_unlock(&arc4random_mtx);
}
| long long arc4random_addrandom(void* a0, unsigned long a1) {
pthread_mutex_lock(&arc4random_mtx);
_rs_stir_if_needed(a1);
_rs_rekey(a0, a1);
return pthread_mutex_unlock(&arc4random_mtx);
}
|
uLong crc32_combine64(crc1, crc2, len2)
uLong crc1;
uLong crc2;
off64_t len2;
{
return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff);
}
| void crc32_combine64(unsigned long long a0, unsigned long long a1, unsigned long long a2) {
unsigned long long v1;
v1 = a1 ^ multmodp(x2nmodp(a2, 0x3), a0);
return;
}
|
void
async_redirect_stdin ()
{
int fd;
fd = open ("/dev/null",
00
);
if (fd > 0)
{
dup2 (fd, 0);
close (fd);
}
else if (fd < 0)
internal_error (gettext("cannot redirect standard input from /dev/null: %s"), strerror (
(*__errno_location ())
));
}
| int async_redirect_stdin()
{
int result;
int *v1;
char *v2;
char *v3;
int fd;
result = open("/dev/null", 0);
fd = result;
if ( result <= 0 )
{
if ( result < 0 )
{
v1 = _errno_location();
v2 = strerror(*v1);
v3 = gettext("cannot redirect standard input from /dev/null: %s");
return internal_error(v3, v2);
}
}
else
{
dup2(result, 0);
return close(fd);
}
return result;
}
|
static void
tostring (VALUE *v)
{
switch (v->type)
{
case integer:
{
char *s =
__gmpz_get_str
(
((void *)0)
, 10, v->u.i);
__gmpz_clear
(v->u.i);
v->u.s = s;
v->type = string;
}
break;
case string:
break;
default:
abort ();
}
}
| unsigned int * tostring(unsigned int *a1)
{
unsigned int *result;
long str;
result = (unsigned int *)*a1;
if ( (_DWORD)result )
{
if ( (_DWORD)result != 1 )
abort();
}
else
{
str = _gmpz_get_str(0LL, 10LL, a1 + 2);
_gmpz_clear(a1 + 2);
*((_QWORD *)a1 + 1) = str;
result = a1;
*a1 = 1;
}
return result;
}
|
static
_Bool
collect_arg (char **argv, int *arg_ptr, const char **collected_arg)
{
char *arg;
const
_Bool
result = collect_arg_nonconst (argv, arg_ptr, &arg);
*collected_arg = arg;
return result;
}
| int collect_arg(unsigned long long *a0, unsigned int *a1, unsigned long long *a2) {
char v0;
char v1;
v0 = collect_arg_nonconst(a0, a1, &v1);
*(a2) = *(&v1);
return v0;
}
|
int parse_server_match_testspec(struct connection_info *ci, char *spec)
{
char *p;
while ((p = strsep(&spec, ",")) && *p != '\0') {
if (strncmp(p, "addr=", 5) == 0) {
ci->address = xstrdup(p + 5);
} else if (strncmp(p, "host=", 5) == 0) {
ci->host = xstrdup(p + 5);
} else if (strncmp(p, "user=", 5) == 0) {
ci->user = xstrdup(p + 5);
} else if (strncmp(p, "laddr=", 6) == 0) {
ci->laddress = xstrdup(p + 6);
} else if (strncmp(p, "rdomain=", 8) == 0) {
ci->rdomain = xstrdup(p + 8);
} else if (strncmp(p, "lport=", 6) == 0) {
ci->lport = a2port(p + 6);
if (ci->lport == -1) {
fprintf(
stderr
, "Invalid port '%s' in test mode"
" specification %s\n", p+6, p);
return -1;
}
} else {
fprintf(
stderr
, "Invalid test mode specification %s\n",
p);
return -1;
}
}
return 0;
}
| long parse_server_match_testspec(long a1, char *a2)
{
long v2;
long v3;
long v4;
long v5;
long v6;
int v7;
char *stringp;
long v10;
char *s1;
v10 = a1;
stringp = a2;
while ( 1 )
{
s1 = strsep(&stringp, ",");
if ( !s1 || !*s1 )
break;
if ( !strncmp(s1, "addr=", 5uLL) )
{
v2 = xstrdup(s1 + 5);
*(_QWORD *)(v10 + 16) = v2;
}
else if ( !strncmp(s1, "host=", 5uLL) )
{
v3 = xstrdup(s1 + 5);
*(_QWORD *)(v10 + 8) = v3;
}
else if ( !strncmp(s1, "user=", 5uLL) )
{
v4 = xstrdup(s1 + 5);
*(_QWORD *)v10 = v4;
}
else if ( !strncmp(s1, "laddr=", 6uLL) )
{
v5 = xstrdup(s1 + 6);
*(_QWORD *)(v10 + 24) = v5;
}
else if ( !strncmp(s1, "rdomain=", 8uLL) )
{
v6 = xstrdup(s1 + 8);
*(_QWORD *)(v10 + 40) = v6;
}
else
{
if ( strncmp(s1, "lport=", 6uLL) )
{
fprintf(stderr, "Invalid test mode specification %s\n", s1);
return 0xFFFFFFFFLL;
}
v7 = a2port(s1 + 6);
*(_DWORD *)(v10 + 32) = v7;
if ( *(_DWORD *)(v10 + 32) == -1 )
{
fprintf(stderr, "Invalid port '%s' in test mode specification %s\n", s1 + 6, s1);
return 0xFFFFFFFFLL;
}
}
}
return 0LL;
}
|
static inline size_t
gcd (size_t u, size_t v)
{
do
{
size_t t = u % v;
u = v;
v = t;
}
while (v);
return u;
}
| int gcd(unsigned long a0, unsigned long a1) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
v1 = a0;
v0 = a1;
do {
v2 = (0 CONCAT v1) /m v0 >> 64;
v1 = v0;
v0 = v2;
} while (v0);
return v1;
}
|
int
u32toutf16 (c, s)
unsigned int c;
wchar_t *s;
{
int l;
l = 0;
if (c < 0x0d800 || (c >= 0x0e000 && c <= 0x0ffff))
{
s[0] = (wchar_t) (c & 0xFFFF);
l = 1;
}
else if (c >= 0x10000 && c <= 0x010ffff)
{
c -= 0x010000;
s[0] = (wchar_t)((c >> 10) + 0xd800);
s[1] = (wchar_t)((c & 0x3ff) + 0xdc00);
l = 2;
}
s[l] = 0;
return l;
}
| long u32toutf16(unsigned int a1, _DWORD *a2)
{
unsigned int v3;
v3 = 0;
if ( a1 > 0xD7FF && (a1 <= 0xDFFF || a1 > 0xFFFF) )
{
if ( a1 > 0xFFFF && a1 <= 0x10FFFF )
{
*a2 = ((a1 - 0x10000) >> 10) + 55296;
a2[1] = (a1 & 0x3FF) + 56320;
v3 = 2;
}
}
else
{
*a2 = (unsigned short)a1;
v3 = 1;
}
a2[v3] = 0;
return v3;
}
|
void
session_close_by_pid(struct ssh *ssh, pid_t pid, int status)
{
Session *s = session_by_pid(pid);
if (s ==
((void *)0)
) {
sshlog("session.c", __func__, 2457, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "no session for pid %ld", (long)pid);
return;
}
if (s->chanid != -1)
session_exit_message(ssh, s, status);
if (s->ttyfd != -1)
session_pty_cleanup(s);
s->pid = 0;
}
| long long session_close_by_pid(unsigned long long a0, unsigned long a1, unsigned long a2) {
unsigned long long v0;
unsigned long v1;
unsigned int v2[48];
unsigned int v4[48];
*(&v2[0]) = session_by_pid(a1);
if (!v2) {
v1 = a1;
v0 = "no session for pid %ld";
v4 = sshlog("session.c", "session_close_by_pid", 0x999, 0x1, 0x5, 0x0);
} else {
if (v2[47] != -1)
session_exit_message(a0, v2, a2);
if (v2[13] != -1)
session_pty_cleanup(v2);
v4 = v2;
v2[8] = 0;
}
return v4;
}
|
int gzclose_w(file)
gzFile file;
{
int ret = 0;
gz_statep state;
if (file ==
((void *)0)
)
return (-2);
state = (gz_statep)file;
if (state->mode != 31153)
return (-2);
if (state->seek) {
state->seek = 0;
if (gz_zero(state, state->skip) == -1)
ret = state->err;
}
if (gz_comp(state, 4) == -1)
ret = state->err;
if (state->size) {
if (!state->direct) {
(void)deflateEnd(&(state->strm));
free(state->out);
}
free(state->in);
}
gz_error(state, 0,
((void *)0)
);
free(state->path);
if (close(state->fd) == -1)
ret = (-1);
free(state);
return ret;
}
| long long gzclose_w(struct_0 *a0) {
unsigned int v0;
unsigned long long v2;
v0 = 0;
if (!a0) {
v2 = 4294967294;
return v2;
} else if (a0->field_18 == 31153) {
if (a0->field_70) {
a0->field_70 = 0;
if (gz_zero(a0, a0->field_68) == -1)
v0 = a0->field_74;
}
if (gz_comp(a0, 0x4) == -1)
v0 = a0->field_74;
if (a0->field_28) {
if (!a0->field_40) {
deflateEnd(&a0[153722867280912929].padding_0[8]);
free(a0->field_38);
}
free(a0->field_30);
}
gz_error(a0, 0x0, 0x0);
free(a0->field_20);
if (close(a0->field_1c) == -1)
v0 = -1;
free(a0);
v2 = v0;
return v2;
} else {
v2 = 4294967294;
return v2;
}
}
|
static void
process_sign(void)
{
u_char *blob, *data, *signature =
((void *)0)
;
size_t blen, dlen, slen = 0;
int r, ok = -1;
struct sshkey *key, *found;
struct sshbuf *msg;
if ((r = sshbuf_get_string(iqueue, &blob, &blen)) != 0 ||
(r = sshbuf_get_string(iqueue, &data, &dlen)) != 0 ||
(r = sshbuf_get_u32(iqueue,
((void *)0)
)) != 0)
sshfatal("ssh-pkcs11-helper.c", __func__, 197, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse");
if ((r = sshkey_from_blob(blob, blen, &key)) != 0)
sshfatal("ssh-pkcs11-helper.c", __func__, 200, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "decode key");
else {
if ((found = lookup_key(key)) !=
((void *)0)
) {
int ret;
if (key->type == KEY_RSA) {
slen = RSA_size(key->rsa);
signature = xmalloc(slen);
ret = RSA_private_encrypt(dlen, data, signature,
found->rsa,
1
);
if (ret != -1) {
slen = ret;
ok = 0;
}
} else if (key->type == KEY_ECDSA) {
u_int xslen = ECDSA_size(key->ecdsa);
signature = xmalloc(xslen);
ret = ECDSA_sign(-1, data, dlen, signature,
&xslen, found->ecdsa);
if (ret != 0)
ok = 0;
else
sshlog("ssh-pkcs11-helper.c", __func__, 226, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "ECDSA_sign returned %d", ret);
slen = xslen;
} else
sshlog("ssh-pkcs11-helper.c", __func__, 230, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "don't know how to sign with key " "type %d", (int)key->type)
;
}
sshkey_free(key);
}
if ((msg = sshbuf_new()) ==
((void *)0)
)
sshfatal("ssh-pkcs11-helper.c", __func__, 237, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
if (ok == 0) {
if ((r = sshbuf_put_u8(msg, 14)) != 0 ||
(r = sshbuf_put_string(msg, signature, slen)) != 0)
sshfatal("ssh-pkcs11-helper.c", __func__, 241, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose response");
} else {
if ((r = sshbuf_put_u8(msg, 30)) != 0)
sshfatal("ssh-pkcs11-helper.c", __func__, 244, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose failure response");
}
free(data);
free(blob);
free(signature);
send_msg(msg);
sshbuf_free(msg);
}
| void process_sign(void)
{
RSA *pRVar1;
EC_KEY *pEVar2;
int iVar3;
undefined8 uVar4;
char **ppcVar5;
undefined *puVar6;
undefined *puVar7;
long in_FS_OFFSET;
char *apcStack192 [6];
ulong auStack144 [3];
char *pcStack120;
undefined8 uStack112;
uint local_68;
int local_64;
int local_60;
int local_5c;
void *local_58;
uchar *local_50;
undefined8 local_48;
int local_40 [2];
uint *local_38;
uchar *local_30;
ulong local_28;
long local_20;
long local_18;
long local_10;
ppcVar5 = (char **)&local_68;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_30 = (uchar *)0x0;
local_28 = 0;
local_60 = -1;
uStack112 = 0x1008ba;
local_64 = sshbuf_get_string(iqueue,&local_58,&local_48);
if (local_64 == 0) {
uStack112 = 0x1008dd;
local_64 = sshbuf_get_string(iqueue,&local_50,local_40);
if (local_64 != 0) goto LAB_00100903;
uStack112 = 0x1008fa;
local_64 = sshbuf_get_u32(iqueue,0);
if (local_64 != 0) goto LAB_00100903;
}
else {
LAB_00100903:
uStack112 = 0x10090d;
uVar4 = ssh_err(local_64);
ppcVar5 = &pcStack120;
pcStack120 = "parse";
sshfatal("ssh-pkcs11-helper.c","process_sign",0xc5,1,1,uVar4);
}
*(undefined8 *)((long)ppcVar5 + -8) = 0x10095b;
iVar3 = sshkey_from_blob(local_58,local_48,&local_38);
local_64 = iVar3;
puVar6 = (undefined *)ppcVar5;
if (iVar3 != 0) {
*(undefined8 *)((long)ppcVar5 + -8) = 0x10096e;
uVar4 = ssh_err(iVar3);
puVar6 = (undefined *)((long)ppcVar5 + -0x10);
*(char **)((long)ppcVar5 + -0x10) = "decode key";
*(undefined8 *)((long)ppcVar5 + -0x18) = 0x1009a5;
sshfatal("ssh-pkcs11-helper.c","process_sign",200,1,1,uVar4);
}
*(undefined8 *)(puVar6 + -8) = 0x1009b1;
local_20 = lookup_key(local_38);
if (local_20 != 0) {
if (*local_38 == 0) {
pRVar1 = *(RSA **)(local_38 + 2);
*(undefined8 *)(puVar6 + -8) = 0x1009da;
iVar3 = RSA_size(pRVar1);
local_28 = (ulong)iVar3;
*(undefined8 *)(puVar6 + -8) = 0x1009ec;
local_30 = (uchar *)xmalloc();
pRVar1 = *(RSA **)(local_20 + 8);
*(undefined8 *)(puVar6 + -8) = 0x100a14;
local_5c = RSA_private_encrypt(local_40[0],local_50,local_30,pRVar1,1);
if (local_5c != -1) {
local_28 = (ulong)local_5c;
local_60 = 0;
}
}
else if (*local_38 == 2) {
pEVar2 = *(EC_KEY **)(local_38 + 8);
*(undefined8 *)(puVar6 + -8) = 0x100a55;
local_68 = ECDSA_size(pEVar2);
*(undefined8 *)(puVar6 + -8) = 0x100a65;
local_30 = (uchar *)xmalloc();
pEVar2 = *(EC_KEY **)(local_20 + 0x20);
*(undefined8 *)(puVar6 + -8) = 0x100a9b;
local_5c = ECDSA_sign(-1,local_50,local_40[0],local_30,&local_68,pEVar2);
if (local_5c == 0) {
*(undefined8 *)(puVar6 + -8) = 0;
*(char **)(puVar6 + -0x10) = "ECDSA_sign returned %d";
*(undefined8 *)(puVar6 + -0x18) = 0x100ae7;
sshlog("ssh-pkcs11-helper.c","process_sign",0xe2,1,2,0);
}
else {
local_60 = 0;
}
local_28 = (ulong)local_68;
}
else {
*(ulong *)(puVar6 + -8) = (ulong)*local_38;
*(char **)(puVar6 + -0x10) = "don\'t know how to sign with key type %d";
*(undefined8 *)(puVar6 + -0x18) = 0x100b33;
sshlog("ssh-pkcs11-helper.c","process_sign",0xe6,1,2,0);
}
}
*(undefined8 *)(puVar6 + -8) = 0x100b43;
sshkey_free(local_38);
*(undefined8 *)(puVar6 + -8) = 0x100b48;
local_18 = sshbuf_new();
puVar7 = puVar6;
if (local_18 == 0) {
puVar7 = puVar6 + -0x10;
*(char **)(puVar6 + -0x10) = "sshbuf_new failed";
*(undefined8 *)(puVar6 + -0x18) = 0x100b8d;
sshfatal("ssh-pkcs11-helper.c","process_sign",0xed,1,1,0);
}
puVar6 = puVar7;
if (local_60 == 0) {
*(undefined8 *)(puVar7 + -8) = 0x100ba4;
local_64 = sshbuf_put_u8(local_18,0xe);
if (local_64 == 0) {
*(undefined8 *)(puVar7 + -8) = 0x100bc4;
local_64 = sshbuf_put_string(local_18,local_30,local_28);
if (local_64 == 0) goto LAB_00100c6d;
}
iVar3 = local_64;
*(undefined8 *)(puVar7 + -8) = 0x100bdb;
uVar4 = ssh_err(iVar3);
puVar6 = puVar7 + -0x10;
*(char **)(puVar7 + -0x10) = "compose response";
*(undefined8 *)(puVar7 + -0x18) = 0x100c12;
sshfatal("ssh-pkcs11-helper.c","process_sign",0xf1,1,1,uVar4);
}
*(undefined8 *)(puVar6 + -8) = 0x100c23;
iVar3 = sshbuf_put_u8(local_18,0x1e);
local_64 = iVar3;
puVar7 = puVar6;
if (iVar3 != 0) {
*(undefined8 *)(puVar6 + -8) = 0x100c36;
uVar4 = ssh_err(iVar3);
puVar7 = puVar6 + -0x10;
*(char **)(puVar6 + -0x10) = "compose failure response";
*(undefined8 *)(puVar6 + -0x18) = 0x100c6d;
sshfatal("ssh-pkcs11-helper.c","process_sign",0xf4,1,1,uVar4);
}
LAB_00100c6d:
*(undefined8 *)(puVar7 + -8) = 0x100c79;
free(local_50);
*(undefined8 *)(puVar7 + -8) = 0x100c85;
free(local_58);
*(undefined8 *)(puVar7 + -8) = 0x100c91;
free(local_30);
*(undefined8 *)(puVar7 + -8) = 0x100c9d;
send_msg(local_18);
*(undefined8 *)(puVar7 + -8) = 0x100ca9;
sshbuf_free(local_18);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)(puVar7 + -8) = 0x100cbe;
__stack_chk_fail();
}
return;
}
|
int load_env(char *envstr, FILE * f) {
long filepos;
int fileline;
enum env_state state;
char quotechar, *c, *str, *val;
filepos = ftell(f);
fileline = LineNumber;
if (
(-1)
== get_string(envstr, 131072, f, "\n"))
return ((-1));
if ((DebugFlags & (0x0008)) != 0) printf ("load_env, read <%s>\n", envstr);
val = str = envstr;
state = NAMEI;
quotechar = '\0';
c = envstr;
while (state != ERROR && *c) {
switch (state) {
case NAMEI:
case VALUEI:
if (*c == '\'' || *c == '"')
quotechar = *c++;
state++;
case NAME:
case VALUE:
if (quotechar) {
if (*c == quotechar) {
state++;
c++;
break;
}
if (state == NAME && *c == '=') {
state = ERROR;
break;
}
}
else {
if (state == NAME) {
if (
((*__ctype_b_loc ())[(int) ((
(unsigned char) *c
))] & (unsigned short int) _ISspace)
) {
c++;
state++;
break;
}
if (*c == '=') {
state++;
break;
}
}
}
*str++ = *c++;
break;
case EQ1:
if (*c == '=') {
state++;
quotechar = '\0';
*str++ = *c;
val = str;
}
else {
if (!
((*__ctype_b_loc ())[(int) ((
(unsigned char) *c
))] & (unsigned short int) _ISspace)
)
state = ERROR;
}
c++;
break;
case EQ2:
case FINI:
if (
((*__ctype_b_loc ())[(int) ((
(unsigned char) *c
))] & (unsigned short int) _ISspace)
)
c++;
else
state++;
break;
default:
abort();
}
}
if (state != FINI && state != EQ2 && !(state == VALUE && !quotechar)) {
if ((DebugFlags & (0x0008)) != 0) printf ("load_env, not an env var, state = %d\n", state);
if (fseek(f, filepos, 0)) {
return (-1);
}
{if ((DebugFlags & (0x0008|0x0001)) != 0) printf ("linenum=%d\n",fileline); LineNumber = fileline; };
return (0);
}
*str = '\0';
if (state == VALUE) {
while (str > val &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)str[-1]
))] & (unsigned short int) _ISspace)
)
*(--str) = '\0';
}
return 1;
}
| long long load_env(unsigned long a0, void* a1) {
char v0;
int tmp_21;
int tmp_7;
int tmp_10;
unsigned int v1;
unsigned int v2;
char *v3;
char *v4;
char *v5;
unsigned int v6;
unsigned long long v8;
char *v13;
*(&v6) = ftell(a1);
v2 = LineNumber;
if (get_string(a0, 0x20000, a1, "\n") == -1) {
v8 = 4294967295;
} else {
if ((DebugFlags & 8))
printf("load_env, read <%s>\n", a0);
v4 = a0;
v5 = v4;
v1 = 0;
v0 = 0;
v3 = a0;
while (true) {
if (v1 == 7)
break;
if (!*(v3))
break;
switch (v1) {
case 2:
if (*(v3) == 61) {
v1 += 1;
v0 = 0;
tmp_21 = v4;
v4 += 1;
*(tmp_21) = *(v3);
v5 = v4;
break;
} else {
v13 = *((*(v3) * 2 + *(__ctype_b_loc()))) & 0x2000;
if (!v13) {
v1 = 7;
break;
}
}
v3 += 1;
continue;
case 3: case 6:
v13 = *((*(v3) * 2 + *(__ctype_b_loc()))) & 0x2000;
if (v13) {
v3 += 1;
continue;
} else {
v1 += 1;
}
continue;
case 0: case 4:
if (*(v3) != 39 && !(*(v3) == 34))
goto LABEL_400522;
tmp_7 = v3;
v3 += 1;
v13 = *(tmp_7);
v0 = v13;
LABEL_400522:
v1 += 1;
case 1: case 5:
if (v0) {
if (v0 == *(v3)) {
v1 += 1;
v3 += 1;
continue;
}
if (!(v1 == 1))
goto LABEL_4005b2;
if (!(*(v3) == 61))
goto LABEL_4005b2;
v1 = 7;
continue;
} else {
if (v1 == 1) {
v13 = *((*(v3) * 2 + *(__ctype_b_loc()))) & 0x2000;
if (v13) {
v3 += 1;
v1 += 1;
continue;
} else if (*(v3) == 61) {
v1 += 1;
continue;
}
}
LABEL_4005b2:
tmp_10 = v3;
v3 += 1;
v13 = v4;
v4 += 1;
*(v13) = *(tmp_10);
continue;
}
default:
abort();
}
}
if (v1 != 6 && v1 != 3) {
if (v1 == 5 && !v0)
goto LABEL_400725;
if ((DebugFlags & 8))
printf("load_env, not an env var, state = %d\n", v1);
if (fseek(a1, *(&v6), 0x0)) {
v8 = 4294967295;
goto LABEL_40077a;
} else {
if ((DebugFlags & 9))
printf("linenum=%d\n", v2);
LineNumber = v2;
v8 = 0;
goto LABEL_40077a;
}
}
LABEL_400725:
*(v4) = 0;
if (v1 == 5) {
while (true) {
if (v4 <= v5)
break;
*(&v13) = *((*(__ctype_b_loc()) + v4[1] * 2));
*(&v13) = v13 & 0x2000;
if (!v13)
break;
v4 += 1;
*(v4) = 0;
}
}
v8 = 1;
}
LABEL_40077a:
return v8;
}
|
void
parse_server_match_config(ServerOptions *options,
struct include_list *includes, struct connection_info *connectinfo)
{
ServerOptions mo;
initialize_server_options(&mo);
parse_server_config(&mo, "reprocess config", cfg, includes,
connectinfo, 0);
copy_set_server_options(options, &mo, 0);
}
| void parse_server_match_config(undefined8 param_1,undefined8 param_2,undefined8 param_3)
{
long in_FS_OFFSET;
undefined local_1ed8 [7880];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
initialize_server_options(local_1ed8);
parse_server_config(local_1ed8,"reprocess config",cfg,param_2,param_3,0);
copy_set_server_options(param_1,local_1ed8,0);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
void generate_pkcs12(common_info_st * cinfo)
{
gnutls_pkcs12_t pkcs12;
gnutls_x509_crl_t *crls;
gnutls_x509_crt_t *crts, ca_crt;
gnutls_x509_privkey_t *keys;
gnutls_mac_algorithm_t mac;
int result;
size_t size;
gnutls_datum_t data;
const char *pass;
const char *name;
unsigned int flags = 0, i;
gnutls_datum_t key_id;
unsigned char _key_id[64];
int indx;
size_t ncrts;
size_t nkeys;
size_t ncrls;
fprintf(
stderr
, "Generating a PKCS #12 structure...\n");
keys = load_privkey_list(0, &nkeys, cinfo);
crts = load_cert_list(0, &ncrts, cinfo);
ca_crt = load_ca_cert(0, cinfo);
crls = load_crl_list(0, &ncrls, cinfo);
if (keys ==
((void *)0)
&& crts ==
((void *)0)
&& ca_crt ==
((void *)0)
&& crls ==
((void *)0)
) {
fprintf(
stderr
, "You must specify one of\n\t--load-privkey\n\t--load-certificate\n\t--load-ca-certificate\n\t--load-crl\n");
app_exit(1);
}
if (cinfo->hash != GNUTLS_DIG_UNKNOWN)
mac = (gnutls_mac_algorithm_t)cinfo->hash;
else
mac = GNUTLS_MAC_SHA256;
if (certtool_options.present.p12_name) {
name = certtool_options.arg.p12_name;
} else {
name = get_pkcs12_key_name();
}
result = gnutls_pkcs12_init(&pkcs12);
if (result < 0) {
fprintf(
stderr
, "pkcs12_init: %s\n",
gnutls_strerror(result));
app_exit(1);
}
pass = get_password(cinfo, &flags, 1);
flags |= cipher_to_flags(cinfo->pkcs_cipher);
for (i = 0; i < ncrts; i++) {
gnutls_pkcs12_bag_t bag;
result = gnutls_pkcs12_bag_init(&bag);
if (result < 0) {
fprintf(
stderr
, "bag_init: %s\n",
gnutls_strerror(result));
app_exit(1);
}
((void) sizeof ((
crts !=
((void *)0)
&& crts[i] !=
((void *)0)) ? 1 : 0), __extension__ ({ if (
crts !=
((void *)0)
&& crts[i] !=
((void *)0)) ; else __assert_fail (
"crts != NULL && crts[i] != NULL"
, "certtool.c", 3003, __extension__ __PRETTY_FUNCTION__); }))
;
result = gnutls_pkcs12_bag_set_crt(bag, crts[i]);
if (result < 0) {
fprintf(
stderr
, "set_crt[%d]: %s\n", i,
gnutls_strerror(result));
app_exit(1);
}
indx = result;
if (i == 0) {
result =
gnutls_pkcs12_bag_set_friendly_name(bag, indx,
name);
if (result < 0) {
fprintf(
stderr
,
"bag_set_friendly_name: %s\n",
gnutls_strerror(result));
app_exit(1);
}
}
size = sizeof(_key_id);
result =
gnutls_x509_crt_get_key_id(crts[i], GNUTLS_KEYID_USE_SHA1, _key_id, &size);
if (result < 0) {
fprintf(
stderr
, "key_id[%d]: %s\n", i,
gnutls_strerror(result));
app_exit(1);
}
key_id.data = _key_id;
key_id.size = size;
result = gnutls_pkcs12_bag_set_key_id(bag, indx, &key_id);
if (result < 0) {
fprintf(
stderr
, "bag_set_key_id: %s\n",
gnutls_strerror(result));
app_exit(1);
}
if (!(flags & GNUTLS_PKCS_PLAIN) || cinfo->empty_password)
result = gnutls_pkcs12_bag_encrypt(bag, pass, flags);
if (result < 0) {
fprintf(
stderr
, "bag_encrypt: %s\n",
gnutls_strerror(result));
app_exit(1);
}
result = gnutls_pkcs12_set_bag(pkcs12, bag);
if (result < 0) {
fprintf(
stderr
, "set_bag: %s\n",
gnutls_strerror(result));
app_exit(1);
}
gnutls_pkcs12_bag_deinit(bag);
}
for (i = 0; i < ncrls; i++) {
gnutls_pkcs12_bag_t bag;
result = gnutls_pkcs12_bag_init(&bag);
if (result < 0) {
fprintf(
stderr
, "bag_init: %s\n",
gnutls_strerror(result));
app_exit(1);
}
result = gnutls_pkcs12_bag_set_crl(bag, crls[i]);
if (result < 0) {
fprintf(
stderr
, "set_crl[%d]: %s\n", i,
gnutls_strerror(result));
app_exit(1);
}
result = gnutls_pkcs12_bag_encrypt(bag, pass, flags);
if (result < 0) {
fprintf(
stderr
, "bag_encrypt: %s\n",
gnutls_strerror(result));
app_exit(1);
}
result = gnutls_pkcs12_set_bag(pkcs12, bag);
if (result < 0) {
fprintf(
stderr
, "set_bag: %s\n",
gnutls_strerror(result));
app_exit(1);
}
gnutls_pkcs12_bag_deinit(bag);
}
if (ca_crt) {
gnutls_pkcs12_bag_t bag;
result = gnutls_pkcs12_bag_init(&bag);
if (result < 0) {
fprintf(
stderr
, "bag_init: %s\n",
gnutls_strerror(result));
app_exit(1);
}
result = gnutls_pkcs12_bag_set_crt(bag, ca_crt);
if (result < 0) {
fprintf(
stderr
, "set_crt[%d]: %s\n", i,
gnutls_strerror(result));
app_exit(1);
}
result = gnutls_pkcs12_bag_encrypt(bag, pass, flags);
if (result < 0) {
fprintf(
stderr
, "bag_encrypt: %s\n",
gnutls_strerror(result));
app_exit(1);
}
result = gnutls_pkcs12_set_bag(pkcs12, bag);
if (result < 0) {
fprintf(
stderr
, "set_bag: %s\n",
gnutls_strerror(result));
app_exit(1);
}
gnutls_pkcs12_bag_deinit(bag);
}
for (i = 0; i < nkeys; i++) {
gnutls_pkcs12_bag_t kbag;
result = gnutls_pkcs12_bag_init(&kbag);
if (result < 0) {
fprintf(
stderr
, "bag_init: %s\n",
gnutls_strerror(result));
app_exit(1);
}
((void) sizeof ((
keys !=
((void *)0)
&& keys[i] !=
((void *)0)) ? 1 : 0), __extension__ ({ if (
keys !=
((void *)0)
&& keys[i] !=
((void *)0)) ; else __assert_fail (
"keys != NULL && keys[i] != NULL"
, "certtool.c", 3139, __extension__ __PRETTY_FUNCTION__); }))
;
size = lbuffer_size;
result =
gnutls_x509_privkey_export_pkcs8(keys[i],
GNUTLS_X509_FMT_DER,
pass, flags, lbuffer,
&size);
if (result < 0) {
fprintf(
stderr
, "key_export[%d]: %s\n", i,
gnutls_strerror(result));
app_exit(1);
}
data.data = lbuffer;
data.size = size;
result =
gnutls_pkcs12_bag_set_data(kbag,
GNUTLS_BAG_PKCS8_ENCRYPTED_KEY,
&data);
if (result < 0) {
fprintf(
stderr
, "bag_set_data: %s\n",
gnutls_strerror(result));
app_exit(1);
}
indx = result;
result =
gnutls_pkcs12_bag_set_friendly_name(kbag, indx, name);
if (result < 0) {
fprintf(
stderr
, "bag_set_friendly_name: %s\n",
gnutls_strerror(result));
app_exit(1);
}
size = sizeof(_key_id);
result =
gnutls_x509_privkey_get_key_id(keys[i], GNUTLS_KEYID_USE_SHA1, _key_id,
&size);
if (result < 0) {
fprintf(
stderr
, "key_id[%d]: %s\n", i,
gnutls_strerror(result));
app_exit(1);
}
key_id.data = _key_id;
key_id.size = size;
result = gnutls_pkcs12_bag_set_key_id(kbag, indx, &key_id);
if (result < 0) {
fprintf(
stderr
, "bag_set_key_id: %s\n",
gnutls_strerror(result));
app_exit(1);
}
result = gnutls_pkcs12_set_bag(pkcs12, kbag);
if (result < 0) {
fprintf(
stderr
, "set_bag: %s\n",
gnutls_strerror(result));
app_exit(1);
}
gnutls_pkcs12_bag_deinit(kbag);
}
result = gnutls_pkcs12_generate_mac2(pkcs12, mac, pass);
if (result < 0) {
fprintf(
stderr
, "generate_mac: %s\n",
gnutls_strerror(result));
app_exit(1);
}
size = lbuffer_size;
result =
gnutls_pkcs12_export(pkcs12, outcert_format, lbuffer, &size);
if (result < 0) {
fprintf(
stderr
, "pkcs12_export: %s\n",
gnutls_strerror(result));
app_exit(1);
}
fwrite(lbuffer, 1, size, outfile);
for (i=0;i<ncrts;i++)
gnutls_x509_crt_deinit(crts[i]);
gnutls_free((void *) (crts)), crts=
((void *)0)
;
gnutls_x509_crt_deinit(ca_crt);
gnutls_pkcs12_deinit(pkcs12);
}
| void generate_pkcs12(struct_0 *a0) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
char v5;
unsigned long long v6;
char v7;
char v8;
char v9;
char v10;
unsigned long long v11;
unsigned long long *v12;
void* v13;
unsigned long long v14;
unsigned long long *v15;
unsigned long long v16;
unsigned long v17;
unsigned int v18;
unsigned long v19;
unsigned int v20;
char v21;
char v22;
unsigned long long *v24;
unsigned long long v25;
v0 = 0;
fprintf(stderr, "Generating a PKCS #12 structure...\n");
v12 = load_privkey_list(0x0, &v8, a0);
v13 = load_cert_list(0x0, &v7, a0);
v14 = load_ca_cert(0x0, a0);
v15 = load_crl_list(0x0, &v9, a0);
if (!v12 && !v13 && !v14 && !v15) {
fprintf(stderr, "You must specify one of\n\t--load-privkey\n\t--load-certificate\n\t--load-ca-certificate\n\t--load-crl\n");
app_exit(0x1);
}
if (v15 || v13 || v14 || v12) {
if (a0->field_b0)
v1 = a0->field_b0;
else
v1 = 6;
if (g_500083)
v11 = load_request;
else
v11 = get_pkcs12_key_name();
v2 = gnutls_pkcs12_init(&v5);
if (v2 < 0) {
fprintf(stderr, "pkcs12_init: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
v16 = get_password(a0, &v0, 0x1, &v0);
v0 |= cipher_to_flags(a0->field_68);
v3 = 0;
while (true) {
if (v3 < *(&v7)) {
v2 = gnutls_pkcs12_bag_init(&v17);
if (v2 < 0) {
fprintf(stderr, "bag_init: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
if (v13 && v13[v3]) {
v2 = gnutls_pkcs12_bag_set_crt(*(&v17), v13[v3], v13[v3]);
if (v2 < 0) {
fprintf(stderr, "set_crt[%d]: %s\n", v3, gnutls_strerror(v2));
app_exit(0x1);
}
v4 = v2;
if (!v3) {
v2 = gnutls_pkcs12_bag_set_friendly_name(*(&v17), v4, v11, v4);
if (v2 < 0) {
fprintf(stderr, "bag_set_friendly_name: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
}
if (v3 || v2 >= 0) {
v6 = 64;
v2 = gnutls_x509_crt_get_key_id(v13[v3], 0x0, &v21, &v6);
if (v2 < 0) {
fprintf(stderr, "key_id[%d]: %s\n", v3, gnutls_strerror(v2));
app_exit(0x1);
}
v19 = &v21;
v20 = v6;
v2 = gnutls_pkcs12_bag_set_key_id(*(&v17), v4, &v19, v4);
if (v2 < 0) {
fprintf(stderr, "bag_set_key_id: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
if (!(v0 & 1) || a0->field_7c)
v2 = gnutls_pkcs12_bag_encrypt(*(&v17), v16, v0, v16);
if (v2 < 0) {
fprintf(stderr, "bag_encrypt: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
v2 = gnutls_pkcs12_set_bag(*(&v5), *(&v17), *(&v17));
if (v2 < 0) {
fprintf(stderr, "set_bag: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
gnutls_pkcs12_bag_deinit(*(&v17));
v3 += 1;
continue;
}
}
if (!v13 || !v13[v3])
__assert_fail();
} else {
for (v3 = 0; v3 < *(&v9); v3 += 1) {
v2 = gnutls_pkcs12_bag_init(&v17);
if (v2 < 0) {
fprintf(stderr, "bag_init: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
v2 = gnutls_pkcs12_bag_set_crl(*(&v17), v15[v3], v15[v3]);
if (v2 < 0) {
fprintf(stderr, "set_crl[%d]: %s\n", v3, gnutls_strerror(v2));
app_exit(0x1);
}
v2 = gnutls_pkcs12_bag_encrypt(*(&v17), v16, v0, v16);
if (v2 < 0) {
fprintf(stderr, "bag_encrypt: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
v2 = gnutls_pkcs12_set_bag(*(&v5), *(&v17), *(&v17));
if (v2 < 0) {
fprintf(stderr, "set_bag: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
gnutls_pkcs12_bag_deinit(*(&v17));
}
if (!v14)
break;
if (v14) {
v2 = gnutls_pkcs12_bag_init(&v17);
if (v2 < 0) {
fprintf(stderr, "bag_init: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
v2 = gnutls_pkcs12_bag_set_crt(*(&v17), v14, v14);
if (v2 < 0) {
fprintf(stderr, "set_crt[%d]: %s\n", v3, gnutls_strerror(v2));
app_exit(0x1);
}
v2 = gnutls_pkcs12_bag_encrypt(*(&v17), v16, v0, v16);
if (v2 < 0) {
fprintf(stderr, "bag_encrypt: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
v2 = gnutls_pkcs12_set_bag(*(&v5), *(&v17), *(&v17));
if (v2 < 0) {
fprintf(stderr, "set_bag: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
gnutls_pkcs12_bag_deinit(*(&v17));
break;
}
}
}
v3 = 0;
while (true) {
if (v3 < *(&v8)) {
v2 = gnutls_pkcs12_bag_init(&v10);
if (v2 < 0) {
fprintf(stderr, "bag_init: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
if (v12 && v12[v3]) {
v6 = lbuffer_size;
v2 = gnutls_x509_privkey_export_pkcs8(v12[v3], 0x0, v16, v0, lbuffer, &v6);
if (v2 < 0) {
fprintf(stderr, "key_export[%d]: %s\n", v3, gnutls_strerror(v2));
app_exit(0x1);
}
v17 = lbuffer;
v18 = v6;
v2 = gnutls_pkcs12_bag_set_data(*(&v10), 0x1, &v17);
if (v2 < 0) {
fprintf(stderr, "bag_set_data: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
v4 = v2;
v2 = gnutls_pkcs12_bag_set_friendly_name(*(&v10), v4, v11, v4);
if (v2 < 0) {
fprintf(stderr, "bag_set_friendly_name: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
v6 = 64;
v2 = gnutls_x509_privkey_get_key_id(v12[v3], 0x0, &v21, &v6);
if (v2 < 0) {
fprintf(stderr, "key_id[%d]: %s\n", v3, gnutls_strerror(v2));
app_exit(0x1);
}
v19 = &v21;
v20 = v6;
v2 = gnutls_pkcs12_bag_set_key_id(*(&v10), v4, &v19, v4);
if (v2 < 0) {
fprintf(stderr, "bag_set_key_id: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
v2 = gnutls_pkcs12_set_bag(*(&v5), *(&v10), *(&v10));
if (v2 < 0) {
fprintf(stderr, "set_bag: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
gnutls_pkcs12_bag_deinit(*(&v10));
v3 += 1;
continue;
}
if (!v12[v3] || !v12)
__assert_fail();
} else {
v2 = gnutls_pkcs12_generate_mac2(*(&v5), v1, v16, v1);
if (v2 < 0) {
fprintf(stderr, "generate_mac: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
*(&v6) = lbuffer_size;
v2 = gnutls_pkcs12_export(*(&v5), outcert_format, lbuffer, &v6);
if (v2 < 0) {
fprintf(stderr, "pkcs12_export: %s\n", gnutls_strerror(v2));
app_exit(0x1);
}
fwrite(lbuffer, 0x1, *(&v6), outfile);
v3 = 0;
break;
}
}
for (; v3 < *(&v7); v3 += 1) {
gnutls_x509_crt_deinit(v13[v3]);
}
*(5243720)(v13);
v13 = 0;
gnutls_x509_crt_deinit(v14);
gnutls_pkcs12_deinit(*(&v5));
v25 = *(&v22) ^ v24[5];
return;
}
}
|
void
rmaliases(void)
{
struct alias *ap, **app;
int i;
({ suppressint++; ({ __asm__ __volatile__ ("": : :"memory"); }); 0; });
for (i = 0; i < 39; i++) {
app = &atab[i];
for (ap = *app; ap; ap = *app) {
*app = freealias(*app);
if (ap == *app) {
app = &ap->next;
}
}
}
({ ({ __asm__ __volatile__ ("": : :"memory"); }); if (--suppressint == 0 && intpending) onint(); 0; });
}
| void rmaliases() {
unsigned int v0;
unsigned long long v1;
unsigned long long *v2;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
suppressint = suppressint + 1;
for (v0 = 0; v0 <= 38; v0 += 1) {
v2 = &(&atab)[v0];
for (v1 = *(v2); v1; v1 = *(v2)) {
*(v2) = freealias(*(v2));
if (v1 == *(v2))
v2 = v1;
}
}
suppressint = suppressint - 1;
v4 = suppressint;
if (!suppressint) {
v5 = intpending;
if (intpending)
v6 = onint();
}
return;
}
|
static inline char *bltinlookup(const char *name)
{
return lookupvar(name);
}
| int bltinlookup(unsigned long long a0) {
return lookupvar(a0);
}
|
void BZ2_bsInitWrite ( EState* s )
{
s->bsLive = 0;
s->bsBuff = 0;
}
| void BZ2_bsInitWrite(unsigned int a0[162]) {
char v0;
unsigned int v2[162];
unsigned long long v3;
a0[161] = 0;
v2 = a0;
a0[160] = 0;
v3 = *(&v0);
return;
}
|
static int print_fou_mapping(struct nlmsghdr *n, void *arg)
{
__u8 family =
2
, local_attr_type, peer_attr_type, byte_len;
struct rtattr *tb[(__FOU_ATTR_MAX - 1) + 1];
__u8 empty_buf[16] = {0};
struct genlmsghdr *ghdr;
int len = n->nlmsg_len;
if (n->nlmsg_type != genl_family)
return 0;
len -= ((( ((sizeof(struct genlmsghdr))+4U -1) & ~(4U -1) )) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) )));
if (len < 0)
return -1;
ghdr = ((void *)(((char *)n) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))));
parse_rtattr(tb, (__FOU_ATTR_MAX - 1), (void *) ghdr + ( ((sizeof(struct genlmsghdr))+4U -1) & ~(4U -1) ), len);
open_json_object(
((void *)0)
);
if (tb[FOU_ATTR_PORT])
print_uint(PRINT_ANY, "port", "port %u",
ntohs(rta_getattr_u16(tb[FOU_ATTR_PORT])));
if (tb[FOU_ATTR_TYPE] &&
rta_getattr_u8(tb[FOU_ATTR_TYPE]) == FOU_ENCAP_GUE)
print_null(PRINT_ANY, "gue", " gue",
((void *)0)
);
else if (tb[FOU_ATTR_IPPROTO])
print_uint(PRINT_ANY, "ipproto",
" ipproto %u", rta_getattr_u8(tb[FOU_ATTR_IPPROTO]));
if (tb[FOU_ATTR_AF]) {
family = rta_getattr_u8(tb[FOU_ATTR_AF]);
print_string(PRINT_JSON, "family",
((void *)0)
,
family_name(family));
if (family ==
10
)
print_string(PRINT_FP,
((void *)0)
,
" -6",
((void *)0)
);
}
local_attr_type = family ==
2
? FOU_ATTR_LOCAL_V4 :
FOU_ATTR_LOCAL_V6;
peer_attr_type = family ==
2
? FOU_ATTR_PEER_V4 :
FOU_ATTR_PEER_V6;
byte_len = af_bit_len(family) / 8;
if (tb[local_attr_type] && memcmp(((void*)(((char*)(tb[local_attr_type])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
empty_buf, byte_len)) {
print_string(PRINT_ANY, "local", " local %s",
format_host(family, ((int)((tb[local_attr_type])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), ((void*)(((char*)(tb[local_attr_type])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))))));
}
if (tb[peer_attr_type] && memcmp(((void*)(((char*)(tb[peer_attr_type])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
empty_buf, byte_len)) {
print_string(PRINT_ANY, "peer", " peer %s",
format_host(family, ((int)((tb[peer_attr_type])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), ((void*)(((char*)(tb[peer_attr_type])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))))));
}
if (tb[FOU_ATTR_PEER_PORT]) {
__u16 p_port = ntohs(rta_getattr_u16(tb[FOU_ATTR_PEER_PORT]));
if (p_port)
print_uint(PRINT_ANY, "peer_port", " peer_port %u",
p_port);
}
if (tb[FOU_ATTR_IFINDEX]) {
int index = rta_getattr_s32(tb[FOU_ATTR_IFINDEX]);
if (index) {
const char *ifname;
ifname = ll_index_to_name(index);
if (ifname)
print_string(PRINT_ANY, "dev", " dev %s",
ifname);
}
}
print_string(PRINT_FP,
((void *)0)
, "\n",
((void *)0)
);
close_json_object();
return 0;
}
| long long print_fou_mapping(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned long v0;
char v1;
char v2;
char v3;
char v4;
unsigned short v5;
unsigned int v6;
unsigned int v7;
unsigned long v8;
unsigned long long v9;
char v10;
char v11;
char v12;
char v13;
char v14;
char v15;
char v16;
void* v17;
void* v18;
unsigned long long v20;
char v21;
unsigned long long v22;
v0 = a1;
v1 = 2;
v17 = 0;
v18 = 0;
v6 = a0->field_0;
if (a0->field_4 != genl_family) {
v20 = 0;
} else {
v6 -= 20;
if (v6 < 0) {
v20 = 4294967295;
} else {
v8 = &a0[2].field_4;
parse_rtattr(&v10, 0xb, v8 + 4, v6);
open_json_object(0x0);
if (*(&v11))
print_uint(0x4, "port", "port %u", ntohs(rta_getattr_u16(*(&v11))));
if (*(&v14)) {
v21 = rta_getattr_u8(*(&v14));
if (v21 == 2)
print_null(0x4, "gue", " gue", 0x0);
}
if ((!*(&v14) || v21 != 2) && *(&v13))
print_uint(0x4, "ipproto", " ipproto %u", rta_getattr_u8(*(&v13)));
if (*(&v12)) {
v1 = rta_getattr_u8(*(&v12));
print_string(0x2, "family", 0x0, family_name(v1));
if (v1 == 10)
print_string(0x1, 0x0, " -6", 0x0);
}
if (v1 == 2)
v21 = 6;
else
v21 = 7;
v2 = v21;
if (v1 == 2)
v21 = 8;
else
v21 = 9;
v3 = v21;
v22 = af_bit_len(v1);
*(&v22) = (v22 < 0 ? (v22 + 7) : v22) >> 3;
v4 = v22;
if (*(&(&v10)[8 * v2]) && memcmp(*(&(&v10)[8 * v2]) + 4, &v17, v4))
print_string(0x4, "local", " local %s", format_host(v1, *(*(&(&v10)[8 * v2])) - 4, *(&(&v10)[8 * v2]) + 4, *(*(&(&v10)[8 * v2])) - 4));
if (*(&(&v10)[8 * v3]) && memcmp(*(&(&v10)[8 * v3]) + 4, &v17, v4))
print_string(0x4, "peer", " peer %s", format_host(v1, *(*(&(&v10)[8 * v3])) - 4, *(&(&v10)[8 * v3]) + 4, *(*(&(&v10)[8 * v3])) - 4));
if (*(&v15)) {
v5 = ntohs(rta_getattr_u16(*(&v15)));
if (v5)
print_uint(0x4, "peer_port", " peer_port %u", v5);
}
if (*(&v16)) {
v7 = rta_getattr_s32(*(&v16));
if (v7) {
v9 = ll_index_to_name(v7);
if (v9)
print_string(0x4, "dev", " dev %s", v9);
}
}
print_string(0x1, 0x0, "\n", 0x0);
close_json_object(0x1, 0x0, "\n", 0x0, a4, a5);
v20 = 0;
}
}
return v20;
}
|
static void new_sgent (struct sgrp *sgent)
{
explicit_bzero((sgent), (sizeof *sgent));
sgent->sg_name = group_name;
if (pflg) {
sgent->sg_passwd = group_passwd;
} else {
sgent->sg_passwd = "!";
}
sgent->sg_adm = &empty_list;
sgent->sg_mem = &empty_list;
}
| long long new_sgent(unsigned long long a0[4]) {
explicit_bzero(a0, 0x20);
a0[0] = group_name;
if (pflg)
a0[1] = group_passwd;
else
a0[1] = "!";
a0[2] = &empty_list;
a0[3] = &empty_list;
return a0;
}
|
static int
rl_change_case (int count, int op)
{
int start, next, end;
int inword, nc, nop;
wchar_t c;
wchar_t wc, nwc;
char mb[
16
+1];
int mlen;
size_t m;
mbstate_t mps;
start = rl_point;
rl_forward_word (count, 0);
end = rl_point;
if (op != 1 && op != 2 && op != 3)
{
rl_ding ();
return 1;
}
if (count < 0)
do { int t; t = start; start = end; end = t; } while (0);
memset (&mps, 0, sizeof (mbstate_t));
rl_modifying (start, end);
inword = 0;
while (start < end)
{
c = _rl_char_value (rl_line_buffer, start);
next = ((
(__ctype_get_mb_cur_max ())
> 1 && rl_byte_oriented == 0) ? _rl_find_next_mbchar ((rl_line_buffer), (start), (1), (0x01)) : ((start) + (1)));
if (_rl_walphabetic (c) == 0)
{
inword = 0;
start = next;
continue;
}
if (op == 3)
{
nop = inword ? 2 : 1;
inword = 1;
}
else
nop = op;
if (
(__ctype_get_mb_cur_max ())
== 1 || rl_byte_oriented)
{
nc = (nop == 1) ? ((1 && (1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)c
))] & (unsigned short int) _ISlower)
)) ? toupper((unsigned char)(c)) : (c)) : ((1 && (1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)c
))] & (unsigned short int) _ISupper)
)) ? tolower((unsigned char)(c)) : (c));
rl_line_buffer[start] = nc;
}
else
{
m = mbrtowc (&wc, rl_line_buffer + start, end - start, &mps);
if (((m) == (size_t)-1 || (m) == (size_t)-2))
wc = (wchar_t)rl_line_buffer[start];
else if (((m) == 0))
wc = L'\0';
nwc = (nop == 1) ? (iswlower (wc) ? towupper (wc) : (wc)) : (iswupper (wc) ? towlower (wc) : (wc));
if (nwc != wc)
{
char *s, *e;
mbstate_t ts;
memset (&ts, 0, sizeof (mbstate_t));
mlen = wcrtomb (mb, nwc, &ts);
if (mlen < 0)
{
nwc = wc;
memset (&ts, 0, sizeof (mbstate_t));
mlen = wcrtomb (mb, nwc, &ts);
if (mlen < 0)
strncpy (mb, rl_line_buffer + start, mlen = m);
}
if (mlen > 0)
mb[mlen] = '\0';
s = rl_line_buffer + start;
e = rl_line_buffer + rl_end;
if (m == mlen)
memcpy (s, mb, mlen);
else if (m > mlen)
{
memcpy (s, mb, mlen);
memmove (s + mlen, s + m, (e - s) - m);
next -= m - mlen;
end -= m - mlen;
rl_end -= m - mlen;
rl_line_buffer[rl_end] = 0;
}
else if (m < mlen)
{
rl_extend_line_buffer (rl_end + mlen + (e - s) - m + 2);
s = rl_line_buffer + start;
e = rl_line_buffer + rl_end;
memmove (s + mlen, s + m, (e - s) - m);
memcpy (s, mb, mlen);
next += mlen - m;
end += mlen - m;
rl_end += mlen - m;
rl_line_buffer[rl_end] = 0;
}
}
}
start = next;
}
rl_point = end;
return 0;
}
| void rl_change_case(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
unsigned long v11;
void* v12;
unsigned long v13;
char v14;
char v15;
char v16;
unsigned long long v18;
unsigned int v19;
void* v20;
v1 = rl_point;
rl_forward_word(a0, 0x0);
v3 = rl_point;
if (a1 != 1 && a1 != 2 && a1 != 3) {
rl_ding();
v18 = 1;
goto LABEL_402581;
}
if (a0 < 0) {
v7 = v1;
v1 = v3;
v3 = v7;
}
memset(&v14, 0x0, 0x8);
rl_modifying(v1, v3, v3);
v4 = 0;
while (true) {
if (v1 >= v3)
break;
v8 = _rl_char_value(rl_line_buffer, v1, v1);
if (__ctype_get_mb_cur_max() > 1 && !rl_byte_oriented) {
v19 = _rl_find_next_mbchar(rl_line_buffer, v1, 0x1, 0x1);
goto LABEL_402109;
}
v19 = v1 + 1;
LABEL_402109:
v2 = v19;
if (!_rl_walphabetic(v8)) {
v4 = 0;
v1 = v2;
continue;
}
if (a1 != 3) {
v5 = a1;
} else {
if (!v4)
v19 = 1;
else
v19 = 2;
v5 = v19;
v4 = 1;
}
if (__ctype_get_mb_cur_max() == 1) {
LABEL_402175:
if (v5 != 1) {
*(&v19) = *((*(__ctype_b_loc()) + v8 * 2));
v19 = v19 & 0x100;
if (!v19)
v19 = v8;
else
v19 = tolower(v8);
} else {
*(&v19) = *((*(__ctype_b_loc()) + v8 * 2));
v19 = v19 & 0x200;
if (v19)
v19 = toupper(v8);
else
v19 = v8;
}
v10 = v19;
*((v1 + rl_line_buffer)) = v10;
goto LABEL_402561;
} else {
if (!(!rl_byte_oriented))
goto LABEL_402175;
v11 = mbrtowc(&v0, rl_line_buffer + v1, v3 - v1, &v14);
if (v11 == -1) {
LABEL_40223e:
v0 = *((v1 + rl_line_buffer));
goto LABEL_402266;
} else {
if (v11 == -2)
goto LABEL_40223e;
if (!v11)
v0 = 0;
LABEL_402266:
if (v5 == 1) {
if (iswlower(v0))
v19 = towupper(v0);
else
v19 = v0;
} else {
if (!iswupper(v0))
v19 = v0;
else
v19 = towlower(v0);
}
v9 = v19;
if (v9 != v0) {
memset(&v15, 0x0, 0x8);
v6 = wcrtomb(&v16, v9, &v15, v9);
if (v6 < 0) {
v9 = v0;
memset(&v15, 0x0, 0x8);
v6 = wcrtomb(&v16, v9, &v15, v9);
if (v6 < 0) {
v6 = v11;
strncpy(&v16, rl_line_buffer + v1, v6);
}
}
if (v6 > 0)
(&v16)[v6] = 0;
v12 = v1 + rl_line_buffer;
v13 = rl_end + rl_line_buffer;
if (v11 == v6) {
memcpy(v12, &v16, v6);
} else if (v11 > v6) {
memcpy(v12, &v16, v6);
memmove(v6 + v12, v12 + v11, v13 - v12 - v11);
v2 += v6 - v11;
v3 += v6 - v11;
rl_end = rl_end + v6 - v11;
*((rl_end + rl_line_buffer)) = 0;
} else if (v11 < v6) {
rl_extend_line_buffer(v6 + rl_end + (v13 - v12) - v11 + 2);
v12 = v1 + rl_line_buffer;
v13 = rl_end + rl_line_buffer;
memmove(v6 + v12, v12 + v11, v13 - v12 - v11);
memcpy(v12, &v16, v6);
v2 += v6 - v11;
v3 += v6 - v11;
rl_end = rl_end + v6 - v11;
*((rl_end + rl_line_buffer)) = 0;
}
}
LABEL_402561:
v1 = v2;
}
}
}
rl_point = v3;
v20 = 0;
LABEL_402581:
return;
}
|
static int e2fsck_journal_sb_csum_verify(journal_t *j,
journal_superblock_t *jsb)
{
__u32 provided, calculated;
if (!jbd2_journal_has_csum_v2or3(j))
return 1;
provided = ext2fs_swab32(( __u32)(__be32)(jsb->s_checksum));
calculated = e2fsck_journal_sb_csum(jsb);
return provided == calculated;
}
| int e2fsck_journal_sb_csum_verify(void* a0, struct_0 *a1, unsigned int a2, unsigned long long a3) {
unsigned int v0;
unsigned int v1;
unsigned int v3;
if (!jbd2_journal_has_csum_v2or3(a0)) {
v3 = 1;
return v3;
}
v0 = ext2fs_swab32(a1->field_fc);
v1 = e2fsck_journal_sb_csum(a1, a1, a2, a3);
v3 = v0 == v1;
return v3;
}
|
pid_t
sys_child_open_for_compress (void)
{
int parent_pipe[2];
int child_pipe[2];
pid_t grandchild_pid;
pid_t child_pid;
signal (
13
,
((__sighandler_t) 1)
);
xpipe (parent_pipe);
child_pid = xfork ();
if (child_pid > 0)
{
archive = parent_pipe[1];
xclose (parent_pipe[0]);
return child_pid;
}
set_program_name (gettext ("tar (child)"));
signal (
13
,
((__sighandler_t) 0)
);
xdup2 (parent_pipe[0],
0
);
xclose (parent_pipe[1]);
if (!(!force_local_option && (rmt_dev_name__ = strchr (archive_name_array[0], ':')) && rmt_dev_name__ > (archive_name_array[0]) && ! memchr (archive_name_array[0], '/', rmt_dev_name__ - (archive_name_array[0])))
&& is_regular_file (archive_name_array[0]))
{
if (backup_option)
maybe_backup_file (archive_name_array[0], 1);
if (strcmp (archive_name_array[0], "-"))
{
archive = creat (archive_name_array[0], (
0200
|
(0200 >> 3)
|
((0200 >> 3) >> 3)
| (
0400
|
(0400 >> 3)
|
((0400 >> 3) >> 3)
)));
if (archive < 0)
{
int saved_errno =
(*__errno_location ())
;
if (backup_option)
undo_last_backup ();
(*__errno_location ())
= saved_errno;
open_fatal (archive_name_array[0]);
}
xdup2 (archive,
1
);
}
priv_set_restore_linkdir ();
xexec (use_compress_program_option);
}
xpipe (child_pipe);
grandchild_pid = xfork ();
if (grandchild_pid == 0)
{
set_program_name (gettext ("tar (grandchild)"));
xdup2 (child_pipe[1],
1
);
xclose (child_pipe[0]);
priv_set_restore_linkdir ();
xexec (use_compress_program_option);
}
xdup2 (child_pipe[0],
0
);
xclose (child_pipe[1]);
if (strcmp (archive_name_array[0], "-") == 0)
archive =
1
;
else
{
archive = ((!force_local_option && (rmt_dev_name__ = strchr (archive_name_array[0], ':')) && rmt_dev_name__ > (archive_name_array[0]) && ! memchr (archive_name_array[0], '/', rmt_dev_name__ - (archive_name_array[0]))) ? rmt_open__ (archive_name_array[0],
0100
|
01
, (1 << 30), rsh_command_option) : creat (archive_name_array[0], (
0200
|
(0200 >> 3)
|
((0200 >> 3) >> 3)
| (
0400
|
(0400 >> 3)
|
((0400 >> 3) >> 3)
))));
if (archive < 0)
open_fatal (archive_name_array[0]);
}
while (1)
{
size_t status = 0;
char *cursor;
size_t length;
for (length = 0, cursor = record_start->buffer;
length < record_size;
length += status, cursor += status)
{
size_t size = record_size - length;
status = safe_read (
0
, cursor, size);
if (status == ((size_t) -1))
read_fatal (use_compress_program_option);
if (status == 0)
break;
}
if (status == 0)
{
if (length > 0)
{
memset (record_start->buffer + length, 0, record_size - length);
status = sys_write_archive_buffer ();
if (status != record_size)
archive_write_error (status);
}
break;
}
status = sys_write_archive_buffer ();
if (status != record_size)
archive_write_error (status);
}
wait_for_grandchild (grandchild_pid);
}
| long long sys_child_open_for_compress(unsigned long a0, unsigned long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
unsigned long long *v4;
void* v5;
unsigned long long v6;
char v7;
char v8;
char v9;
char v10;
unsigned long v11;
unsigned long long *v13;
unsigned long long v14;
v11 = v13[5];
signal(0xd, 0x1);
xpipe(&v7);
v0 = xfork();
if (v0 <= 0) {
set_program_name(gettext("tar (child)"));
signal(0xd, 0x0);
xdup2(*(&v7), 0x0, a2, a3, a4, a5);
xclose(*(&v8));
if (!force_local_option) {
rmt_dev_name__ = strchr(*(archive_name_array), 0x3a);
if (!(!rmt_dev_name__) && !(*(archive_name_array) >= rmt_dev_name__) && !(memchr(*(archive_name_array), 0x2f, rmt_dev_name__ - *(archive_name_array)))) {
LABEL_400966:
xpipe(&v9);
v2 = xfork();
if (!v2) {
set_program_name(gettext("tar (grandchild)"));
xdup2(*(&v10), 0x1, a2, a3, a4, a5);
xclose(*(&v9));
priv_set_restore_linkdir();
xexec(*(&use_compress_program_option));
}
xdup2(*(&v9), 0x0, a2, a3, a4, a5);
xclose(*(&v10));
if (!strcmp(*(archive_name_array), "-")) {
archive = 1;
} else {
if (!(force_local_option ^ 1)) {
v14 = creat(*(archive_name_array), 0x1b6);
} else {
rmt_dev_name__ = strchr(*(archive_name_array), 0x3a);
if (!rmt_dev_name__) {
v14 = creat(*(archive_name_array), 0x1b6);
} else if (*(archive_name_array) >= rmt_dev_name__) {
v14 = creat(*(archive_name_array), 0x1b6);
} else if (!memchr(*(archive_name_array), 0x2f, rmt_dev_name__ - *(archive_name_array))) {
v14 = rmt_open__(*(archive_name_array), 0x41, 0x40000000, rsh_command_option);
} else {
v14 = creat(*(archive_name_array), 0x1b6);
}
}
archive = v14;
if (archive < 0)
open_fatal(*(archive_name_array));
}
while (true) {
v3 = 0;
v5 = 0;
v4 = record_start;
while (true) {
if (v5 >= record_size)
break;
v6 = record_size - v5;
v3 = safe_read(0x0, v4, v6);
if (v3 == -1)
read_fatal(*(&use_compress_program_option));
if (!v3)
break;
v5 += v3;
v4 += v3;
}
if (!v3) {
if (!v5)
wait_for_grandchild(v2);
memset(record_start + v5, 0x0, record_size - v5);
v3 = sys_write_archive_buffer();
if (v3 == record_size)
wait_for_grandchild(v2);
archive_write_error(v3);
}
v3 = sys_write_archive_buffer();
if (v3 != record_size) {
archive_write_error(v3);
wait_for_grandchild(v2);
}
}
}
}
if (is_regular_file(*(archive_name_array))) {
if (backup_option)
maybe_backup_file(*(archive_name_array), 0x1);
if (strcmp(*(archive_name_array), "-")) {
archive = creat(*(archive_name_array), 0x1b6);
if (archive < 0) {
v1 = *(__errno_location());
if (backup_option)
undo_last_backup();
*(__errno_location()) = v1;
open_fatal(*(archive_name_array));
}
xdup2(archive, 0x1, rmt_dev_name__ - *(archive_name_array), a3, a4, a5);
}
priv_set_restore_linkdir();
xexec(*(&use_compress_program_option));
}
goto LABEL_400966;
} else {
archive = *(&v8);
xclose(*(&v7));
if ((v11 ^ v13[5]))
__stack_chk_fail();
return v0;
}
}
|
static const struct mod **mod_get_all_sorted_dependencies(const struct mod *mod, size_t *n_deps)
{
const struct mod **deps;
size_t last = 0;
*n_deps = mod_count_all_dependencies(mod);
if (*n_deps == 0)
return
((void *)0)
;
deps = malloc(sizeof(struct mod *) * (*n_deps));
if (deps ==
((void *)0)
)
return
((void *)0)
;
if (mod_fill_all_unique_dependencies(mod, deps, *n_deps, &last) < 0) {
free(deps);
return
((void *)0)
;
}
qsort(deps, last, sizeof(struct mod *), dep_cmp);
*n_deps = last;
return deps;
}
| int mod_get_all_sorted_dependencies(void* a0, unsigned long long *a1) {
void* v0;
void* v1;
unsigned int v3;
v0 = 0;
*(a1) = mod_count_all_dependencies(a0);
if (!*(a1)) {
v3 = 0;
} else {
v1 = malloc(*(a1) * 8);
if (!v1) {
v3 = 0;
} else {
v3 = mod_fill_all_unique_dependencies(a0, v1, *(a1), &v0);
if (v3 < 0) {
free(v1);
v3 = 0;
} else {
qsort(v1, v0, 0x8, dep_cmp);
*(a1) = v0;
v3 = v1;
}
}
}
return v3;
}
|
static int do_add(int cmd, int argc, char **argv)
{
struct ip_tunnel_parm p;
const char *basedev;
if (parse_args(argc, argv, cmd, &p) < 0)
return -1;
if (p.iph.ttl && p.iph.frag_off == 0) {
fprintf(
stderr
, "ttl != 0 and nopmtudisc are incompatible\n");
return -1;
}
basedev = tnl_defname(&p);
if (!basedev) {
fprintf(
stderr
,
"cannot determine tunnel mode (ipip, gre, vti or sit)\n");
return -1;
}
return tnl_add_ioctl(cmd, basedev, p.name, &p);
}
| undefined8 do_add(undefined4 param_1,undefined4 param_2,undefined8 param_3)
{
int iVar1;
undefined8 uVar2;
long lVar3;
long in_FS_OFFSET;
undefined local_48 [38];
short local_22;
char local_20;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = parse_args(param_2,param_3,param_1,local_48);
if (iVar1 < 0) {
uVar2 = 0xffffffff;
}
else if ((local_20 == '\0') || (local_22 != 0)) {
lVar3 = tnl_defname(local_48);
if (lVar3 == 0) {
fprintf(stderr,"cannot determine tunnel mode (ipip, gre, vti or sit)\n");
uVar2 = 0xffffffff;
}
else {
uVar2 = tnl_add_ioctl(param_1,lVar3,local_48,local_48);
}
}
else {
fprintf(stderr,"ttl != 0 and nopmtudisc are incompatible\n");
uVar2 = 0xffffffff;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
}
|
static int
posix_cclass_only (pattern)
char *pattern;
{
char *p, *p1;
char cc[16];
enum char_class valid;
p = pattern;
while (p = strchr (p, '['))
{
if (p[1] != ':')
{
p++;
continue;
}
p += 2;
for (p1 = p; *p1; p1++)
if (*p1 == ':' && p1[1] == ']')
break;
if (*p1 == 0)
break;
if ((p1 - p) >= sizeof (cc))
return 0;
bcopy (p, cc, p1 - p);
cc[p1 - p] = '\0';
valid = is_valid_cclass (cc);
if (valid == CC_NO_CLASS)
return 0;
p = p1 + 2;
}
return 1;
}
| undefined8 posix_cclass_only(char *param_1)
{
int iVar1;
undefined8 uVar2;
long in_FS_OFFSET;
char *local_38;
char *local_30;
char local_28 [24];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_38 = param_1;
while (local_38 = strchr(local_38,0x5b), local_38 != (char *)0x0) {
if (local_38[1] == ':') {
local_38 = local_38 + 2;
for (local_30 = local_38; (*local_30 != '\0' && ((*local_30 != ':' || (local_30[1] != ']'))));
local_30 = local_30 + 1) {
}
if (*local_30 == '\0') break;
if (0xf < (ulong)((long)local_30 - (long)local_38)) {
uVar2 = 0;
goto LAB_0010299a;
}
bcopy(local_38,local_28,(long)local_30 - (long)local_38);
local_30[(long)(local_28 + -(long)local_38)] = '\0';
iVar1 = is_valid_cclass(local_28);
if (iVar1 == 0) {
uVar2 = 0;
goto LAB_0010299a;
}
local_38 = local_30 + 2;
}
else {
local_38 = local_38 + 1;
}
}
uVar2 = 1;
LAB_0010299a:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar2;
}
__stack_chk_fail();
}
|
static
_Bool
get_funky_string (char **dest, char const **src,
_Bool
equals_end,
size_t *output_count)
{
char num;
size_t count;
enum {
ST_GND, ST_BACKSLASH, ST_OCTAL, ST_HEX, ST_CARET, ST_END, ST_ERROR
} state;
char const *p;
char *q;
p = *src;
q = *dest;
count = 0;
num = 0;
state = ST_GND;
while (state < ST_END)
{
switch (state)
{
case ST_GND:
switch (*p)
{
case ':':
case '\0':
state = ST_END;
break;
case '\\':
state = ST_BACKSLASH;
++p;
break;
case '^':
state = ST_CARET;
++p;
break;
case '=':
if (equals_end)
{
state = ST_END;
break;
}
__attribute__ ((__fallthrough__));
default:
*(q++) = *(p++);
++count;
break;
}
break;
case ST_BACKSLASH:
switch (*p)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
state = ST_OCTAL;
num = *p - '0';
break;
case 'x':
case 'X':
state = ST_HEX;
num = 0;
break;
case 'a':
num = '\a';
break;
case 'b':
num = '\b';
break;
case 'e':
num = 27;
break;
case 'f':
num = '\f';
break;
case 'n':
num = '\n';
break;
case 'r':
num = '\r';
break;
case 't':
num = '\t';
break;
case 'v':
num = '\v';
break;
case '?':
num = 127;
break;
case '_':
num = ' ';
break;
case '\0':
state = ST_ERROR;
break;
default:
num = *p;
break;
}
if (state == ST_BACKSLASH)
{
*(q++) = num;
++count;
state = ST_GND;
}
++p;
break;
case ST_OCTAL:
if (*p < '0' || *p > '7')
{
*(q++) = num;
++count;
state = ST_GND;
}
else
num = (num << 3) + (*(p++) - '0');
break;
case ST_HEX:
switch (*p)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
num = (num << 4) + (*(p++) - '0');
break;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
num = (num << 4) + (*(p++) - 'a') + 10;
break;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
num = (num << 4) + (*(p++) - 'A') + 10;
break;
default:
*(q++) = num;
++count;
state = ST_GND;
break;
}
break;
case ST_CARET:
state = ST_GND;
if (*p >= '@' && *p <= '~')
{
*(q++) = *(p++) & 037;
++count;
}
else if (*p == '?')
{
*(q++) = 127;
++count;
}
else
state = ST_ERROR;
break;
default:
abort ();
}
}
*dest = q;
*src = p;
*output_count = count;
return state != ST_ERROR;
}
| int get_funky_string(unsigned long long *a0, unsigned long long *a1, unsigned long long a2, unsigned long a3) {
unsigned long long *v0;
int tmp_14;
int tmp_25;
int tmp_43;
int tmp_17;
char v1;
unsigned int v2;
void* v3;
unsigned long v4;
unsigned long long v5;
char *v7;
v0 = a3;
v4 = *(a1);
v5 = *(a0);
v3 = 0;
v1 = 0;
v2 = 0;
while (true) {
if (v2 > 4) {
*(a0) = v5;
*(a1) = v4;
*(&v7) = v0;
*(v0) = v3;
*(&v7) = v2 != 6;
return v7;
}
switch (v2) {
case 0:
if (*(v4) == 94) {
v2 = 4;
v4 += 1;
break;
}
if (*(v4) <= 94) {
if (*(v4) == 92) {
v2 = 1;
v4 += 1;
break;
}
if (*(v4) <= 92) {
if (*(v4) == 61) {
if (a2) {
v2 = 5;
break;
}
} else {
if (*(v4) <= 61) {
if (*(v4) && !(*(v4) == 58))
goto LABEL_40353c;
v2 = 5;
break;
}
}
}
}
LABEL_40353c:
tmp_14 = v4;
v4 += 1;
v7 = v5;
v5 += 1;
*(&a2) = *(tmp_14);
*(v7) = a2;
v3 += 1;
continue;
case 1:
if (!*(v4)) {
v2 = 6;
} else {
if (*(v4) < 0)
goto LABEL_403627;
if (!(*(v4) <= 120))
goto LABEL_403627;
if (*(v4) < 48)
goto LABEL_403627;
switch (*(v4)) {
case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55:
v2 = 2;
v1 = *(v4) - 48;
break;
case 63:
v1 = 127;
break;
case 88: case 120:
v2 = 3;
v1 = 0;
break;
case 95:
v1 = 32;
break;
case 97:
v1 = 7;
break;
case 98:
v1 = 8;
break;
case 101:
v1 = 27;
break;
case 102:
v1 = 12;
break;
case 110:
v1 = 10;
break;
case 114:
v1 = 13;
break;
case 116:
v1 = 9;
break;
case 118:
v1 = 11;
break;
default:
LABEL_403627:
v1 = *(v4);
break;
}
}
if (v2 == 1) {
v7 = v5;
v5 += 1;
*(v7) = v1;
v3 += 1;
v2 = 0;
}
v4 += 1;
continue;
case 2:
if (*(v4) > 47 && *(v4) <= 55) {
tmp_25 = v4;
v4 += 1;
v7 = *(tmp_25) + (v1 * 8) - 48;
v1 = v7;
LABEL_4036b8:
continue;
}
v7 = v5;
v5 += 1;
*(v7) = v1;
v3 += 1;
v2 = 0;
goto LABEL_4036b8;
case 3:
if (*(v4) <= 102) {
if (*(v4) >= 97) {
tmp_43 = v4;
v4 += 1;
v7 = *(tmp_43) + (v1 * 16) - 87;
v1 = v7;
goto LABEL_403770;
}
if (*(v4) <= 57) {
if (*(v4) >= 48) {
tmp_43 = v4;
v4 += 1;
v7 = *(tmp_43) + (v1 * 16) - 48;
v1 = v7;
goto LABEL_403770;
}
} else {
if (*(v4) - 65 <= 5) {
tmp_43 = v4;
v4 += 1;
v7 = *(tmp_43) + (v1 * 16) - 55;
v1 = v7;
goto LABEL_403770;
}
}
}
v7 = v5;
v5 += 1;
*(v7) = v1;
v3 += 1;
v2 = 0;
LABEL_403770:
continue;
case 4:
v2 = 0;
if (*(v4) > 63 && *(v4) != 127) {
tmp_17 = v4;
v4 += 1;
v7 = v5;
v5 += 1;
*(&a2) = *(tmp_17) & 31;
*(v7) = a2;
v3 += 1;
goto LABEL_4037e0;
}
if (*(v4) != 63) {
v2 = 6;
} else {
v7 = v5;
v5 += 1;
*(v7) = 127;
v3 += 1;
continue;
}
LABEL_4037e0:
continue;
default:
abort();
}
}
}
|
static struct argp_option const *
find_argp_option (struct argp *ap, int key)
{
struct argp_option const *p =
((void *)0)
;
struct argp_child const *child;
p = find_argp_option_key (ap->options, key);
if (!p && ap->children)
{
for (child = ap->children; child->argp; child++)
{
p = find_argp_option_key (child->argp->options, key);
if (p)
break;
}
}
return p;
}
| int find_argp_option(unsigned long long a0[5], unsigned long a1) {
unsigned long v0;
unsigned long long **v1;
v0 = 0;
v0 = find_argp_option_key(a0[0], a1);
if (!v0 && a0[4]) {
for (v1 = a0[4]; *(v1); v1 += 4) {
v0 = find_argp_option_key(*(*(v1)), a1);
if (v0)
break;
}
}
return v0;
}
|
inline void ext2fs_dirent_set_file_type(struct ext2_dir_entry *entry, int type)
{
entry->name_len = (entry->name_len & 0xff) | (type << 8);
}
| void ext2fs_dirent_set_file_type(void)
{
halt_baddata();
}
|
void
format_absolute_time(uint64_t t, char *buf, size_t len)
{
time_t tt = t > 0x7fffffffffffffffLL ? 0x7fffffffffffffffLL : t;
struct tm tm;
localtime_r(&tt, &tm);
strftime(buf, len, "%Y-%m-%dT%H:%M:%S", &tm);
}
| long long format_absolute_time(unsigned long long a0, char *a1, unsigned int a2) {
unsigned long long v0;
char v1;
unsigned long long v3;
if (a0 < 0)
v3 = 9223372036854775807;
else
v3 = a0;
v0 = v3;
localtime_r(&v0, &v1);
strftime(a1, a2, "%Y-%", &v1);
return 0;
}
|
static BitStream* bsOpenWriteStream ( FILE* stream )
{
BitStream *bs = malloc ( sizeof(BitStream) );
if (bs ==
((void *)0)
) mallocFail ( sizeof(BitStream) );
bs->handle = stream;
bs->buffer = 0;
bs->buffLive = 0;
bs->mode = 'w';
return bs;
}
| _DWORD * bsOpenWriteStream(long a1)
{
_DWORD *v2;
v2 = malloc(0x18uLL);
if ( !v2 )
mallocFail(0x18u);
*(_QWORD *)v2 = a1;
v2[2] = 0;
v2[3] = 0;
*((_BYTE *)v2 + 16) = 119;
return v2;
}
|
void
login_set_current_time(struct logininfo *li)
{
struct timeval tv;
gettimeofday(&tv,
((void *)0)
);
li->tv_sec = tv.tv_sec;
li->tv_usec = tv.tv_usec;
}
| void login_set_current_time(unsigned int a0[232]) {
char v0;
char v1;
char v2;
unsigned long long *v4;
unsigned long long v5;
gettimeofday(&v0, NULL);
a0[230] = *(&v0);
a0[231] = *(&v1);
v5 = *(&v2) ^ v4[5];
return;
}
|
static
void usage ( Char *fullProgName )
{
fprintf (
stderr
,
"bzip2, a block-sorting file compressor. "
"Version %s.\n"
"\n usage: %s [flags and input files in any order]\n"
"\n"
" -h --help print this message\n"
" -d --decompress force decompression\n"
" -z --compress force compression\n"
" -k --keep keep (don't delete) input files\n"
" -f --force overwrite existing output files\n"
" -t --test test compressed file integrity\n"
" -c --stdout output to standard out\n"
" -q --quiet suppress noncritical error messages\n"
" -v --verbose be verbose (a 2nd -v gives more)\n"
" -L --license display software version & license\n"
" -V --version display software version & license\n"
" -s --small use less memory (at most 2500k)\n"
" -1 .. -9 set block size to 100k .. 900k\n"
" --fast alias for -1\n"
" --best alias for -9\n"
"\n"
" If invoked as `bzip2', default action is to compress.\n"
" as `bunzip2', default action is to decompress.\n"
" as `bzcat', default action is to decompress to stdout.\n"
"\n"
" If no file names are given, bzip2 compresses or decompresses\n"
" from standard input to standard output. You can combine\n"
" short flags, so `-v -4' means the same as -v4 or -4v, &c.\n"
"\n"
,
BZ2_bzlibVersion(),
fullProgName
);
}
| void usage(unsigned long a0) {
unsigned long long v1;
v1 = fprintf(stderr, "bzip2, a block-sorting file compressor. Version %s.\n\n usage: %s [flags and input files in any order]\n\n -h --help print this message\n -d --decompress force decompression\n -z --compress force compression\n -k --keep keep (don't delete) input files\n -f --force overwrite existing output files\n -t --test test compressed file integrity\n -c --stdout output to standard out\n -q --quiet suppress noncritical error messages\n -v --verbose be verbose (a 2nd -v gives more)\n -L --license display software version & license\n -V --version display software version & license\n -s --small use less memory (at most 2500k)\n -1 .. -9 set block size to 100k .. 900k\n --fast alias for -1\n --best alias for -9\n\n If invoked as `bzip2', default action is to compress.\n as `bunzip2', default action is to decompress.\n as `bzcat', default action is to deco", BZ2_bzlibVersion(), a0);
return;
}
|
static void
set_addrinfo_port(struct addrinfo *addrs, int port)
{
struct addrinfo *addr;
for (addr = addrs; addr !=
((void *)0)
; addr = addr->ai_next) {
switch (addr->ai_family) {
case
2
:
((struct sockaddr_in *)addr->ai_addr)->
sin_port = htons(port);
break;
case
10
:
((struct sockaddr_in6 *)addr->ai_addr)->
sin6_port = htons(port);
break;
}
}
}
| void set_addrinfo_port(unsigned long long a0, unsigned long a1) {
struct_0 *v0;
unsigned long long v2;
unsigned long long v3;
v2 = a0;
for (v0 = a0; v0; v0 = v0->field_28) {
switch (v0->field_4) {
case 2:
v0->field_18->field_2 = htons(a1);
break;
case 10:
v0->field_18->field_2 = htons(a1);
break;
default:
goto LABEL_4016d9;
}
LABEL_4016d9:
v3 = v0->field_28;
}
return;
}
|
static void
pkg_update_fields(struct pkginfo *pkg, struct fsys_namenode_queue *newconffiles)
{
struct dependency *newdeplist, **newdeplistlastp;
struct dependency *newdep, *dep;
struct deppossi **newpossilastp, *possi, *newpossi;
struct conffile **iconffileslastp, *newiconff;
struct fsys_namenode_list *cfile;
newdeplist =
((void *)0)
;
newdeplistlastp = &newdeplist;
for (dep = pkg->available.depends; dep; dep = dep->next) {
newdep = nfmalloc(sizeof(*newdep));
newdep->up = pkg;
newdep->next =
((void *)0)
;
newdep->list =
((void *)0)
;
newpossilastp = &newdep->list;
for (possi = dep->list; possi; possi = possi->next) {
newpossi = nfmalloc(sizeof(*newpossi));
newpossi->up = newdep;
newpossi->ed = possi->ed;
newpossi->next =
((void *)0)
;
newpossi->rev_next = newpossi->rev_prev =
((void *)0)
;
newpossi->arch_is_implicit = possi->arch_is_implicit;
newpossi->arch = possi->arch;
newpossi->verrel = possi->verrel;
if (possi->verrel != DPKG_RELATION_NONE)
newpossi->version = possi->version;
else
dpkg_version_blank(&newpossi->version);
newpossi->cyclebreak =
0
;
*newpossilastp = newpossi;
newpossilastp = &newpossi->next;
}
newdep->type = dep->type;
*newdeplistlastp = newdep;
newdeplistlastp = &newdep->next;
}
copy_dependency_links(pkg, &pkg->installed.depends, newdeplist, 0);
pkg->installed.essential = pkg->available.essential;
pkg->installed.is_protected = pkg->available.is_protected;
pkg->installed.multiarch = pkg->available.multiarch;
pkg->installed.description = pkg->available.description;
pkg->installed.maintainer = pkg->available.maintainer;
pkg->installed.source = pkg->available.source;
pkg->installed.arch = pkg->available.arch;
pkg->installed.pkgname_archqual = pkg->available.pkgname_archqual;
pkg->installed.installedsize = pkg->available.installedsize;
pkg->installed.version = pkg->available.version;
pkg->installed.origin = pkg->available.origin;
pkg->installed.bugs = pkg->available.bugs;
pkg->installed.conffiles =
((void *)0)
;
iconffileslastp = &pkg->installed.conffiles;
for (cfile = newconffiles->head; cfile; cfile = cfile->next) {
newiconff = nfmalloc(sizeof(*newiconff));
newiconff->next =
((void *)0)
;
newiconff->name = nfstrsave(cfile->namenode->name);
newiconff->hash = nfstrsave(cfile->namenode->oldhash);
newiconff->obsolete = !!(cfile->namenode->flags & FNNF_OBS_CONFF);
newiconff->remove_on_upgrade = !!(
cfile->namenode->flags & FNNF_RM_CONFF_ON_UPGRADE);
*iconffileslastp = newiconff;
iconffileslastp = &newiconff->next;
}
pkg->installed.arbs = pkg->available.arbs;
}
| void pkg_update_fields(struct_0 *a0, unsigned long long *a1) {
struct_0 *v0;
int tmp_187;
void* v1;
unsigned long v2;
struct_4 *v3;
unsigned long long *v4;
struct_1 *v5;
struct_7 *v6;
struct_5 *v7;
struct_7 *v8;
struct_3 *v9;
struct_2 *v10;
char v11;
unsigned long long v13;
unsigned long long *v14;
unsigned long long v15;
v0 = a0;
v1 = 0;
v2 = &v1;
for (v3 = a0->field_c0; v3; v3 = v3->field_8) {
v9 = nfmalloc(0x20);
v9->field_0 = a0;
v9->field_8 = 0;
v9->field_10 = 0;
v4 = &v9->field_10;
for (v5 = v3->field_10; v5; v5 = v5->field_10) {
v10 = nfmalloc(0x50);
v10->field_0 = v9;
v10->field_8 = v5->field_8;
v10->field_10 = 0;
v10->field_20 = 0;
v10->field_18 = v10->field_20;
v10->field_4c = v5->field_4c;
v10->field_28 = v5->field_28;
v10->field_48 = v5->field_48;
if (v5->field_48) {
v13 = v5->field_38;
v10->field_30 = v5->field_30;
v10->field_38 = v13;
v10->field_40 = v5->field_40;
} else {
dpkg_version_blank(&v10->field_30);
}
v10->field_4d = 0;
*(v4) = v10;
v4 = &v10->field_10;
}
v9->field_18 = v3->field_18;
*(v2) = v9;
v2 = &v9->field_8;
}
copy_dependency_links(a0, &a0->padding_0[72], v1, 0x0);
a0->field_50 = a0->field_c8;
a0->field_51 = a0->field_c9;
a0->field_54 = a0->field_cc;
a0->field_68 = a0->field_e0;
a0->field_70 = a0->field_e8;
a0->field_78 = a0->field_f0;
a0->field_58 = a0->field_d0;
a0->field_60 = a0->field_d8;
a0->field_80 = a0->field_f8;
tmp_187 = a0->field_118;
a0->field_98 = a0->field_110;
a0->field_a0 = tmp_187;
a0->field_a8 = a0->field_120;
a0->field_88 = a0->field_100;
a0->field_90 = a0->field_108;
a0->field_b0 = 0;
v6 = &a0->field_b0;
for (v7 = *(a1); v7; v7 = v7->field_0) {
v8 = nfmalloc(0x20);
v8->field_0 = 0;
v8->field_8 = nfstrsave(v7->field_8->field_8);
v8->field_10 = nfstrsave(v7->field_8->field_38);
v8->field_18 = (v7->field_8->field_30 & 8);
v8->field_19 = (v7->field_8->field_30 & 0x400);
v6->field_0 = v8;
v6 = v8;
}
a0->field_b8 = a0->field_130;
v15 = *(&v11) ^ v14[5];
return;
}
|
(r = sshpkt_put_cstring(ssh, "")) != 0 ||
(r = sshpkt_send(ssh)) != 0) {
sshpkt_fatal(ssh, r,
"%s: send open failure", __func__);
}
| void sshpkt_put_cstring(void)
{
halt_baddata();
}
|
void stopit(int sig __attribute__((unused)))
{
unlink("/etc/nologin");
unlink("/fastboot");
unlink("/forcefsck");
unlink("/var/run/shutdown.pid");
printf("\r\nShutdown cancelled.\r\n");
exit(0);
}
| void stopit(unsigned long a0) {
unsigned int v0;
v0 = a0;
unlink("/etc/nologin");
unlink("/fastboot");
unlink("/forcefsck");
unlink("/var/run/shutdown.pid");
printf("\r\nShutdown cancelled.\r\n");
exit(0x0);
}
|
gl_linked_last_node (gl_list_t list)
{
if (list->count > 0)
return list->root.prev;
else
return
((void *)0)
;
}
| long long gl_linked_last_node(unsigned long long a0[9]) {
return (!a0[8] ? a0[6] : 0);
}
|
static inline __u32 nl_mgrp(__u32 group)
{
if (group > 31 ) {
fprintf(
stderr
, "Use setsockopt for this group %d\n", group);
exit(-1);
}
return group ? (1 << (group - 1)) : 0;
}
| int nl_mgrp(unsigned long a0) {
unsigned int v1;
if (a0 > 31) {
fprintf(stderr, "Use setsockopt for this group %d\n", a0);
exit(0xffffffff);
}
if (a0)
v1 = 1 << (a0 - 1 & 31);
else
v1 = 0;
return v1;
}
|
void
srclimit_init(int max, int persource, int ipv4len, int ipv6len)
{
int i;
max_children = max;
ipv4_masklen = ipv4len;
ipv6_masklen = ipv6len;
max_persource = persource;
if (max_persource == 0x7fffffff)
return;
sshlog("srclimit.c", __func__, 53, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "%s: max connections %d, per source %d, masks %d,%d", __func__, max, persource, ipv4len, ipv6len)
;
if (max <= 0)
sshfatal("srclimit.c", __func__, 56, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: invalid number of sockets: %d", __func__, max);
child = xcalloc(max_children, sizeof(*child));
for (i = 0; i < max_children; i++)
child[i].id = -1;
}
| void srclimit_init(uint param_1,uint param_2,uint param_3,uint param_4)
{
char **ppcVar1;
char *pcStack72;
char *pcStack64;
ulong uStack56;
ulong uStack48;
uint local_28;
uint local_24;
uint local_20;
uint local_1c;
int local_c;
max_children = param_1;
max_persource = param_2;
ipv4_masklen = param_3;
ipv6_masklen = param_4;
if (param_2 != 0x7fffffff) {
uStack48 = (ulong)param_4;
uStack56 = (ulong)param_3;
pcStack64 = (char *)(ulong)param_2;
pcStack72 = (char *)(ulong)param_1;
local_28 = param_4;
local_24 = param_3;
local_20 = param_2;
local_1c = param_1;
sshlog("srclimit.c","srclimit_init",0x35,0,5,0,
"%s: max connections %d, per source %d, masks %d,%d","srclimit_init");
ppcVar1 = (char **)&local_28;
if ((int)local_1c < 1) {
uStack56 = (ulong)local_1c;
pcStack64 = "srclimit_init";
ppcVar1 = &pcStack72;
pcStack72 = "%s: invalid number of sockets: %d";
sshfatal("srclimit.c","srclimit_init",0x38,0,1,0);
}
*(undefined8 *)((long)ppcVar1 + -8) = 0x100100;
child = xcalloc((long)(int)max_children,0x1c);
for (local_c = 0; local_c < (int)max_children; local_c = __addvsi3(local_c,1)) {
*(undefined4 *)((long)local_c * 0x1c + child) = 0xffffffff;
*(undefined8 *)((long)ppcVar1 + -8) = 0x100141;
}
}
return;
}
|
static
_Bool
opt_expr (struct predicate **eval_treep)
{
struct predlist regex_list={
((void *)0)
,
((void *)0)
}, name_list={
((void *)0)
,
((void *)0)
};
struct predlist cbo_list[NumEvaluationCosts];
int i;
struct predicate *curr;
struct predicate **prevp;
struct predicate **last_sidep;
PRED_FUNC pred_func;
enum predicate_type p_type;
_Bool
has_side_effects =
0
;
enum predicate_precedence prev_prec,
biop_prec;
if (eval_treep ==
((void *)0)
|| *eval_treep ==
((void *)0)
)
return (
0
);
for (i=0; i<NumEvaluationCosts; i++)
predlist_init (&cbo_list[i]);
prevp = eval_treep;
prev_prec = AND_PREC;
curr = *prevp;
while (curr->pred_left !=
((void *)0)
)
{
prevp = &curr->pred_left;
prev_prec = curr->p_prec;
curr = curr->pred_left;
}
if (curr->p_type != BI_OP)
set_new_parent (curr, prev_prec, prevp);
if (options.debug_options & (DebugExpressionTree|DebugTreeOpt))
{
fprintf (
stderr
, "Normalized Eval Tree:\n");
print_tree (
stderr
, *eval_treep, 0);
}
prevp = eval_treep;
biop_prec = NO_PREC;
if ((*prevp) && (*prevp)->p_type == BI_OP)
biop_prec = (*prevp)->p_prec;
while ((curr = *prevp) !=
((void *)0)
)
{
if (curr->p_type == BI_OP)
{
if (curr->p_prec != biop_prec)
curr = set_new_parent (curr, biop_prec, prevp);
}
p_type = curr->pred_right->p_type;
pred_func = curr->pred_right->pred_func;
switch (p_type)
{
case NO_TYPE:
case PRIMARY_TYPE:
if (biop_prec == COMMA_PREC)
break;
if (!curr->pred_right->side_effects)
{
_Bool
reorder;
if (predicate_is_cost_free (curr->pred_right))
{
if (options.debug_options & DebugTreeOpt)
{
fprintf (
stderr
, "-O%d: promoting cheap predicate ",
(int)options.optimisation_level);
print_predicate (
stderr
, curr->pred_right);
fprintf (
stderr
, " into name_list\n");
}
predlist_insert (&name_list, curr, prevp);
continue;
}
if (pred_func == pred_regex)
{
predlist_insert (®ex_list, curr, prevp);
continue;
}
reorder = ((options.optimisation_level > 1)
&& (NeedsType == curr->pred_right->p_cost
|| NeedsInodeNumber == curr->pred_right->p_cost)
&& !curr->pred_right->need_stat) ||
(options.optimisation_level > 2);
if (reorder)
{
if (options.debug_options & DebugTreeOpt)
{
fprintf (
stderr
, "-O%d: categorising predicate ",
(int)options.optimisation_level);
print_predicate (
stderr
, curr->pred_right);
fprintf (
stderr
, " by cost (%s)\n",
cost_name(curr->pred_right->p_cost));
}
predlist_insert (&cbo_list[curr->pred_right->p_cost], curr, prevp);
continue;
}
}
break;
case UNI_OP:
curr->pred_right->side_effects
= opt_expr (&curr->pred_right->pred_right);
break;
case BI_OP:
curr->pred_right->side_effects = opt_expr (&curr->pred_right);
break;
default:
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"oops -- invalid expression type!\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("oops -- invalid expression type!")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("oops -- invalid expression type!")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
break;
}
if (curr->pred_right->side_effects ==
1
)
{
last_sidep = prevp;
merge_lists (cbo_list, NumEvaluationCosts, &name_list, ®ex_list, last_sidep);
has_side_effects =
1
;
}
prevp = &curr->pred_left;
}
last_sidep = prevp;
merge_lists (cbo_list, NumEvaluationCosts, &name_list, ®ex_list, last_sidep);
return has_side_effects;
}
| int opt_expr(unsigned long long *a0) {
char v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
struct_0 *v6;
struct struct_2 **v7;
unsigned long long *v8;
unsigned long v9;
void* v10;
void* v11;
void* v12;
void* v13;
char v14;
unsigned int v16;
char v17;
v10 = 0;
v11 = 0;
v12 = 0;
v13 = 0;
v0 = 0;
if (!a0) {
LABEL_40108d:
v16 = 0;
} else {
if (!*(a0))
goto LABEL_40108d;
for (v2 = 0; v2 <= 10; v2 += 1) {
predlist_init(&(&v14)[16 * v2]);
}
v7 = a0;
v3 = 3;
for (v6 = *(v7); v6->field_110; v6 = v6->field_110) {
v7 = &v6->field_110;
v3 = v6->field_14;
}
if (v6->field_10 != 3)
set_new_parent(v6, v3, v7);
if ((got.pred_or & 9)) {
fprintf(stderr, "Normalized Eval Tree:\n");
print_tree(stderr, *(a0), 0x0);
}
v7 = a0;
v4 = 0;
if (*(v7) && *(v7)->field_10 == 3)
v4 = *(v7)->field_14;
while (true) {
v6 = &*(v7)->padding_0;
if (!v6) {
v8 = v7;
merge_lists(&v14, 0xb, &v12, &v10, v8);
v16 = v0;
break;
}
if (v6->field_10 == 3 && v4 != v6->field_14)
v6 = set_new_parent(v6, v4, v7);
v5 = v6->field_118->field_10;
v9 = v6->field_118->field_0;
if (v5 == 3) {
v6->field_118->field_18 = opt_expr(&v6->field_118);
goto LABEL_4015a1;
}
if (v5 > 3) {
error(0x1, 0x0, gettext("oops -- invalid expression type!"));
} else if (v5 <= 1) {
if (v4 == 1)
goto LABEL_4015a1;
if (!(v6->field_118->field_18 ^ 1)) {
LABEL_4015a1:
if (v6->field_118->field_18) {
v8 = v7;
merge_lists(&v14, 0xb, &v12, &v10, v8);
v0 = 1;
}
v7 = &v6->field_110;
} else {
if (predicate_is_cost_free(v6->field_118)) {
if ((got.pred_or & 8)) {
fprintf(stderr, "-O%d: promoting cheap predicate ", *(&got.pred_regex));
print_predicate(stderr, v6->field_118);
fprintf(stderr, " into name_list\n");
}
predlist_insert(&v12, v6, v7);
continue;
}
if (v9 == *(&got.pred_regex)) {
predlist_insert(&v10, v6, v7);
continue;
}
if (*(&got.pred_regex) > 1) {
if (v6->field_118->field_20 != 2 && !(v6->field_118->field_20 == 1))
goto LABEL_401427;
if (!(!(v6->field_118->field_1a ^ 1)))
goto LABEL_401434;
}
LABEL_401427:
if (*(&got.pred_regex) <= 2) {
v17 = 0;
LABEL_401440:
v1 = v17;
v1 &= 1;
if (v1) {
if ((got.pred_or & 8)) {
fprintf(stderr, "-O%d: categorising predicate ", *(&got.pred_regex));
print_predicate(stderr, v6->field_118);
fprintf(stderr, " by cost (%s)\n", cost_name(v6->field_118->field_20));
}
predlist_insert(&(&v14)[16 * v6->field_118->field_20], v6, v7);
continue;
}
goto LABEL_4015a1;
}
LABEL_401434:
v17 = 1;
goto LABEL_401440;
}
} else if (v5 == 2) {
v6->field_118->field_18 = opt_expr(&v6->field_118[7].padding_1b[1]);
goto LABEL_4015a1;
}
}
}
return v16;
}
|
static int cfg_external_add(struct cfg *cfg, const char *path)
{
struct cfg_external *ext;
size_t len = strlen(path);
ext = malloc(sizeof(struct cfg_external) + len + 1);
if (ext ==
((void *)0)
) {
log_printf(
3
, "external add: out of memory\n");
return -
12
;
}
strcpy(ext->path, path);
ext->len = len;
log_printf(
7
, "external add: %s\n", ext->path);
ext->next = cfg->externals;
cfg->externals = ext;
return 0;
}
| void cfg_external_add(struct_0 *a0, char *a1, unsigned long long a2, unsigned long long a3, unsigned long long a4) {
unsigned long v0;
unsigned long long v1[2];
unsigned long long v3;
void* v4;
v0 = strlen(a1);
v1[0] = malloc(v0 + 17);
if (!v1) {
log_printf(0x3, "external add: out of memory\n", a2, a3, a4);
v3 = 4294967284;
} else {
strcpy(v1 + 1, a1);
v1[1] = v0;
log_printf(0x7, "external add: %s\n", v1 + 1, a3, a4);
v1[0] = a0->field_1028;
a0->field_1028 = v1;
v4 = 0;
}
return;
}
|
int
ssh_digest_buffer(int alg, const struct sshbuf *b, u_char *d, size_t dlen)
{
return ssh_digest_memory(alg, sshbuf_ptr(b), sshbuf_len(b), d, dlen);
}
| long long ssh_digest_buffer(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned int a3) {
return ssh_digest_memory(a0, sshbuf_ptr(a1), sshbuf_len(a1), a2, a3);
}
|
static long_int
ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
int year0, int yday0, int hour0, int min0, int sec0)
{
_Static_assert (-1 / 2 == 0, "verify (" "-1 / 2 == 0" ")");
int a4 = shr (year1, 2) + shr (1900, 2) - ! (year1 & 3);
int b4 = shr (year0, 2) + shr (1900, 2) - ! (year0 & 3);
int a100 = (a4 + (a4 < 0)) / 25 - (a4 < 0);
int b100 = (b4 + (b4 < 0)) / 25 - (b4 < 0);
int a400 = shr (a100, 2);
int b400 = shr (b100, 2);
int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
long_int years = year1 - year0;
long_int days = 365 * years + yday1 - yday0 + intervening_leap_days;
long_int hours = 24 * days + hour1 - hour0;
long_int minutes = 60 * hours + min1 - min0;
long_int seconds = 60 * minutes + sec1 - sec0;
return seconds;
}
| long ydhms_diff(long a1, long a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10)
{
int v10;
int v11;
int v17;
int v18;
int v19;
int v20;
int v21;
v10 = shr(a1, 2);
v17 = v10 + shr(1900LL, 2) - ((a1 & 3) == 0);
v11 = shr(a6, 2);
v18 = (__PAIR64__(v11 + (unsigned int)shr(1900LL, 2), a6 & 3) - 1) >> 32;
v19 = ((v17 < 0) + v17) / 25 - (v17 < 0);
v20 = ((v18 < 0) + v18) / 25 - (v18 < 0);
v21 = shr(v19, 2);
return a5
+ 60
* (a4
+ 60 * (a3 + 24 * (a2 + 365 * (a1 - a6) - a7 + (int)(v17 - v18 - (v19 - v20) + v21 - shr(v20, 2))) - a8)
- a9)
- a10;
}
|
int xfrm_sctx_parse(char *ctxstr, char *s,
struct xfrm_user_sec_ctx *sctx)
{
int slen;
slen = strlen(s) + 1;
sctx->exttype = XFRMA_SEC_CTX;
sctx->ctx_doi = 1;
sctx->ctx_alg = 1;
sctx->ctx_len = slen;
sctx->len = sizeof(struct xfrm_user_sec_ctx) + slen;
memcpy(ctxstr, s, slen);
return 0;
}
| long xfrm_sctx_parse(void *a1, const char *a2, long a3)
{
int v3;
v3 = strlen(a2);
*(_WORD *)(a3 + 2) = 8;
*(_BYTE *)(a3 + 5) = 1;
*(_BYTE *)(a3 + 4) = 1;
*(_WORD *)(a3 + 6) = v3 + 1;
*(_WORD *)a3 = v3 + 9;
memcpy(a1, a2, v3 + 1);
return 0LL;
}
|
static inline void
write_pending (char *outbuf, char **bpout)
{
idx_t n_write = *bpout - outbuf;
if (0 < n_write)
{
if (full_write (
1
, outbuf, n_write) != n_write)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"write error\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, gettext ("write error")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, gettext ("write error")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
*bpout = outbuf;
}
}
| void write_pending(long param_1,long *param_2)
{
long lVar1;
long lVar2;
undefined8 uVar3;
int *piVar4;
lVar1 = *param_2 - param_1;
if (0 < lVar1) {
lVar2 = full_write(1,param_1,lVar1);
if (lVar2 != lVar1) {
uVar3 = gettext("write error");
piVar4 = __errno_location();
error(1,*piVar4,uVar3);
}
*param_2 = param_1;
}
return;
}
|
int main(int argc, char **argv)
{
char proc_dir_name[32];
char *target_str;
pid_t target;
int proc_dir_fd;
int ranges;
struct map_range *mappings;
struct stat st;
struct passwd *pw;
int written;
Prog = Basename (argv[0]);
log_set_progname(Prog);
log_set_logfd(
stderr
);
if (argc < 2)
usage();
target_str = argv[1];
if (!get_pid(target_str, &target))
usage();
written = snprintf(proc_dir_name, sizeof(proc_dir_name), "/proc/%u/",
target);
if ((written <= 0) || (written >= sizeof(proc_dir_name))) {
fprintf(
stderr
, "%s: snprintf of proc path failed: %s\n",
Prog, strerror(
(*__errno_location ())
));
}
proc_dir_fd = open(proc_dir_name,
0200000
);
if (proc_dir_fd < 0) {
fprintf(
stderr
, gettext ("%s: Could not open proc directory for target %u\n"),
Prog, target);
return
1
;
}
pw = get_my_pwent ();
if (
((void *)0)
== pw) {
fprintf (
stderr
,
gettext ("%s: Cannot determine your user name.\n"),
Prog);
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
4
, "Cannot determine the user name of the caller (UID %lu)", (unsigned long) getuid ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
)
;
return
1
;
}
if (fstat(proc_dir_fd, &st) < 0) {
fprintf(
stderr
, gettext ("%s: Could not stat directory for target %u\n"),
Prog, target);
return
1
;
}
if ((getuid() != pw->pw_uid) ||
(!getdef_bool("GRANT_AUX_GROUP_SUBIDS") && (getgid() != pw->pw_gid)) ||
(pw->pw_uid != st.st_uid) ||
(getgid() != st.st_gid)) {
fprintf(
stderr
, gettext ("%s: Target process %u is owned by a different user: uid:%lu pw_uid:%lu st_uid:%lu, gid:%lu pw_gid:%lu st_gid:%lu\n"),
Prog, target,
(unsigned long int)getuid(), (unsigned long int)pw->pw_uid, (unsigned long int)st.st_uid,
(unsigned long int)getgid(), (unsigned long int)pw->pw_gid, (unsigned long int)st.st_gid);
return
1
;
}
if (!sub_uid_open(
00
)) {
return
1
;
}
ranges = ((argc - 2) + 2) / 3;
mappings = get_map_ranges(ranges, argc - 2, argv + 2);
if (!mappings)
usage();
verify_ranges(pw, ranges, mappings);
write_mapping(proc_dir_fd, ranges, mappings, "uid_map", pw->pw_uid);
sub_uid_close();
return
0
;
}
| int main(unsigned long long a0, unsigned long long a1[2], unsigned long long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
unsigned long v6;
unsigned int v7;
char v8;
unsigned int v9;
unsigned int v10;
unsigned int v11;
void* v12;
unsigned long long v13;
unsigned int v14[6];
void* v15;
char *v16;
char v17;
char v18;
char v19;
char v20;
unsigned int v22;
unsigned long long v23;
v7 = a0;
Prog = Basename(a1[0]);
log_set_progname(0xf87d894810ec8348);
log_set_logfd(stderr);
if (v7 <= 1)
usage();
v13 = a1[1];
v22 = get_pid(v13, &v8, &v8);
if (!v22)
usage();
v9 = snprintf(&v20, 0x20, "/proc/%u/", *(&v8));
if (v9 <= 0 || v9 > 31)
fprintf(stderr, "%s: snprintf of proc path failed: %s\n", 283935560, strerror(*(__errno_location())));
v10 = open(&v20, 0x10000, 0x8348);
if (v10 < 0) {
fprintf(stderr, gettext("%s: Could not open proc directory for target %u\n"));
v22 = 1;
} else {
*(&v14[0]) = get_my_pwent();
if (!v14) {
fprintf(stderr, gettext("%s: Cannot determine your user name.\n"));
v16 = setlocale(0x6, NULL);
v12 = 0;
if (v16)
v12 = strdup(v16);
if (v12)
setlocale(0x6, "C");
getuid();
syslog(0x4, "Cannot determine the user name of the caller (UID %lu)");
if (v12) {
setlocale(0x6, v12);
free(v12);
}
v22 = 1;
} else {
v22 = fstat(v10, &v17);
if (v22 < 0) {
fprintf(stderr, gettext("%s: Could not stat directory for target %u\n"));
v22 = 1;
} else {
v22 = getuid();
if (v22 == v14[4]) {
*(&v22) = getdef_bool("GRANT_AUX_GROUP_SUBIDS") ^ 1;
if (v22)
v22 = getgid();
if ((v22 == v14[5] || !v22) && v14[4] == *(&v18)) {
v22 = getgid();
if (v22 == *(&v19)) {
v22 = sub_uid_open(0x0);
if (!v22) {
v22 = 1;
} else {
v11 = (v7 * 1431655766 >> 32) - (v7 >> 31);
v15 = get_map_ranges(v11, v7 - 2, a1 + 1, v7 - 2);
if (!v15)
usage();
verify_ranges(v14, v11, v15);
write_mapping(v10, v11, v15, "uid_map", v14[4]);
sub_uid_close(a0, v11, a2, "uid_map", a4, a5);
v22 = 0;
}
}
}
}
}
}
}
if (v22 == v14[4] && v22 >= 0 && v14 && v10 >= 0 && (v22 == v14[5] || !v22) && v14[4] == *(&v18) && v22 != *(&v19) || v22 == v14[4] && v22 >= 0 && v14 && v10 >= 0 && v22 && v22 != v14[5] || v22 == v14[4] && v22 >= 0 && v14 && v10 >= 0 && (v22 == v14[5] || !v22) && v14[4] != *(&v18) || v22 >= 0 && v14 && v10 >= 0 && v22 != v14[4]) {
v6 = *(&v19);
v23 = *(&v18);
v5 = v14[4];
v4 = getuid();
v3 = v6;
v2 = v14[5];
v1 = getgid();
v0 = v23;
fprintf(stderr, gettext("%s: Target process %u is owned by a different user: uid:%lu pw_uid:%lu st_uid:%lu, gid:%lu pw_gid:%lu st_gid:%lu\n"));
v22 = 1;
}
if (...)
return v22;
}
|
WORD_LIST *
expand_string_assignment (string, quoted)
char *string;
int quoted;
{
WORD_DESC td;
WORD_LIST *value;
if (string == 0 || *string == '\0')
return ((WORD_LIST *)
((void *)0)
);
expand_no_split_dollar_star = 1;
td.flags = (1 << 11);
td.flags |= ((1 << 5)|(1 << 7));
td.word = (char *)strcpy (sh_xmalloc((1 + strlen (string)), "subst.c", 4410), (string));
value = call_expand_word_internal (&td, quoted, 0, (int *)
((void *)0)
, (int *)
((void *)0)
);
do { if (td.word) sh_xfree((td.word), "subst.c", 4412); } while (0);
expand_no_split_dollar_star = 0;
if (value)
{
if (value->word)
{
remove_quoted_nulls (value->word->word);
value->word->flags &= ~(1 << 18);
}
dequote_list (value);
}
return (value);
}
| long long expand_string_assignment(char *a0, unsigned long a1) {
struct_0 *v0;
unsigned long long v1;
unsigned int v2;
void* v4;
unsigned int v5;
if (!a0) {
LABEL_40b487:
v4 = 0;
} else {
if (!*(a0))
goto LABEL_40b487;
expand_no_split_dollar_star = 1;
v2 = 0x800;
v5 = v2;
*(&v5) = v2 | 160;
v2 = v5;
v1 = strcpy(sh_xmalloc(strlen(a0) + 1, "subst.c", 0x113a), a0);
v0 = call_expand_word_internal(&v1, a1, 0x0, 0x0, 0x0);
if (v1)
sh_xfree(v1, "subst.c", 0x113c);
expand_no_split_dollar_star = 0;
if (v0) {
if (v0->field_8) {
remove_quoted_nulls(v0->field_8->field_0);
v0->field_8->field_8 = v0->field_8->field_8 & -262145;
}
dequote_list(v0);
}
v4 = v0;
}
return v4;
}
|
static void usage(void)
{
print_usage(
stderr
);
}
| void usage() {
unsigned long long v1;
v1 = print_usage(stderr);
return;
}
|
static void
history_def_delete(history_t *h,
HistEventW *ev __attribute__((__unused__)), hentry_t *hp)
{
HistEventPrivate *evp = (void *)&hp->ev;
if (hp == &h->list)
abort();
if (h->cursor == hp) {
h->cursor = hp->prev;
if (h->cursor == &h->list)
h->cursor = hp->next;
}
hp->prev->next = hp->next;
hp->next->prev = hp->prev;
free(evp->str);
free(hp);
h->cur--;
}
| void history_def_delete(struct_0 *a0, unsigned long a1, struct_1 *a2) {
unsigned long v0;
struct_0 *v2;
v0 = a1;
if (a2 == a0)
abort();
if (a2 == a0->field_28) {
a0->field_28 = a2->field_20;
if (a0->field_28 == a0)
a0->field_28 = a2->field_18;
}
a2->field_20->field_18 = a2->field_18;
a2->field_18->field_20 = a2->field_20;
free(a2->field_8);
free(a2);
v2 = a0;
a0->field_34 = a0->field_34 - 1;
return;
}
|
int
argv_split(const char *s, int *argcp, char ***argvp, int terminate_on_comment)
{
int r = -1;
int argc = 0, quote, i, j;
char *arg, **argv = xcalloc(1, sizeof(*argv));
*argvp =
((void *)0)
;
*argcp = 0;
for (i = 0; s[i] != '\0'; i++) {
if (s[i] == ' ' || s[i] == '\t')
continue;
if (terminate_on_comment && s[i] == '#')
break;
quote = 0;
argv = xreallocarray(argv, (argc + 2), sizeof(*argv));
arg = argv[argc++] = xcalloc(1, strlen(s + i) + 1);
argv[argc] =
((void *)0)
;
for (j = 0; s[i] != '\0'; i++) {
if (s[i] == '\\') {
if (s[i + 1] == '\'' ||
s[i + 1] == '\"' ||
s[i + 1] == '\\' ||
(quote == 0 && s[i + 1] == ' ')) {
i++;
arg[j++] = s[i];
} else {
arg[j++] = s[i];
}
} else if (quote == 0 && (s[i] == ' ' || s[i] == '\t'))
break;
else if (quote == 0 && (s[i] == '\"' || s[i] == '\''))
quote = s[i];
else if (quote != 0 && s[i] == quote)
quote = 0;
else
arg[j++] = s[i];
}
if (s[i] == '\0') {
if (quote != 0) {
r = -4;
goto out;
}
break;
}
}
*argcp = argc;
*argvp = argv;
argc = 0;
argv =
((void *)0)
;
r = 0;
out:
if (argc != 0 && argv !=
((void *)0)
) {
for (i = 0; i < argc; i++)
free(argv[i]);
free(argv);
}
return r;
}
| long argv_split(long a1, _DWORD *a2, _QWORD *a3, int a4)
{
size_t v4;
int v5;
long *v6;
int v7;
int v8;
int v9;
unsigned int v13;
int v14;
int v15;
int i;
int j;
int v18;
_QWORD *ptr;
long v20;
v14 = 0;
ptr = (_QWORD *)xcalloc(1LL, 8LL);
*a3 = 0LL;
*a2 = 0;
for ( i = 0; *(_BYTE *)(i + a1); ++i )
{
if ( *(_BYTE *)(i + a1) != 32 && *(_BYTE *)(i + a1) != 9 )
{
if ( a4 && *(_BYTE *)(i + a1) == 35 )
break;
v15 = 0;
ptr = (_QWORD *)xreallocarray(ptr, v14 + 2, 8LL);
v4 = strlen((const char *)(i + a1)) + 1;
v5 = v14++;
v6 = &ptr[v5];
*v6 = xcalloc(1LL, v4);
v20 = *v6;
ptr[v14] = 0LL;
v18 = 0;
while ( *(_BYTE *)(i + a1) )
{
if ( *(_BYTE *)(i + a1) == 92 )
{
if ( *(_BYTE *)(i + 1 + a1) == 39
|| *(_BYTE *)(i + 1 + a1) == 34
|| *(_BYTE *)(i + 1 + a1) == 92
|| !v15 && *(_BYTE *)(i + 1 + a1) == 32 )
{
++i;
v7 = v18++;
*(_BYTE *)(v20 + v7) = *(_BYTE *)(i + a1);
}
else
{
v8 = v18++;
*(_BYTE *)(v20 + v8) = *(_BYTE *)(i + a1);
}
}
else
{
if ( !v15 && (*(_BYTE *)(i + a1) == 32 || *(_BYTE *)(i + a1) == 9) )
break;
if ( !v15 && (*(_BYTE *)(i + a1) == 34 || *(_BYTE *)(i + a1) == 39) )
{
v15 = *(char *)(i + a1);
}
else if ( v15 && v15 == *(char *)(i + a1) )
{
v15 = 0;
}
else
{
v9 = v18++;
*(_BYTE *)(v20 + v9) = *(_BYTE *)(i + a1);
}
}
++i;
}
if ( !*(_BYTE *)(i + a1) )
{
if ( v15 )
{
v13 = -4;
goto LABEL_34;
}
break;
}
}
}
*a2 = v14;
*a3 = ptr;
v14 = 0;
ptr = 0LL;
v13 = 0;
LABEL_34:
if ( v14 && ptr )
{
for ( j = 0; j < v14; ++j )
free((void *)ptr[j]);
free(ptr);
}
return v13;
}
|
void
rl_discard_keymap (Keymap map)
{
int i;
if (map == 0)
return;
for (i = 0; i < 257; i++)
{
switch (map[i].type)
{
case 0:
break;
case 1:
rl_discard_keymap ((Keymap)map[i].function);
xfree ((char *)map[i].function);
break;
case 2:
xfree ((char *)map[i].function);
break;
}
}
}
| void rl_discard_keymap(char *a0) {
unsigned int v0;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
if (a0) {
for (v0 = 0; v0 <= 0x100; v0 += 1) {
v2 = a0[16 * v0];
if (a0[16 * v0] == 2) {
v3 = xfree(*(&a0[8 + 16 * v0]));
} else if (a0[16 * v0] <= 2 && a0[16 * v0] && a0[16 * v0] == 1) {
rl_discard_keymap(*(&a0[8 + 16 * v0]));
v4 = xfree(*(&a0[8 + 16 * v0]));
}
}
}
return;
}
|
int
reallocarr(void *ptr, size_t number, size_t size)
{
int saved_errno, result;
void *optr;
void *nptr;
saved_errno =
(*__errno_location ())
;
memcpy(&optr, ptr, sizeof(ptr));
if (number == 0 || size == 0) {
free(optr);
nptr =
((void *)0)
;
memcpy(ptr, &nptr, sizeof(ptr));
(*__errno_location ())
= saved_errno;
return 0;
}
if ((number|size) >= (((size_t)1) << (sizeof(size_t) * 8 / 2)) &&
number >
(18446744073709551615UL)
/ size) {
(*__errno_location ())
= saved_errno;
return
75
;
}
nptr = realloc(optr, number * size);
if (nptr ==
((void *)0)
) {
result =
(*__errno_location ())
;
} else {
result = 0;
memcpy(ptr, &nptr, sizeof(ptr));
}
(*__errno_location ())
= saved_errno;
return result;
}
| int reallocarr(void *param_1,ulong param_2,ulong param_3)
{
int iVar1;
int *piVar2;
long in_FS_OFFSET;
int local_28;
void *local_20;
void *local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
piVar2 = __errno_location();
iVar1 = *piVar2;
memcpy(&local_20,param_1,8);
if ((param_2 == 0) || (param_3 == 0)) {
free(local_20);
local_18 = (void *)0x0;
memcpy(param_1,&local_18,8);
piVar2 = __errno_location();
*piVar2 = iVar1;
local_28 = 0;
}
else if (((param_2 | param_3) < 0x100000000) ||
(SUB168(ZEXT816(param_2) * ZEXT816(param_3) >> 0x40,0) == 0)) {
local_18 = realloc(local_20,param_2 * param_3);
if (local_18 == (void *)0x0) {
piVar2 = __errno_location();
local_28 = *piVar2;
}
else {
local_28 = 0;
memcpy(param_1,&local_18,8);
}
piVar2 = __errno_location();
*piVar2 = iVar1;
}
else {
piVar2 = __errno_location();
*piVar2 = iVar1;
local_28 = 0x4b;
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_28;
}
__stack_chk_fail();
}
|
void
delete_all_contexts (vcxt)
VAR_CONTEXT *vcxt;
{
delete_local_contexts (vcxt);
delete_all_variables (global_variables->table);
shell_variables = global_variables;
}
| long long delete_all_contexts(void* a0) {
delete_local_contexts(a0);
delete_all_variables(*((global_variables + 32)));
shell_variables = global_variables;
return global_variables;
}
|
static inline __be16 rta_getattr_be16(const struct rtattr *rta)
{
return ntohs(rta_getattr_u16(rta));
}
| void rta_getattr_be16(void)
{
uint16_t __netshort;
__netshort = rta_getattr_u16();
ntohs(__netshort);
return;
}
|
static inline int tl_to_darg(struct dentry_info_args *darg,
struct ext4_fc_tl *tl, __u8 *val)
{
struct ext4_fc_dentry_info fcd;
int tag = (( __u16)(__le16)(tl->fc_tag));
memcpy(&fcd, val, sizeof(fcd));
darg->parent_ino = (( __u32)(__le32)(fcd.fc_parent_ino));
darg->ino = (( __u32)(__le32)(fcd.fc_ino));
darg->dname_len = ext4_fc_tag_len(tl) -
sizeof(struct ext4_fc_dentry_info);
darg->dname = malloc(darg->dname_len + 1);
if (!darg->dname)
return -
12
;
memcpy(darg->dname,
val + sizeof(struct ext4_fc_dentry_info),
darg->dname_len);
darg->dname[darg->dname_len] = 0;
do { if ((1) <= (-1)) { printf ("" "(%s, %d): %s: ", "journal.c", 638, __FUNCTION__); printf ("%s: %s, ino %lu, parent %lu\n", tag == 0x0003 ? "create" : (tag == 0x0004 ? "link" : (tag == 0x0005 ? "unlink" : "error")), darg->dname, darg->ino, darg->parent_ino); } } while (0)
;
return 0;
}
| long tl_to_darg(long a1, long a2, long a3)
{
int dest[2];
unsigned long v6;
v6 = __readfsqword(0x28u);
memcpy(dest, (const void *)a3, sizeof(dest));
*(_QWORD *)a1 = (unsigned int)dest[0];
*(_QWORD *)(a1 + 16) = (unsigned int)dest[1];
*(_DWORD *)(a1 + 8) = ext4_fc_tag_len(a2) - 8;
*(_QWORD *)(a1 + 24) = malloc(*(_DWORD *)(a1 + 8) + 1);
if ( !*(_QWORD *)(a1 + 24) )
return 4294967284LL;
memcpy(*(void **)(a1 + 24), (const void *)(a3 + 8), *(int *)(a1 + 8));
*(_BYTE *)(*(_QWORD *)(a1 + 24) + *(int *)(a1 + 8)) = 0;
return 0LL;
}
|
void
strip_trailing (string, len, newlines_only)
char *string;
int len;
int newlines_only;
{
while (len >= 0)
{
if ((newlines_only && string[len] == '\n') ||
(!newlines_only && (((string[len]) == ' ') || ((string[len]) == '\t'))))
len--;
else
break;
}
string[len + 1] = '\0';
}
| long long strip_trailing(char *a0, unsigned long a1, unsigned long a2) {
unsigned int v0;
v0 = a1;
while (true) {
if (v0 < 0)
break;
if (a2 && a0[v0] == 10)
goto LABEL_400902;
if (a2)
break;
if (a0[v0] != 32 && a0[v0] != 9)
break;
LABEL_400902:
v0 -= 1;
}
a0[1 + v0] = 0;
return &a0[1 + v0];
}
|
int
sshkey_save_public(const struct sshkey *key, const char *path,
const char *comment)
{
int fd, oerrno;
FILE *f =
((void *)0)
;
int r = -1;
if ((fd = open(path,
01
|
0100
|
01000
, 0644)) == -1)
return -24;
if ((f = fdopen(fd, "w")) ==
((void *)0)
) {
r = -24;
close(fd);
goto fail;
}
if ((r = sshkey_write(key, f)) != 0)
goto fail;
fprintf(f, " %s\n", comment);
if (ferror(f)) {
r = -24;
goto fail;
}
if (fclose(f) != 0) {
r = -24;
f =
((void *)0)
;
fail:
if (f !=
((void *)0)
) {
oerrno =
(*__errno_location ())
;
fclose(f);
(*__errno_location ())
= oerrno;
}
return r;
}
return 0;
}
| long sshkey_save_public(long a1, const char *a2, const char *a3)
{
unsigned int v5;
int fd;
int v7;
FILE *stream;
fd = open(a2, 577, 420LL);
if ( fd == -1 )
return 4294967272LL;
stream = fdopen(fd, "w");
if ( stream )
{
v5 = sshkey_write(a1, stream);
if ( !v5 )
{
fprintf(stream, " %s\n", a3);
if ( ferror(stream) )
{
v5 = -24;
}
else
{
if ( !fclose(stream) )
return 0LL;
v5 = -24;
stream = 0LL;
}
}
}
else
{
v5 = -24;
close(fd);
}
if ( stream )
{
v7 = *_errno_location();
fclose(stream);
*_errno_location() = v7;
}
return v5;
}
|
)
{
error (0,
(*__errno_location ())
, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, filename));
return
0
;
}
| void error(void)
{
halt_baddata();
}
|
static void
statdb_node_print(FILE *out, struct fsys_namenode *file)
{
struct file_stat *filestat = file->statoverride;
struct passwd *pw;
struct group *gr;
if (!filestat)
return;
pw = getpwuid(filestat->uid);
if (pw)
fprintf(out, "%s ", pw->pw_name);
else if (filestat->uname)
fprintf(out, "%s ", filestat->uname);
else
fprintf(out, "#%d ", filestat->uid);
gr = getgrgid(filestat->gid);
if (gr)
fprintf(out, "%s ", gr->gr_name);
else if (filestat->gname)
fprintf(out, "%s ", filestat->gname);
else
fprintf(out, "#%d ", filestat->gid);
fprintf(out, "%o %s\n", filestat->mode & ~
0170000
, file->name);
}
| void statdb_node_print(void* a0, unsigned long long a1[5]) {
struct_0 *v0;
int tmp_27;
unsigned long long *v1;
unsigned long long *v2;
unsigned long long v4;
unsigned long long v5;
unsigned long long v7;
v4 = a1[4];
v0 = a1[4];
if (v0) {
v1 = &getpwuid(v0->field_0)->pw_name;
if (v1) {
fprintf(a0, "%s ", *(v1));
} else if (v0->field_10) {
fprintf(a0, "%s ", v0->field_10);
} else {
fprintf(a0, "#%d ", v0->field_0);
}
v2 = &getgrgid(v0->field_4)->gr_name;
if (v2) {
fprintf(a0, "%s ", *(v2));
} else if (v0->field_18) {
fprintf(a0, "%s ", v0->field_18);
} else {
fprintf(a0, "#%d ", v0->field_4);
}
v5 = v0->field_8;
*(&v5) = (v0->field_8 >> 8) & 15;
tmp_27 = v5;
v7 = fprintf(a0, "%o %s\n", tmp_27, a1[1]);
}
return;
}
|
rlim_t
string_to_rlimtype (s)
char *s;
{
rlim_t ret;
int neg;
ret = 0;
neg = 0;
while (s && *s && (((*s) == ' ') || ((*s) == '\t')))
s++;
if (s && (*s == '-' || *s == '+'))
{
neg = *s == '-';
s++;
}
for ( ; s && *s && ((*s) >= '0' && (*s) <= '9'); s++)
ret = (ret * 10) + ((*s) - '0');
return (neg ? -ret : ret);
}
| long long string_to_rlimtype(unsigned long a0) {
char *v0;
unsigned int v1;
void* v2;
v0 = a0;
v2 = 0;
v1 = 0;
while (true) {
if (!v0)
break;
switch (*(v0)) {
case 9: case 32:
v0 += 1;
break;
default:
goto LABEL_400223;
}
}
LABEL_400223:
if (v0) {
switch (*(v0)) {
case 43: case 45:
v1 = *(v0) == 45;
v0 += 1;
break;
}
}
for (; v0 && *(v0) && *(v0) > 47 && *(v0) <= 57; v0 += 1) {
v2 = *(v0) - 48 + v2 * 10;
}
return (!v1 ? -(v2) : v2);
}
|
static void usage (int status)
{
FILE *usageout = (0 != status) ?
stderr
:
stdout
;
(void) fprintf (usageout,
gettext ("Usage: %s [options] [action]\n" "\n" "Options:\n")
,
Prog);
(void) fputs (gettext (" -g, --group groupname change groupname instead of the user's group\n" " (root only)\n")
, usageout);
(void) fputs (gettext (" -R, --root CHROOT_DIR directory to chroot into\n"), usageout);
(void) fputs (gettext ("\n"), usageout);
(void) fputs (gettext ("Actions:\n"), usageout);
(void) fputs (gettext (" -a, --add username add username to the members of the group\n"), usageout);
(void) fputs (gettext (" -d, --delete username remove username from the members of the group\n"), usageout);
(void) fputs (gettext (" -h, --help display this help message and exit\n"), usageout);
(void) fputs (gettext (" -p, --purge purge all members from the group\n"), usageout);
(void) fputs (gettext (" -l, --list list the members of the group\n"), usageout);
exit (status);
}
| void usage(int param_1)
{
undefined8 uVar1;
FILE *__stream;
char *pcVar2;
uVar1 = Prog;
__stream = stdout;
if (param_1 != 0) {
__stream = stderr;
}
pcVar2 = (char *)gettext("Usage: %s [options] [action]\n\nOptions:\n");
fprintf(__stream,pcVar2,uVar1);
pcVar2 = (char *)gettext(
" -g, --group groupname change groupname instead of the user\'s group\n (root only)\n"
);
fputs(pcVar2,__stream);
pcVar2 = (char *)gettext(" -R, --root CHROOT_DIR directory to chroot into\n");
fputs(pcVar2,__stream);
pcVar2 = (char *)gettext(&DAT_001017b3);
fputs(pcVar2,__stream);
pcVar2 = (char *)gettext("Actions:\n");
fputs(pcVar2,__stream);
pcVar2 = (char *)gettext(
" -a, --add username add username to the members of the group\n"
);
fputs(pcVar2,__stream);
pcVar2 = (char *)gettext(
" -d, --delete username remove username from the members of the group\n"
);
fputs(pcVar2,__stream);
pcVar2 = (char *)gettext(" -h, --help display this help message and exit\n");
fputs(pcVar2,__stream);
pcVar2 = (char *)gettext(" -p, --purge purge all members from the group\n");
fputs(pcVar2,__stream);
pcVar2 = (char *)gettext(" -l, --list list the members of the group\n");
fputs(pcVar2,__stream);
exit(param_1);
}
|
static struct option_locus *
optloc_lookup (int id)
{
return option_class[id];
}
| undefined8 optloc_lookup(int param_1)
{
return *(undefined8 *)(option_class + (long)param_1 * 8);
}
|
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 long a1[2], unsigned long a2) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long v4;
char v5;
unsigned long long v6;
char v7;
unsigned long long v8;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned int v16;
unsigned long long v17;
unsigned long long v18;
unsigned long long v19;
void* v20;
unsigned long long v21;
v8 = *(&v8);
v6 = *(&v6);
v2 = 0;
if (a2) {
if (a0 <= 0) {
fprintf(*(&stderr), "No netns name specified\n");
v11 = 4294967295;
return;
}
} else {
if (a0 <= 1) {
fprintf(*(&stderr), "No netns name and PID specified\n");
v10 = 4294967295;
return;
} else if (!(!get_s32(&v0, a1[1], 0x0, a1[1])) || !(*(&v0))) {
fprintf(*(&stderr), "Invalid PID: %s\n", a1[1]);
v12 = 4294967295;
return;
}
}
v4 = a1[0];
snprintf(&v5, 0x1000, "%s/%s", &g_40385e, v4);
if (create_netns_dir()) {
v13 = 4294967295;
return;
}
v1 = open64("/var/run/netns", 0x10000, 0x0);
if (v1 < 0) {
fprintf(*(&stderr), "Cannot open netns runtime directory \"%s\": %s\n", &g_40385e, strerror(*(__errno_location())));
v14 = 4294967295;
return;
}
if (flock(v1, 0x2) < 0) {
fprintf(*(&stderr), "Warning: could not flock netns runtime directory \"%s\": %s\n", &g_40385e, strerror(*(__errno_location())));
close(v1);
v1 = -1;
}
for (; mount(&g_403ca7, "/var/run/netns", "none", 0x104000, NULL); v2 = 1) {
if (!(*(__errno_location()) == 22) || !(!v2)) {
fprintf(*(&stderr), "mount --make-shared %s failed: %s\n", &g_40385e, strerror(*(__errno_location())));
if (v1 != -1) {
flock(v1, 0x8);
close(v1);
}
v17 = 4294967295;
return;
}
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 (v1 != -1) {
flock(v1, 0x8);
close(v1);
}
v18 = 4294967295;
return;
}
}
if (v1 != -1) {
flock(v1, 0x8);
close(v1);
}
v16 = 192;
v3 = open64(&v5, 0xc0, 0x0);
if (v3 < 0) {
fprintf(*(&stderr), "Cannot create namespace file \"%s\": %s\n", &v5, strerror(*(__errno_location())));
v19 = 4294967295;
return;
}
close(v3);
if (!a2) {
snprintf(&v7, 0x1000, "/proc/%d/ns/net", *(&v0));
} else {
netns_save(v3, reg_64, 64 CONCAT 0);
if (unshare(0x40000000) < 0) {
fprintf(*(&stderr), "Failed to create a new network namespace \"%s\": %s\n", v4, strerror(*(__errno_location())));
goto LABEL_402309;
} else {
strcpy(&v7, "/proc/self/ns/net");
}
}
if (mount(&v7, &v5, "none", 0x1000, NULL) >= 0) {
netns_restore();
v20 = 0;
return;
}
fprintf(*(&stderr), "Bind %s -> %s failed: %s\n", &v7, &v5, strerror(*(__errno_location())));
LABEL_402309:
if (a2) {
netns_restore();
netns_delete(a0, a1);
} else if (unlink(&v5) < 0) {
fprintf(*(&stderr), "Cannot remove namespace file \"%s\": %s\n", &v5, strerror(*(__errno_location())));
}
v21 = 4294967295;
return;
}
|
void
set_follow_state (enum SymlinkOption opt)
{
switch (opt)
{
case SYMLINK_ALWAYS_DEREF:
options.xstat = optionl_stat;
options.x_getfilecon = optionl_getfilecon;
options.no_leaf_check =
1
;
break;
case SYMLINK_NEVER_DEREF:
options.xstat = optionp_stat;
options.x_getfilecon = optionp_getfilecon;
break;
case SYMLINK_DEREF_ARGSONLY:
options.xstat = optionh_stat;
options.x_getfilecon = optionh_getfilecon;
options.no_leaf_check =
1
;
}
options.symlink_handling = opt;
if (options.debug_options & DebugStat)
{
options.xstat = debug_stat;
}
}
| void * set_follow_state(unsigned int a1)
{
void *result;
if ( a1 == 2 )
{
options[10] = (unsigned int ( *)(long))&optionh_stat;
options[12] = (unsigned int ( *)(long))optionh_getfilecon;
BYTE4(options[1]) = 1;
}
else if ( a1 <= 2 )
{
if ( a1 )
{
options[10] = (unsigned int ( *)(long))&optionl_stat;
options[12] = (unsigned int ( *)(long))optionl_getfilecon;
BYTE4(options[1]) = 1;
}
else
{
options[10] = (unsigned int ( *)(long))&optionp_stat;
options[12] = (unsigned int ( *)(long))optionp_getfilecon;
}
}
LODWORD(options[9]) = a1;
result = (void *)((unsigned long)options[8] & 2);
if ( result )
{
result = &debug_stat;
options[10] = (unsigned int ( *)(long))&debug_stat;
}
return result;
}
|
static char **
array_concat (arr1, arr2)
char **arr1, **arr2;
{
register int i, j, len, len1, len2;
register char **result;
if (arr1 == 0)
return (arr2);
if (arr2 == 0)
return (arr1);
if (arr1[0] && arr1[0][0] == 0 && arr1[1] == 0)
{
strvec_dispose (arr1);
return (arr2);
}
if (arr2[0] && arr2[0][0] == 0 && arr2[1] == 0)
return (arr1);
len1 = strvec_len (arr1);
len2 = strvec_len (arr2);
result = (char **)sh_malloc(((1 + (len1 * len2)) * sizeof (char *)), "braces.c", 759);
if (result == 0)
return (result);
len = 0;
for (i = 0; i < len1; i++)
{
int strlen_1 = strlen (arr1[i]);
for (j = 0; j < len2; j++)
{
result[len] = (char *)sh_xmalloc((1 + strlen_1 + strlen (arr2[j])), "braces.c", 770);
strcpy (result[len], arr1[i]);
strcpy (result[len] + strlen_1, arr2[j]);
len++;
}
sh_xfree((arr1[i]), "braces.c", 775);
}
sh_xfree((arr1), "braces.c", 777);
result[len] = (char *)
((void *)0)
;
return (result);
}
| int array_concat(unsigned long long a0, void* a1) {
unsigned int v0;
int tmp_0;
unsigned long v1;
unsigned long long v2;
unsigned int v3;
unsigned int v5;
unsigned int v6;
void* v7;
void* v9;
void* v10;
unsigned long long v11;
v2 = a0;
if (!v2) {
v5 = a1;
} else if (!a1) {
v5 = v2;
} else {
if (*(v2) && !*(*(v2)) && !*((v2 + 8))) {
strvec_dispose(v2);
v5 = a1;
}
if (!*(v2) || *(*(v2)) || *((v2 + 8))) {
if (*(a1) && !*(*(a1)) && !a1[8])
v5 = v2;
if (!*(a1) || *(*(a1)) || a1[8]) {
v6 = strvec_len(v2);
v0 = strvec_len(a1);
v7 = sh_malloc((v6 * v0 + 1) * 8, "braces.c", 0x2f7);
if (!v7) {
v5 = 0;
} else {
v9 = 0;
for (v11 = 0; v11 < v6; v11 = 1) {
v3 = strlen(*((v2 + v11 * 8)));
for (v10 = 0; v10 < v0; v10 = v10 + 1) {
v1 = v3 + 1;
v5 = strlen(*((a1 + 0x8 * v10)));
tmp_0 = v5 + v1;
v1 = v7 + 0x8 * v9;
*(v1) = sh_xmalloc(tmp_0, "braces.c", 0x302);
strcpy(*((0x8 * v9 + v7)), *(v2));
strcpy(v3 + *((0x8 * v9 + v7)), *((a1 + 0x8 * v10)));
v9 = v9 + 1;
}
sh_xfree(*(v2), "braces.c", 0x307);
}
sh_xfree(v2, "braces.c", 0x309);
*((0x8 * v9 + v7)) = 0;
v5 = v7;
}
}
}
}
return v5;
}
|
void
Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes,
const u_int8_t *key, u_int16_t keybytes)
{
u_int16_t i;
u_int16_t j;
u_int16_t k;
u_int32_t temp;
u_int32_t datal;
u_int32_t datar;
j = 0;
for (i = 0; i < 16 + 2; i++) {
temp = Blowfish_stream2word(key, keybytes, &j);
c->P[i] = c->P[i] ^ temp;
}
j = 0;
datal = 0x00000000;
datar = 0x00000000;
for (i = 0; i < 16 + 2; i += 2) {
datal ^= Blowfish_stream2word(data, databytes, &j);
datar ^= Blowfish_stream2word(data, databytes, &j);
Blowfish_encipher(c, &datal, &datar);
c->P[i] = datal;
c->P[i + 1] = datar;
}
for (i = 0; i < 4; i++) {
for (k = 0; k < 256; k += 2) {
datal ^= Blowfish_stream2word(data, databytes, &j);
datar ^= Blowfish_stream2word(data, databytes, &j);
Blowfish_encipher(c, &datal, &datar);
c->S[i][k] = datal;
c->S[i][k + 1] = datar;
}
}
}
| long long Blowfish_expandstate(unsigned int *a0, char *a1, unsigned long a2, char *a3, unsigned long a4) {
unsigned short v0;
unsigned short v1;
unsigned short v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
v0 = 0;
for (v1 = 0; v1 <= 17; v1 += 1) {
v5 = Blowfish_stream2word(a3, a4, &v0);
a0[0x400 + v1] = a0[0x400 + v1] ^ v5;
}
v0 = 0;
v3 = 0;
v4 = 0;
for (v1 = 0; v1 <= 17; v1 += 2) {
v3 = Blowfish_stream2word(a1, a2, &v0) ^ v3;
v4 = Blowfish_stream2word(a1, a2, &v0) ^ v4;
Blowfish_encipher(a0, &v3, &v4);
a0[0x400 + v1] = v3;
a0[0x400 + __addvsi3(v1, 0x1, v3, v1 + 0x400)] = v4;
}
for (v1 = 0; v1 <= 3; v1 += 1) {
for (v2 = 0; v2 <= 255; v2 += 2) {
v3 = Blowfish_stream2word(a1, a2, &v0) ^ v3;
v4 = Blowfish_stream2word(a1, a2, &v0) ^ v4;
Blowfish_encipher(a0, &v3, &v4);
a0[0x100 * v1 + v2] = v3;
a0[0x100 * v1 + __addvsi3(v2, 0x1, v3, v2 + v1 * 0x100)] = v4;
}
}
return 0;
}
|
char *
remove_backslashes (string)
char *string;
{
char *r, *ret, *s;
r = ret = (char *)sh_xmalloc((strlen (string) + 1), "subst.c", 4079);
for (s = string; s && *s; )
{
if (*s == '\\')
s++;
if (*s == 0)
break;
*r++ = *s++;
}
*r = '\0';
return ret;
}
| long remove_backslashes(const char *a1)
{
size_t v1;
const char *v2;
char *v3;
char *v5;
const char *v6;
long v7;
v1 = strlen(a1);
v7 = sh_xmalloc(v1 + 1, "subst.c", 4079LL);
v5 = (char *)v7;
v6 = a1;
while ( v6 && *v6 )
{
if ( *v6 == 92 )
++v6;
if ( !*v6 )
break;
v2 = v6++;
v3 = v5++;
*v3 = *v2;
}
*v5 = 0;
return v7;
}
|
int crypto_sign_ed25519_ref_sc25519_isshort_vartime(const crypto_sign_ed25519_ref_sc25519 *x)
{
int i;
for(i=31;i>15;i--)
if(x->v[i] != 0) return 0;
return 1;
}
| long long crypto_sign_ed25519_ref_sc25519_isshort_vartime(unsigned int *a0) {
unsigned int v0;
unsigned long long v2;
v0 = 31;
while (true) {
if (v0 <= 15) {
v2 = 1;
break;
} else if (!a0[v0]) {
v0 = __addvsi3(v0, 0xffffffff, v0);
} else {
v2 = 0;
break;
}
}
return v2;
}
|
, 0, gettext ("[=c=] expressions may not appear in string2 when translating")), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
if (s2->has_restricted_char_class)
{
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"when translating, the only character classes that may appear in\\nstring2 are 'upper' and 'lower'\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("when translating, the only character classes that may appear in\nstring2 are 'upper' and 'lower'")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("when translating, the only character classes that may appear in\nstring2 are 'upper' and 'lower'")), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
| void gettext(void)
{
halt_baddata();
}
|
static void
dump_cfg_fmtint(OpCodes code, int val)
{
printf("%s %s\n", lookup_opcode_name(code), fmt_intarg(code, val));
}
| void dump_cfg_fmtint(undefined4 param_1,undefined4 param_2)
{
undefined8 uVar1;
undefined8 uVar2;
uVar1 = fmt_intarg(param_1,param_2);
uVar2 = lookup_opcode_name(param_1);
printf("%s %s\n",uVar2,uVar1);
return;
}
|
static VALUE *
docolon (VALUE *sv, VALUE *pv)
{
VALUE *v;
char const *errmsg;
struct re_pattern_buffer re_buffer;
char fastmap[
(0x7f * 2 + 1)
+ 1];
struct re_registers re_regs;
regoff_t matchlen;
tostring (sv);
tostring (pv);
re_regs.num_regs = 0;
re_regs.start =
((void *)0)
;
re_regs.end =
((void *)0)
;
re_buffer.buffer =
((void *)0)
;
re_buffer.allocated = 0;
re_buffer.fastmap = fastmap;
re_buffer.translate =
((void *)0)
;
re_syntax_options =
((((((unsigned long int) 1) << 1) << 1) | ((((((((unsigned long int) 1) << 1) << 1) << 1) << 1) << 1) << 1) | (((((((((unsigned long int) 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) | (((((((((((unsigned long int) 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) | ((((((((((((((((((unsigned long int) 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1)) | (((unsigned long int) 1) << 1) | ((((((((((((((((((((((((((unsigned long int) 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1)) & ~((((((((((((((((((((((((((unsigned long int) 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) & ~((((((((((((((((((unsigned long int) 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1);
errmsg = re_compile_pattern (pv->u.s, strlen (pv->u.s), &re_buffer);
if (errmsg)
((!!sizeof (struct { _Static_assert (EXPR_INVALID, "verify_expr (" "EXPR_INVALID" ", " "(error (EXPR_INVALID, 0, \"%s\", (errmsg)), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXPR_INVALID, 0, "%s", (errmsg)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXPR_INVALID, 0, "%s", (errmsg)), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
re_buffer.newline_anchor = 0;
matchlen = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs);
if (0 <= matchlen)
{
if (re_buffer.re_nsub > 0)
{
if (re_regs.end[1] < 0)
v = str_value ("");
else
{
sv->u.s[re_regs.end[1]] = '\0';
v = str_value (sv->u.s + re_regs.start[1]);
}
}
else
{
size_t i = (
(__ctype_get_mb_cur_max ())
== 1
? matchlen
: mbs_offset_to_chars (sv->u.s, matchlen));
v = int_value (i);
}
}
else if (matchlen == -1)
{
if (re_buffer.re_nsub > 0)
v = str_value ("");
else
v = int_value (0);
}
else
((!!sizeof (struct { _Static_assert (EXPR_FAILURE, "verify_expr (" "EXPR_FAILURE" ", " "(error (EXPR_FAILURE, (matchlen == -2 ? (*__errno_location ()) : 75), gettext (\"error in regular expression matcher\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXPR_FAILURE, (matchlen == -2 ?
(*__errno_location ())
:
75
), gettext ("error in regular expression matcher")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXPR_FAILURE, (matchlen == -2 ?
(*__errno_location ())
:
75
), gettext ("error in regular expression matcher")), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
if (0 < re_regs.num_regs)
{
free (re_regs.start);
free (re_regs.end);
}
re_buffer.fastmap =
((void *)0)
;
regfree (&re_buffer);
return v;
}
| long docolon(long a1, long a2)
{
size_t v2;
int v3;
long v4;
char *v5;
int v6;
int v8;
long v9;
const char *v10;
struct re_registers regs;
struct re_pattern_buffer buffer;
char v13;
unsigned long v14;
v14 = __readfsqword(0x28u);
tostring((unsigned int *)a1);
tostring((unsigned int *)a2);
regs.num_regs = 0;
regs.start = 0LL;
regs.end = 0LL;
buffer.buffer = 0LL;
buffer.allocated = 0LL;
buffer.fastmap = &v13;
buffer.translate = 0LL;
re_syntax_options = 710LL;
v2 = strlen(*(const char **)(a2 + 8));
v10 = re_compile_pattern(*(const char **)(a2 + 8), v2, &buffer);
if ( v10 )
error(2, 0, "%s", v10);
*((_BYTE *)&buffer + 56) &= ~0x80u;
v3 = strlen(*(const char **)(a1 + 8));
v8 = re_match(&buffer, *(const char **)(a1 + 8), v3, 0, ®s);
if ( v8 < 0 )
{
if ( v8 != -1 )
{
v5 = gettext("error in regular expression matcher");
if ( v8 == -2 )
v6 = *_errno_location();
else
v6 = 75;
error(3, v6, v5);
goto LABEL_19;
}
if ( buffer.re_nsub )
{
LABEL_6:
v9 = str_value((long)locale);
goto LABEL_19;
}
v9 = (long)int_value(0LL);
}
else
{
if ( !buffer.re_nsub )
{
if ( _ctype_get_mb_cur_max() == 1 )
v4 = v8;
else
v4 = mbs_offset_to_chars(*(_QWORD *)(a1 + 8), v8);
v9 = (long)int_value(v4);
goto LABEL_19;
}
if ( regs.end[1] < 0 )
goto LABEL_6;
*(_BYTE *)(*(_QWORD *)(a1 + 8) + regs.end[1]) = 0;
v9 = str_value(*(_QWORD *)(a1 + 8) + regs.start[1]);
}
LABEL_19:
if ( regs.num_regs )
{
free(regs.start);
free(regs.end);
}
buffer.fastmap = 0LL;
regfree(&buffer);
return v9;
}
|
int
do_rmdir(struct sftp_conn *conn, const char *path)
{
u_int status, id;
sshlog("sftp-client.c", __func__, 891, 0, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "Sending SSH2_FXP_RMDIR \"%s\"", path);
id = conn->msg_id++;
send_string_request(conn, id, 15, path,
strlen(path));
status = get_status(conn, id);
if (status != 0)
sshlog("sftp-client.c", __func__, 899, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "remote rmdir \"%s\": %s", path, fx2txt(status));
return status == 0 ? 0 : -1;
}
| long long do_rmdir(struct_0 *a0, char *a1) {
int tmp_17;
unsigned long v0;
unsigned long v1;
struct_0 *v2;
unsigned int v3;
unsigned int v4;
unsigned long long v6;
v2 = a0;
v1 = a1;
sshlog("sftp-client.c", "do_rmdir", 0x37b, 0x0, 0x6, 0x0, "Sending SSH2_FXP_RMDIR \"%s\"");
tmp_17 = a0->field_18;
a0->field_18 = a0->field_18 + 1;
v3 = tmp_17;
send_string_request(a0, v3, 0xf, a1, strlen(a1));
v4 = get_status(a0, v3);
if (v4) {
fx2txt(v4);
v0 = a1;
sshlog("sftp-client.c", "do_rmdir", 0x383, 0x0, 0x2, 0x0, "remote rmdir \"%s\": %s");
}
if (!v4)
v6 = 0;
else
v6 = 4294967295;
return v6;
}
|
vi_match(EditLine *el, wint_t c __attribute__((__unused__)))
{
const wchar_t match_chars[] = L"()[]{}";
wchar_t *cp;
size_t delta, i, count;
wchar_t o_ch, c_ch;
*el->el_line.lastchar = '\0';
i = wcscspn(el->el_line.cursor, match_chars);
o_ch = el->el_line.cursor[i];
if (o_ch == 0)
return 6;
delta = (size_t)(wcschr(match_chars, o_ch) - match_chars);
c_ch = match_chars[delta ^ 1];
count = 1;
delta = 1 - (delta & 1) * 2;
for (cp = &el->el_line.cursor[i]; count; ) {
cp += delta;
if (cp < el->el_line.buffer || cp >= el->el_line.lastchar)
return 6;
if (*cp == o_ch)
count++;
else if (*cp == c_ch)
count--;
}
el->el_line.cursor = cp;
if (el->el_chared.c_vcmd.action != 0x00) {
if (delta > 0)
el->el_line.cursor++;
cv_delfini(el);
return 4;
}
return 5;
}
| long vi_match(long a1)
{
wchar_t *v2;
wchar_t wc;
_DWORD *v4;
long v5;
size_t v6;
long v7;
wchar_t reject[10];
unsigned long v9;
v9 = __readfsqword(0x28u);
wcscpy(reject, U"()[]{}");
**(_DWORD **)(a1 + 96) = 0;
v6 = wcscspn(*(const wchar_t **)(a1 + 88), reject);
wc = *(_DWORD *)(4 * v6 + *(_QWORD *)(a1 + 88));
if ( !wc )
return 6LL;
v2 = wcschr(reject, wc);
v5 = 1LL;
v7 = 1 - 2 * ((v2 - reject) & 1);
v4 = (_DWORD *)(4 * v6 + *(_QWORD *)(a1 + 88));
while ( v5 )
{
v4 += v7;
if ( (unsigned long)v4 < *(_QWORD *)(a1 + 80) || (unsigned long)v4 >= *(_QWORD *)(a1 + 96) )
return 6LL;
if ( wc == *v4 )
{
++v5;
}
else if ( reject[(v2 - reject) ^ 1] == *v4 )
{
--v5;
}
}
*(_QWORD *)(a1 + 88) = v4;
if ( !*(_DWORD *)(a1 + 960) )
return 5LL;
if ( v7 )
*(_QWORD *)(a1 + 88) += 4LL;
cv_delfini(a1);
return 4LL;
}
|
int
acl_copy_entry(acl_entry_t dest_d, acl_entry_t src_d)
{
acl_entry_obj *dest_p = ((acl_entry_obj *)__ext2int_and_check(dest_d, (0x9D6B))),
*src_p = ((acl_entry_obj *)__ext2int_and_check(src_d, (0x9D6B)));
if (!dest_d || !src_p)
return -1;
dest_p->i.e_entry.e_tag = src_p->i.e_entry.e_tag;
dest_p->i.e_entry.e_id = src_p->i.e_entry.e_id;
dest_p->i.e_entry.e_perm = src_p->i.e_entry.e_perm;
__acl_reorder_entry_obj_p(dest_p);
return 0;
}
| long long acl_copy_entry(unsigned long long a0, unsigned long long a1) {
struct_0 *v0;
int tmp_41;
int tmp_59;
struct_0 *v1;
unsigned long long v3;
v0 = __ext2int_and_check(a0, 0x9d6b);
v1 = __ext2int_and_check(a1, 0x9d6b);
if (a0 && v1) {
v0->field_20 = v1->field_20;
tmp_41 = v1->field_30;
v0->field_28 = v1->field_28;
v0->field_30 = tmp_41;
tmp_59 = v1->field_40;
v0->field_38 = v1->field_38;
v0->field_40 = tmp_59;
__acl_reorder_entry_obj_p(v0);
v3 = 0;
}
if (!a0 || !v1)
v3 = 4294967295;
return v3;
}
|
static void
display_speed (struct termios *mode,
_Bool
fancy)
{
if (cfgetispeed (mode) == 0 || cfgetispeed (mode) == cfgetospeed (mode))
wrapf (fancy ? "speed %lu baud;" : "%lu\n",
baud_to_value (cfgetospeed (mode)));
else
wrapf (fancy ? "ispeed %lu baud; ospeed %lu baud;" : "%lu %lu\n",
baud_to_value (cfgetispeed (mode)),
baud_to_value (cfgetospeed (mode)));
if (!fancy)
current_col = 0;
}
| void display_speed(void* a0, unsigned long a1) {
unsigned long v1;
if (!cfgetispeed(a0)) {
LABEL_4032b6:
baud_to_value(cfgetospeed(a0));
wrapf();
} else {
if (cfgetispeed(a0) == cfgetospeed(a0))
goto LABEL_4032b6;
baud_to_value(cfgetospeed(a0));
baud_to_value(cfgetispeed(a0));
wrapf();
}
v1 = a1 ^ 1;
if ((a1 ^ 1))
current_col = 0;
return;
}
|
static void
sparse_major_coder (struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr, void const *data)
{
code_num (st->sparse_major, keyword, xhdr);
}
| long long sparse_major_coder(struct_0 *a0, unsigned int a1, void* a2, unsigned long a3) {
unsigned long v0;
v0 = a3;
return code_num(a0->field_124, a1, a2);
}
|
static int
user_key_command_allowed2(struct passwd *user_pw, struct sshkey *key,
const char *remote_ip, const char *remote_host,
struct sshauthopt **authoptsp)
{
struct passwd *runas_pw =
((void *)0)
;
FILE *f =
((void *)0)
;
int r, ok, found_key = 0;
int i, uid_swapped = 0, ac = 0;
pid_t pid;
char *username =
((void *)0)
, *key_fp =
((void *)0)
, *keytext =
((void *)0)
;
char uidstr[32], *tmp, *command =
((void *)0)
, **av =
((void *)0)
;
void (*osigchld)(int);
if (authoptsp !=
((void *)0)
)
*authoptsp =
((void *)0)
;
if (options.authorized_keys_command ==
((void *)0)
)
return 0;
if (options.authorized_keys_command_user ==
((void *)0)
) {
sshlog("auth2-pubkey.c", __func__, 638, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "No user for AuthorizedKeysCommand specified, skipping");
return 0;
}
osigchld = ssh_signal(
17
,
((__sighandler_t) 0)
);
username = percent_expand(options.authorized_keys_command_user,
"u", user_pw->pw_name, (char *)
((void *)0)
);
runas_pw = getpwnam(username);
if (runas_pw ==
((void *)0)
) {
sshlog("auth2-pubkey.c", __func__, 653, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "AuthorizedKeysCommandUser \"%s\" not found: %s", username, strerror(
(*__errno_location ())
))
;
goto out;
}
if ((key_fp = sshkey_fingerprint(key, options.fingerprint_hash,
SSH_FP_DEFAULT)) ==
((void *)0)
) {
sshlog("auth2-pubkey.c", __func__, 661, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "sshkey_fingerprint failed");
goto out;
}
if ((r = sshkey_to_base64(key, &keytext)) != 0) {
sshlog("auth2-pubkey.c", __func__, 665, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "sshkey_to_base64 failed");
goto out;
}
if (argv_split(options.authorized_keys_command, &ac, &av, 0) != 0) {
sshlog("auth2-pubkey.c", __func__, 671, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "AuthorizedKeysCommand \"%s\" contains invalid quotes", options.authorized_keys_command)
;
goto out;
}
if (ac == 0) {
sshlog("auth2-pubkey.c", __func__, 676, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "AuthorizedKeysCommand \"%s\" yielded no arguments", options.authorized_keys_command)
;
goto out;
}
snprintf(uidstr, sizeof(uidstr), "%llu",
(unsigned long long)user_pw->pw_uid);
for (i = 1; i < ac; i++) {
tmp = percent_expand(av[i],
"U", uidstr,
"u", user_pw->pw_name,
"h", user_pw->pw_dir,
"t", sshkey_ssh_name(key),
"f", key_fp,
"k", keytext,
(char *)
((void *)0)
);
if (tmp ==
((void *)0)
)
sshfatal("auth2-pubkey.c", __func__, 692, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "percent_expand failed");
free(av[i]);
av[i] = tmp;
}
command = argv_assemble(ac, av);
if (ac == 1) {
av = xreallocarray(av, ac + 2, sizeof(*av));
av[1] = xstrdup(user_pw->pw_name);
av[2] =
((void *)0)
;
free(command);
xasprintf(&command, "%s %s", av[0], av[1]);
}
if ((pid = subprocess("AuthorizedKeysCommand", command,
ac, av, &f,
(1<<1)|(1<<2),
runas_pw, temporarily_use_uid, restore_uid)) == 0)
goto out;
uid_swapped = 1;
temporarily_use_uid(runas_pw);
ok = auth_check_authkeys_file(user_pw, f,
options.authorized_keys_command, key, remote_ip,
remote_host, authoptsp);
fclose(f);
f =
((void *)0)
;
if (exited_cleanly(pid, "AuthorizedKeysCommand", command, 0) != 0)
goto out;
found_key = ok;
out:
if (f !=
((void *)0)
)
fclose(f);
ssh_signal(
17
, osigchld);
for (i = 0; i < ac; i++)
free(av[i]);
free(av);
if (uid_swapped)
restore_uid();
free(command);
free(username);
free(key_fp);
free(keytext);
return found_key;
}
| int user_key_command_allowed2(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long *a4) {
char v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
void* v9;
void* v10;
void* v11;
void* v12;
void* v13;
void* v14;
void* v15;
unsigned long long v16;
unsigned long v17;
char v18;
unsigned long v19;
unsigned long long v20;
unsigned long v21;
unsigned long long v22;
void* v23;
unsigned long v24;
unsigned long long *v25;
void* v26;
char v27;
unsigned long long v28;
unsigned int v29;
v14 = 0;
v9 = 0;
v3 = 0;
v5 = 0;
v2 = 0;
v15 = 0;
v13 = 0;
v10 = 0;
v11 = 0;
v12 = 0;
if (a4)
*(a4) = 0;
if (!*(5250648)) {
v29 = 0;
return v29;
} else if (*(5250656)) {
v16 = ssh_signal(0x11, 0x0);
v15 = percent_expand(*(5250656), "u", a0->field_0, 0x0);
v14 = getpwnam(v15);
if (!v14) {
sshlog("auth2-pubkey.c", "user_key_command_allowed2", 0x28d, 0x0, 0x2, 0x0, "AuthorizedKeysCommandUser \"%s\" not found: %s", v15, strerror(*(__errno_location())), *(&v0), *(&v1));
} else {
v13 = sshkey_fingerprint(a1, *(5250728), 0x0, *(5250728));
if (v13) {
v6 = sshkey_to_base64(a1, &v10, &v10);
if (v6) {
sshlog("auth2-pubkey.c", "user_key_command_allowed2", 0x299, 0x1, 0x2, ssh_err(v6), "sshkey_to_base64 failed", *(&v0), *(&v1), a4, a3);
} else if (argv_split(*(5250648), &v2, &v12, 0x0)) {
sshlog("auth2-pubkey.c", "user_key_command_allowed2", 0x29f, 0x0, 0x2, 0x0, "AuthorizedKeysCommand \"%s\" contains invalid quotes", *(5250648), *(&v1), a4, a3);
} else if (v2) {
snprintf(&v18, 0x20, "%llu", a0->field_10);
for (v4 = 1; v4 < v2; v4 = __addvsi3(v4, 0x1, v4 * 8 + v12)) {
v26 = 0;
v25 = v10;
v24 = "k";
v23 = v13;
v22 = "f";
v21 = sshkey_ssh_name(a1);
v20 = "t";
v19 = a0->field_20;
v17 = percent_expand(*((v12 + 8 * v4)), "U", &v18, "u");
if (!v17) {
v25 = "percent_expand failed";
sshfatal("auth2-pubkey.c", "user_key_command_allowed2", 0x2b4, 0x1, 0x1, 0x0, *(&v27));
}
free(*((v12 + 8 * v4)));
*((8 * v4 + v12)) = v17;
}
v11 = argv_assemble(v2, v12, v12);
if (v2 == 1) {
v29 = __addvsi3(v2, 0x2, a2);
v12 = xreallocarray(v12, v29, 0x8, v29);
*(&v12[8]) = xstrdup(a0->field_0);
*(&v12[16]) = 0;
free(v11);
xasprintf(&v11, "%s %s", *(v12), v12[8]);
}
v25 = got.restore_uid;
v24 = got.temporarily_use_uid;
v23 = v14;
v7 = subprocess("AuthorizedKeysCommand", v11, v2, v12, &v9, 0x6, *(&v27), v28);
if (v7) {
v5 = 1;
temporarily_use_uid(v14);
v25 = a4;
v8 = auth_check_authkeys_file(a0, v9, *(5250648), a1, a2, a3);
fclose(v9);
v9 = 0;
if (!exited_cleanly(v7, "AuthorizedKeysCommand", v11, 0x0))
v3 = v8;
}
} else {
sshlog("auth2-pubkey.c", "user_key_command_allowed2", 0x2a4, 0x0, 0x2, 0x0, "AuthorizedKeysCommand \"%s\" yielded no arguments", *(5250648), *(&v1), a4, a3);
}
} else {
sshlog("auth2-pubkey.c", "user_key_command_allowed2", 0x295, 0x1, 0x2, 0x0, "sshkey_fingerprint failed", *(&v0), *(&v1), a4, a3);
}
}
if (v9)
fclose(v9);
ssh_signal(0x11, v16);
for (v4 = 0; v4 < v2; v4 = __addvsi3(v4, 0x1, v2)) {
free(*((v12 + 8 * v4)));
}
free(v12);
if (v5)
restore_uid();
free(v11);
free(v15);
free(v13);
free(v10);
v29 = v3;
return v29;
} else {
sshlog("auth2-pubkey.c", "user_key_command_allowed2", 0x27e, 0x0, 0x2, 0x0, "No user for AuthorizedKeysCommand specified, skipping", *(&v0), *(&v1), a4, a3);
v29 = 0;
return v29;
}
}
|
int
rl_transpose_words (int count, int key)
{
char *word1, *word2;
int w1_beg, w1_end, w2_beg, w2_end;
int orig_point, orig_end;
orig_point = rl_point;
orig_end = rl_end;
if (!count)
return 0;
rl_forward_word (count, key);
w2_end = rl_point;
rl_backward_word (1, key);
w2_beg = rl_point;
rl_backward_word (count, key);
w1_beg = rl_point;
rl_forward_word (1, key);
w1_end = rl_point;
if ((w1_beg == w2_beg) || (w2_beg < w1_end))
{
rl_ding ();
rl_point = orig_point;
return 1;
}
word1 = rl_copy_text (w1_beg, w1_end);
word2 = rl_copy_text (w2_beg, w2_end);
rl_begin_undo_group ();
rl_point = w2_beg;
rl_delete_text (w2_beg, w2_end);
rl_insert_text (word1);
rl_point = w1_beg;
rl_delete_text (w1_beg, w1_end);
rl_insert_text (word2);
rl_point = w2_end;
rl_end = orig_end;
rl_end_undo_group ();
xfree (word1);
xfree (word2);
return 0;
}
| long long rl_transpose_words(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
char *v6;
char *v7;
unsigned long long v9;
v0 = rl_point;
v1 = rl_end;
if (!a0) {
v9 = 0;
} else {
rl_forward_word(a0, a1);
v2 = rl_point;
rl_backward_word(0x1, a1);
v3 = rl_point;
rl_backward_word(a0, a1);
v4 = rl_point;
rl_forward_word(0x1, a1);
v5 = rl_point;
if (v4 != v3 && v3 >= v5) {
v6 = rl_copy_text(v4, v5, v5);
v7 = rl_copy_text(v3, v2, v2);
rl_begin_undo_group();
rl_point = v3;
rl_delete_text(v3, v2);
rl_insert_text(v6);
rl_point = v4;
rl_delete_text(v4, v5);
rl_insert_text(v7);
rl_point = v2;
rl_end = v1;
rl_end_undo_group();
xfree(v6);
xfree(v7);
v9 = 0;
}
if (v3 < v5 || v4 == v3) {
rl_ding();
rl_point = v0;
v9 = 1;
}
}
return v9;
}
|
vi_alias(EditLine *el, wint_t c __attribute__((__unused__)))
{
char alias_name[3];
const char *alias_text;
if (el->el_chared.c_aliasfun ==
((void *)0)
)
return 6;
alias_name[0] = '_';
alias_name[2] = 0;
if (el_getc(el, &alias_name[1]) != 1)
return 6;
alias_text = (*el->el_chared.c_aliasfun)(el->el_chared.c_aliasarg,
alias_name);
if (alias_text !=
((void *)0)
)
el_wpush(el, ct_decode_string(alias_text, &el->el_scratch));
return 0;
}
| long long vi_alias(unsigned long long a0[126], unsigned long a1) {
unsigned int v0;
unsigned long long v1;
char v2;
char v3;
char v4;
unsigned long long v6;
unsigned long long v7;
v0 = a1;
if (!a0[123]) {
v6 = 6;
return v6;
}
v2 = 95;
v4 = 0;
if (el_getc(a0, &v3, &v3) != 1) {
v6 = 6;
return v6;
}
v1 = a0[123](a0[125], &v2, &v2, a0[123]);
if (v1) {
v7 = ct_decode_string(v1, &a0[1 + 31], &a0[1 + 31]);
el_wpush(a0, v7, v7);
v6 = 0;
return v6;
}
v6 = 0;
return v6;
}
|
static Authmethod *
authmethod_lookup(const char *name)
{
Authmethod *method =
((void *)0)
;
if (name !=
((void *)0)
)
for (method = authmethods; method->name !=
((void *)0)
; method++)
if (strcmp(name, method->name) == 0)
return method;
sshlog("sshconnect2.c", __func__, 2321, 0, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "Unrecognized authentication method name: %s", name ? name : "NULL");
return
((void *)0)
;
}
| const char ** authmethod_lookup(const char *a1)
{
const char *v2;
const char **i;
if ( a1 )
{
for ( i = (const char **)&authmethods; *i; i += 5 )
{
if ( !strcmp(a1, *i) )
return i;
}
}
if ( a1 )
v2 = a1;
else
v2 = "NULL";
sshlog("sshconnect2.c", "authmethod_lookup", 2321LL, 0LL, 6LL, 0LL, "Unrecognized authentication method name: %s", v2);
return 0LL;
}
|
parse_cmd(EditLine *el, const wchar_t *cmd)
{
el_bindings_t *b = el->el_map.help;
size_t i;
for (i = 0; i < el->el_map.nfunc; i++)
if (wcscmp(b[i].name, cmd) == 0)
return b[i].func;
return -1;
}
| long long parse_cmd(unsigned long long a0[136], unsigned short *a1) {
void* v0;
void* v1;
unsigned long long v4;
v1 = a0[133];
v0 = 0;
while (true) {
if (v0 >= a0[135]) {
v4 = 4294967295;
break;
} else if (!wcscmp(*((v1 + 0x18 * v0)), a1)) {
v4 = *((8 + v1 + 0x18 * v0));
break;
} else {
v0 += 1;
}
}
return v4;
}
|
static void
addblanks ()
{
register int i;
unsigned char uc;
for (i = 0; i < 256; i++)
{
uc = i;
if (
((*__ctype_b_loc ())[(int) ((
uc
))] & (unsigned short int) _ISblank)
)
lsyntax[uc] |= 0x2000;
}
}
| void addblanks(void)
{
ushort **ppuVar1;
uint uVar2;
for (uVar2 = 0; (int)uVar2 < 0x100; uVar2 = uVar2 + 1) {
ppuVar1 = __ctype_b_loc();
if (((*ppuVar1)[(byte)uVar2] & 1) != 0) {
*(uint *)(lsyntax + (long)(int)(uVar2 & 0xff) * 4) =
*(uint *)(lsyntax + (long)(int)(uVar2 & 0xff) * 4) | 0x2000;
}
}
return;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.