input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
u_int
ssh_packet_get_maxsize(struct ssh *ssh)
{
return ssh->state->max_packet_size;
}
| long long ssh_packet_get_maxsize(struct struct_0 **a0) {
return *(a0)->field_138;
}
|
static inline int parser_eof(void)
{
return tokpushback && lasttoken == 0;
}
| _BOOL8 parser_eof()
{
return tokpushback && !lasttoken;
}
|
static intmax_t
expland ()
{
register intmax_t val1, val2;
int set_noeval;
val1 = expbor ();
while (curtok == 7)
{
set_noeval = 0;
if (val1 == 0)
{
set_noeval = 1;
noeval++;
}
readtok ();
val2 = expbor ();
if (set_noeval)
noeval--;
val1 = val1 && val2;
lasttok = 7;
}
return (val1);
}
| long expland(void)
{
int iVar1;
long lVar2;
long lVar3;
lVar2 = expbor();
do {
if (curtok != 7) {
return lVar2;
}
if (lVar2 == 0) {
noeval = noeval + 1;
}
readtok();
lVar3 = expbor();
if (lVar2 == 0) {
noeval = noeval + -1;
LAB_001012d5:
iVar1 = 0;
}
else {
if (lVar3 == 0) goto LAB_001012d5;
iVar1 = 1;
}
lVar2 = (long)iVar1;
lasttok = 7;
} while( true );
}
|
int
platform_sys_dir_uid(uid_t uid)
{
if (uid == 0)
return 1;
return 0;
}
| long long platform_sys_dir_uid(unsigned long a0) {
unsigned long long v1;
if (!a0)
v1 = 1;
else
v1 = 0;
return v1;
}
|
3) {
strlcat(msg, "\nAre you sure you want "
"to continue connecting (yes/no)? ", sizeof(msg));
if (!confirm(msg,
((void *)0)
))
goto fail;
} else if (options.strict_host_key_checking !=
| void strlcat(void)
{
halt_baddata();
}
|
static const char *tnl_defname(const struct ip_tunnel_parm *p)
{
switch (p->iph.protocol) {
case
IPPROTO_IPIP
:
if (p->i_flags & ((__be16)0x0001))
return "ip_vti0";
else
return "tunl0";
case
IPPROTO_GRE
:
return "gre0";
case
IPPROTO_IPV6
:
return "sit0";
}
return
((void *)0)
;
}
| int tnl_defname(struct_0 *a0) {
unsigned int v1;
if (a0->field_29 != 47) {
if (a0->field_29 <= 47) {
if (a0->field_29 == 4) {
if ((a0->field_14 & 1))
v1 = &g_4026ae;
else
v1 = &g_4026b6;
}
if (a0->field_29 == 41)
v1 = &g_4026c1;
}
if (a0->field_29 > 47 || a0->field_29 != 4 && a0->field_29 != 41)
v1 = 0;
} else {
v1 = &g_4026bc;
}
return v1;
}
|
int
main (int argc, char **argv)
{
int c;
;
set_program_name (argv[0]);
setlocale (
6
, "");
bindtextdomain ("coreutils", "/usr/local/share/locale");
textdomain ("coreutils");
hard_LC_COLLATE = hard_locale (
3
);
atexit (close_stdout);
only_file_1 =
1
;
only_file_2 =
1
;
both =
1
;
seen_unpairable =
0
;
issued_disorder_warning[0] = issued_disorder_warning[1] =
0
;
check_input_order = CHECK_ORDER_DEFAULT;
total_option =
0
;
while ((c = getopt_long (argc, argv, "123z", long_options,
((void *)0)
)) != -1)
switch (c)
{
case '1':
only_file_1 =
0
;
break;
case '2':
only_file_2 =
0
;
break;
case '3':
both =
0
;
break;
case 'z':
delim = '\0';
break;
case NOCHECK_ORDER_OPTION:
check_input_order = CHECK_ORDER_DISABLED;
break;
case CHECK_ORDER_OPTION:
check_input_order = CHECK_ORDER_ENABLED;
break;
case OUTPUT_DELIMITER_OPTION:
if (col_sep_len && !(strcmp (col_sep, optarg) == 0))
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"multiple output delimiters specified\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("multiple output delimiters specified")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("multiple output delimiters specified")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
col_sep = optarg;
col_sep_len = *optarg ? strlen (optarg) : 1;
break;
case TOTAL_OPTION:
total_option =
1
;
break;
case GETOPT_HELP_CHAR: usage (
0
); break;;
case GETOPT_VERSION_CHAR: version_etc (
stdout
, "comm", "GNU coreutils", Version, ("Richard M. Stallman"), ("David MacKenzie"), (char *)
((void *)0)
); exit (
0
); break;;
default:
usage (
1
);
}
if (! col_sep_len)
col_sep_len = 1;
if (argc - optind < 2)
{
if (argc <= optind)
error (0, 0, gettext ("missing operand"));
else
error (0, 0, gettext ("missing operand after %s"), quote (argv[argc - 1]));
usage (
1
);
}
if (2 < argc - optind)
{
error (0, 0, gettext ("extra operand %s"), quote (argv[optind + 2]));
usage (
1
);
}
compare_files (argv + optind);
}
| int main(unsigned long a0) {
void* v0;
unsigned int v1;
unsigned long v2;
unsigned long v4;
unsigned long long *v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
v2 = v4;
set_program_name(*(v5));
setlocale(0x6, &g_401703);
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
hard_LC_COLLATE = hard_locale(0x3);
atexit(got.close_stdout);
only_file_1 = 1;
only_file_2 = 1;
both = 1;
seen_unpairable = 0;
g_4015be = 0;
issued_disorder_warning = g_4015be;
check_input_order = 0;
total_option = 0;
while (true) {
v1 = getopt_long(a0, v5, "123z", &long_options, NULL);
if (v1 == -1) {
if (!col_sep_len)
col_sep_len = 1;
if (a0 - optind <= 1) {
if (a0 <= optind) {
error(0x0, 0x0, gettext("missing operand"));
break;
} else {
v8 = quote(v5[1 + a0]);
error(0x0, 0x0, gettext("missing operand after %s"));
break;
}
} else {
if (a0 - optind > 2) {
v9 = quote(v5[2 + optind]);
error(0x0, 0x0, gettext("extra operand %s"));
usage(0x1);
}
compare_files(&v5[optind]);
}
} else if (v1 <= 131) {
if (v1 >= 122) {
switch (v1) {
case 122:
delim = 0;
break;
case 128:
check_input_order = 1;
break;
case 129:
check_input_order = 2;
break;
case 130:
if (col_sep_len) {
v6 = strcmp(col_sep, optarg);
if (v6)
error(0x1, 0x0, gettext("multiple output delimiters specified"));
}
if (!col_sep_len || !v6) {
col_sep = optarg;
if (*(optarg))
v7 = strlen(optarg);
else
v7 = 1;
col_sep_len = v7;
break;
}
case 131:
total_option = 1;
break;
default:
usage(0x1);
}
} else if (v1 == 51) {
both = 0;
} else if (v1 <= 51) {
if (v1 == 50) {
only_file_2 = 0;
} else if (v1 <= 50) {
if (v1 == 49) {
only_file_1 = 0;
} else if (v1 <= 49) {
if (v1 == -131) {
v0 = 0;
version_etc(stdout, "comm", "GNU coreutils", Version, "Richard M. Stallman", "David MacKenzie");
exit(0x0);
}
if (v1 == -130)
usage(0x0);
}
}
}
}
}
usage(0x1);
}
|
static inline const char *rta_getattr_str(const struct rtattr *rta)
{
return (const char *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| int rta_getattr_str(unsigned long a0) {
return a0 + 4;
}
|
static int
rsa_generate_private_key(u_int bits, RSA **rsap)
{
RSA *private =
((void *)0)
;
BIGNUM *f4 =
((void *)0)
;
int ret = -1;
if (rsap ==
((void *)0)
)
return -10;
if (bits < 1024 ||
bits > (16384 / 8) * 8)
return -56;
*rsap =
((void *)0)
;
if ((private = RSA_new()) ==
((void *)0)
|| (f4 = BN_new()) ==
((void *)0)
) {
ret = -2;
goto out;
}
if (!BN_set_word(f4,
0x10001L
) ||
!RSA_generate_key_ex(private, bits, f4,
((void *)0)
)) {
ret = -22;
goto out;
}
*rsap = private;
private =
((void *)0)
;
ret = 0;
out:
RSA_free(private);
BN_free(f4);
return ret;
}
| int rsa_generate_private_key(unsigned long a0, unsigned long long *a1) {
unsigned int v0;
void* v1;
unsigned long long v2;
unsigned int v4;
v1 = 0;
v2 = 0;
v0 = -1;
if (!a1) {
v4 = -10;
} else {
if (a0 > 1023 && a0 <= 0x4000) {
*(a1) = 0;
v1 = RSA_new();
if (v1) {
v2 = BN_new();
if (v2) {
v4 = BN_set_word(v2, 0x10001);
if (v4) {
v4 = RSA_generate_key_ex(v1, a0, v2, 0x0);
if (v4) {
*(a1) = v1;
v1 = 0;
v0 = 0;
}
}
if (!v4 || !v4)
v0 = -22;
}
}
if (!v1 || !v2)
v0 = -2;
RSA_free(v1);
BN_free(v2);
v4 = v0;
}
if (a0 <= 1023 || a0 > 0x4000)
v4 = -56;
}
return v4;
}
|
static void open_files (void)
{
if (gr_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, gr_dbname ());
exit (10);
}
add_cleanup (cleanup_unlock_group,
((void *)0)
);
if (is_shadow_grp) {
if (sgr_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, sgr_dbname ());
exit (10);
}
add_cleanup (cleanup_unlock_gshadow,
((void *)0)
);
}
add_cleanup (cleanup_report_add_group, group_name);
if (gr_open (
0100
|
02
) == 0) {
fprintf (
stderr
, gettext ("%s: cannot open %s\n"), Prog, gr_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
4
, "cannot open %s", gr_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
exit (10);
}
if (is_shadow_grp) {
if (sgr_open (
0100
|
02
) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot open %s\n"),
Prog, sgr_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
4
, "cannot open %s", sgr_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
exit (10);
}
}
}
| long long open_files() {
void* v0;
void* v1;
char *v2;
char *v3;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
if (!gr_lock()) {
v5 = gr_dbname();
fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n"));
exit(0xa);
}
add_cleanup(got.cleanup_unlock_group, 0x0);
if (is_shadow_grp) {
if (sgr_lock()) {
add_cleanup(got.cleanup_unlock_gshadow, 0x0);
} else {
v6 = sgr_dbname();
fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n"));
exit(0xa);
}
}
add_cleanup(got.cleanup_report_add_group, group_name);
if (!gr_open(0x42)) {
v8 = gr_dbname();
fprintf(*(&stderr), gettext("%s: cannot open %s\n"));
v3 = setlocale(0x6, NULL);
v0 = 0;
if (v3)
v0 = strdup(v3);
if (v0)
setlocale(0x6, "C");
gr_dbname();
syslog(0x4, "cannot open %s");
if (v0) {
setlocale(0x6, v0);
free(v0);
}
exit(0xa);
} else {
v7 = is_shadow_grp;
if (!is_shadow_grp)
return v7;
v7 = sgr_open(0x42);
if (v7)
return v7;
v9 = sgr_dbname();
fprintf(*(&stderr), gettext("%s: cannot open %s\n"));
v2 = setlocale(0x6, NULL);
v1 = 0;
if (v2)
v1 = strdup(v2);
if (v1)
setlocale(0x6, "C");
sgr_dbname();
syslog(0x4, "cannot open %s");
if (v1) {
setlocale(0x6, v1);
free(v1);
}
exit(0xa);
}
}
|
static void
save_tty_chars (struct termios *tiop)
{
_rl_last_tty_chars = _rl_tty_chars;
_rl_tty_chars.t_eof = tiop->c_cc[
4
];
_rl_tty_chars.t_eol = tiop->c_cc[
11
];
_rl_tty_chars.t_eol2 = tiop->c_cc[
16
];
_rl_tty_chars.t_erase = tiop->c_cc[
2
];
_rl_tty_chars.t_werase = tiop->c_cc[
14
];
_rl_tty_chars.t_kill = tiop->c_cc[
3
];
_rl_tty_chars.t_reprint = tiop->c_cc[
12
];
_rl_intr_char = _rl_tty_chars.t_intr = tiop->c_cc[
0
];
_rl_quit_char = _rl_tty_chars.t_quit = tiop->c_cc[
1
];
_rl_susp_char = _rl_tty_chars.t_susp = tiop->c_cc[
10
];
_rl_tty_chars.t_start = tiop->c_cc[
8
];
_rl_tty_chars.t_stop = tiop->c_cc[
9
];
_rl_tty_chars.t_lnext = tiop->c_cc[
15
];
_rl_tty_chars.t_flush = tiop->c_cc[
13
];
}
| void save_tty_chars(char a0[34]) {
char v0;
unsigned long long v2;
unsigned long long v3;
_rl_last_tty_chars = *(&_rl_tty_chars);
g_400e28 = *(&g_400e18);
_rl_tty_chars = a0[21];
g_400e11 = a0[28];
g_400e12 = a0[33];
g_400e13 = a0[19];
g_400e14 = a0[31];
g_400e15 = a0[20];
g_400e16 = a0[29];
g_400e17 = a0[17];
_rl_intr_char = g_400e17;
g_400e18 = a0[18];
_rl_quit_char = g_400e18;
g_400e19 = a0[27];
_rl_susp_char = g_400e19;
g_400e1b = a0[25];
g_400e1c = a0[26];
g_400e1d = a0[32];
v2 = a0[30];
g_400e1e = a0[30];
v3 = *(&v0);
return;
}
|
void
set_directory_hook ()
{
if (dircomplete_expand)
{
rl_directory_completion_hook = bash_directory_completion_hook;
rl_directory_rewrite_hook = (rl_icppfunc_t *)0;
}
else
{
rl_directory_rewrite_hook = bash_directory_completion_hook;
rl_directory_completion_hook = (rl_icppfunc_t *)0;
}
}
| void set_directory_hook(void)
{
if (dircomplete_expand == 0) {
rl_directory_rewrite_hook = bash_directory_completion_hook;
rl_directory_completion_hook = (code *)0x0;
}
else {
rl_directory_completion_hook = bash_directory_completion_hook;
rl_directory_rewrite_hook = (code *)0x0;
}
return;
}
|
void
sv_mail (name)
char *name;
{
if (name[4] == 'C')
reset_mail_timer ();
else
{
free_mail_files ();
remember_mail_dates ();
}
}
| long long sv_mail(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned long long v1;
if (a0->field_4 == 67) {
v1 = reset_mail_timer();
} else {
free_mail_files();
v1 = remember_mail_dates(a0, a1, a2, a3, a4, a5);
}
return v1;
}
|
!ext2fs_inode_has_valid_blocks2(fs, inode) &&
fix_problem(ctx, 0x01005D, &pctx)) {
inode->i_flags &= ~0x00080000;
e2fsck_write_inode(ctx, ino, inode, "pass1");
failed_csum = 0;
}
| && (((*local_200 & 0xf000) == 0xa000 &&
((iVar3 = ext2fs_inode_has_valid_blocks2(local_1e0,local_200),
iVar3 == 0 &&
(iVar3 = fix_problem(param_1,0x1005d,&local_128), iVar3 != 0))))))
{
*(uint *)(local_200 + 0x10) = *(uint *)(local_200 + 0x10) & 0xfff7ffff;
e2fsck_write_inode(param_1,local_23c,local_200,"pass1");
local_21c = 0;
}
|
static void
suspone(int pid, int signo)
{
int status;
if (pid > 1) {
kill(pid, signo);
while (waitpid(pid, &status,
2
) == -1 &&
(*__errno_location ())
==
4
)
;
}
}
| unsigned long suspone(__pid_t a1, int a2)
{
int stat_loc;
unsigned long v4;
v4 = __readfsqword(0x28u);
if ( a1 > 1 )
{
kill(a1, a2);
while ( waitpid(a1, &stat_loc, 2) == -1 && *_errno_location() == 4 )
;
}
return __readfsqword(0x28u) ^ v4;
}
|
static void
parse_grep_colors (void)
{
const char *p;
char *q;
char *name;
char *val;
p = getenv ("GREP_COLORS");
if (p ==
((void *)0)
|| *p == '\0')
return;
q = xstrdup (p);
name = q;
val =
((void *)0)
;
for (;;)
if (*q == ':' || *q == '\0')
{
char c = *q;
struct color_cap const *cap;
*q++ = '\0';
for (cap = color_dict; cap->name; cap++)
if ((strcmp (cap->name, name) == 0))
break;
if (cap->var && val)
*(cap->var) = val;
if (cap->fct)
cap->fct ();
if (c == '\0')
return;
name = q;
val =
((void *)0)
;
}
else if (*q == '=')
{
if (q == name || val)
return;
*q++ = '\0';
val = q;
}
else if (val ==
((void *)0)
)
q++;
else if (*q == ';' || c_isdigit (*q))
q++;
else
return;
}
| void parse_grep_colors() {
char v0;
int tmp_20;
int tmp_8;
char *v1;
char *v2;
void* v3;
unsigned long long v4;
char *v5;
unsigned long long v8;
char *v10;
unsigned long long v12;
unsigned long long v13;
v5 = getenv("GREP_COLORS");
if (!v5)
return;
v8 = *(v5);
if (!*(v5))
return;
*(&v1) = xstrdup(v5);
v2 = v1;
v3 = 0;
while (true) {
switch (*(v1)) {
case 0: case 58:
v0 = *(v1);
tmp_20 = v1;
v1 += 1;
*(tmp_20) = 0;
for (v4 = &color_dict; *(v4) && strcmp(*(v4), v2); v4 += 24);
if (*((v4 + 8)) && v3)
*(*((v4 + 8))) = v3;
v12 = *((v4 + 16));
if (*((v4 + 16)))
v13 = *(((stack_base)[24] + 16))();
if (!v0)
return;
v2 = v1;
v3 = 0;
break;
case 61:
v10 = v1;
if (v1 == v2)
return;
if (v3)
return;
tmp_8 = v1;
v1 += 1;
*(tmp_8) = 0;
v3 = v1;
continue;
default:
if (v3) {
if (*(v1) != 59 && !c_isdigit(*(v1)))
return;
v1 += 1;
break;
} else {
v1 += 1;
continue;
}
}
}
}
|
void e2fsck_write_bitmaps(e2fsck_t ctx)
{
ext2_filsys fs = ctx->fs;
errcode_t retval;
const char *old_op;
old_op = ehandler_operation((gettext ("writing block and inode bitmaps")));
retval = ext2fs_write_bitmaps(fs);
ehandler_operation(old_op);
if (retval) {
com_err(ctx->program_name, retval,
(gettext ("while rewriting block and inode bitmaps for %s")),
ctx->device_name);
fatal_error(ctx, 0);
}
}
| long long e2fsck_write_bitmaps(unsigned long long a0[4]) {
unsigned long long v0;
unsigned long long v1;
unsigned long long v2;
v0 = a0[0];
v1 = ehandler_operation(gettext("writing block and inode bitmaps"));
v2 = ext2fs_write_bitmaps(v0);
if (v2) {
com_err(a0[1], v2, gettext("while rewriting block and inode bitmaps for %s"), a0[3]);
fatal_error();
}
return ehandler_operation(v1);
}
|
void
uid_to_uname (uid_t uid, char **uname)
{
struct passwd *passwd;
if (uid != 0 && uid == cached_no_such_uid)
{
*uname = xstrdup ("");
return;
}
if (!cached_uname || uid != cached_uid)
{
passwd = getpwuid (uid);
if (passwd)
{
cached_uid = uid;
assign_string (&cached_uname, passwd->pw_name);
}
else
{
cached_no_such_uid = uid;
*uname = xstrdup ("");
return;
}
}
*uname = xstrdup (cached_uname);
}
| long long uid_to_uname(unsigned long a0, unsigned long long *a1) {
unsigned long long *v0;
unsigned long long *v2;
if (a0 && a0 == cached_no_such_uid) {
v2 = a1;
*(a1) = xstrdup(&g_404344);
}
if (!a0 || a0 != cached_no_such_uid) {
if (!cached_uname || a0 != cached_uid) {
v0 = &getpwuid(a0)->pw_name;
if (v0) {
cached_uid = a0;
assign_string(&cached_uname, *(v0));
} else {
cached_no_such_uid = a0;
v2 = a1;
*(a1) = xstrdup(&g_404344);
}
}
if (v0 || a0 == cached_uid && cached_uname) {
v2 = a1;
*(a1) = xstrdup(cached_uname);
}
}
return v2;
}
|
static int
userauth_passwd(struct ssh *ssh)
{
Authctxt *authctxt = (Authctxt *)ssh->authctxt;
char *password, *prompt =
((void *)0)
;
const char *host = options.host_key_alias ? options.host_key_alias :
authctxt->host;
int r;
if (authctxt->attempt_passwd++ >= options.number_of_password_prompts)
return 0;
if (authctxt->attempt_passwd != 1)
sshlog("sshconnect2.c", __func__, 1080, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Permission denied, please try again.");
xasprintf(&prompt, "%s@%s's password: ", authctxt->server_user, host);
password = read_passphrase(prompt, 0);
if ((r = sshpkt_start(ssh, 50)) != 0 ||
(r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
(r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
(r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
(r = sshpkt_put_u8(ssh, 0)) != 0 ||
(r = sshpkt_put_cstring(ssh, password)) != 0 ||
(r = sshpkt_add_padding(ssh, 64)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
sshfatal("sshconnect2.c", __func__, 1092, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send packet");
free(prompt);
if (password !=
((void *)0)
)
freezero(password, strlen(password));
ssh_dispatch_set(ssh, 60,
&input_userauth_passwd_changereq);
return 1;
}
| undefined8 userauth_passwd(long param_1)
{
int iVar1;
undefined4 uVar2;
undefined8 uVar3;
size_t sVar4;
char **ppcVar5;
long in_FS_OFFSET;
char *pcStack104;
undefined8 uStack96;
undefined auStack88 [8];
long local_50;
int local_44;
void *local_40;
undefined8 *local_38;
long local_30;
char *local_28;
long local_20;
ppcVar5 = (char **)auStack88;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_38 = *(undefined8 **)(param_1 + 0x860);
local_40 = (void *)0x0;
local_30 = _sshkey_alg_list;
if (_sshkey_alg_list == 0) {
local_30 = local_38[2];
}
iVar1 = *(int *)(local_38 + 0xf);
uStack96 = 0x101ef3;
local_50 = param_1;
uVar2 = __addvsi3(iVar1,1);
*(undefined4 *)(local_38 + 0xf) = uVar2;
if (_lookup_marker_in_hostkeys <= iVar1) {
uVar3 = 0;
ppcVar5 = (char **)auStack88;
goto LAB_0010210e;
}
if (*(int *)(local_38 + 0xf) != 1) {
pcStack104 = "Permission denied, please try again.";
sshlog("sshconnect2.c","userauth_passwd",0x438,0,2,0);
}
uStack96 = 0x101f7d;
xasprintf(&local_40,"%s@%s\'s password: ",*local_38,local_30);
uStack96 = 0x101f8e;
local_28 = (char *)read_passphrase(local_40,0);
uStack96 = 0x101fa3;
local_44 = sshpkt_start(local_50,0x32);
if (local_44 == 0) {
uStack96 = 0x101fc6;
local_44 = sshpkt_put_cstring(local_50,*local_38);
if (local_44 != 0) goto LAB_0010207f;
uStack96 = 0x101fea;
local_44 = sshpkt_put_cstring(local_50,local_38[3]);
if (local_44 != 0) goto LAB_0010207f;
uStack96 = 0x102011;
local_44 = sshpkt_put_cstring(local_50,*(undefined8 *)local_38[4]);
if (local_44 != 0) goto LAB_0010207f;
uStack96 = 0x10202b;
local_44 = sshpkt_put_u8(local_50,0);
if (local_44 != 0) goto LAB_0010207f;
uStack96 = 0x102047;
local_44 = sshpkt_put_cstring(local_50,local_28);
if (local_44 != 0) goto LAB_0010207f;
uStack96 = 0x102061;
local_44 = sshpkt_add_padding(local_50,0x40);
if (local_44 != 0) goto LAB_0010207f;
uStack96 = 0x102076;
local_44 = sshpkt_send(local_50);
if (local_44 != 0) goto LAB_0010207f;
}
else {
LAB_0010207f:
uStack96 = 0x102089;
uVar3 = ssh_err(local_44);
ppcVar5 = &pcStack104;
pcStack104 = "send packet";
sshfatal("sshconnect2.c","userauth_passwd",0x444,1,1,uVar3);
}
*(undefined8 *)((long)ppcVar5 + -8) = 0x1020cc;
free(local_40);
if (local_28 != (char *)0x0) {
*(undefined8 *)((long)ppcVar5 + -8) = 0x1020df;
sVar4 = strlen(local_28);
*(undefined8 *)((long)ppcVar5 + -8) = 0x1020f1;
freezero(local_28,sVar4);
}
*(undefined8 *)((long)ppcVar5 + -8) = 0x102109;
ssh_dispatch_set(local_50,0x3c,input_userauth_passwd_changereq);
uVar3 = 1;
LAB_0010210e:
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar3;
}
*(undefined8 *)((long)ppcVar5 + -8) = 0x102122;
__stack_chk_fail();
}
|
static void
print_forceinfo(const struct forceinfo *fi)
{
char *desc, *line;
desc = m_strdup(gettext(fi->desc));
line = strtok(desc, "\n");
print_forceinfo_line(fi->type, fi->name, line);
while ((line = strtok(
((void *)0)
, "\n")))
print_forceinfo_line(FORCETYPE_DISABLED, "", line);
free(desc);
}
| void print_forceinfo(struct_0 *a0) {
void* v0;
unsigned int v1;
unsigned long long v3;
v0 = m_strdup(gettext(a0->field_10));
*(&v1) = strtok(v0, "\n");
print_forceinfo_line(a0->field_c, a0->field_0, *(&v1));
while (true) {
*(&v1) = strtok(NULL, "\n");
if (!*(&v1))
break;
print_forceinfo_line(0x0, &g_400ee5, *(&v1));
}
v3 = free(v0);
return;
}
|
struct pidfh *
pidfile_open(const char *path, mode_t mode, pid_t *pidptr)
{
struct pidfh *pfh;
struct stat sb;
int error, fd, len, count;
struct timespec rqtp;
pfh = malloc(sizeof(*pfh));
if (pfh ==
((void *)0)
)
return (
((void *)0)
);
if (path ==
((void *)0)
) {
len = asprintf(&pfh->pf_path, "/var/run/%s.pid", getprogname());
if (len < 0) {
free(pfh);
return (
((void *)0)
);
}
} else
pfh->pf_path = strdup(path);
fd = flopen(pfh->pf_path,
01
|
0100
|
01000
|
04000
, mode);
if (fd == -1) {
if (
(*__errno_location ())
==
11
) {
if (pidptr ==
((void *)0)
) {
(*__errno_location ())
=
17
;
} else {
count = 20;
rqtp.tv_sec = 0;
rqtp.tv_nsec = 5000000;
for (;;) {
(*__errno_location ())
= pidfile_read(pfh->pf_path,
pidptr);
if (
(*__errno_location ())
!=
11
|| --count == 0)
break;
nanosleep(&rqtp, 0);
}
if (
(*__errno_location ())
==
11
)
*pidptr = -1;
if (
(*__errno_location ())
== 0 ||
(*__errno_location ())
==
11
)
(*__errno_location ())
=
17
;
}
}
error =
(*__errno_location ())
;
free(pfh->pf_path);
free(pfh);
(*__errno_location ())
= error;
return (
((void *)0)
);
}
if (fstat(fd, &sb) == -1) {
error =
(*__errno_location ())
;
unlink(pfh->pf_path);
free(pfh->pf_path);
close(fd);
free(pfh);
(*__errno_location ())
= error;
return (
((void *)0)
);
}
pfh->pf_fd = fd;
pfh->pf_dev = sb.st_dev;
pfh->pf_ino = sb.st_ino;
return (pfh);
}
| _DWORD * pidfile_open(const char *a1, unsigned int a2, _DWORD *a3)
{
const char *v4;
const char *v5;
int *v6;
int v8;
int fd;
int v10;
int v11;
_DWORD *ptr;
struct timespec requested_time;
struct stat buf;
unsigned long v15;
v15 = __readfsqword(0x28u);
ptr = malloc(0x20uLL);
if ( !ptr )
return 0LL;
if ( a1 )
{
*((_QWORD *)ptr + 1) = strdup(a1);
}
else
{
v4 = (const char *)getprogname();
if ( asprintf((char **)ptr + 1, "/var/run/%s.pid", v4) < 0 )
{
free(ptr);
return 0LL;
}
}
fd = flopen(*((_QWORD *)ptr + 1), 2625LL, a2);
if ( fd == -1 )
{
if ( *_errno_location() == 11 )
{
if ( a3 )
{
v8 = 20;
requested_time.tv_sec = 0LL;
requested_time.tv_nsec = 5000000LL;
while ( 1 )
{
v5 = (const char *)*((_QWORD *)ptr + 1);
v6 = _errno_location();
*v6 = pidfile_read(v5, a3);
if ( *_errno_location() != 11 )
break;
if ( !--v8 )
break;
nanosleep(&requested_time, 0LL);
}
if ( *_errno_location() == 11 )
*a3 = -1;
if ( !*_errno_location() || *_errno_location() == 11 )
*_errno_location() = 17;
}
else
{
*_errno_location() = 17;
}
}
v10 = *_errno_location();
free(*((void **)ptr + 1));
free(ptr);
*_errno_location() = v10;
return 0LL;
}
else if ( fstat(fd, &buf) == -1 )
{
v11 = *_errno_location();
unlink(*((const char **)ptr + 1));
free(*((void **)ptr + 1));
close(fd);
free(ptr);
*_errno_location() = v11;
return 0LL;
}
else
{
*ptr = fd;
*((_QWORD *)ptr + 2) = buf.st_dev;
*((_QWORD *)ptr + 3) = buf.st_ino;
return ptr;
}
}
|
static int
client_input_hostkeys(struct ssh *ssh)
{
const u_char *blob =
((void *)0)
;
size_t i, len = 0;
struct sshbuf *buf =
((void *)0)
;
struct sshkey *key =
((void *)0)
, **tmp;
int r;
char *fp;
static int hostkeys_seen = 0;
struct hostkeys_update_ctx *ctx =
((void *)0)
;
u_int want;
if (hostkeys_seen)
sshfatal("clientloop.c", __func__, 2238, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "server already sent hostkeys");
if (options.update_hostkeys == 2 &&
options.batch_mode)
return 1;
if (!options.update_hostkeys || options.num_user_hostfiles <= 0)
return 1;
ctx = xcalloc(1, sizeof(*ctx));
while (ssh_packet_remaining(ssh) > 0) {
sshkey_free(key);
key =
((void *)0)
;
if ((r = sshpkt_get_string_direct(ssh, &blob, &len)) != 0) {
sshlog("clientloop.c", __func__, 2250, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse key");
goto out;
}
if ((r = sshkey_from_blob(blob, len, &key)) != 0) {
sshlog("clientloop.c", __func__, 2254, 1, r == -14 ? SYSLOG_LEVEL_DEBUG1 : SYSLOG_LEVEL_ERROR, ssh_err(r), "convert key")
;
continue;
}
fp = sshkey_fingerprint(key, options.fingerprint_hash,
SSH_FP_DEFAULT);
sshlog("clientloop.c", __func__, 2261, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "received %s key %s", sshkey_type(key), fp);
free(fp);
if (!key_accepted_by_hostkeyalgs(key)) {
sshlog("clientloop.c", __func__, 2265, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "%s key not permitted by " "HostkeyAlgorithms", sshkey_ssh_name(key))
;
continue;
}
if (sshkey_is_cert(key)) {
sshlog("clientloop.c", __func__, 2271, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "%s key is a certificate; skipping", sshkey_ssh_name(key))
;
continue;
}
for (i = 0; i < ctx->nkeys; i++) {
if (sshkey_equal(key, ctx->keys[i])) {
sshlog("clientloop.c", __func__, 2278, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "received duplicated %s host key", sshkey_ssh_name(key))
;
goto out;
}
}
if ((tmp = recallocarray(ctx->keys, ctx->nkeys, ctx->nkeys + 1,
sizeof(*ctx->keys))) ==
((void *)0)
)
sshfatal("clientloop.c", __func__, 2286, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "recallocarray failed nkeys = %zu", ctx->nkeys)
;
ctx->keys = tmp;
ctx->keys[ctx->nkeys++] = key;
key =
((void *)0)
;
}
if (ctx->nkeys == 0) {
sshlog("clientloop.c", __func__, 2294, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "server sent no hostkeys");
goto out;
}
if ((ctx->keys_match = calloc(ctx->nkeys,
sizeof(*ctx->keys_match))) ==
((void *)0)
||
(ctx->keys_verified = calloc(ctx->nkeys,
sizeof(*ctx->keys_verified))) ==
((void *)0)
)
sshfatal("clientloop.c", __func__, 2302, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "calloc failed");
get_hostfile_hostname_ipaddr(host,
options.check_host_ip ? (struct sockaddr *)&hostaddr :
((void *)0)
,
options.port, &ctx->host_str,
options.check_host_ip ? &ctx->ip_str :
((void *)0)
);
for (i = 0; i < options.num_user_hostfiles; i++) {
sshlog("clientloop.c", __func__, 2311, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "searching %s for %s / %s", options.user_hostfiles[i], ctx->host_str, ctx->ip_str ? ctx->ip_str : "(none)")
;
if ((r = hostkeys_foreach(options.user_hostfiles[i],
hostkeys_find, ctx, ctx->host_str, ctx->ip_str,
(1<<1), 0)) != 0) {
if (r == -24 &&
(*__errno_location ())
==
2
) {
sshlog("clientloop.c", __func__, 2318, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "hostkeys file %s does not exist", options.user_hostfiles[i])
;
continue;
}
sshlog("clientloop.c", __func__, 2322, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "hostkeys_foreach failed for %s", options.user_hostfiles[i])
;
goto out;
}
}
ctx->nnew = ctx->nincomplete = 0;
want = (1) | ( options.check_host_ip ? (1<<1) : 0);
for (i = 0; i < ctx->nkeys; i++) {
if (ctx->keys_match[i] == 0)
ctx->nnew++;
if ((ctx->keys_match[i] & want) != want)
ctx->nincomplete++;
}
sshlog("clientloop.c", __func__, 2338, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "%zu server keys: %zu new, %zu retained, " "%zu incomplete match. %zu to remove", ctx->nkeys, ctx->nnew, ctx->nkeys - ctx->nnew - ctx->nincomplete, ctx->nincomplete, ctx->nold)
;
if (ctx->nnew == 0 && ctx->nold == 0) {
sshlog("clientloop.c", __func__, 2344, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "no new or deprecated keys from server");
goto out;
}
if (ctx->complex_hostspec) {
sshlog("clientloop.c", __func__, 2350, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "CA/revocation marker, manual host list or wildcard " "host pattern found, skipping UserKnownHostsFile update")
;
goto out;
}
if (ctx->other_name_seen) {
sshlog("clientloop.c", __func__, 2355, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "host key found matching a different name/address, " "skipping UserKnownHostsFile update")
;
goto out;
}
if (ctx->nold != 0) {
if (check_old_keys_othernames(ctx) != 0)
goto out;
if (ctx->old_key_seen) {
sshlog("clientloop.c", __func__, 2370, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "key(s) for %s%s%s exist under other names; " "skipping UserKnownHostsFile update", ctx->host_str, ctx->ip_str ==
((void *)0)
? "" : ",", ctx->ip_str ==
((void *)0)
? "" : ctx->ip_str)
;
goto out;
}
}
if (ctx->nnew == 0) {
update_known_hosts(ctx);
goto out;
}
sshlog("clientloop.c", __func__, 2391, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "asking server to prove ownership for %zu keys", ctx->nnew);
if ((r = sshpkt_start(ssh, 80)) != 0 ||
(r = sshpkt_put_cstring(ssh,
"hostkeys-prove-00@openssh.com")) != 0 ||
(r = sshpkt_put_u8(ssh, 1)) != 0)
sshfatal("clientloop.c", __func__, 2396, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "prepare hostkeys-prove");
if ((buf = sshbuf_new()) ==
((void *)0)
)
sshfatal("clientloop.c", __func__, 2398, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new");
for (i = 0; i < ctx->nkeys; i++) {
if (ctx->keys_match[i])
continue;
sshbuf_reset(buf);
if ((r = sshkey_putb(ctx->keys[i], buf)) != 0 ||
(r = sshpkt_put_stringb(ssh, buf)) != 0)
sshfatal("clientloop.c", __func__, 2405, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble hostkeys-prove");
}
if ((r = sshpkt_send(ssh)) != 0)
sshfatal("clientloop.c", __func__, 2408, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send hostkeys-prove");
client_register_global_confirm(
client_global_hostkeys_private_confirm, ctx);
ctx =
((void *)0)
;
out:
hostkeys_update_ctx_free(ctx);
sshkey_free(key);
sshbuf_free(buf);
return 1;
}
| undefined8 client_input_hostkeys(undefined8 param_1)
{
size_t sVar1;
long lVar2;
long lVar3;
long lVar4;
undefined8 uVar5;
undefined8 *puVar6;
int iVar7;
void *pvVar8;
char *pcVar9;
int *piVar10;
undefined8 uVar11;
undefined8 uVar12;
undefined4 uVar13;
undefined *puVar14;
char **ppcVar15;
undefined *puVar16;
undefined8 *puVar17;
long in_FS_OFFSET;
char *apcStack136 [2];
undefined auStack120 [8];
undefined8 local_70;
int local_68;
uint local_64;
undefined8 local_60;
undefined8 local_58;
undefined8 local_50;
ulong local_48;
long local_40;
undefined8 *local_38;
void *local_30;
long local_28;
long local_20;
ppcVar15 = (char **)auStack120;
local_70 = param_1;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_60 = 0;
local_58 = 0;
local_40 = 0;
local_50 = 0;
local_38 = (undefined8 *)0x0;
if (hostkeys_seen_20652 != 0) {
ppcVar15 = apcStack136;
apcStack136[0] = "server already sent hostkeys";
sshfatal("clientloop.c","client_input_hostkeys",0x8be,1,1,0);
}
if ((((_DAT_0010d71c == 2) && (_mkdtemp != 0)) || (_DAT_0010d71c == 0)) || (_memset == 0))
goto LAB_001078b7;
*(undefined8 *)((long)ppcVar15 + -8) = 0x106c9b;
local_38 = (undefined8 *)xcalloc(1,0x60);
while( true ) {
*(undefined8 *)((long)ppcVar15 + -8) = 0x10701e;
iVar7 = ssh_packet_remaining(local_70);
if (iVar7 < 1) break;
*(undefined8 *)((long)ppcVar15 + -8) = 0x106cb0;
sshkey_free(local_50);
local_50 = 0;
*(undefined8 *)((long)ppcVar15 + -8) = 0x106ccf;
local_68 = sshpkt_get_string_direct(local_70,&local_60,&local_58);
if (local_68 != 0) {
*(undefined8 *)((long)ppcVar15 + -8) = 0x106ce2;
uVar12 = ssh_err(local_68);
*(char **)((long)ppcVar15 + -0x10) = "parse key";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x106d19;
sshlog("clientloop.c","client_input_hostkeys",0x8ca,1,2,uVar12);
goto LAB_0010788e;
}
*(undefined8 *)((long)ppcVar15 + -8) = 0x106d39;
local_68 = sshkey_from_blob(local_60,local_58,&local_50);
if (local_68 == 0) {
*(undefined8 *)((long)ppcVar15 + -8) = 0x106db4;
local_30 = (void *)sshkey_fingerprint(local_50,_DAT_0010d718,0);
*(undefined8 *)((long)ppcVar15 + -8) = 0x106dc4;
uVar12 = sshkey_type(local_50);
*(void **)((long)ppcVar15 + -0x10) = local_30;
*(undefined8 *)((long)ppcVar15 + -0x18) = uVar12;
*(char **)((long)ppcVar15 + -0x20) = "received %s key %s";
*(undefined8 *)((long)ppcVar15 + -0x28) = 0x106e02;
sshlog("clientloop.c","client_input_hostkeys",0x8d5,1,7,0);
*(undefined8 *)((long)ppcVar15 + -8) = 0x106e12;
free(local_30);
*(undefined8 *)((long)ppcVar15 + -8) = 0x106e1e;
iVar7 = key_accepted_by_hostkeyalgs(local_50);
if (iVar7 == 0) {
*(undefined8 *)((long)ppcVar15 + -8) = 0x106e2e;
uVar12 = sshkey_ssh_name(local_50);
*(undefined8 *)((long)ppcVar15 + -8) = uVar12;
*(char **)((long)ppcVar15 + -0x10) = "%s key not permitted by HostkeyAlgorithms";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x106e65;
sshlog("clientloop.c","client_input_hostkeys",0x8d9,1,7,0);
}
else {
*(undefined8 *)((long)ppcVar15 + -8) = 0x106e7a;
iVar7 = sshkey_is_cert(local_50);
if (iVar7 == 0) {
for (local_48 = 0; local_48 < (ulong)local_38[5]; local_48 = local_48 + 1) {
uVar12 = *(undefined8 *)(local_38[2] + local_48 * 8);
*(undefined8 *)((long)ppcVar15 + -8) = 0x106ef9;
iVar7 = sshkey_equal(local_50,uVar12);
if (iVar7 != 0) {
*(undefined8 *)((long)ppcVar15 + -8) = 0x106f09;
uVar12 = sshkey_ssh_name(local_50);
*(undefined8 *)((long)ppcVar15 + -8) = uVar12;
*(char **)((long)ppcVar15 + -0x10) = "received duplicated %s host key";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x106f40;
sshlog("clientloop.c","client_input_hostkeys",0x8e6,1,2,0);
goto LAB_0010788e;
}
}
lVar2 = local_38[5];
uVar12 = local_38[5];
uVar11 = local_38[2];
*(undefined8 *)((long)ppcVar15 + -8) = 0x106f89;
local_28 = recallocarray(uVar11,uVar12,lVar2 + 1,8);
puVar16 = (undefined *)ppcVar15;
if (local_28 == 0) {
*(undefined8 *)((long)ppcVar15 + -8) = local_38[5];
puVar16 = (undefined *)((long)ppcVar15 + -0x10);
*(char **)((long)ppcVar15 + -0x10) = "recallocarray failed nkeys = %zu";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x106fd3;
sshfatal("clientloop.c","client_input_hostkeys",0x8ee,1,1,0);
}
local_38[2] = local_28;
lVar2 = local_38[5];
local_38[5] = lVar2 + 1;
*(undefined8 *)(local_38[2] + lVar2 * 8) = local_50;
local_50 = 0;
ppcVar15 = (char **)puVar16;
}
else {
*(undefined8 *)((long)ppcVar15 + -8) = 0x106e8a;
uVar12 = sshkey_ssh_name(local_50);
*(undefined8 *)((long)ppcVar15 + -8) = uVar12;
*(char **)((long)ppcVar15 + -0x10) = "%s key is a certificate; skipping";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x106ec1;
sshlog("clientloop.c","client_input_hostkeys",0x8df,1,7,0);
}
}
}
else {
*(undefined8 *)((long)ppcVar15 + -8) = 0x106d4c;
uVar12 = ssh_err(local_68);
if (local_68 == -0xe) {
uVar13 = 5;
}
else {
uVar13 = 2;
}
*(char **)((long)ppcVar15 + -0x10) = "convert key";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x106d92;
sshlog("clientloop.c","client_input_hostkeys",0x8ce,1,uVar13,uVar12);
}
}
if (local_38[5] == 0) {
*(char **)((long)ppcVar15 + -0x10) = "server sent no hostkeys";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x10706d;
sshlog("clientloop.c","client_input_hostkeys",0x8f6,1,5,0);
}
else {
sVar1 = local_38[5];
*(undefined8 *)((long)ppcVar15 + -8) = 0x10708b;
pvVar8 = calloc(sVar1,4);
local_38[3] = pvVar8;
if (local_38[3] == 0) {
LAB_001070d0:
*(char **)((long)ppcVar15 + -0x10) = "calloc failed";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x10710a;
sshfatal("clientloop.c","client_input_hostkeys",0x8fe,1,1,0);
ppcVar15 = (char **)((long)ppcVar15 + -0x10);
}
else {
sVar1 = local_38[5];
*(undefined8 *)((long)ppcVar15 + -8) = 0x1070b8;
pvVar8 = calloc(sVar1,4);
local_38[4] = pvVar8;
if (local_38[4] == 0) goto LAB_001070d0;
}
puVar6 = local_38;
if (DAT_0010c09c == 0) {
puVar17 = (undefined8 *)0x0;
}
else {
puVar17 = local_38 + 1;
}
if (DAT_0010c09c == 0) {
puVar16 = (undefined *)0x0;
}
else {
puVar16 = &hostaddr;
}
*(undefined8 *)((long)ppcVar15 + -8) = 0x10715a;
get_hostfile_hostname_ipaddr(host,puVar16,_system & 0xffff,puVar6,puVar17);
for (local_48 = 0; local_48 < _memset; local_48 = local_48 + 1) {
if (local_38[1] == 0) {
pcVar9 = "(none)";
}
else {
pcVar9 = (char *)local_38[1];
}
uVar12 = *local_38;
uVar11 = *(undefined8 *)(channel_still_open + (local_48 + 0x3e) * 8);
*(char **)((long)ppcVar15 + -8) = pcVar9;
*(undefined8 *)((long)ppcVar15 + -0x10) = uVar12;
*(undefined8 *)((long)ppcVar15 + -0x18) = uVar11;
*(char **)((long)ppcVar15 + -0x20) = "searching %s for %s / %s";
*(undefined8 *)((long)ppcVar15 + -0x28) = 0x1071e0;
sshlog("clientloop.c","client_input_hostkeys",0x907,1,5,0);
puVar6 = local_38;
uVar12 = local_38[1];
uVar11 = *local_38;
uVar5 = *(undefined8 *)(channel_still_open + (local_48 + 0x3e) * 8);
*(undefined8 *)((long)ppcVar15 + -0x10) = 0;
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x107230;
local_68 = hostkeys_foreach(uVar5,hostkeys_find,puVar6,uVar11,uVar12,2);
if (local_68 != 0) {
if (local_68 == -0x18) {
*(undefined8 *)((long)ppcVar15 + -8) = 0x10724c;
piVar10 = __errno_location();
if (*piVar10 == 2) {
*(undefined8 *)((long)ppcVar15 + -8) =
*(undefined8 *)(channel_still_open + (local_48 + 0x3e) * 8);
*(char **)((long)ppcVar15 + -0x10) = "hostkeys file %s does not exist";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x1072a5;
sshlog("clientloop.c","client_input_hostkeys",0x90e,1,5,0);
goto LAB_0010730d;
}
}
iVar7 = local_68;
uVar12 = *(undefined8 *)(channel_still_open + (local_48 + 0x3e) * 8);
*(undefined8 *)((long)ppcVar15 + -8) = 0x1072d0;
uVar11 = ssh_err(iVar7);
*(undefined8 *)((long)ppcVar15 + -8) = uVar12;
*(char **)((long)ppcVar15 + -0x10) = "hostkeys_foreach failed for %s";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x107304;
sshlog("clientloop.c","client_input_hostkeys",0x912,1,2,uVar11);
goto LAB_0010788e;
}
LAB_0010730d:
}
local_38[7] = 0;
local_38[6] = local_38[7];
if (DAT_0010c09c == 0) {
local_64 = 1;
}
else {
local_64 = 3;
}
for (local_48 = 0; local_48 < (ulong)local_38[5]; local_48 = local_48 + 1) {
if (*(int *)(local_38[3] + local_48 * 4) == 0) {
local_38[6] = local_38[6] + 1;
}
if (local_64 != (*(uint *)(local_38[3] + local_48 * 4) & local_64)) {
local_38[7] = local_38[7] + 1;
}
}
uVar12 = local_38[7];
lVar2 = local_38[5];
lVar3 = local_38[6];
lVar4 = local_38[7];
uVar11 = local_38[6];
uVar5 = local_38[5];
*(undefined8 *)((long)ppcVar15 + -8) = local_38[9];
*(undefined8 *)((long)ppcVar15 + -0x10) = uVar12;
*(long *)((long)ppcVar15 + -0x18) = (lVar2 - lVar3) - lVar4;
*(undefined8 *)((long)ppcVar15 + -0x20) = uVar11;
*(undefined8 *)((long)ppcVar15 + -0x28) = uVar5;
*(char **)((long)ppcVar15 + -0x30) =
"%zu server keys: %zu new, %zu retained, %zu incomplete match. %zu to remove";
*(undefined8 *)((long)ppcVar15 + -0x38) = 0x107450;
sshlog("clientloop.c","client_input_hostkeys",0x922,1,7,0);
puVar6 = local_38;
if ((local_38[6] == 0) && (local_38[9] == 0)) {
*(char **)((long)ppcVar15 + -0x10) = "no new or deprecated keys from server";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x1074a8;
sshlog("clientloop.c","client_input_hostkeys",0x928,1,5,0);
}
else if (*(int *)(local_38 + 10) == 0) {
if (*(int *)((long)local_38 + 0x5c) == 0) {
if (local_38[9] == 0) {
LAB_00107605:
puVar6 = local_38;
if (local_38[6] == 0) {
*(undefined8 *)((long)ppcVar15 + -8) = 0x10761e;
update_known_hosts(puVar6);
}
else {
*(undefined8 *)((long)ppcVar15 + -8) = local_38[6];
*(char **)((long)ppcVar15 + -0x10) = "asking server to prove ownership for %zu keys";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x107662;
sshlog("clientloop.c","client_input_hostkeys",0x957,1,7,0);
uVar12 = local_70;
*(undefined8 *)((long)ppcVar15 + -8) = 0x107677;
local_68 = sshpkt_start(uVar12,0x50);
uVar12 = local_70;
if (local_68 == 0) {
*(undefined8 *)((long)ppcVar15 + -8) = 0x107693;
local_68 = sshpkt_put_cstring(uVar12,"hostkeys-prove-00@openssh.com");
uVar12 = local_70;
if (local_68 != 0) goto LAB_001076b6;
*(undefined8 *)((long)ppcVar15 + -8) = 0x1076ad;
local_68 = sshpkt_put_u8(uVar12,1);
puVar16 = (undefined *)ppcVar15;
if (local_68 != 0) goto LAB_001076b6;
}
else {
LAB_001076b6:
iVar7 = local_68;
*(undefined8 *)((long)ppcVar15 + -8) = 0x1076c0;
uVar12 = ssh_err(iVar7);
puVar16 = (undefined *)((long)ppcVar15 + -0x10);
*(char **)((long)ppcVar15 + -0x10) = "prepare hostkeys-prove";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x1076f7;
sshfatal("clientloop.c","client_input_hostkeys",0x95c,1,1,uVar12);
}
*(undefined8 *)(puVar16 + -8) = 0x1076fc;
local_40 = sshbuf_new();
puVar14 = puVar16;
if (local_40 == 0) {
puVar14 = puVar16 + -0x10;
*(char **)(puVar16 + -0x10) = "sshbuf_new";
*(undefined8 *)(puVar16 + -0x18) = 0x107741;
sshfatal("clientloop.c","client_input_hostkeys",0x95e,1,1,0);
}
puVar16 = puVar14;
for (local_48 = 0; local_48 < (ulong)local_38[5]; local_48 = local_48 + 1) {
puVar14 = puVar16;
if (*(int *)(local_38[3] + local_48 * 4) == 0) {
*(undefined8 *)(puVar16 + -8) = 0x107777;
sshbuf_reset(local_40);
uVar12 = *(undefined8 *)(local_38[2] + local_48 * 8);
*(undefined8 *)(puVar16 + -8) = 0x10779c;
local_68 = sshkey_putb(uVar12,local_40);
if (local_68 == 0) {
*(undefined8 *)(puVar16 + -8) = 0x1077b8;
local_68 = sshpkt_put_stringb(local_70,local_40);
if (local_68 == 0) goto LAB_00107803;
}
*(undefined8 *)(puVar16 + -8) = 0x1077cb;
uVar12 = ssh_err(local_68);
puVar14 = puVar16 + -0x10;
*(char **)(puVar16 + -0x10) = "assemble hostkeys-prove";
*(undefined8 *)(puVar16 + -0x18) = 0x107802;
sshfatal("clientloop.c","client_input_hostkeys",0x965,1,1,uVar12);
}
LAB_00107803:
puVar16 = puVar14;
}
*(undefined8 *)(puVar16 + -8) = 0x107826;
local_68 = sshpkt_send(local_70);
ppcVar15 = (char **)puVar16;
if (local_68 != 0) {
*(undefined8 *)(puVar16 + -8) = 0x107839;
uVar12 = ssh_err(local_68);
ppcVar15 = (char **)(puVar16 + -0x10);
*(char **)(puVar16 + -0x10) = "send hostkeys-prove";
*(undefined8 *)(puVar16 + -0x18) = 0x107870;
sshfatal("clientloop.c","client_input_hostkeys",0x968,1,1,uVar12);
}
puVar6 = local_38;
*(undefined8 *)((long)ppcVar15 + -8) = 0x107883;
client_register_global_confirm(client_global_hostkeys_private_confirm,puVar6);
local_38 = (undefined8 *)0x0;
}
}
else {
*(undefined8 *)((long)ppcVar15 + -8) = 0x10756a;
iVar7 = check_old_keys_othernames(puVar6);
if (iVar7 == 0) {
if (*(int *)(local_38 + 0xb) == 0) goto LAB_00107605;
if (local_38[1] == 0) {
puVar16 = &DAT_00108c6c;
}
else {
puVar16 = (undefined *)local_38[1];
}
if (local_38[1] == 0) {
puVar14 = &DAT_00108c6c;
}
else {
puVar14 = &DAT_0010a445;
}
uVar12 = *local_38;
*(undefined **)((long)ppcVar15 + -8) = puVar16;
*(undefined **)((long)ppcVar15 + -0x10) = puVar14;
*(undefined8 *)((long)ppcVar15 + -0x18) = uVar12;
*(char **)((long)ppcVar15 + -0x20) =
"key(s) for %s%s%s exist under other names; skipping UserKnownHostsFile update";
*(undefined8 *)((long)ppcVar15 + -0x28) = 0x1075fc;
sshlog("clientloop.c","client_input_hostkeys",0x942,1,5,0);
}
}
}
else {
*(char **)((long)ppcVar15 + -0x10) =
"host key found matching a different name/address, skipping UserKnownHostsFile update";
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x107544;
sshlog("clientloop.c","client_input_hostkeys",0x933,1,5,0);
}
}
else {
*(char **)((long)ppcVar15 + -0x10) =
"CA/revocation marker, manual host list or wildcard host pattern found, skipping UserKnownHostsFile update"
;
*(undefined8 *)((long)ppcVar15 + -0x18) = 0x1074f6;
sshlog("clientloop.c","client_input_hostkeys",0x92e,1,5,0);
}
}
LAB_0010788e:
puVar6 = local_38;
*(undefined8 *)((long)ppcVar15 + -8) = 0x10789a;
hostkeys_update_ctx_free(puVar6);
uVar12 = local_50;
*(undefined8 *)((long)ppcVar15 + -8) = 0x1078a6;
sshkey_free(uVar12);
lVar2 = local_40;
*(undefined8 *)((long)ppcVar15 + -8) = 0x1078b2;
sshbuf_free(lVar2);
LAB_001078b7:
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return 1;
}
*(undefined8 *)((long)ppcVar15 + -8) = 0x1078cb;
__stack_chk_fail();
}
|
static char *
array_to_string_internal (start, end, sep, quoted)
ARRAY_ELEMENT *start, *end;
char *sep;
int quoted;
{
char *result, *t;
ARRAY_ELEMENT *ae;
int slen, rsize, rlen, reg;
if (start == end)
return ((char *)
((void *)0)
);
slen = strlen(sep);
result =
((void *)0)
;
for (rsize = rlen = 0, ae = start; ae != end; ae = ((ae)->next)) {
if (rsize == 0)
result = (char *)sh_xmalloc((rsize = 64), "array.c", 927);
if (((ae)->value)) {
t = quoted ? quote_string(((ae)->value)) : ((ae)->value);
reg = strlen(t);
do { if ((rlen) + ((reg + slen + 2)) >= rsize) { while ((rlen) + ((reg + slen + 2)) >= rsize) rsize += (rsize); result = sh_xrealloc((result), (rsize), "array.c", 931); } } while (0)
;
strcpy(result + rlen, t);
rlen += reg;
if (quoted)
sh_xfree((t), "array.c", 936);
if (((ae)->next) != end) {
strcpy(result + rlen, sep);
rlen += slen;
}
}
}
if (result)
result[rlen] = '\0';
return(result);
}
| long array_to_string_internal(long a1, long a2, const char *a3, int a4)
{
const char *v5;
int v8;
int v9;
int v10;
int v11;
long v12;
long i;
char *src;
if ( a1 == a2 )
return 0LL;
v10 = strlen(a3);
v12 = 0LL;
v9 = 0;
v8 = 0;
for ( i = a1; i != a2; i = *(_QWORD *)(i + 16) )
{
if ( !v8 )
{
v8 = 64;
v12 = sh_xmalloc(64LL, "array.c", 927LL);
}
if ( *(_QWORD *)(i + 8) )
{
if ( a4 )
v5 = (const char *)quote_string(*(_QWORD *)(i + 8));
else
v5 = *(const char **)(i + 8);
src = (char *)v5;
v11 = strlen(v5);
if ( v8 <= v11 + v10 + 2 + v9 )
{
while ( v8 <= v11 + v10 + 2 + v9 )
v8 *= 2;
v12 = sh_xrealloc(v12, v8, "array.c", 931LL);
}
strcpy((char *)(v12 + v9), src);
v9 += v11;
if ( a4 )
sh_xfree(src, "array.c", 936LL);
if ( a2 != *(_QWORD *)(i + 16) )
{
strcpy((char *)(v12 + v9), a3);
v9 += v10;
}
}
}
if ( v12 )
*(_BYTE *)(v9 + v12) = 0;
return v12;
}
|
int gzgetc(file)
gzFile file;
{
unsigned char buf[1];
gz_statep state;
if (file ==
((void *)0)
)
return -1;
state = (gz_statep)file;
if (state->mode != 7247 ||
(state->err != 0 && state->err != (-5)))
return -1;
if (state->x.have) {
state->x.have--;
state->x.pos++;
return *(state->x.next)++;
}
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
}
| void gzgetc(struct_0 *a0) {
struct_2 *v0;
int tmp_49;
char v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v7;
unsigned long long v8;
if (!a0) {
v3 = 4294967295;
} else {
v0 = &a0->field_0;
if (a0->field_18 == 7247 && (!a0->field_74 || a0->field_74 == -5)) {
if (a0->field_0) {
a0->field_0 = a0->field_0 - 1;
a0->field_10 = a0->field_10 + 1;
tmp_49 = a0->field_8;
a0->field_8 = a0->field_8 + 1;
v5 = *(tmp_49);
} else if (gz_read(a0, &v1, 0x1)) {
v8 = v1;
} else {
v7 = 4294967295;
}
}
if (a0->field_18 != 7247 || a0->field_74 && a0->field_74 != -5)
v4 = 4294967295;
}
return;
}
|
static void
bzr_addfn (struct exclude *ex, char const *pattern, int options, void *data)
{
while (
((*__ctype_b_loc ())[(int) ((
*pattern
))] & (unsigned short int) _ISspace)
)
++pattern;
if (*pattern == 0 || *pattern == '#')
return;
if (*pattern == '!')
{
if (*++pattern == '!')
++pattern;
else
options |= (1 << 29);
}
if (strncmp (pattern, "RE:", 3) == 0)
{
pattern += 3;
options &= ~(1 << 28);
options |= (1 << 27);
}
add_exclude (ex, pattern, options);
}
| void bzr_addfn(undefined8 param_1,char *param_2,uint param_3)
{
int iVar1;
ushort **ppuVar2;
uint local_1c;
char *local_18;
local_18 = param_2;
while( true ) {
ppuVar2 = __ctype_b_loc();
if (((*ppuVar2)[*local_18] & 0x2000) == 0) break;
local_18 = local_18 + 1;
}
if ((*local_18 != '\0') && (*local_18 != '#')) {
local_1c = param_3;
if (*local_18 == '!') {
if (local_18[1] == '!') {
local_18 = local_18 + 2;
}
else {
local_1c = param_3 | 0x20000000;
local_18 = local_18 + 1;
}
}
iVar1 = strncmp(local_18,"RE:",3);
if (iVar1 == 0) {
local_18 = local_18 + 3;
local_1c = local_1c & 0xefffffff | 0x8000000;
}
add_exclude(param_1,local_18,local_1c);
}
return;
}
|
(r = sshbuf_put(b, cp, len)) != 0 ||
(r = sshbuf_put_stringb(downstream->output, b)) != 0) {
sshlog("channels.c", __func__, 3142, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "compose muxclient");
goto out;
}
| ((local_34 = sshbuf_put(local_20,local_28,local_30), local_34 == 0 &&
(local_34 = sshbuf_put_stringb(*(undefined8 *)(local_18 + 0x70),local_20),
local_34 == 0)))) {
uVar2 = 0x10a75c;
iVar1 = ssh_packet_log_type(param_2 & 0xff);
if (iVar1 != 0) {
sshlog("channels.c","channel_proxy_upstream",0xc4b,1,7,0,
"channel %u: up->down: type %u",param_1[1],param_2,uVar2);
}
}
|
int deflateEnd(strm)
z_streamp strm;
{
int status;
if (deflateStateCheck(strm)) return (-2);
status = strm->state->status;
{if (strm->state->pending_buf) (*((strm)->zfree))((strm)->opaque, (voidpf)(strm->state->pending_buf));};
{if (strm->state->head) (*((strm)->zfree))((strm)->opaque, (voidpf)(strm->state->head));};
{if (strm->state->prev) (*((strm)->zfree))((strm)->opaque, (voidpf)(strm->state->prev));};
{if (strm->state->window) (*((strm)->zfree))((strm)->opaque, (voidpf)(strm->state->window));};
(*((strm)->zfree))((strm)->opaque, (voidpf)(strm->state));
strm->state = 0;
return status == 113 ? (-3) : 0;
}
| void deflateEnd(struct_0 *a0) {
unsigned int v0;
unsigned long long v3;
unsigned long long v4;
void* v5;
if (deflateStateCheck(a0)) {
v3 = 4294967294;
} else {
v0 = a0->field_38->field_8;
if (a0->field_38->field_10)
a0->field_48(a0->field_50, a0->field_38->field_10, a0->field_38->field_10, a0->field_48);
if (a0->field_38->field_78)
a0->field_48(a0->field_50, a0->field_38->field_78, a0->field_38->field_78, a0->field_48);
if (a0->field_38->field_70)
a0->field_48(a0->field_50, a0->field_38->field_70, a0->field_38->field_70, a0->field_48);
if (a0->field_38->field_60)
a0->field_48(a0->field_50, a0->field_38->field_60, a0->field_38->field_60, a0->field_48);
a0->field_48(a0->field_50, a0->field_38, a0->field_38, a0->field_48);
a0->field_38 = 0;
if (v0 == 113)
v4 = 4294967293;
else
v5 = 0;
}
return;
}
|
static inline void
initialize_exit_failure (int status)
{
if (status !=
1
)
exit_failure = status;
}
| long initialize_exit_failure(unsigned int a1)
{
long result;
if ( a1 != 1 )
{
result = a1;
exit_failure = a1;
}
return result;
}
|
inline int ext2fs_dirent_name_len(const struct ext2_dir_entry *entry)
{
return entry->name_len & 0xff;
}
| void ext2fs_dirent_name_len(void)
{
halt_baddata();
}
|
static int
sshsig_wrap_verify(struct sshbuf *signature, const char *hashalg,
const struct sshbuf *h_message, const char *expect_namespace,
struct sshkey **sign_keyp, struct sshkey_sig_details **sig_details)
{
int r = -1;
struct sshbuf *buf =
((void *)0)
, *toverify =
((void *)0)
;
struct sshkey *key =
((void *)0)
;
const u_char *sig;
char *got_namespace =
((void *)0)
, *sigtype =
((void *)0)
, *sig_hashalg =
((void *)0)
;
size_t siglen;
sshlog("sshsig.c", __func__, 300, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "verify message length %zu", sshbuf_len(h_message));
if (sig_details !=
((void *)0)
)
*sig_details =
((void *)0)
;
if (sign_keyp !=
((void *)0)
)
*sign_keyp =
((void *)0)
;
if ((toverify = sshbuf_new()) ==
((void *)0)
) {
sshlog("sshsig.c", __func__, 307, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "sshbuf_new failed");
r = -2;
goto done;
}
if ((r = sshbuf_put(toverify, "SSHSIG",
(sizeof("SSHSIG") - 1))) != 0 ||
(r = sshbuf_put_cstring(toverify, expect_namespace)) != 0 ||
(r = sshbuf_put_string(toverify,
((void *)0)
, 0)) != 0 ||
(r = sshbuf_put_cstring(toverify, hashalg)) != 0 ||
(r = sshbuf_put_stringb(toverify, h_message)) != 0) {
sshlog("sshsig.c", __func__, 317, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "assemble message to verify");
goto done;
}
if ((r = sshsig_parse_preamble(signature)) != 0)
goto done;
if ((r = sshkey_froms(signature, &key)) != 0 ||
(r = sshbuf_get_cstring(signature, &got_namespace,
((void *)0)
)) != 0 ||
(r = sshbuf_get_string(signature,
((void *)0)
,
((void *)0)
)) != 0 ||
(r = sshbuf_get_cstring(signature, &sig_hashalg,
((void *)0)
)) != 0 ||
(r = sshbuf_get_string_direct(signature, &sig, &siglen)) != 0) {
sshlog("sshsig.c", __func__, 329, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse signature object");
goto done;
}
if (sshbuf_len(signature) != 0) {
sshlog("sshsig.c", __func__, 334, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Signature contains trailing data");
r = -4;
goto done;
}
if (strcmp(expect_namespace, got_namespace) != 0) {
sshlog("sshsig.c", __func__, 340, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Couldn't verify signature: namespace does not match");
sshlog("sshsig.c", __func__, 341, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "expected namespace \"%s\" received \"%s\"", expect_namespace, got_namespace)
;
r = -21;
goto done;
}
if (strcmp(hashalg, sig_hashalg) != 0) {
sshlog("sshsig.c", __func__, 347, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Couldn't verify signature: hash algorithm mismatch");
sshlog("sshsig.c", __func__, 348, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "expected algorithm \"%s\" received \"%s\"", hashalg, sig_hashalg)
;
r = -21;
goto done;
}
if (sshkey_type_plain(key->type) == KEY_RSA) {
if ((r = sshkey_get_sigtype(sig, siglen, &sigtype)) != 0) {
sshlog("sshsig.c", __func__, 356, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Couldn't verify signature: unable to get " "signature type")
;
goto done;
}
if (match_pattern_list(sigtype, "rsa-sha2-512,rsa-sha2-256", 0) != 1) {
sshlog("sshsig.c", __func__, 361, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Couldn't verify signature: unsupported RSA " "signature algorithm %s", sigtype)
;
r = -58;
goto done;
}
}
if ((r = sshkey_verify(key, sig, siglen, sshbuf_ptr(toverify),
sshbuf_len(toverify),
((void *)0)
, 0, sig_details)) != 0) {
sshlog("sshsig.c", __func__, 369, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Signature verification failed");
goto done;
}
r = 0;
if (sign_keyp !=
((void *)0)
) {
*sign_keyp = key;
key =
((void *)0)
;
}
done:
free(got_namespace);
free(sigtype);
free(sig_hashalg);
sshbuf_free(buf);
sshbuf_free(toverify);
sshkey_free(key);
return r;
}
| long sshsig_wrap_verify(
long a1,
const char *a2,
long a3,
const char *a4,
unsigned int **a5,
_QWORD *a6)
{
long v6;
long v7;
long v8;
long v9;
long v10;
long v11;
long v12;
unsigned int sigtype;
unsigned int *v19;
long v20;
char *s2;
void *ptr;
char *v23;
long v24;
long v25;
long v26;
unsigned long v27;
v27 = __readfsqword(0x28u);
v25 = 0LL;
v26 = 0LL;
v19 = 0LL;
s2 = 0LL;
ptr = 0LL;
v23 = 0LL;
v6 = sshbuf_len(a3);
sshlog("sshsig.c", "sshsig_wrap_verify", 300LL, 1LL, 5LL, 0LL, "verify message length %zu", v6);
if ( a6 )
*a6 = 0LL;
if ( a5 )
*a5 = 0LL;
v26 = sshbuf_new();
if ( v26 )
{
sigtype = sshbuf_put(v26, "SSHSIG", 6LL);
if ( sigtype
|| (sigtype = sshbuf_put_cstring(v26, a4)) != 0
|| (sigtype = sshbuf_put_string(v26, 0LL, 0LL)) != 0
|| (sigtype = sshbuf_put_cstring(v26, a2)) != 0
|| (sigtype = sshbuf_put_stringb(v26, a3)) != 0 )
{
v7 = ssh_err(sigtype);
sshlog("sshsig.c", "sshsig_wrap_verify", 317LL, 1LL, 2LL, v7, "assemble message to verify");
}
else
{
sigtype = sshsig_parse_preamble(a1);
if ( !sigtype )
{
sigtype = sshkey_froms(a1, &v19);
if ( sigtype
|| (sigtype = sshbuf_get_cstring(a1, &s2, 0LL)) != 0
|| (sigtype = sshbuf_get_string(a1, 0LL, 0LL)) != 0
|| (sigtype = sshbuf_get_cstring(a1, &v23, 0LL)) != 0
|| (sigtype = sshbuf_get_string_direct(a1, &v20, &v24)) != 0 )
{
v8 = ssh_err(sigtype);
sshlog("sshsig.c", "sshsig_wrap_verify", 329LL, 1LL, 2LL, v8, "parse signature object");
}
else if ( sshbuf_len(a1) )
{
sshlog("sshsig.c", "sshsig_wrap_verify", 334LL, 0LL, 2LL, 0LL, "Signature contains trailing data");
sigtype = -4;
}
else if ( !strcmp(a4, s2) )
{
if ( !strcmp(a2, v23) )
{
if ( !(unsigned int)sshkey_type_plain(*v19) )
{
sigtype = sshkey_get_sigtype(v20, v24, &ptr);
if ( sigtype )
{
v9 = ssh_err(sigtype);
sshlog(
"sshsig.c",
"sshsig_wrap_verify",
356LL,
0LL,
2LL,
v9,
"Couldn't verify signature: unable to get signature type");
goto LABEL_35;
}
if ( (unsigned int)match_pattern_list(ptr, "rsa-sha2-512,rsa-sha2-256", 0LL) != 1 )
{
sshlog(
"sshsig.c",
"sshsig_wrap_verify",
361LL,
0LL,
2LL,
0LL,
"Couldn't verify signature: unsupported RSA signature algorithm %s",
(const char *)ptr);
sigtype = -58;
goto LABEL_35;
}
}
v10 = sshbuf_len(v26);
v11 = sshbuf_ptr(v26);
sigtype = sshkey_verify(v19, v20, v24, v11, v10, 0LL, 0LL, a6);
if ( sigtype )
{
v12 = ssh_err(sigtype);
sshlog("sshsig.c", "sshsig_wrap_verify", 369LL, 0LL, 2LL, v12, "Signature verification failed");
}
else
{
sigtype = 0;
if ( a5 )
{
*a5 = v19;
v19 = 0LL;
}
}
}
else
{
sshlog(
"sshsig.c",
"sshsig_wrap_verify",
347LL,
0LL,
2LL,
0LL,
"Couldn't verify signature: hash algorithm mismatch");
sshlog(
"sshsig.c",
"sshsig_wrap_verify",
348LL,
1LL,
5LL,
0LL,
"expected algorithm \"%s\" received \"%s\"",
a2,
v23);
sigtype = -21;
}
}
else
{
sshlog(
"sshsig.c",
"sshsig_wrap_verify",
340LL,
0LL,
2LL,
0LL,
"Couldn't verify signature: namespace does not match");
sshlog(
"sshsig.c",
"sshsig_wrap_verify",
341LL,
1LL,
5LL,
0LL,
"expected namespace \"%s\" received \"%s\"",
a4,
s2);
sigtype = -21;
}
}
}
}
else
{
sshlog("sshsig.c", "sshsig_wrap_verify", 307LL, 1LL, 2LL, 0LL, "sshbuf_new failed");
sigtype = -2;
}
LABEL_35:
free(s2);
free(ptr);
free(v23);
sshbuf_free(v25);
sshbuf_free(v26);
sshkey_free(v19);
return sigtype;
}
|
static int
optionh_getfilecon (int fd, const char *name, char **p)
{
int rv;
if (0 == state.curdepth)
{
rv = getfileconat (fd, name, p);
if (0 == rv)
return 0;
else
return fallback_getfilecon (fd, name, p, rv);
}
else
{
return lgetfileconat (fd, name, p);
}
}
| long long optionh_getfilecon(unsigned long a0, unsigned long long a1, unsigned long long a2) {
unsigned int v0;
void* v2;
if (!state) {
v0 = getfileconat(a0, a1, a2, a1);
if (!v0)
v2 = 0;
else
v2 = fallback_getfilecon(a0, a1, a2, v0);
} else {
v2 = lgetfileconat(a0, a1, a2, a1);
}
return v2;
}
|
static int
server_input_channel_open(int type, u_int32_t seq, struct ssh *ssh)
{
Channel *c =
((void *)0)
;
char *ctype =
((void *)0)
;
const char *errmsg =
((void *)0)
;
int r, reason = 2;
u_int rchan = 0, rmaxpack = 0, rwindow = 0;
if ((r = sshpkt_get_cstring(ssh, &ctype,
((void *)0)
)) != 0 ||
(r = sshpkt_get_u32(ssh, &rchan)) != 0 ||
(r = sshpkt_get_u32(ssh, &rwindow)) != 0 ||
(r = sshpkt_get_u32(ssh, &rmaxpack)) != 0)
sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
sshlog("serverloop.c", __func__, 635, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "ctype %s rchan %u win %u max %u", ctype, rchan, rwindow, rmaxpack)
;
if (strcmp(ctype, "session") == 0) {
c = server_request_session(ssh);
} else if (strcmp(ctype, "direct-tcpip") == 0) {
c = server_request_direct_tcpip(ssh, &reason, &errmsg);
} else if (strcmp(ctype, "direct-streamlocal@openssh.com") == 0) {
c = server_request_direct_streamlocal(ssh);
} else if (strcmp(ctype, "tun@openssh.com") == 0) {
c = server_request_tun(ssh);
}
if (c !=
((void *)0)
) {
sshlog("serverloop.c", __func__, 648, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "confirm %s", ctype);
c->remote_id = rchan;
c->have_remote_id = 1;
c->remote_window = rwindow;
c->remote_maxpacket = rmaxpack;
if (c->type != 12) {
if ((r = sshpkt_start(ssh, 91)) != 0 ||
(r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
(r = sshpkt_put_u32(ssh, c->self)) != 0 ||
(r = sshpkt_put_u32(ssh, c->local_window)) != 0 ||
(r = sshpkt_put_u32(ssh, c->local_maxpacket)) != 0 ||
(r = sshpkt_send(ssh)) != 0) {
sshpkt_fatal(ssh, r,
"%s: send open confirm", __func__);
}
}
} else {
sshlog("serverloop.c", __func__, 665, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "failure %s", ctype);
if ((r = sshpkt_start(ssh, 92)) != 0 ||
(r = sshpkt_put_u32(ssh, rchan)) != 0 ||
(r = sshpkt_put_u32(ssh, reason)) != 0 ||
(r = sshpkt_put_cstring(ssh, errmsg ? errmsg : "open failed")) != 0 ||
(r = sshpkt_put_cstring(ssh, "")) != 0 ||
(r = sshpkt_send(ssh)) != 0) {
sshpkt_fatal(ssh, r,
"%s: send open failure", __func__);
}
}
free(ctype);
return 0;
}
| long long server_input_channel_open(unsigned long a0, unsigned long a1, unsigned long long a2) {
void* v0;
unsigned long v1;
unsigned long v2;
void* v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
void* v11;
void* v12;
void* v13;
unsigned long long v15;
v5 = a0;
v4 = a1;
v13 = 0;
v11 = 0;
v12 = 0;
v6 = 2;
v7 = 0;
v8 = 0;
v9 = 0;
v10 = sshpkt_get_cstring(a2, &v11, 0x0, &v11);
if (!(!v10) || !((v10 = sshpkt_get_u32(a2, &v7, &v7), !v10))) {
LABEL_40198f:
sshpkt_fatal(a2, v10, "%s: parse packet", "server_input_channel_open");
} else {
v10 = sshpkt_get_u32(a2, &v9, &v9);
if (v10 || (v10 = sshpkt_get_u32(a2, &v8, &v8), v10))
goto LABEL_40198f;
}
v2 = v9;
v1 = v7;
v0 = v11;
sshlog("serverloop.c", "server_input_channel_open", 0x27b, 0x1, 0x5, 0x0, "ctype %s rchan %u win %u max %u");
if (!strcmp(v11, "session")) {
v13 = server_request_session(a2);
} else if (!strcmp(v11, "direct-tcpip")) {
v13 = server_request_direct_tcpip(a2, &v6, &v12);
} else if (!strcmp(v11, "direct-streamlocal@openssh.com")) {
v13 = server_request_direct_streamlocal(a2);
} else if (!strcmp(v11, "tun@openssh.com")) {
v13 = server_request_tun(a2);
}
if (!(!v13))
goto LABEL_0x401af1;
while (true) {
v3 = v11;
if (v13) {
sshlog("serverloop.c", "server_input_channel_open", 0x288, 0x1, 0x5, 0x0, "confirm %s");
*(&v13[8]) = v7;
*(&v13[12]) = 1;
*(&v13[168]) = v9;
*(&v13[172]) = v8;
if (*(v13) == 12)
break;
v10 = sshpkt_start(a2, 0x5b);
if (!v10 && (v10 = sshpkt_put_u32(a2, v13[8], v13[8]), !v10)) {
v10 = sshpkt_put_u32(a2, v13[4], v13[4]);
if (!v10 && (v10 = sshpkt_put_u32(a2, v13[176], v13[176]), !v10)) {
v10 = sshpkt_put_u32(a2, v13[188], v13[188]);
if (!(v10) && !((v10 = sshpkt_send(a2), v10)))
break;
}
}
sshpkt_fatal(a2, v10, "%s: send open confirm", "server_input_channel_open");
} else {
sshlog("serverloop.c", "server_input_channel_open", 0x299, 0x1, 0x5, 0x0, "failure %s");
v10 = sshpkt_start(a2, 0x5c);
if (!v10 && (v10 = sshpkt_put_u32(a2, v7, v7), !v10)) {
v10 = sshpkt_put_u32(a2, v6, v6);
if (!v10 && (v15 = (!v12 ? v12 : "open failed"), v10 = sshpkt_put_cstring(a2, v15), !v10)) {
v10 = sshpkt_put_cstring(a2, &g_403301);
if (!(v10) && !((v10 = sshpkt_send(a2), v10)))
break;
}
}
sshpkt_fatal(a2, v10, "%s: send open failure", "server_input_channel_open");
break;
}
}
free(v11);
return 0;
}
|
char *
line_abbrevname(char *dst, const char *src, int dstsize)
{
size_t len;
memset(dst, '\0', dstsize);
if (strncmp(src, "/dev/", 5) == 0)
src += 5;
len = strlen(src);
if (len > 0) {
if (((int)len - dstsize) > 0)
src += ((int)len - dstsize);
strncpy(dst, src, (size_t)dstsize);
}
return (dst);
}
| void * line_abbrevname(void *a1, char *a2, int a3)
{
char *s1;
size_t v6;
s1 = a2;
memset(a1, 0, a3);
if ( !strncmp(a2, "/dev/", 5uLL) )
s1 = a2 + 5;
v6 = strlen(s1);
if ( v6 )
{
if ( (int)v6 - a3 > 0 )
s1 += (int)v6 - a3;
strncpy((char *)a1, s1, a3);
}
return a1;
}
|
static char *
scanright(
char *startp, char *rmesc, char *rmescend, char *str, int quotes,
int zero
) {
int esc = 0;
char *loc;
char *loc2;
for (loc = str - 1, loc2 = rmescend; loc >= startp; loc2--) {
int match;
char c = *loc2;
const char *s = loc2;
if (zero) {
*loc2 = '\0';
s = rmesc;
}
match = !fnmatch((str), (s), 0);
*loc2 = c;
if (match)
return loc;
loc--;
if (quotes) {
if (--esc < 0) {
esc = esclen(startp, loc);
}
if (esc % 2) {
esc--;
loc--;
}
}
}
return 0;
}
| long long scanright(unsigned int a0, char *a1, char *a2, char *a3, unsigned long a4, unsigned long a5) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
char *v4;
char *v5;
void* v7;
v1 = 0;
v3 = a3 + 1;
v4 = a2;
while (true) {
if (v3 >= a0) {
v0 = *(v4);
v5 = v4;
if (a5) {
*(v4) = 0;
v5 = a1;
}
v2 = !fnmatch(a3, v5, 0x0);
*(v4) = v0;
if (v2) {
v7 = v3;
return v7;
}
*(&v3) = v3 - 1;
if (a4) {
v1 -= 1;
if (v1 < 0)
v1 = esclen(a0, *(&v3));
if ((v1 & 1)) {
v1 -= 1;
v3 -= 1;
}
}
v4 += 1;
} else {
v7 = 0;
return v7;
}
}
}
|
static inline
_Bool
es_match (struct E_string const *es, size_t i, char c)
{
return es->s[i] == c && !es->escaped[i];
}
| int es_match(unsigned long long a0[2], char *a1, unsigned long a2) {
unsigned int v1;
unsigned int v2;
if (a2 == a1[a0[0]] && (a1[a0[1]] ^ 1)) {
v1 = 1;
goto LABEL_4002d8;
}
v1 = 0;
LABEL_4002d8:
v2 = v1 & 1;
return v2;
}
|
static intmax_t
strlong (num)
char *num;
{
register char *s;
register unsigned char c;
int base, foundbase;
intmax_t val, pval;
s = num;
base = 10;
foundbase = 0;
if (*s == '0')
{
s++;
if (*s == '\0')
return 0;
if (*s == 'x' || *s == 'X')
{
base = 16;
s++;
}
else
base = 8;
foundbase++;
}
val = 0;
for (c = *s++; c; c = *s++)
{
if (c == '#')
{
if (foundbase)
evalerror (gettext("invalid number"));
if (val < 2 || val > 64)
evalerror (gettext("invalid arithmetic base"));
base = val;
val = 0;
foundbase++;
if (((1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)*s
))] & (unsigned short int) _ISalnum)
) || ((*s) == '_') || ((*s) == '@')) == 0)
evalerror (gettext("invalid integer constant"));
}
else if (((1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)c
))] & (unsigned short int) _ISalnum)
) || ((c) == '_') || ((c) == '@')))
{
if (((c) >= '0' && (c) <= '9'))
c = ((c) - '0');
else if (c >= 'a' && c <= 'z')
c -= 'a' - 10;
else if (c >= 'A' && c <= 'Z')
c -= 'A' - ((base <= 36) ? 10 : 36);
else if (c == '@')
c = 62;
else if (c == '_')
c = 63;
if (c >= base)
evalerror (gettext("value too great for base"));
val = (val * base) + c;
}
else
break;
}
return (val);
}
| int strlong(char a0[2]) {
unsigned int v0;
int tmp_5;
int tmp_2;
unsigned int v1;
void* v2;
unsigned long long v4;
unsigned short v5;
unsigned short v6;
unsigned long long v8;
unsigned int v9;
char *v10;
v4 = a0;
v0 = 10;
v1 = 0;
if (a0[0] == 48) {
v4 = &a0[1];
if (!a0[1]) {
v9 = 0;
goto LABEL_402b61;
} else {
if (a0[1] == 120) {
LABEL_4029ab:
v0 = 16;
v4 = a0 + 1;
} else {
if (a0[1] == 88)
goto LABEL_4029ab;
v0 = 8;
}
v1 += 1;
}
}
v2 = 0;
tmp_5 = v4;
v10 = &v4[1];
v8 = *(tmp_5);
while (true) {
if (!v8) {
LABEL_402b5d:
v9 = v2;
break;
} else {
if (v8 == 35) {
if (v1)
evalerror(gettext("invalid number"));
if (v2 > 1 && v2 <= 64) {
v0 = v2;
v2 = 0;
v1 += 1;
v6 = *((*(__ctype_b_loc()) + *(v10) * 2));
if (!(v6 & 8) && *(v10) != 95 && *(v10) != 64) {
v9 = 0;
LABEL_402a75:
if (!v9)
evalerror(gettext("invalid integer constant"));
goto LABEL_402b49;
}
v9 = 1;
goto LABEL_402a75;
}
evalerror(gettext("invalid arithmetic base"));
}
v5 = *((*(__ctype_b_loc()) + v8 * 2));
v9 = v5 & 8;
if (!v9 && v8 != 95) {
if (v8 == 64)
goto LABEL_402ac2;
goto LABEL_402b5d;
}
LABEL_402ac2:
if (v8 > 47 && v8 <= 57) {
v8 = v8 - 48;
goto LABEL_402b16;
}
if (v8 > 96 && v8 <= 122) {
v8 = v8 - 87;
goto LABEL_402b16;
}
if (v8 > 64 && v8 <= 90) {
if (v0 <= 36)
v9 = 55;
else
v9 = 29;
v8 -= v9;
goto LABEL_402b16;
}
if (v8 == 64) {
v8 = 62;
} else if (v8 == 95) {
v8 = 63;
}
LABEL_402b16:
if (v0 <= v8)
evalerror(gettext("value too great for base"));
v2 = v8 + v2 * v0;
LABEL_402b49:
tmp_2 = v10;
v10 += 1;
v8 = *(tmp_2);
}
}
LABEL_402b61:
return v9;
}
|
int
sshkey_ecdsa_bits_to_nid(int bits)
{
switch (bits) {
case 256:
return
415
;
case 384:
return
715
;
case 521:
return
716
;
default:
return -1;
}
}
| int sshkey_ecdsa_bits_to_nid(unsigned long a0) {
unsigned int v1;
if (a0 != 521) {
if (a0 <= 521) {
if (a0 == 0x100)
v1 = 415;
if (a0 == 384)
v1 = 715;
}
if (a0 > 521 || a0 != 384 && a0 != 0x100)
v1 = -1;
} else {
v1 = 716;
}
return v1;
}
|
static void
read_interrupt(int signo)
{
interrupted = 1;
}
| long long read_interrupt(unsigned long a0) {
unsigned int v0;
unsigned long v2;
v0 = a0;
interrupted = 1;
return v2;
}
|
ext2fs_has_feature_csum_seed(fs->super) &&
fix_problem(ctx, 0x00004B, &pctx)) {
ext2fs_clear_feature_csum_seed(fs->super);
fs->super->s_checksum_seed = 0;
ext2fs_mark_super_dirty(fs);
}
| int ext2fs_has_feature_csum_seed(struct_0 *a0) {
return (a0->field_60 & 0x2000);
}
|
static void
pr_forward_ed_hunk (struct change *hunk)
{
lin i, f0, l0, f1, l1;
enum changes changes = analyze_hunk (hunk, &f0, &l0, &f1, &l1);
if (!changes)
return;
begin_output ();
fputc_unlocked (change_letter[changes],outfile);
print_number_range (' ', files, f0, l0);
fputc_unlocked ('\n',outfile);
if (changes == OLD)
return;
for (i = f1; i <= l1; i++)
print_1_line ("", &files[1].linbuf[i]);
fputs_unlocked (".\n",outfile);
}
| long long pr_forward_ed_hunk(unsigned long long a0) {
unsigned int v0;
char v1;
char v2;
char v3;
char v4;
unsigned long long v5;
v0 = analyze_hunk(a0, &v1, &v2, &v3, &v4);
if (v0) {
begin_output();
fputc_unlocked(*(v0 + &change_letter), outfile);
print_number_range(0x20, 0x500028, *(&v1), *(&v2));
fputc_unlocked(0xa, outfile);
if (v0 != 1) {
for (v5 = *(&v3); v5 <= *(&v4); v5 += 1) {
print_1_line(&g_4004e5, *(5243408) + v5 * 8, v5 * 8);
}
fputs_unlocked(".\n", outfile);
}
}
return 0;
}
|
struct ssh_krl *
ssh_krl_init(void)
{
struct ssh_krl *krl;
if ((krl = calloc(1, sizeof(*krl))) ==
((void *)0)
)
return
((void *)0)
;
do { (&krl->revoked_keys)->rbh_root =
((void *)0)
; } while (0);
do { (&krl->revoked_sha1s)->rbh_root =
((void *)0)
; } while (0);
do { (&krl->revoked_sha256s)->rbh_root =
((void *)0)
; } while (0);
do { (&krl->revoked_certs)->tqh_first =
((void *)0)
; (&krl->revoked_certs)->tqh_last = &(&krl->revoked_certs)->tqh_first; } while (0);
return krl;
}
| int ssh_krl_init() {
unsigned long long v0[9];
unsigned int v2;
v0[0] = calloc(0x1, 0x48);
if (!v0) {
v2 = 0;
return v2;
}
v0[4] = 0;
v0[5] = 0;
v0[6] = 0;
v0[7] = 0;
v0[8] = &v0[7];
v2 = v0;
return v2;
}
|
static struct file_stat **
statdb_node_find(const char *filename)
{
struct fsys_namenode *file;
file = fsys_hash_find_node(filename, 0);
return &file->statoverride;
}
| int statdb_node_find(unsigned long long a0) {
unsigned long v0;
v0 = fsys_hash_find_node(a0, 0x0);
return v0 + 32;
}
|
static int
xstrcoll_df_version (V a, V b)
{
return dirfirst_check (a, b, xstrcoll_version);
}
| long long xstrcoll_df_version(void* a0, void* a1) {
return dirfirst_check(a0, a1, xstrcoll_version);
}
|
static void decrement_badcount(e2fsck_t ctx, blk64_t block,
struct dup_cluster *p)
{
p->num_bad--;
if (p->num_bad <= 0 ||
(p->num_bad == 1 && !check_if_fs_block(ctx, block))) {
if (check_if_fs_cluster(ctx, ((block) >> (ctx->fs)->cluster_ratio_bits)))
return;
ext2fs_unmark_block_bitmap2(ctx->block_dup_map, block);
}
}
| void decrement_badcount(struct_0 *a0, unsigned long a1, unsigned long a2) {
unsigned int *v0;
unsigned long long v2;
unsigned long v4;
unsigned long long v5;
unsigned long long v6;
v0 = a2;
*(v0) = *(v0) - 1;
if (*(v0) > 0) {
v2 = *(v0);
if (!(*(v0) == 1))
goto LABEL_401794;
if (!(!check_if_fs_block(a0, a1)))
goto LABEL_401794;
}
if ((a0->field_0->field_c0 & 63))
v4 = a1 >> (a0->field_0->field_c0 & 63);
else
v4 = a1 >> (a0->field_0->field_c0 & 63);
v5 = check_if_fs_cluster(a0, v4);
if (!v5)
v6 = ext2fs_unmark_block_bitmap2(a0->field_1a8, a1, a1);
LABEL_401794:
return;
}
|
static
_Bool
fnmatch_sanitycheck (void)
{
static
_Bool
checked =
0
;
if (!checked)
{
if (0 != fnmatch ("foo", "foo", 0)
|| 0 == fnmatch ("Foo", "foo", 0)
|| 0 != fnmatch ("Foo", "foo",
(1 << 4)
))
{
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"sanity check of the fnmatch() library function failed.\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("sanity check of the fnmatch() library function failed.")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("sanity check of the fnmatch() library function failed.")), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
return
0
;
}
checked =
1
;
}
return checked;
}
| void fnmatch_sanitycheck() {
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
if ((checked.10967 ^ 1)) {
v1 = fnmatch("foo", "foo", 0x0);
if (!v1) {
v2 = fnmatch("Foo", "foo", 0x0);
if (v2) {
v3 = fnmatch("Foo", "foo", 0x10);
if (!v3)
checked.10967 = 1;
}
}
if (!v2 || v1 || v3)
error(0x1, 0x0, gettext("sanity check of the fnmatch() library function failed."));
}
if (!(checked.10967 ^ 1) || !v1 && !v3 && v2) {
v4 = checked.10967;
return;
}
}
|
static void
xattr_selinux_coder (struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr, void const *data)
{
code_string (st->cntx_name, keyword, xhdr);
}
| long long xattr_selinux_coder(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long a3) {
unsigned long v0;
v0 = a3;
return code_string(a0->field_30, a1, a2);
}
|
(*__errno_location ())
));
window = (64*(32*1024));
packetmax = (32*1024);
if (cctx->want_tty) {
window >>= 1;
packetmax >>= 1;
}
| int * __errno_location(void)
{
halt_baddata();
}
|
static void
invis_addc (int *outp, char c, char face)
{
realloc_line (*outp + 1);
(line_state_invisible->line)[*outp] = c;
(line_state_invisible->lface)[*outp] = face;
*outp += 1;
}
| long long invis_addc(unsigned int *a0, unsigned long a1, unsigned long a2) {
realloc_line(*(a0) + 1);
*((*(line_state_invisible) + *(a0))) = a1;
*((*((line_state_invisible + 8)) + *(a0))) = a2;
*(a0) = *(a0) + 1;
return a0;
}
|
static intmax_t
ipow (base, exp)
intmax_t base, exp;
{
intmax_t result;
result = 1;
while (exp)
{
if (exp & 1)
result *= base;
exp >>= 1;
base *= base;
}
return result;
}
| long ipow(long param_1,ulong param_2)
{
ulong local_28;
long local_20;
long local_10;
local_10 = 1;
local_20 = param_1;
for (local_28 = param_2; local_28 != 0; local_28 = (long)local_28 >> 1) {
if ((local_28 & 1) != 0) {
local_10 = local_10 * local_20;
}
local_20 = local_20 * local_20;
}
return local_10;
}
|
const char *
archive_format_string (enum archive_format fmt)
{
struct fmttab const *p;
for (p = fmttab; p->name; p++)
if (p->fmt == fmt)
return p->name;
return "unknown?";
}
| int archive_format_string(unsigned long a0) {
unsigned long long v0;
unsigned int v2;
v0 = &fmttab;
while (true) {
if (!*(v0)) {
v2 = &g_4053dd;
break;
} else if (a0 == *((v0 + 8))) {
v2 = *(v0);
break;
} else {
v0 += 16;
}
}
return v2;
}
|
static void ipstats_fini_hw_s_info(struct ipstats_hw_s_info *hwsi)
{
int i;
for (i = 0; i < IPSTATS_HW_S_INFO_IDX_COUNT; i++)
free(hwsi->infos[i]);
}
| void ipstats_fini_hw_s_info(long param_1)
{
int local_c;
for (local_c = 0; local_c < 1; local_c = local_c + 1) {
free(*(void **)(param_1 + (long)local_c * 8));
}
return;
}
|
static void
delseq (struct seq *seq)
{
for (size_t i = 0; i < seq->alloc; i++)
{
freeline (seq->lines[i]);
free (seq->lines[i]);
}
free (seq->lines);
}
| void delseq(unsigned long long a0[3]) {
void* v0;
unsigned long long v2;
for (v0 = 0; v0 < a0[1]; v0 += 1) {
freeline(*((a0[2] + v0 * 8)));
free(*((a0[2] + v0 * 8)));
}
v2 = free(a0[2]);
return;
}
|
get_stat_mtime (struct stat const *st)
{
return ((st)->st_mtim);
}
| void get_stat_mtime(void)
{
halt_baddata();
}
|
static int insmod_all(struct kmod_ctx *ctx, char **args, int nargs)
{
int i, err = 0;
for (i = 0; i < nargs; i++) {
int r = insmod(ctx, args[i],
((void *)0)
);
if (r < 0)
err = r;
}
return err;
}
| int insmod_all(unsigned long long a0, unsigned long long *a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
v1 = 0;
for (v0 = 0; v0 < a2; v0 += 1) {
v2 = insmod(a0, a1[v0], 0x0);
if (v2 < 0)
v1 = v2;
}
return v1;
}
|
int
rl_history_search_forward (int count, int ignore)
{
if (count == 0)
return (0);
if (rl_last_func != rl_history_search_forward &&
rl_last_func != rl_history_search_backward)
rl_history_search_reinit (0x01);
if (_rl_history_search_len == 0)
return (rl_get_next_history (count, ignore));
return (rl_history_search_internal ((((count) >= 0) ? (count) : -(count)), (count > 0) ? 1 : -1));
}
| long long rl_history_search_forward(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
void* v1;
unsigned long long v2;
if (!a0) {
v1 = 0;
} else {
if (rl_last_func != rl_history_search_forward && rl_last_func != rl_history_search_backward)
rl_history_search_reinit(0x1);
if (!_rl_history_search_len) {
v1 = rl_get_next_history(a0, a1, a1);
} else {
if (a0 > 0)
v2 = 1;
else
v2 = 4294967295;
v1 = rl_history_search_internal((a0 >> 31 ^ a0) - (a0 >> 31), v2, a0 >> 31, v2, a4, a5);
}
}
return v1;
}
|
static void fail_exit (int code)
{
if (gr_locked) {
if (gr_unlock () == 0) {
fprintf (
stderr
,
gettext ("%s: failed to unlock %s\n"),
Prog, gr_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failed to unlock %s", gr_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
}
if (sgr_locked) {
if (sgr_unlock () == 0) {
fprintf (
stderr
,
gettext ("%s: failed to unlock %s\n"),
Prog, sgr_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failed to unlock %s", sgr_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
}
exit (code);
}
| void fail_exit(unsigned long a0) {
void* v0;
void* v1;
char *v2;
char *v3;
unsigned long v4;
unsigned long v5;
unsigned long v7;
unsigned long v8;
unsigned long long v10;
unsigned long long v12;
v5 = v7;
v4 = v8;
if (gr_locked && !gr_unlock()) {
v10 = gr_dbname();
fprintf(stderr, gettext("%s: failed to unlock %s\n"));
v2 = setlocale(0x6, NULL);
v0 = 0;
if (v2)
v0 = strdup(v2);
if (v0)
setlocale(0x6, "C");
gr_dbname();
syslog(0x3, "failed to unlock %s");
if (v0) {
setlocale(0x6, v0);
free(v0);
}
}
if (sgr_locked && !sgr_unlock()) {
v12 = sgr_dbname();
fprintf(stderr, gettext("%s: failed to unlock %s\n"));
v3 = setlocale(0x6, NULL);
v1 = 0;
if (v3)
v1 = strdup(v3);
if (v1)
setlocale(0x6, "C");
sgr_dbname();
syslog(0x3, "failed to unlock %s");
if (v1) {
setlocale(0x6, v1);
free(v1);
}
}
exit(a0);
}
|
static
_Bool
gl_linked_remove_at (gl_list_t list, size_t position)
{
size_t count = list->count;
gl_list_node_t removed_node;
if (!(position < count))
abort ();
if (position <= ((count - 1) / 2))
{
gl_list_node_t node;
gl_list_node_t after_removed;
node = &list->root;
for (; position > 0; position--)
node = node->next;
removed_node = node->next;
after_removed = node->next->next;
node->next = after_removed;
after_removed->prev = node;
}
else
{
gl_list_node_t node;
gl_list_node_t before_removed;
position = count - 1 - position;
node = &list->root;
for (; position > 0; position--)
node = node->prev;
removed_node = node->prev;
before_removed = node->prev->prev;
node->prev = before_removed;
before_removed->next = node;
}
list->count--;
if (list->base.dispose_fn !=
((void *)0)
)
list->base.dispose_fn (removed_node->value);
free (removed_node);
return
1
;
}
| long long gl_linked_remove_at(unsigned long long a0[9], unsigned long a1) {
unsigned long v0;
unsigned long long v1[3];
unsigned long long *v2[3];
struct_0 *v3;
unsigned long v4;
unsigned long long *v5;
struct_2 *v6;
v0 = a1;
v4 = a0[8];
if (v0 >= v4)
abort();
if (v0 > v4 - 1 >> 1) {
v0 = v4 - v0 - 1;
for (v3 = &a0[5]; v0; v0 -= 1) {
v3 = &v3->field_8->field_0;
}
v1[0] = v3->field_8;
v5 = v3->field_8->field_8;
v3->field_8 = &v5;
*(v5) = v3;
} else {
for (v2 = &a0[5]; v0; v0 -= 1) {
v2 = &(*(v2))[0];
}
v1[0] = *(v2);
v6 = (*(v2))[0];
*(v2) = &v6;
v6->field_8 = v2;
}
a0[8] = a0[8] - 1;
if (a0[3])
a0[3](v1[2]);
free(v1);
return 1;
}
|
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_eatbnl();
else
v1 = pgetc();
return v1;
}
|
static void
close_listen_socks(void)
{
int i;
for (i = 0; i < num_listen_socks; i++)
close(listen_socks[i]);
num_listen_socks = 0;
}
| long close_listen_socks()
{
long result;
int i;
for ( i = 0; ; ++i )
{
result = (unsigned int)num_listen_socks;
if ( i >= num_listen_socks )
break;
close(listen_socks[i]);
}
num_listen_socks = 0;
return result;
}
|
static void grp_update (void)
{
add_cleanup (cleanup_report_del_group_group, group_name);
if (is_shadow_grp) {
add_cleanup (cleanup_report_del_group_gshadow, group_name);
}
if (gr_remove (group_name) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot remove entry '%s' from %s\n"),
Prog, group_name, gr_dbname ());
exit (10);
}
if (is_shadow_grp && (sgr_locate (group_name) !=
((void *)0)
)) {
if (sgr_remove (group_name) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot remove entry '%s' from %s\n"),
Prog, group_name, sgr_dbname ());
exit (10);
}
}
}
| long long grp_update() {
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
add_cleanup(got.cleanup_report_del_group_group, group_name);
if (is_shadow_grp)
add_cleanup(got.cleanup_report_del_group_gshadow, group_name);
if (!gr_remove(group_name)) {
v2 = gr_dbname();
fprintf(*(&stderr), gettext("%s: cannot remove entry '%s' from %s\n"));
exit(0xa);
}
v1 = is_shadow_grp;
if (is_shadow_grp) {
v1 = sgr_locate(group_name);
if (v1) {
v1 = sgr_remove(group_name);
if (!v1) {
v3 = sgr_dbname();
fprintf(*(&stderr), gettext("%s: cannot remove entry '%s' from %s\n"));
exit(0xa);
}
}
}
return v1;
}
|
static
_Bool
get_funky_string (char **dest, const char **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;
const char *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_400835;
v2 = 5;
break;
}
}
}
}
LABEL_400835:
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_400920;
if (!(*(v4) <= 120))
goto LABEL_400920;
if (*(v4) < 48)
goto LABEL_400920;
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_400920:
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_4009b1:
continue;
}
v7 = v5;
v5 += 1;
*(v7) = v1;
v3 += 1;
v2 = 0;
goto LABEL_4009b1;
case 3:
if (*(v4) <= 102) {
if (*(v4) >= 97) {
tmp_43 = v4;
v4 += 1;
v7 = *(tmp_43) + (v1 * 16) - 87;
v1 = v7;
goto LABEL_400a69;
}
if (*(v4) <= 57) {
if (*(v4) >= 48) {
tmp_43 = v4;
v4 += 1;
v7 = *(tmp_43) + (v1 * 16) - 48;
v1 = v7;
goto LABEL_400a69;
}
} else {
if (*(v4) - 65 <= 5) {
tmp_43 = v4;
v4 += 1;
v7 = *(tmp_43) + (v1 * 16) - 55;
v1 = v7;
goto LABEL_400a69;
}
}
}
v7 = v5;
v5 += 1;
*(v7) = v1;
v3 += 1;
v2 = 0;
LABEL_400a69:
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_400ad9;
}
if (*(v4) != 63) {
v2 = 6;
} else {
v7 = v5;
v5 += 1;
*(v7) = 127;
v3 += 1;
continue;
}
LABEL_400ad9:
continue;
default:
abort();
}
}
}
|
static void
parse_grep_colors (void)
{
const char *p;
char *q;
char *name;
char *val;
p = getenv ("GREP_COLORS");
if (p ==
((void *)0)
|| *p == '\0')
return;
q = xstrdup (p);
name = q;
val =
((void *)0)
;
for (;;)
if (*q == ':' || *q == '\0')
{
char c = *q;
struct color_cap const *cap;
*q++ = '\0';
for (cap = color_dict; cap->name; cap++)
if ((strcmp (cap->name, name) == 0))
break;
if (cap->var && val)
*(cap->var) = val;
if (cap->fct)
cap->fct ();
if (c == '\0')
return;
name = q;
val =
((void *)0)
;
}
else if (*q == '=')
{
if (q == name || val)
return;
*q++ = '\0';
val = q;
}
else if (val ==
((void *)0)
)
q++;
else if (*q == ';' || c_isdigit (*q))
q++;
else
return;
}
| long parse_grep_colors()
{
long result;
char *v1;
char *v2;
char v3;
char *v4;
char *s2;
char *i;
char **j;
long v8;
result = (long)getenv("GREP_COLORS");
v8 = result;
if ( result )
{
result = *(unsigned char *)result;
if ( (_BYTE)result )
{
v4 = (char *)xstrdup(v8);
s2 = v4;
for ( i = 0LL; ; i = 0LL )
{
while ( *v4 != 58 && *v4 )
{
if ( *v4 == 61 )
{
result = (long)v4;
if ( v4 == s2 || i )
return result;
v2 = v4++;
*v2 = 0;
i = v4;
}
else if ( i )
{
if ( *v4 != 59 )
{
result = c_isdigit((unsigned int)*v4);
if ( !(_BYTE)result )
return result;
}
++v4;
}
else
{
++v4;
}
}
v3 = *v4;
v1 = v4++;
*v1 = 0;
for ( j = color_dict; *j && strcmp(*j, s2); j += 3 )
;
if ( j[1] && i )
*(_QWORD *)j[1] = i;
result = (long)j[2];
if ( result )
result = ((long (*)(void))j[2])();
if ( !v3 )
break;
s2 = v4;
}
}
}
return result;
}
|
static int
bash_glob_completion_internal (what_to_do)
int what_to_do;
{
return bash_specific_completion (what_to_do, glob_complete_word);
}
| int bash_glob_completion_internal(unsigned long a0) {
return bash_specific_completion(a0, glob_complete_word);
}
|
static void
run_invoke_hooks(const char *action, struct invoke_list *hook_list)
{
struct invoke_hook *hook;
setenv("DPKG_HOOK_ACTION", action, 1);
for (hook = hook_list->head; hook; hook = hook->next) {
int status;
status = system(hook->command);
if (status != 0)
ohshit(gettext("error executing hook '%s', exit code %d"), hook->command,
status);
}
unsetenv("DPKG_HOOK_ACTION");
}
| void run_invoke_hooks(char *param_1,undefined8 *param_2)
{
undefined8 uVar1;
int iVar2;
undefined8 uVar3;
undefined8 *local_20;
setenv("DPKG_HOOK_ACTION",param_1,1);
for (local_20 = (undefined8 *)*param_2; local_20 != (undefined8 *)0x0;
local_20 = (undefined8 *)*local_20) {
iVar2 = system((char *)local_20[1]);
if (iVar2 != 0) {
uVar1 = local_20[1];
uVar3 = gettext("error executing hook \'%s\', exit code %d");
ohshit(uVar3,uVar1,iVar2);
}
}
unsetenv("DPKG_HOOK_ACTION");
return;
}
|
inline int
priv_set_remove_linkdir (void)
{
return -1;
}
| void priv_set_remove_linkdir(void)
{
halt_baddata();
}
|
static union node *
makename(void)
{
union node *n;
n = (union node *)stalloc(sizeof (struct narg));
n->type = 15;
n->narg.next =
((void *)0)
;
n->narg.text = wordtext;
n->narg.backquote = backquotelist;
return n;
}
| int makename() {
struct_0 *v0;
v0 = stalloc(0x20);
v0->field_0 = 15;
v0->field_8 = 0;
v0->field_10 = -556885833387505336;
v0->field_18 = -556885833387505336;
return v0;
}
|
static void
format_user_or_group (char const *name, uintmax_t id, int width)
{
if (name)
{
int width_gap = width - gnu_mbswidth (name, 0);
int pad =
(((
0
)>(
width_gap
))?(
0
):(
width_gap
))
;
dired_outstring (name);
do
dired_outbyte (' ');
while (pad--);
}
else
dired_pos += printf ("%*"
"l" "u"
" ", width, id);
}
| void format_user_or_group(long param_1,undefined8 param_2,uint param_3)
{
int iVar1;
bool bVar2;
int local_10;
if (param_1 == 0) {
iVar1 = printf("%*lu ",(ulong)param_3,param_2);
dired_pos = dired_pos + iVar1;
}
else {
iVar1 = gnu_mbswidth(param_1,0);
local_10 = 0;
if (-1 < (int)(param_3 - iVar1)) {
local_10 = param_3 - iVar1;
}
dired_outstring(param_1);
do {
dired_outbyte(0x20);
bVar2 = local_10 != 0;
local_10 = local_10 + -1;
} while (bVar2);
}
return;
}
|
static int
rsa_hash_alg_oid(int hash_alg, const u_char **oidp, size_t *oidlenp)
{
switch (hash_alg) {
case 1:
*oidp = id_sha1;
*oidlenp = sizeof(id_sha1);
break;
case 2:
*oidp = id_sha256;
*oidlenp = sizeof(id_sha256);
break;
case 4:
*oidp = id_sha512;
*oidlenp = sizeof(id_sha512);
break;
default:
return -10;
}
return 0;
}
| int rsa_hash_alg_oid(unsigned long a0, unsigned long long *a1, unsigned long long *a2) {
unsigned int v1;
if (a0 == 4) {
*(a1) = &id_sha512;
} else {
if (a0 > 4) {
v1 = -10;
return v1;
}
if (a0 == 1) {
*(a1) = &id_sha1;
*(a2) = 15;
v1 = 0;
return v1;
}
if (a0 != 2) {
v1 = -10;
return v1;
}
*(a1) = &id_sha256;
}
*(a2) = 19;
v1 = 0;
return v1;
}
|
int
parse_user_host_port(const char *s, char **userp, char **hostp, int *portp)
{
char *sdup, *cp, *tmp;
char *user =
((void *)0)
, *host =
((void *)0)
;
int port = -1, ret = -1;
if (userp !=
((void *)0)
)
*userp =
((void *)0)
;
if (hostp !=
((void *)0)
)
*hostp =
((void *)0)
;
if (portp !=
((void *)0)
)
*portp = -1;
if ((sdup = tmp = strdup(s)) ==
((void *)0)
)
return -1;
if ((cp = strrchr(tmp, '@')) !=
((void *)0)
) {
*cp = '\0';
if (*tmp == '\0')
goto out;
if ((user = strdup(tmp)) ==
((void *)0)
)
goto out;
tmp = cp + 1;
}
if ((cp = hpdelim(&tmp)) ==
((void *)0)
|| *cp == '\0')
goto out;
host = xstrdup(cleanhostname(cp));
if (tmp !=
((void *)0)
&& *tmp != '\0') {
if ((port = a2port(tmp)) <= 0)
goto out;
}
if (userp !=
((void *)0)
) {
*userp = user;
user =
((void *)0)
;
}
if (hostp !=
((void *)0)
) {
*hostp = host;
host =
((void *)0)
;
}
if (portp !=
((void *)0)
)
*portp = port;
ret = 0;
out:
free(sdup);
free(user);
free(host);
return ret;
}
| long long parse_user_host_port(char *a0, unsigned long long *a1, unsigned long long *a2, unsigned int *a3) {
unsigned int v0;
unsigned int v1;
char *v2;
void* v3;
void* v4;
char *v5;
char *v6;
unsigned long long v8;
v3 = 0;
v4 = 0;
v0 = -1;
v1 = -1;
if (a1)
*(a1) = 0;
if (a2)
*(a2) = 0;
if (a3)
*(a3) = -1;
v2 = strdup(a0);
v5 = v2;
if (!v5) {
v8 = 4294967295;
} else {
v6 = strrchr(v2, 0x40);
if (v6) {
*(v6) = 0;
if (*(v2)) {
v3 = strdup(v2);
if (v3)
v2 = v6 + 1;
}
}
if (!v6 || *(v2) && v3) {
v6 = hpdelim(&v2);
if (v6 && *(v6)) {
v4 = xstrdup(cleanhostname(v6));
if (v2 && *(v2))
v0 = a2port(v2);
if (!v2 || !*(v2) || v0 > 0) {
if (a1) {
*(a1) = v3;
v3 = 0;
}
if (a2) {
*(a2) = v4;
v4 = 0;
}
if (a3)
*(a3) = v0;
v1 = 0;
}
}
}
free(v5);
free(v3);
free(v4);
v8 = v1;
}
return v8;
}
|
void
print_context_header (struct file_data inf[], char const *const *names,
_Bool
unidiff)
{
if (unidiff)
{
print_context_label ("---", &inf[0], names[0], file_label[0]);
print_context_label ("+++", &inf[1], names[1], file_label[1]);
}
else
{
print_context_label ("***", &inf[0], names[0], file_label[0]);
print_context_label ("---", &inf[1], names[1], file_label[1]);
}
}
| long long print_context_header(void* a0, unsigned long long a1[2], unsigned long a2) {
unsigned long long v1;
if (!a2) {
print_context_label("***", a0, a1[0], *(&file_label));
v1 = print_context_label("---", a0 + 304, a1[1], *(&ignore_blank_lines));
return v1;
}
print_context_label("---", a0, a1[0], *(&file_label));
v1 = print_context_label("+++", a0 + 304, a1[1], *(&ignore_blank_lines));
return v1;
}
|
int print_addrlabel(struct nlmsghdr *n, void *arg)
{
struct ifaddrlblmsg *ifal = ((void *)(((char *)n) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))));
int len = n->nlmsg_len;
struct rtattr *tb[(__IFAL_MAX - 1)+1];
if (n->nlmsg_type != RTM_NEWADDRLABEL && n->nlmsg_type != RTM_DELADDRLABEL)
return 0;
len -= ((sizeof(*ifal)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) )));
if (len < 0)
return -1;
parse_rtattr(tb, (__IFAL_MAX - 1), ((struct rtattr *)(((char *)(ifal)) + ( ((sizeof(struct ifaddrlblmsg))+4U -1) & ~(4U -1) ))), len);
open_json_object(
((void *)0)
);
if (n->nlmsg_type == RTM_DELADDRLABEL)
print_bool(PRINT_ANY, "deleted", "Deleted ",
1
);
if (tb[IFAL_ADDRESS]) {
const char *host
= format_host(ifal->ifal_family, ((int)((tb[IFAL_ADDRESS])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), ((void*)(((char*)(tb[IFAL_ADDRESS])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))))
;
print_string(PRINT_FP,
((void *)0)
, "prefix ",
((void *)0)
);
print_color_string(PRINT_ANY,
ifa_family_color(ifal->ifal_family),
"address", "%s", host);
print_uint(PRINT_ANY, "prefixlen", "/%u ",
ifal->ifal_prefixlen);
}
if (ifal->ifal_index) {
print_string(PRINT_FP,
((void *)0)
, "dev ",
((void *)0)
);
print_color_string(PRINT_ANY, COLOR_IFNAME,
"ifname", "%s ",
ll_index_to_name(ifal->ifal_index));
}
if (tb[IFAL_LABEL] && ((int)((tb[IFAL_LABEL])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))) == sizeof(uint32_t)) {
uint32_t label = rta_getattr_u32(tb[IFAL_LABEL]);
print_uint(PRINT_ANY,
"label", "label %u ", label);
}
print_string(PRINT_FP,
((void *)0)
, "\n", "");
close_json_object();
return 0;
}
| undefined8
print_addrlabel(int *param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4,
undefined8 param_5,undefined8 param_6)
{
undefined4 uVar1;
undefined8 uVar2;
long in_FS_OFFSET;
undefined local_28 [8];
ushort *local_20;
short *local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if ((*(short *)(param_1 + 1) == 0x48) || (*(short *)(param_1 + 1) == 0x49)) {
if (*param_1 + -0x1c < 0) {
uVar2 = 0xffffffff;
}
else {
parse_rtattr(local_28,2,param_1 + 7,*param_1 + -0x1c,param_5,param_6,param_2);
open_json_object(0);
if (*(short *)(param_1 + 1) == 0x49) {
print_bool(4,"deleted","Deleted ",1);
}
if (local_20 != (ushort *)0x0) {
uVar2 = format_host(*(undefined *)(param_1 + 4),*local_20 - 4,local_20 + 2);
print_string(1,0,"prefix ",0);
uVar1 = ifa_family_color(*(undefined *)(param_1 + 4));
print_color_string(4,uVar1,"address",&DAT_00100b82,uVar2);
print_uint(4,"prefixlen",&DAT_00100b8d,*(undefined *)((long)param_1 + 0x12));
}
if (param_1[5] != 0) {
print_string(1,0,&DAT_00100b9c,0);
uVar2 = ll_index_to_name(param_1[5]);
print_color_string(4,0,"ifname",&DAT_00100ba1,uVar2);
}
if ((local_18 != (short *)0x0) && (*local_18 == 8)) {
uVar1 = rta_getattr_u32(local_18);
print_uint(4,"label","label %u ",uVar1);
}
print_string(1,0,&DAT_00100bbd,&DAT_00100bbc);
close_json_object();
uVar2 = 0;
}
}
else {
uVar2 = 0;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
}
|
static struct var **
hashvar(const char *p)
{
unsigned int hashval;
hashval = ((unsigned char) *p) << 4;
while (*p && *p != '=')
hashval += (unsigned char) *p++;
return &vartab[hashval % 39];
}
| char * hashvar(unsigned char *a1)
{
unsigned char *v1;
unsigned char *v3;
unsigned int v4;
v3 = a1;
v4 = 16 * *a1;
while ( *v3 && *v3 != 61 )
{
v1 = v3++;
v4 += *v1;
}
return (char *)&vartab + 8 * (v4 % 0x27);
}
|
static void
mp_factor (mpz_t t, struct mp_factors *factors)
{
mp_factor_init (factors);
if (
((
t
)->_mp_size < 0 ? -1 : (
t
)->_mp_size > 0)
!= 0)
{
mp_factor_using_division (t, factors);
if (
(__builtin_constant_p (
1
) && (
1
) == 0 ? ((
t
)->_mp_size < 0 ? -1 : (
t
)->_mp_size > 0) : __gmpz_cmp_ui (
t
,
1
))
!= 0)
{
do { if (dev_debug) fprintf (
stderr
, "[is number prime?] "); } while (0);
if (mp_prime_p (t))
mp_factor_insert (factors, t);
else
mp_factor_using_pollard_rho (t, 1, factors);
}
}
}
| long long mp_factor(struct_0 *a0, unsigned long a1) {
unsigned long long v1;
unsigned long long v2;
mp_factor_init(a1);
if (a0->field_4 >= 0) {
v1 = a0->field_4;
if (a0->field_4 <= 0)
goto LABEL_404654;
}
mp_factor_using_division(a0, a1);
v1 = __gmpz_cmp_ui(a0, 0x1, v2);
if (v1) {
if (dev_debug)
fprintf(stderr, "[is number prime?] ");
if (!mp_prime_p(a0, a1, v2))
v1 = mp_factor_using_pollard_rho(a0, 1, a1);
else
v1 = mp_factor_insert(a1, a0);
}
LABEL_404654:
return v1;
}
|
COMMAND *
make_for_command (name, map_list, action, lineno)
WORD_DESC *name;
WORD_LIST *map_list;
COMMAND *action;
int lineno;
{
return (make_for_or_select (cm_for, name, map_list, action, lineno));
}
| long long make_for_command(unsigned int a0, unsigned int a1, unsigned int a2, unsigned long a3) {
return make_for_or_select(0x0, a0, a1, a2, a3);
}
|
static int index_insert(struct index_node *node, const char *key,
const char *value, unsigned int priority)
{
int i = 0;
int ch;
index__checkstring(key);
index__checkstring(value);
while(1) {
int j;
for (j = 0; node->prefix[j]; j++) {
ch = node->prefix[j];
if (ch != key[i+j]) {
char *prefix = node->prefix;
struct index_node *n;
n = (calloc(sizeof(struct index_node), 1));
memcpy(n, node, sizeof(struct index_node));
n->prefix = (strdup(&prefix[j+1]));
memset(node, 0, sizeof(struct index_node));
prefix[j] = '\0';
node->prefix = prefix;
node->first = ch;
node->last = ch;
node->children[ch] = n;
break;
}
}
i += j;
ch = key[i];
if(ch == '\0')
return index_add_value(&node->values, value, priority);
if (!node->children[ch]) {
struct index_node *child;
if (ch < node->first)
node->first = ch;
if (ch > node->last)
node->last = ch;
node->children[ch] = (calloc(sizeof(struct index_node), 1));
child = node->children[ch];
child->prefix = (strdup(&key[i+1]));
child->first = 128;
index_add_value(&child->values, value, priority);
return 0;
}
node = node->children[ch];
i++;
}
}
| int index_insert(void* a0, char *a1, void* a2, unsigned long a3) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
char *v4;
unsigned long long *v5;
struct_2 *v6;
unsigned int v8;
v0 = a0;
v1 = 0;
index__checkstring(a1);
index__checkstring(a2);
while (true) {
for (v2 = 0; *((v2 + v0->field_0)); v2 += 1) {
v3 = *((v2 + v0->field_0));
if (v3 != a1[v1 + v2]) {
v4 = v0->field_0;
v5 = calloc(0x418, 0x1);
memcpy(v5, v0, 0x418);
*(v5) = strdup(&v4[1 + v2]);
memset(v0, 0x0, 0x418);
v4[v2] = 0;
v0->field_0 = v4;
v0->field_10 = v3;
v0->field_11 = v3;
*((&(&v0[1].field_0)[v3] + 6)) = v5;
break;
}
}
v1 += v2;
v3 = a1[v1];
if (!v3) {
v8 = index_add_value(&v0->padding_8, a2, a3);
break;
} else if (!*((&(&v0[1].field_0)[v3] + 6))) {
if (v3 < v0->field_10)
v0->field_10 = v3;
if (v3 > v0->field_11)
v0->field_11 = v3;
*((&(&v0[1].field_0)[v3] + 6)) = calloc(0x418, 0x1);
v6 = *((&(&v0[1].field_0)[v3] + 6));
v6->field_0 = strdup(&a1[1 + v1]);
v6->field_10 = 128;
index_add_value(&v6->padding_8, a2, a3);
v8 = 0;
break;
} else {
v0 = *((&(&v0[1].field_0)[v3] + 6));
v1 += 1;
}
}
return v8;
}
|
void
process_permitopen(struct ssh *ssh, ServerOptions *options)
{
process_permitopen_list(ssh, sPermitOpen,
options->permitted_opens, options->num_permitted_opens);
process_permitopen_list(ssh, sPermitListen,
options->permitted_listens,
options->num_permitted_listens);
}
| long long process_permitopen(unsigned long long a0, struct_0 *a1) {
process_permitopen_list(a0, 0x42, a1->field_1e20, a1->field_1e28);
return process_permitopen_list(a0, 0x43, a1->field_1e30, a1->field_1e38);
}
|
static void
maketagdumpdir (struct directory *directory)
{
size_t len = strlen (directory->tagfile) + 1;
char *new_dump = xmalloc (len + 2);
new_dump[0] = 'Y';
memcpy (new_dump + 1, directory->tagfile, len);
new_dump[len + 1] = 0;
directory->idump = directory->dump;
directory->dump = dumpdir_create0 (new_dump,
((void *)0)
);
free (new_dump);
}
| void maketagdumpdir(unsigned long long a0[10]) {
unsigned int v0;
char *v1;
unsigned long long v3;
*(&v0) = strlen(a0[9]) + 1;
v1 = xmalloc(*(&v0) + 2);
*(v1) = 89;
memcpy(v1 + 1, a0[9], *(&v0));
v1[1 + *(&v0)] = 0;
a0[6] = a0[5];
a0[5] = dumpdir_create0(v1, NULL);
v3 = free(v1);
return;
}
|
&& ( (!is_shadow_grp)
|| (strcmp (grent->gr_passwd, "x") != 0))
) {
grent->gr_passwd = group_passwd;
}
| int strcmp(char *__s1,char *__s2)
{
halt_baddata();
}
|
static uInt longest_match(s, cur_match)
deflate_state *s;
IPos cur_match;
{
unsigned chain_length = s->max_chain_length;
register Bytef *scan = s->window + s->strstart;
register Bytef *match;
register int len;
int best_len = (int)s->prev_length;
int nice_match = s->nice_match;
IPos limit = s->strstart > (IPos)((s)->w_size-(258 +3 +1)) ?
s->strstart - (IPos)((s)->w_size-(258 +3 +1)) : 0;
Posf *prev = s->prev;
uInt wmask = s->w_mask;
register Bytef *strend = s->window + s->strstart + 258;
register Byte scan_end1 = scan[best_len - 1];
register Byte scan_end = scan[best_len];
;
if (s->prev_length >= s->good_match) {
chain_length >>= 2;
}
if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead;
;
do {
;
match = s->window + cur_match;
if (match[best_len] != scan_end ||
match[best_len - 1] != scan_end1 ||
*match != *scan ||
*++match != scan[1]) continue;
scan += 2, match++;
;
do {
} while (*++scan == *++match && *++scan == *++match &&
*++scan == *++match && *++scan == *++match &&
*++scan == *++match && *++scan == *++match &&
*++scan == *++match && *++scan == *++match &&
scan < strend);
;
len = 258 - (int)(strend - scan);
scan = strend - 258;
if (len > best_len) {
s->match_start = cur_match;
best_len = len;
if (len >= nice_match) break;
scan_end1 = scan[best_len - 1];
scan_end = scan[best_len];
}
} while ((cur_match = prev[cur_match & wmask]) > limit
&& --chain_length != 0);
if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
return s->lookahead;
}
| uint longest_match(long param_1,uint param_2)
{
char *pcVar1;
uint uVar2;
uint uVar3;
char *pcVar4;
char *pcVar6;
char cVar7;
char cVar8;
uint local_5c;
uint local_4c;
uint local_48;
uint local_44;
char *pcVar5;
local_4c = *(uint *)(param_1 + 0xbc);
pcVar5 = (char *)(*(long *)(param_1 + 0x60) + (ulong)*(uint *)(param_1 + 0xac));
local_48 = *(uint *)(param_1 + 0xb8);
local_44 = *(uint *)(param_1 + 0xd0);
if (*(int *)(param_1 + 0x50) - 0x106U < *(uint *)(param_1 + 0xac)) {
uVar2 = (*(int *)(param_1 + 0xac) - *(int *)(param_1 + 0x50)) + 0x106;
}
else {
uVar2 = 0;
}
pcVar1 = (char *)(*(long *)(param_1 + 0x60) + (ulong)*(uint *)(param_1 + 0xac) + 0x102);
cVar7 = pcVar5[(long)(int)local_48 + -1];
cVar8 = pcVar5[(int)local_48];
if (*(uint *)(param_1 + 0xcc) <= *(uint *)(param_1 + 0xb8)) {
local_4c = local_4c >> 2;
}
local_5c = param_2;
if (*(uint *)(param_1 + 0xb4) < local_44) {
local_44 = *(uint *)(param_1 + 0xb4);
}
do {
pcVar6 = (char *)(*(long *)(param_1 + 0x60) + (ulong)local_5c);
if ((((cVar8 == pcVar6[(int)local_48]) && (cVar7 == pcVar6[(long)(int)local_48 + -1])) &&
(*pcVar6 == *pcVar5)) && (pcVar6[1] == pcVar5[1])) {
pcVar6 = pcVar6 + 2;
pcVar5 = pcVar5 + 2;
while (((((pcVar4 = pcVar5 + 1, *pcVar4 == pcVar6[1] &&
(pcVar4 = pcVar5 + 2, *pcVar4 == pcVar6[2])) &&
((pcVar4 = pcVar5 + 3, *pcVar4 == pcVar6[3] &&
((pcVar4 = pcVar5 + 4, *pcVar4 == pcVar6[4] &&
(pcVar4 = pcVar5 + 5, *pcVar4 == pcVar6[5])))))) &&
(pcVar4 = pcVar5 + 6, *pcVar4 == pcVar6[6])) &&
(pcVar4 = pcVar5 + 7, *pcVar4 == pcVar6[7]))) {
pcVar4 = pcVar5 + 8;
pcVar6 = pcVar6 + 8;
if ((*pcVar4 != *pcVar6) || (pcVar5 = pcVar4, pcVar1 <= pcVar4)) break;
}
uVar3 = 0x102 - ((int)pcVar1 - (int)pcVar4);
pcVar5 = pcVar1 + -0x102;
if ((int)local_48 < (int)uVar3) {
*(uint *)(param_1 + 0xb0) = local_5c;
local_48 = uVar3;
if ((int)local_44 <= (int)uVar3) {
LAB_0010305d:
if (*(uint *)(param_1 + 0xb4) < local_48) {
local_48 = *(uint *)(param_1 + 0xb4);
}
return local_48;
}
cVar7 = pcVar5[(long)(int)uVar3 + -1];
cVar8 = pcVar5[(int)uVar3];
}
}
local_5c = (uint)*(ushort *)
(*(long *)(param_1 + 0x70) + (ulong)(local_5c & *(uint *)(param_1 + 0x58)) * 2
);
if ((local_5c <= uVar2) || (local_4c = local_4c - 1, local_4c == 0)) goto LAB_0010305d;
} while( true );
}
|
static char **
expand_seqterm (text, tlen)
char *text;
size_t tlen;
{
char *t, *lhs, *rhs;
int lhs_t, rhs_t, lhs_l, rhs_l, width;
intmax_t lhs_v, rhs_v, incr;
intmax_t tl, tr;
char **result, *ep, *oep;
t = strstr (text, "..");
if (t == 0)
return ((char **)
((void *)0)
);
lhs_l = t - text;
lhs = substring (text, 0, lhs_l);
rhs = substring (text, lhs_l + sizeof("..") - 1, tlen);
if (lhs[0] == 0 || rhs[0] == 0)
{
sh_xfree((lhs), "braces.c", 492);
sh_xfree((rhs), "braces.c", 493);
return ((char **)
((void *)0)
);
}
lhs_t = (legal_number (lhs, &tl)) ? 1 :
(((1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)lhs[0]
))] & (unsigned short int) _ISalpha)
) && lhs[1] == 0) ? 2 : 0);
ep = 0;
if ((1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)rhs[0]
))] & (unsigned short int) _ISdigit)
) || ((rhs[0] == '+' || rhs[0] == '-') && (1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)rhs[1]
))] & (unsigned short int) _ISdigit)
)))
{
rhs_t = 1;
(*__errno_location ())
= 0;
tr = strtoimax (rhs, &ep, 10);
if (
(*__errno_location ())
==
34
|| (ep && *ep != 0 && *ep != '.'))
rhs_t = 0;
}
else if ((1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)rhs[0]
))] & (unsigned short int) _ISalpha)
) && (rhs[1] == 0 || rhs[1] == '.'))
{
rhs_t = 2;
ep = rhs + 1;
}
else
{
rhs_t = 0;
ep = 0;
}
incr = 1;
if (rhs_t != 0)
{
oep = ep;
(*__errno_location ())
= 0;
if (ep && *ep == '.' && ep[1] == '.' && ep[2])
incr = strtoimax (ep + 2, &ep, 10);
if (*ep != 0 ||
(*__errno_location ())
==
34
)
rhs_t = 0;
tlen -= ep - oep;
}
if (lhs_t != rhs_t || lhs_t == 0 || rhs_t == 0)
{
sh_xfree((lhs), "braces.c", 538);
sh_xfree((rhs), "braces.c", 539);
return ((char **)
((void *)0)
);
}
if (lhs_t == 2)
{
lhs_v = (unsigned char)lhs[0];
rhs_v = (unsigned char)rhs[0];
width = 1;
}
else
{
lhs_v = tl;
rhs_v = tr;
rhs_l = tlen - lhs_l - sizeof ("..") + 1;
width = 0;
if (lhs_l > 1 && lhs[0] == '0')
width = lhs_l, lhs_t = 3;
if (lhs_l > 2 && lhs[0] == '-' && lhs[1] == '0')
width = lhs_l, lhs_t = 3;
if (rhs_l > 1 && rhs[0] == '0' && width < rhs_l)
width = rhs_l, lhs_t = 3;
if (rhs_l > 2 && rhs[0] == '-' && rhs[1] == '0' && width < rhs_l)
width = rhs_l, lhs_t = 3;
if (width < lhs_l && lhs_t == 3)
width = lhs_l;
if (width < rhs_l && lhs_t == 3)
width = rhs_l;
}
result = mkseq (lhs_v, rhs_v, incr, lhs_t, width);
sh_xfree((lhs), "braces.c", 578);
sh_xfree((rhs), "braces.c", 579);
return (result);
}
| long expand_seqterm(const char *a1, unsigned int a2)
{
int v3;
long v4;
unsigned int v5;
int v6;
int v7;
int v8;
int v9;
int v10;
long v11;
char *endptr;
long v13;
long v14;
long v15;
intmax_t v16;
char *v17;
unsigned char *v18;
char *nptr;
char *v20;
long v21;
unsigned long v22;
v5 = a2;
v22 = __readfsqword(0x28u);
v17 = strstr(a1, "..");
if ( !v17 )
return 0LL;
v9 = (_DWORD)v17 - (_DWORD)a1;
v18 = (unsigned char *)substring(a1, 0LL, (unsigned int)((_DWORD)v17 - (_DWORD)a1));
nptr = (char *)substring(a1, (unsigned int)((_DWORD)v17 - (_DWORD)a1 + 2), a2);
if ( *v18 && *nptr )
{
if ( (unsigned int)legal_number(v18, &v11) )
{
v3 = 1;
}
else if ( ((*_ctype_b_loc())[*v18] & 0x400) == 0 || v18[1] )
{
v3 = 0;
}
else
{
v3 = 2;
}
v6 = v3;
endptr = 0LL;
if ( ((*_ctype_b_loc())[(unsigned char)*nptr] & 0x800) != 0
|| (*nptr == 43 || *nptr == 45) && ((*_ctype_b_loc())[(unsigned char)nptr[1]] & 0x800) != 0 )
{
v7 = 1;
*_errno_location() = 0;
v16 = strtoimax(nptr, &endptr, 10);
if ( *_errno_location() == 34 || endptr && *endptr && *endptr != 46 )
v7 = 0;
}
else if ( ((*_ctype_b_loc())[(unsigned char)*nptr] & 0x400) != 0 && (!nptr[1] || nptr[1] == 46) )
{
v7 = 2;
endptr = nptr + 1;
}
else
{
v7 = 0;
endptr = 0LL;
}
v15 = 1LL;
if ( v7 )
{
v20 = endptr;
*_errno_location() = 0;
if ( endptr && *endptr == 46 && endptr[1] == 46 && endptr[2] )
v15 = strtoimax(endptr + 2, &endptr, 10);
if ( *endptr || *_errno_location() == 34 )
v7 = 0;
v5 = a2 - ((_DWORD)endptr - (_DWORD)v20);
}
if ( v6 == v7 && v6 && v7 )
{
if ( v6 == 2 )
{
v13 = *v18;
v14 = (unsigned char)*nptr;
v4 = mkseq(v13, v14, v15, 2, 1);
}
else
{
v13 = v11;
v14 = v16;
v10 = v5 - v9 - 2;
v8 = 0;
if ( v9 > 1 && *v18 == 48 )
{
v8 = v9;
v6 = 3;
}
if ( v9 > 2 && *v18 == 45 && v18[1] == 48 )
{
v8 = v9;
v6 = 3;
}
if ( v10 > 1 && *nptr == 48 && v8 < v10 )
{
v8 = v5 - v9 - 2;
v6 = 3;
}
if ( v10 > 2 && *nptr == 45 && nptr[1] == 48 && v8 < v10 )
{
v8 = v5 - v9 - 2;
v6 = 3;
}
if ( v8 < v9 && v6 == 3 )
v8 = v9;
if ( v8 < v10 && v6 == 3 )
v8 = v5 - v9 - 2;
v4 = mkseq(v13, v14, v15, v6, v8);
}
v21 = v4;
sh_xfree(v18, "braces.c", 578LL);
sh_xfree(nptr, "braces.c", 579LL);
return v21;
}
else
{
sh_xfree(v18, "braces.c", 538LL);
sh_xfree(nptr, "braces.c", 539LL);
return 0LL;
}
}
else
{
sh_xfree(v18, "braces.c", 492LL);
sh_xfree(nptr, "braces.c", 493LL);
return 0LL;
}
}
|
int
ssh_packet_process_incoming(struct ssh *ssh, const char *buf, u_int len)
{
struct session_state *state = ssh->state;
int r;
if (state->packet_discard) {
state->keep_alive_timeouts = 0;
if (len >= state->packet_discard) {
if ((r = ssh_packet_stop_discard(ssh)) != 0)
return r;
}
state->packet_discard -= len;
return 0;
}
if ((r = sshbuf_put(state->input, buf, len)) != 0)
return r;
return 0;
}
| int ssh_packet_process_incoming(unsigned long long *a0, unsigned long long a1, unsigned long a2) {
unsigned int v0;
struct_0 *v1;
unsigned int v3;
v1 = *(a0);
if (!v1->field_1c4) {
v0 = sshbuf_put(v1->field_20, a1, a2, a1);
if (!v0)
v3 = 0;
else
v3 = v0;
} else {
v1->field_14c = 0;
if (a2 >= v1->field_1c4) {
v0 = ssh_packet_stop_discard(a0);
if (v0) {
v3 = v0;
goto LABEL_40445e;
}
}
v1->field_1c4 = v1->field_1c4 - a2;
v3 = 0;
}
LABEL_40445e:
return v3;
}
|
static inline
_Bool
ignorable_ctx_err (int err)
{
return err ==
95
|| err ==
61
;
}
| int ignorable_ctx_err(unsigned long a0) {
unsigned int v1;
unsigned int v2;
switch (a0) {
case 61: case 95:
v1 = 1;
break;
default:
v1 = 0;
break;
}
v2 = v1 & 1;
return v2;
}
|
static
void my_re_exec(void)
{
CHILD *ch;
sigset_t mask, oldset;
pid_t pid;
char **env;
int fd;
if (strchr("S0123456",runlevel) ==
((void *)0)
)
return;
alarm(0);
sigfillset(&mask);
sigprocmask(
0
, &mask, &oldset);
if ((fd = make_pipe(11)) < 0) {
sigprocmask(
2
, &oldset,
((void *)0)
);
initlog(1, "Attempt to re-exec failed");
}
fail_cancel();
if (pipe_fd >= 0)
close(pipe_fd);
pipe_fd = -1;
((got_signals) &= ~(1 << (
17
)));
((got_signals) &= ~(1 << (
1
)));
((got_signals) &= ~(1 << (
10
)));
((got_signals) &= ~(1 << (
12
)));
for(ch = family; ch; ch = ch->next)
if (ch->flags & 64) {
;
ch->flags &= ~(2|64|32);
if (ch->process[0] != '+')
write_utmp_wtmp("", ch->id, ch->pid,
8
,
((void *)0)
);
}
if ((pid = fork()) == 0) {
send_state(fd);
exit(0);
}
env = init_buildenv(0);
execle(myname, myname, "--init",
((void *)0)
, env);
init_freeenv(env);
close(fd);
close(11);
sigprocmask(
2
, &oldset,
((void *)0)
);
initlog(1, "Attempt to re-exec failed");
}
| void my_re_exec(unsigned long a0, unsigned int a1, unsigned long a2, unsigned int a3, unsigned int a4, unsigned int a5) {
unsigned int v0;
int tmp_43;
int tmp_48;
unsigned int v1;
struct_0 *v2;
unsigned long long *v3;
char v4;
char v5;
char v6;
unsigned long v8;
unsigned long v9;
unsigned long long *v10;
unsigned long long v11;
if (strchr("S0123456", runlevel)) {
alarm(0x0);
sigfillset(&v4);
sigprocmask(0x0, &v4, &v5);
v0 = make_pipe(0xb, &v4, &v5, a3, a4, a5);
if (v0 < 0) {
sigprocmask(0x2, &v5, NULL);
initlog(0x1, "Attempt to re-exec failed", 0x0, a3, a4, a5);
}
fail_cancel();
if (pipe_fd >= 0)
close(pipe_fd);
pipe_fd = -1;
oops_error = 955024200;
oops_error = 955024200;
v8 = 874961156424106824;
*(&v8) = 131;
tmp_43 = v8;
oops_error = tmp_43;
v9 = 874961156424106824;
*(&v9) = 131;
tmp_48 = v9;
oops_error = tmp_48;
for (v2 = family; v2; v2 = v2->field_c0) {
if ((v2->field_0 & 64)) {
v2->field_0 = v2->field_0 & -99;
if (v2->field_34 != 43)
write_utmp_wtmp(&g_407481, &v2->padding_c[16], v2->field_8, 0x8, 0x0);
}
}
v1 = fork();
if (!v1) {
send_state(v0);
exit(0x0);
}
v3 = init_buildenv(0x0, a1, a2, 0x8, 0x0, a5);
execle(myname, myname);
init_freeenv(v3);
close(v0);
close(0xb);
sigprocmask(0x2, &v5, NULL);
initlog(0x1, "Attempt to re-exec failed", 0x0, 0x8, 0x0, a5);
}
v11 = *(&v6) ^ v10[5];
return;
}
|
static char *
read_diff (char const *filea,
char const *fileb,
char **output_placement)
{
char *diff_result;
size_t current_chunk_size, total;
int fd, wstatus, status;
int werrno = 0;
struct stat pipestat;
char const *argv[9];
char const **ap;
int fds[2];
pid_t pid;
ap = argv;
*ap++ = diff_program;
if (text)
*ap++ = "-a";
if (strip_trailing_cr)
*ap++ = "--strip-trailing-cr";
*ap++ = "--horizon-lines=100";
*ap++ = "--";
*ap++ = filea;
*ap++ = fileb;
*ap = 0;
if (pipe (fds) != 0)
perror_with_exit ("pipe");
pid = fork ();
if (pid == 0)
{
close (fds[0]);
if (fds[1] !=
1
)
{
dup2 (fds[1],
1
);
close (fds[1]);
}
execvp (diff_program, (char **) argv);
_exit (
(*__errno_location ())
==
2
? 127 : 126);
}
if (pid == -1)
perror_with_exit ("fork");
close (fds[1]);
fd = fds[0];
if (fstat (fd, &pipestat) != 0)
perror_with_exit ("fstat");
current_chunk_size = ((1) >= (((pipestat).st_blksize)) ? (1) : (((pipestat).st_blksize)));
diff_result = xmalloc (current_chunk_size);
total = 0;
for (;;)
{
size_t bytes_to_read = current_chunk_size - total;
size_t bytes = block_read (fd, diff_result + total, bytes_to_read);
total += bytes;
if (bytes != bytes_to_read)
{
if (bytes ==
(18446744073709551615UL)
)
perror_with_exit (gettext ("read failed"));
break;
}
if (
(9223372036854775807L)
/ 2 <= current_chunk_size)
xalloc_die ();
current_chunk_size *= 2;
diff_result = xrealloc (diff_result, current_chunk_size);
}
if (total != 0 && diff_result[total-1] != '\n')
fatal ("invalid diff format; incomplete last line");
*output_placement = diff_result;
if (close (fd) != 0)
perror_with_exit ("close");
if (waitpid (pid, &wstatus, 0) < 0)
perror_with_exit ("waitpid");
status = ! werrno &&
(((
wstatus
) & 0x7f) == 0)
?
(((
wstatus
) & 0xff00) >> 8)
: 0x7fffffff;
if (2 <= status)
((!!sizeof (struct { _Static_assert (2, "verify_expr (" "2" ", " "(error (2, werrno, gettext (status == 126 ? \"subsidiary program '%s' could not be invoked\" : status == 127 ? \"subsidiary program '%s' not found\" : status == 0x7fffffff ? \"subsidiary program '%s' failed\" : \"subsidiary program '%s' failed (exit status %d)\"), diff_program, status), assume (false))" ")"); int _gl_dummy; })) ? ((error (2, werrno, gettext (status == 126 ? "subsidiary program '%s' could not be invoked" : status == 127 ? "subsidiary program '%s' not found" : status == 0x7fffffff ? "subsidiary program '%s' failed" : "subsidiary program '%s' failed (exit status %d)"), diff_program, status), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (2, werrno, gettext (status == 126 ? "subsidiary program '%s' could not be invoked" : status == 127 ? "subsidiary program '%s' not found" : status == 0x7fffffff ? "subsidiary program '%s' failed" : "subsidiary program '%s' failed (exit status %d)"), diff_program, status), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
return diff_result + total;
}
| long read_diff(long a1, long a2, _QWORD *a3)
{
long *v3;
long *v4;
long *v5;
long *v6;
long *v7;
long *v8;
int v9;
__blksize_t st_blksize;
char *v11;
int v12;
char *v13;
const char *v14;
char *v15;
int stat_loc;
int errnum;
__pid_t pid;
int fd;
unsigned int v22;
long v23;
unsigned long v24;
long v25;
long *v26;
long v27;
long v28;
int pipedes[2];
char *argv;
long v31;
struct stat v32;
unsigned long v33;
v33 = __readfsqword(0x28u);
errnum = 0;
v26 = &v31;
argv = diff_program;
if ( text )
{
v3 = v26++;
*v3 = (long)"-a";
}
if ( strip_trailing_cr )
{
v4 = v26++;
*v4 = (long)"--strip-trailing-cr";
}
v5 = v26++;
*v5 = (long)"--horizon-lines=100";
v6 = v26++;
*v6 = (long)"--";
v7 = v26++;
*v7 = a1;
v8 = v26++;
*v8 = a2;
*v26 = 0LL;
if ( pipe(pipedes) )
perror_with_exit("pipe");
pid = fork();
if ( !pid )
{
close(pipedes[0]);
if ( pipedes[1] != 1 )
{
dup2(pipedes[1], 1);
close(pipedes[1]);
}
execvp(diff_program, &argv);
if ( *_errno_location() == 2 )
v9 = 127;
else
v9 = 126;
exit(v9);
}
if ( pid == -1 )
perror_with_exit("fork");
close(pipedes[1]);
fd = pipedes[0];
if ( fstat(pipedes[0], &v32) )
perror_with_exit("fstat");
st_blksize = v32.st_blksize;
if ( v32.st_blksize <= 0 )
st_blksize = 1LL;
v24 = st_blksize;
v23 = xmalloc(st_blksize);
v25 = 0LL;
while ( 1 )
{
v27 = v24 - v25;
v28 = block_read((unsigned int)fd, v23 + v25, v24 - v25);
v25 += v28;
if ( v28 != v27 )
break;
if ( v24 > 0x3FFFFFFFFFFFFFFELL )
xalloc_die();
v24 *= 2LL;
v23 = xrealloc(v23, v24);
}
if ( v28 == -1 )
{
v11 = gettext("read failed");
perror_with_exit(v11);
}
if ( v25 && *(_BYTE *)(v25 - 1 + v23) != 10 )
fatal("invalid diff format; incomplete last line");
*a3 = v23;
if ( close(fd) )
perror_with_exit("close");
if ( waitpid(pid, &stat_loc, 0) < 0 )
perror_with_exit("waitpid");
if ( errnum || (stat_loc & 0x7F) != 0 )
v12 = 0x7FFFFFFF;
else
v12 = BYTE1(stat_loc);
v22 = v12;
if ( v12 > 1 )
{
v13 = diff_program;
switch ( v22 )
{
case 0x7Eu:
v14 = "subsidiary program '%s' could not be invoked";
break;
case 0x7Fu:
v14 = "subsidiary program '%s' not found";
break;
case 0x7FFFFFFFu:
v14 = "subsidiary program '%s' failed";
break;
default:
v14 = "subsidiary program '%s' failed (exit status %d)";
break;
}
v15 = gettext(v14);
error(2, errnum, v15, v13, v22);
}
return v23 + v25;
}
|
static void build_tree(s, desc)
deflate_state *s;
tree_desc *desc;
{
ct_data *tree = desc->dyn_tree;
const ct_data *stree = desc->stat_desc->static_tree;
int elems = desc->stat_desc->elems;
int n, m;
int max_code = -1;
int node;
s->heap_len = 0, s->heap_max = (2*(256 +1+29)+1);
for (n = 0; n < elems; n++) {
if (tree[n].fc.freq != 0) {
s->heap[++(s->heap_len)] = max_code = n;
s->depth[n] = 0;
} else {
tree[n].dl.len = 0;
}
}
while (s->heap_len < 2) {
node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
tree[node].fc.freq = 1;
s->depth[node] = 0;
s->opt_len--; if (stree) s->static_len -= stree[node].dl.len;
}
desc->max_code = max_code;
for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
node = elems;
do {
{ n = s->heap[1]; s->heap[1] = s->heap[s->heap_len--]; pqdownheap(s, tree, 1); };
m = s->heap[1];
s->heap[--(s->heap_max)] = n;
s->heap[--(s->heap_max)] = m;
tree[node].fc.freq = tree[n].fc.freq + tree[m].fc.freq;
s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
s->depth[n] : s->depth[m]) + 1);
tree[n].dl.dad = tree[m].dl.dad = (ush)node;
s->heap[1] = node++;
pqdownheap(s, tree, 1);
} while (s->heap_len >= 2);
s->heap[--(s->heap_max)] = s->heap[1];
gen_bitlen(s, (tree_desc *)desc);
gen_codes ((ct_data *)tree, max_code, s->bl_count);
}
| unsigned long build_tree(long a1, long a2)
{
int v2;
long v3;
int v4;
char v5;
long v6;
int i;
int j;
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
long v17;
long v18;
v17 = *(_QWORD *)a2;
v18 = **(_QWORD **)(a2 + 16);
v15 = *(_DWORD *)(*(_QWORD *)(a2 + 16) + 20LL);
v12 = -1;
*(_DWORD *)(a1 + 5300) = 0;
*(_DWORD *)(a1 + 5304) = 573;
for ( i = 0; i < v15; ++i )
{
if ( *(_WORD *)(4LL * i + v17) )
{
v12 = i;
*(_DWORD *)(a1 + 4 * ((int)++*(_DWORD *)(a1 + 5300) + 752LL)) = i;
*(_BYTE *)(a1 + i + 5308) = 0;
}
else
{
*(_WORD *)(4LL * i + v17 + 2) = 0;
}
}
while ( *(int *)(a1 + 5300) <= 1 )
{
if ( v12 > 1 )
v2 = 0;
else
v2 = ++v12;
v3 = (int)++*(_DWORD *)(a1 + 5300) + 752LL;
*(_DWORD *)(a1 + 4 * v3) = v2;
v13 = *(_DWORD *)(a1 + 4 * v3);
*(_WORD *)(4LL * v13 + v17) = 1;
*(_BYTE *)(a1 + v13 + 5308) = 0;
--*(_QWORD *)(a1 + 5912);
if ( v18 )
*(_QWORD *)(a1 + 5920) -= *(unsigned short *)(4LL * v13 + v18 + 2);
}
*(_DWORD *)(a2 + 8) = v12;
for ( j = *(_DWORD *)(a1 + 5300) / 2; j > 0; --j )
pqdownheap(a1, v17, j);
v14 = v15;
do
{
v11 = *(_DWORD *)(a1 + 3012);
v4 = *(_DWORD *)(a1 + 5300);
*(_DWORD *)(a1 + 5300) = v4 - 1;
*(_DWORD *)(a1 + 3012) = *(_DWORD *)(a1 + 4 * (v4 + 752LL));
pqdownheap(a1, v17, 1);
v16 = *(_DWORD *)(a1 + 3012);
*(_DWORD *)(a1 + 4 * ((int)--*(_DWORD *)(a1 + 5304) + 752LL)) = v11;
*(_DWORD *)(a1 + 4 * ((int)--*(_DWORD *)(a1 + 5304) + 752LL)) = v16;
*(_WORD *)(4LL * v14 + v17) = *(_WORD *)(4LL * v11 + v17) + *(_WORD *)(4LL * v16 + v17);
if ( *(_BYTE *)(a1 + v11 + 5308) < *(_BYTE *)(a1 + v16 + 5308) )
v5 = *(_BYTE *)(a1 + v16 + 5308);
else
v5 = *(_BYTE *)(a1 + v11 + 5308);
*(_BYTE *)(a1 + v14 + 5308) = v5 + 1;
v6 = 4LL * v16 + v17;
*(_WORD *)(v6 + 2) = v14;
*(_WORD *)(4LL * v11 + v17 + 2) = *(_WORD *)(v6 + 2);
LODWORD(v6) = v14++;
*(_DWORD *)(a1 + 3012) = v6;
pqdownheap(a1, v17, 1);
}
while ( *(int *)(a1 + 5300) > 1 );
*(_DWORD *)(a1 + 4 * ((int)--*(_DWORD *)(a1 + 5304) + 752LL)) = *(_DWORD *)(a1 + 3012);
gen_bitlen(a1, (long *)a2);
return gen_codes(v17, v12, a1 + 2976);
}
|
void
oom_adjust_setup(void)
{
int i, value;
FILE *fp;
sshlog("port-linux.c", __func__, 266, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "%s", __func__);
for (i = 0; oom_adjust[i].path !=
((void *)0)
; i++) {
oom_adj_path = oom_adjust[i].path;
value = oom_adjust[i].value;
if ((fp = fopen(oom_adj_path, "r+")) !=
((void *)0)
) {
if (fscanf(fp, "%d", &oom_adj_save) != 1)
sshlog("port-linux.c", __func__, 272, 0, SYSLOG_LEVEL_VERBOSE,
((void *)0)
, "error reading %s: %s", oom_adj_path, strerror(
(*__errno_location ())
))
;
else {
rewind(fp);
if (fprintf(fp, "%d\n", value) <= 0)
sshlog("port-linux.c", __func__, 277, 0, SYSLOG_LEVEL_VERBOSE,
((void *)0)
, "error writing %s: %s", oom_adj_path, strerror(
(*__errno_location ())
))
;
else
sshlog("port-linux.c", __func__, 280, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Set %s from %d to %d", oom_adj_path, oom_adj_save, value)
;
}
fclose(fp);
return;
}
}
oom_adj_path =
((void *)0)
;
}
| void oom_adjust_setup(void)
{
uint uVar1;
int iVar2;
FILE *__stream;
int *piVar3;
char *pcVar4;
undefined8 uVar5;
int local_18;
sshlog("port-linux.c","oom_adjust_setup",0x10a,0,7,0,&DAT_00100409,"oom_adjust_setup");
local_18 = 0;
while( true ) {
if (*(long *)(lRam000000000010022c + (long)local_18 * 0x10) == 0) {
oom_adj_path = (char *)0x0;
return;
}
oom_adj_path = *(char **)(lRam0000000000100061 + (long)local_18 * 0x10);
uVar1 = *(uint *)(lRam000000000010007f + (long)local_18 * 0x10 + 8);
__stream = fopen(oom_adj_path,"r+");
if (__stream != (FILE *)0x0) break;
local_18 = __addvsi3(local_18,1);
}
iVar2 = __isoc99_fscanf(__stream,&DAT_0010040f,&oom_adj_save);
if (iVar2 == 1) {
rewind(__stream);
iVar2 = fprintf(__stream,"%d\n",(ulong)uVar1);
if (iVar2 < 1) {
piVar3 = __errno_location();
uVar5 = 0x100171;
pcVar4 = strerror(*piVar3);
sshlog("port-linux.c","oom_adjust_setup",0x115,0,4,0,"error writing %s: %s",oom_adj_path,
pcVar4,uVar5);
}
else {
sshlog("port-linux.c","oom_adjust_setup",0x118,0,5,0,"Set %s from %d to %d",oom_adj_path,
oom_adj_save,uVar1);
}
}
else {
piVar3 = __errno_location();
uVar5 = 0x1000ec;
pcVar4 = strerror(*piVar3);
sshlog("port-linux.c","oom_adjust_setup",0x110,0,4,0,"error reading %s: %s",oom_adj_path,pcVar4,
uVar5);
}
fclose(__stream);
return;
}
|
static struct name *
merge_sort_sll (struct name *list, int length,
int (*compare) (struct name const*, struct name const*))
{
struct name *first_list;
struct name *second_list;
int first_length;
int second_length;
struct name *result;
struct name **merge_point;
struct name *cursor;
int counter;
if (length == 1)
return list;
if (length == 2)
{
if ((*compare) (list, ((list)->next)) > 0)
{
result = ((list)->next);
((result)->next) = list;
((list)->next) = 0;
return result;
}
return list;
}
first_list = list;
first_length = (length + 1) / 2;
second_length = length / 2;
for (cursor = list, counter = first_length - 1;
counter;
cursor = ((cursor)->next), counter--)
continue;
second_list = ((cursor)->next);
((cursor)->next) = 0;
first_list = merge_sort_sll (first_list, first_length, compare);
second_list = merge_sort_sll (second_list, second_length, compare);
merge_point = &result;
while (first_list && second_list)
if ((*compare) (first_list, second_list) < 0)
{
cursor = ((first_list)->next);
*merge_point = first_list;
merge_point = &((first_list)->next);
first_list = cursor;
}
else
{
cursor = ((second_list)->next);
*merge_point = second_list;
merge_point = &((second_list)->next);
second_list = cursor;
}
if (first_list)
*merge_point = first_list;
else
*merge_point = second_list;
return result;
}
| undefined8 **** merge_sort_sll(undefined8 ****param_1,int param_2,code *param_3)
{
int iVar1;
long in_FS_OFFSET;
int local_44;
undefined8 ****local_38;
undefined8 ****local_30;
undefined8 ****local_28;
undefined8 ****local_20;
undefined8 ****local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (param_2 != 1) {
if (param_2 == 2) {
iVar1 = (*param_3)(param_1,*param_1);
if (0 < iVar1) {
local_38 = (undefined8 ****)*param_1;
*local_38 = param_1;
*param_1 = (undefined8 ***)0x0;
param_1 = local_38;
}
}
else {
iVar1 = (param_2 + 1) / 2;
local_18 = param_1;
local_44 = iVar1;
while (local_44 = local_44 + -1, local_44 != 0) {
local_18 = (undefined8 ****)*local_18;
}
local_28 = (undefined8 ****)*local_18;
*local_18 = (undefined8 ***)0x0;
local_30 = param_1;
local_30 = (undefined8 ****)merge_sort_sll(param_1,iVar1,param_3);
local_28 = (undefined8 ****)merge_sort_sll(local_28,param_2 / 2,param_3);
local_20 = &local_38;
while ((local_30 != (undefined8 ****)0x0 && (local_28 != (undefined8 ****)0x0))) {
iVar1 = (*param_3)(local_30,local_28);
if (iVar1 < 0) {
local_18 = (undefined8 ****)*local_30;
*local_20 = local_30;
local_20 = local_30;
local_30 = local_18;
}
else {
local_18 = (undefined8 ****)*local_28;
*local_20 = local_28;
local_20 = local_28;
local_28 = local_18;
}
}
if (local_30 == (undefined8 ****)0x0) {
*local_20 = local_28;
param_1 = local_38;
}
else {
*local_20 = local_30;
param_1 = local_38;
}
}
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return param_1;
}
__stack_chk_fail();
}
|
static void
finalise_cert_exts(void)
{
if (certflags_command !=
((void *)0)
)
cert_ext_add("force-command", certflags_command, 1);
if (certflags_src_addr !=
((void *)0)
)
cert_ext_add("source-address", certflags_src_addr, 1);
if ((certflags_flags & (1<<6)) != 0)
cert_ext_add("verify-required",
((void *)0)
, 1);
if ((certflags_flags & (1)) != 0)
cert_ext_add("permit-X11-forwarding",
((void *)0)
, 0);
if ((certflags_flags & (1<<1)) != 0)
cert_ext_add("permit-agent-forwarding",
((void *)0)
, 0);
if ((certflags_flags & (1<<2)) != 0)
cert_ext_add("permit-port-forwarding",
((void *)0)
, 0);
if ((certflags_flags & (1<<3)) != 0)
cert_ext_add("permit-pty",
((void *)0)
, 0);
if ((certflags_flags & (1<<4)) != 0)
cert_ext_add("permit-user-rc",
((void *)0)
, 0);
if ((certflags_flags & (1<<5)) != 0)
cert_ext_add("no-touch-required",
((void *)0)
, 0);
if (ncert_ext > 0)
qsort(cert_ext, ncert_ext, sizeof(*cert_ext), cert_ext_cmp);
}
| void finalise_cert_exts() {
unsigned long long v1;
unsigned long long v2;
if (certflags_command)
cert_ext_add("force-command", certflags_command, 0x1);
if (certflags_src_addr)
cert_ext_add("source-address", certflags_src_addr, 0x1);
if ((certflags_flags & 64))
cert_ext_add("verify-required", 0x0, 0x1);
if ((certflags_flags & 1))
cert_ext_add("permit-X11-forwarding", 0x0, 0x0);
if ((certflags_flags & 2))
cert_ext_add("permit-agent-forwarding", 0x0, 0x0);
if ((certflags_flags & 4))
cert_ext_add("permit-port-forwarding", 0x0, 0x0);
if ((certflags_flags & 8))
cert_ext_add("permit-pty", 0x0, 0x0);
if ((certflags_flags & 16))
cert_ext_add("permit-user-rc", 0x0, 0x0);
if ((certflags_flags & 32))
cert_ext_add("no-touch-required", 0x0, 0x0);
v1 = ncert_ext;
if (ncert_ext)
v2 = qsort(cert_ext, ncert_ext, 0x18, cert_ext_cmp);
return;
}
|
static char *
uidtostr_ptr (uid_t const *uid)
{
static char buf[((((((sizeof (uintmax_t) * 8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)];
return umaxtostr (*uid, buf);
}
| int uidtostr_ptr(unsigned int *a0) {
return umaxtostr(*(a0), &buf.6446);
}
|
hist_set(EditLine *el, hist_fun_t fun, void *ptr)
{
el->el_history.ref = ptr;
el->el_history.fun = fun;
return 0;
}
| long long hist_set(unsigned long long a0[145], unsigned long a1, unsigned long a2) {
a0[143] = a2;
a0[144] = a1;
return 0;
}
|
static const char *resolve_hostname (const char *string)
{
struct hostent *hp;
hp = gethostbyname (string);
if (
((void *)0)
!= hp) {
return inet_ntoa (*((struct in_addr *) *(hp->h_addr_list)));
}
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "%s - unknown host", string) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
return string;
}
| char * resolve_hostname(char *param_1)
{
hostent *phVar1;
char *__s;
char *local_20;
phVar1 = gethostbyname(param_1);
if (phVar1 == (hostent *)0x0) {
__s = setlocale(6,(char *)0x0);
local_20 = (char *)0x0;
if (__s != (char *)0x0) {
local_20 = strdup(__s);
}
if (local_20 != (char *)0x0) {
setlocale(6,"C");
}
syslog(3,"%s - unknown host",param_1);
if (local_20 != (char *)0x0) {
setlocale(6,local_20);
free(local_20);
}
}
else {
param_1 = inet_ntoa((in_addr)((in_addr *)*phVar1->h_addr_list)->s_addr);
}
return param_1;
}
|
static void
set_hhmmss (parser_control *pc, intmax_t hour, intmax_t minutes,
time_t sec, int nsec)
{
pc->hour = hour;
pc->minutes = minutes;
pc->seconds.tv_sec = sec;
pc->seconds.tv_nsec = nsec;
}
| void set_hhmmss(unsigned long long a0[13], unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4) {
char v0;
unsigned long long v2[13];
unsigned long long v3;
a0[9] = a1;
a0[10] = a2;
a0[11] = a3;
v2 = a0;
a0[12] = a4;
v3 = *(&v0);
return;
}
|
void
sv_histignore (name)
char *name;
{
setup_history_ignore (name);
}
| void sv_histignore(undefined8 param_1)
{
setup_history_ignore(param_1);
return;
}
|
static void
set_other_indent (
_Bool
same_paragraph)
{
if (split)
other_indent = first_indent;
else if (crown)
{
other_indent = (same_paragraph ? in_column : first_indent);
}
else if (tagged)
{
if (same_paragraph && in_column != first_indent)
{
other_indent = in_column;
}
else if (other_indent == first_indent)
other_indent = first_indent == 0 ? 3 : 0;
}
else
{
other_indent = first_indent;
}
}
| void set_other_indent(unsigned long a0) {
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
if (split) {
v1 = *(&first_indent);
other_indent = *(&first_indent);
} else if (crown) {
if (a0)
v3 = *(&in_column);
else
v3 = *(&first_indent);
other_indent = v3;
} else if (!tagged) {
v2 = *(&first_indent);
other_indent = *(&first_indent);
} else {
if (a0 && *(&in_column) != *(&first_indent)) {
v5 = *(&in_column);
other_indent = *(&in_column);
goto LABEL_400ba7;
}
v4 = *(&first_indent);
if (other_indent == *(&first_indent)) {
if (!*(&first_indent))
v6 = 3;
else
v6 = 0;
other_indent = v6;
}
}
LABEL_400ba7:
return;
}
|
int
sh_mbsnlen(src, srclen, maxlen)
const char *src;
size_t srclen;
int maxlen;
{
int count;
int sind;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
for (sind = count = 0; src[sind]; )
{
count++;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((src)[sind]); if (_f) mblength = 1; else if (locale_utf8locale && (((src)[sind] & 0x80) == 0)) mblength = (src)[sind] != 0; else { state_bak = state; mblength = mbrlen ((src) + (sind), (srclen) - (sind), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (sind)++; } else if (mblength == 0) (sind)++; else (sind) += mblength; } else (sind)++; } while (0);
if (sind > maxlen)
break;
}
return count;
}
| long long sh_mbsnlen(char *a0, unsigned long a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
memset(&v4, 0x0, 0x8);
v0 = 0;
v1 = v0;
while (a0[v1]) {
v0 += 1;
if (locale_mb_cur_max > 1) {
v2 = is_basic(a0[v1]);
if (v2) {
v3 = 1;
} else {
if (locale_utf8locale && a0[v1] >= 0)
v3 = a0[v1];
if (a0[v1] < 0 || !locale_utf8locale) {
v5 = v4;
v3 = mbrlen(&a0[v1], a1 - v1, &v4, &a0[v1]);
}
}
if (v3 != -2 && v3 != -1) {
if (!v3)
v1 += 1;
else
v1 += v3;
}
if (v3 == -2 || v3 == -1) {
v4 = v5;
v1 += 1;
}
} else {
v1 += 1;
}
if (v1 > a2)
break;
}
return v0;
}
|
void
init_mail_dates ()
{
if (mailfiles == 0)
remember_mail_dates ();
}
| unsigned long init_mail_dates()
{
unsigned long result;
result = mailfiles;
if ( !mailfiles )
return remember_mail_dates();
return result;
}
|
static int xfrm_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
unsigned int link = 0;
__u32 if_id = 0;
while (argc > 0) {
if (!matches(*argv, "dev")) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
link = ll_name_to_index(*argv);
if (!link)
exit(nodev(*argv));
} else if (!matches(*argv, "if_id")) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u32(&if_id, *argv, 0))
invarg("if_id value is invalid", *argv);
else if (!if_id)
invarg("if_id value is invalid", *argv);
else
addattr32(n, 1024, IFLA_XFRM_IF_ID, if_id);
} else {
xfrm_print_help(lu, argc, argv,
stderr
);
return -1;
}
argc--; argv++;
}
if (!if_id)
missarg("IF_ID");
if (link)
addattr32(n, 1024, IFLA_XFRM_LINK, link);
return 0;
}
| long long xfrm_parse_opt(unsigned int a0, unsigned long a1, unsigned int a2, unsigned long long a3) {
unsigned long long *v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long long v7;
v1 = a1;
*(&v0) = a2;
v3 = 0;
v2 = 0;
while (true) {
if (v1 <= 0) {
if (!v2)
missarg("IF_ID");
if (v3)
addattr32(a3, 0x400, 0x1, v3);
v7 = 0;
break;
} else {
if ((matches(*(v0), "dev") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
v3 = ll_name_to_index(*(v0));
if (!v3)
exit(nodev(*(v0)));
} else if ((matches(*(v0), "if_id") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v2, *(v0), 0x0, *(v0)))
invarg("if_id value is invalid", *(v0));
if (!v2)
invarg("if_id value is invalid", *(v0));
addattr32(a3, 0x400, 0x2, v2);
} else {
xfrm_print_help(a0, v1, v0, stderr);
v7 = 4294967295;
break;
}
v1 -= 1;
v0 += 1;
}
}
return v7;
}
|
static struct addrinfo *
resolve_addr(const char *name, int port, char *caddr, size_t clen)
{
char addr[
1025
], strport[
32
];
struct addrinfo hints, *res;
int gaierr;
if (port <= 0)
port = default_ssh_port();
snprintf(strport, sizeof strport, "%u", port);
memset(&hints, 0, sizeof(hints));
hints.ai_family = options.address_family == -1 ?
0
: options.address_family;
hints.ai_socktype =
SOCK_STREAM
;
hints.ai_flags =
0x0004
|
0x0400
;
if ((gaierr = getaddrinfo(name, strport, &hints, &res)) != 0) {
sshlog("ssh.c", __func__, 345, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "could not resolve name %.100s as address: %s", name, ssh_gai_strerror(gaierr))
;
return
((void *)0)
;
}
if (res ==
((void *)0)
) {
sshlog("ssh.c", __func__, 350, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "getaddrinfo %.100s returned no addresses", name);
return
((void *)0)
;
}
if (res->ai_next !=
((void *)0)
) {
sshlog("ssh.c", __func__, 354, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "getaddrinfo %.100s returned multiple addresses", name);
goto fail;
}
if ((gaierr = getnameinfo(res->ai_addr, res->ai_addrlen,
addr, sizeof(addr),
((void *)0)
, 0,
1
)) != 0) {
sshlog("ssh.c", __func__, 359, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Could not format address for name %.100s: %s", name, ssh_gai_strerror(gaierr))
;
goto fail;
}
if (strlcpy(caddr, addr, clen) >= clen) {
sshlog("ssh.c", __func__, 364, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "host \"%s\" addr \"%s\" too long (max %lu)", name, addr, (u_long)clen)
;
if (clen > 0)
*caddr = '\0';
fail:
freeaddrinfo(res);
return
((void *)0)
;
}
return res;
}
| int resolve_addr(unsigned long long a0, unsigned long a1, char *a2, unsigned long long a3) {
unsigned int v0;
unsigned int v1;
char v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
char v6;
char v7;
unsigned int v9;
v0 = a1;
if (v0 <= 0)
v0 = default_ssh_port();
snprintf(&v6, 0x20, "%u", v0);
memset(&v3, 0x0, 0x30);
if (false)
v9 = 0;
v9 = 8278818138817399553;
v4 = v9;
v5 = 1;
v3 = 1028;
v1 = getaddrinfo(a0, &v6, &v3, &v2);
if (v1) {
ssh_gai_strerror(v1);
sshlog("ssh.c", "resolve_addr", 0x159, 0x1, 0x6, 0x0, "could not resolve name %.100s as address: %s", a0);
v9 = 0;
} else if (!*(&v2)) {
sshlog("ssh.c", "resolve_addr", 0x15e, 0x1, 0x5, 0x0, "getaddrinfo %.100s returned no addresses", a0);
v9 = 0;
} else {
if (*((*(&v2) + 40))) {
sshlog("ssh.c", "resolve_addr", 0x162, 0x1, 0x5, 0x0, "getaddrinfo %.100s returned multiple addresses", a0);
} else {
v1 = getnameinfo(*((*(&v2) + 24)), *((*(&v2) + 16)), &v7, 0x401, 0x0, 0x0);
if (v1) {
ssh_gai_strerror(v1);
sshlog("ssh.c", "resolve_addr", 0x167, 0x1, 0x5, 0x0, "Could not format address for name %.100s: %s", a0);
} else {
v9 = strlcpy(a2, &v7, a3, &v7);
if (a3 <= v9) {
sshlog("ssh.c", "resolve_addr", 0x16c, 0x1, 0x2, 0x0, "host \"%s\" addr \"%s\" too long (max %lu)", a0);
if (a3)
*(a2) = 0;
} else {
v9 = *(&v2);
}
}
}
if (a3 <= v9 || v1 || *((*(&v2) + 40))) {
freeaddrinfo(*(&v2));
v9 = 0;
}
}
return v9;
}
|
static inline void
emit_ancillary_info (char const *program)
{
struct infomap { char const *program; char const *node; } const infomap[] = {
{ "[", "test invocation" },
{ "coreutils", "Multi-call invocation" },
{ "sha224sum", "sha2 utilities" },
{ "sha256sum", "sha2 utilities" },
{ "sha384sum", "sha2 utilities" },
{ "sha512sum", "sha2 utilities" },
{
((void *)0)
,
((void *)0)
}
};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && ! (strcmp (program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
}
| void emit_ancillary_info(char *param_1)
{
FILE *__stream;
int iVar1;
char *pcVar2;
char *pcVar3;
long in_FS_OFFSET;
char *local_b8;
char **local_b0;
char *local_98;
char *local_90;
char *local_88;
char *local_80;
char *local_78;
char *local_70;
char *local_68;
char *local_60;
char *local_58;
char *local_50;
char *local_48;
char *local_40;
undefined8 local_38;
undefined8 local_30;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_98 = "[";
local_90 = "test invocation";
local_88 = "coreutils";
local_80 = "Multi-call invocation";
local_78 = "sha224sum";
local_70 = "sha2 utilities";
local_68 = "sha256sum";
local_60 = "sha2 utilities";
local_58 = "sha384sum";
local_50 = "sha2 utilities";
local_48 = "sha512sum";
local_40 = "sha2 utilities";
local_38 = 0;
local_30 = 0;
local_b0 = &local_98;
while ((*local_b0 != (char *)0x0 && (iVar1 = strcmp(param_1,*local_b0), iVar1 != 0))) {
local_b0 = local_b0 + 2;
}
local_b8 = param_1;
if (local_b0[1] != (char *)0x0) {
local_b8 = local_b0[1];
}
pcVar2 = (char *)gettext("\n%s online help: <%s>\n");
printf(pcVar2,"GNU coreutils","https:
pcVar2 = setlocale(5,(char *)0x0);
if ((pcVar2 != (char *)0x0) && (iVar1 = strncmp(pcVar2,"en_",3), __stream = stdout, iVar1 != 0)) {
pcVar2 = (char *)gettext(
"Report any translation bugs to <https:
);
fputs_unlocked(pcVar2,__stream);
}
iVar1 = strcmp(param_1,"[");
pcVar2 = param_1;
if (iVar1 == 0) {
pcVar2 = "test";
}
pcVar3 = (char *)gettext("Full documentation <%s%s>\n");
printf(pcVar3,"https:
if (local_b8 == param_1) {
pcVar2 = " invocation";
}
else {
pcVar2 = "";
}
pcVar3 = (char *)gettext("or available locally via: info \'(coreutils) %s%s\'\n");
printf(pcVar3,local_b8,pcVar2);
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
}
|
static void
sigterm_handler(int sig)
{
received_sigterm = sig;
}
| long long sigterm_handler(unsigned long a0) {
received_sigterm = a0;
return a0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.