input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
static void
trigproc_enqueue_deferred(struct pkginfo *pend)
{
if (f_triggers < 0)
return;
ensure_package_clientdata(pend);
if (pend->clientdata->trigprocdeferred)
return;
pend->clientdata->trigprocdeferred = pkg_queue_push(&deferred, pend);
debug(dbg_triggers, "trigproc_enqueue_deferred pend=%s",
pkg_name(pend, pnaw_always));
}
| void trigproc_enqueue_deferred(long param_1)
{
long lVar1;
undefined8 uVar2;
if ((-1 < f_triggers) &&
(ensure_package_clientdata(param_1), *(long *)(*(long *)(param_1 + 0x138) + 0x18) == 0)) {
lVar1 = *(long *)(param_1 + 0x138);
uVar2 = pkg_queue_push(deferred,param_1);
*(undefined8 *)(lVar1 + 0x18) = uVar2;
uVar2 = pkg_name(param_1,3);
debug(0x1000,"trigproc_enqueue_deferred pend=%s",uVar2);
}
return;
}
|
static void
zaptemp (char const *name)
{
struct tempnode *volatile *pnode;
struct tempnode *node;
struct tempnode *next;
int unlink_status;
int unlink_errno = 0;
struct cs_status cs;
for (pnode = &temphead; (node = *pnode)->name != name; pnode = &node->next)
continue;
if (node->state == UNREAPED)
wait_proc (node->pid);
next = node->next;
cs_enter (&cs);
unlink_status = unlink (name);
unlink_errno =
(*__errno_location ())
;
*pnode = next;
cs_leave (&cs);
if (unlink_status != 0)
error (0, unlink_errno, gettext ("warning: cannot remove: %s"), quotearg_n_style_colon (0, shell_escape_quoting_style, name));
if (! next)
temptail = pnode;
free (node);
}
| void zaptemp(char *a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v2;
unsigned long long v3;
unsigned long v4;
char v5;
char v6;
unsigned long long v8;
unsigned long long *v9;
unsigned long long v10;
v0 = 0;
v2 = &temphead;
while (true) {
v3 = *(v2);
if (a0 == v3 + 13)
break;
v2 = v3;
}
if (*((v3 + 12)) == 1)
wait_proc(*((v3 + 8)));
v4 = *(v3);
cs_enter(&v5);
v1 = unlink(a0);
v0 = *(__errno_location());
*(v2) = v4;
cs_leave(&v5);
if (v1) {
v8 = quotearg_n_style_colon(0x0, 0x3, a0);
error(0x0, v0, gettext("warning: cannot remove: %s"));
}
if (!v4)
temptail = v2;
free(v3);
v10 = *(&v6) ^ v9[5];
return;
}
|
void crq_info(common_info_st *cinfo)
{
gnutls_x509_crq_t crq;
int ret;
size_t size;
gnutls_datum_t pem;
ret = gnutls_x509_crq_init(&crq);
if (ret < 0) {
fprintf(
stderr
, "crq_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
pem.data = (void *) _gnutls_fread_file(infile, 0, &size);
pem.size = size;
if (!pem.data) {
fprintf(
stderr
, "%s", infile ? "file" : "standard input");
app_exit(1);
}
ret = gnutls_x509_crq_import(crq, &pem, incert_format);
free(pem.data);
if (ret < 0) {
fprintf(
stderr
, "import error: %s\n", gnutls_strerror(ret));
app_exit(1);
}
print_crq_info(crq, outfile, cinfo);
gnutls_x509_crq_deinit(crq);
}
| void crq_info(unsigned long long a0) {
unsigned int v0;
char v1;
char v2;
void* v3;
unsigned int v4;
char v5;
unsigned int v7;
unsigned long long *v8;
unsigned long long v9;
v0 = gnutls_x509_crq_init(&v1);
if (v0 < 0) {
fprintf(*(&stderr), "crq_init: %s\n", gnutls_strerror(v0));
app_exit(0x1);
}
v3 = _gnutls_fread_file(infile, 0x0, &v2);
v4 = *(&v2);
if (!v3) {
if (!infile)
v7 = &g_40b4c4;
else
v7 = "file";
fprintf(*(&stderr), "%s", v7);
app_exit(0x1);
} else {
v0 = gnutls_x509_crq_import(*(&v1), &v3, incert_format, &v3);
free(v3);
if (v0 >= 0) {
print_crq_info(*(&v1), outfile, a0);
gnutls_x509_crq_deinit(*(&v1));
v9 = *(&v5) ^ v8[5];
return;
}
fprintf(*(&stderr), "import error: %s\n", gnutls_strerror(v0));
app_exit(0x1);
}
}
|
int
rl_forward (int count, int key)
{
return (rl_forward_char (count, key));
}
| long long rl_forward(unsigned long a0, unsigned long a1) {
return rl_forward_char(a0, a1);
}
|
static void update_shadow (void)
{
const struct spwd *sp;
struct spwd *nsp;
if (spw_lock () == 0) {
(void) fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, spw_dbname ());
exit (5);
}
spw_locked =
1
;
if (spw_open (
0100
|
02
) == 0) {
(void) fprintf (
stderr
,
gettext ("%s: cannot open %s\n"),
Prog, spw_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
4
, "cannot open %s", spw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
fail_exit (3);
}
sp = spw_locate (name);
if (
((void *)0)
== sp) {
(void) spw_close ();
update_noshadow ();
if (spw_unlock () == 0) {
(void) fprintf (
stderr
,
gettext ("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failed to unlock %s", spw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
spw_locked =
0
;
return;
}
nsp = __spw_dup (sp);
if (
((void *)0)
== nsp) {
oom ();
}
nsp->sp_pwdp = update_crypt_pw (nsp->sp_pwdp);
if (xflg) {
nsp->sp_max = (age_max * (24L*3600L)) / (24L*3600L);
}
if (nflg) {
nsp->sp_min = (age_min * (24L*3600L)) / (24L*3600L);
}
if (wflg) {
nsp->sp_warn = (warn * (24L*3600L)) / (24L*3600L);
}
if (iflg) {
nsp->sp_inact = (inact * (24L*3600L)) / (24L*3600L);
}
if (do_update_age) {
nsp->sp_lstchg = (long) gettime () / (24L*3600L);
if (0 == nsp->sp_lstchg) {
nsp->sp_lstchg = -1;
}
}
if (eflg) {
nsp->sp_lstchg = 0;
}
if (spw_update (nsp) == 0) {
(void) fprintf (
stderr
,
gettext ("%s: failed to prepare the new %s entry '%s'\n"),
Prog, spw_dbname (), nsp->sp_namp);
fail_exit (3);
}
if (spw_close () == 0) {
(void) fprintf (
stderr
,
gettext ("%s: failure while writing changes to %s\n"),
Prog, spw_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failure while writing changes to %s", spw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
fail_exit (3);
}
if (spw_unlock () == 0) {
(void) fprintf (
stderr
,
gettext ("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failed to unlock %s", spw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
spw_locked =
0
;
}
| void update_shadow() {
void* v0;
void* v1;
void* v2;
void* v3;
char *v4;
unsigned long long v5;
unsigned long long v6[7];
char *v7;
char *v8;
char *v9;
unsigned long long v13;
unsigned long long v14;
unsigned long long v16;
unsigned long long v18;
unsigned long long v19;
unsigned long long v20;
unsigned long long v21;
unsigned long long v22;
unsigned long long v24;
unsigned long long v25;
unsigned long long v26;
unsigned long long v27;
if (!spw_lock()) {
v13 = spw_dbname();
fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n"));
exit(0x5);
}
spw_locked = 1;
if (!spw_open(0x42)) {
v14 = spw_dbname();
fprintf(*(&stderr), gettext("%s: cannot open %s\n"));
v4 = setlocale(0x6, NULL);
v0 = 0;
if (v4)
v0 = strdup(v4);
if (v0)
setlocale(0x6, "C");
spw_dbname();
syslog(0x4, "cannot open %s");
if (v0) {
setlocale(0x6, v0);
free(v0);
}
fail_exit(0x3);
} else {
v5 = spw_locate(name);
if (!v5) {
spw_close();
update_noshadow();
if (!spw_unlock()) {
v16 = spw_dbname();
fprintf(*(&stderr), gettext("%s: failed to unlock %s\n"));
v9 = setlocale(0x6, NULL);
v1 = 0;
if (v9)
v1 = strdup(v9);
if (v1)
setlocale(0x6, "C");
spw_dbname();
v18 = syslog(0x3, "failed to unlock %s");
if (v1) {
setlocale(0x6, v1);
v19 = free(v1);
}
}
spw_locked = 0;
} else {
v6[0] = __spw_dup(v5);
if (!v6)
oom();
v6[1] = update_crypt_pw(v6[1]);
if (xflg)
v6[4] = age_max;
if (nflg)
v6[3] = age_min;
if (wflg)
v6[5] = warn;
if (iflg)
v6[6] = inact;
if (do_update_age) {
v6[2] = (gettime() * 1749024623285053783 >> 64 >> 13) - (gettime() >> 63);
if (!v6[2])
v6[2] = -1;
}
if (eflg)
v6[2] = 0;
v20 = spw_update(v6);
if (!v20) {
v22 = spw_dbname();
fprintf(*(&stderr), gettext("%s: failed to prepare the new %s entry '%s'\n"));
fail_exit(0x3);
}
v21 = spw_close();
if (!v21) {
v24 = spw_dbname();
fprintf(*(&stderr), gettext("%s: failure while writing changes to %s\n"));
v7 = setlocale(0x6, NULL);
v2 = 0;
if (v7)
v2 = strdup(v7);
if (v2)
setlocale(0x6, "C");
spw_dbname();
syslog(0x3, "failure while writing changes to %s");
if (v2) {
setlocale(0x6, v2);
free(v2);
}
fail_exit(0x3);
} else {
if (!spw_unlock()) {
v25 = spw_dbname();
fprintf(*(&stderr), gettext("%s: failed to unlock %s\n"));
v8 = setlocale(0x6, NULL);
v3 = 0;
if (v8)
v3 = strdup(v8);
if (v3)
setlocale(0x6, "C");
spw_dbname();
v26 = syslog(0x3, "failed to unlock %s");
if (v3) {
setlocale(0x6, v3);
v27 = free(v3);
}
}
spw_locked = 0;
}
}
if (!v5 || v20 && v21 && v6)
return;
}
}
|
static void
shift_boundaries (struct file_data filevec[])
{
int f;
for (f = 0; f < 2; f++)
{
char *changed = filevec[f].changed;
char *other_changed = filevec[1 - f].changed;
lin const *equivs = filevec[f].equivs;
lin i = 0;
lin j = 0;
lin i_end = filevec[f].buffered_lines;
while (1)
{
lin runlength, start, corresponding;
while (i < i_end && !changed[i])
{
while (other_changed[j++])
continue;
i++;
}
if (i == i_end)
break;
start = i;
while (changed[++i])
continue;
while (other_changed[j])
j++;
do
{
runlength = i - start;
while (start && equivs[start - 1] == equivs[i - 1])
{
changed[--start] = 1;
changed[--i] = 0;
while (changed[start - 1])
start--;
while (other_changed[--j])
continue;
}
corresponding = other_changed[j - 1] ? i : i_end;
while (i != i_end && equivs[start] == equivs[i])
{
changed[start++] = 0;
changed[i++] = 1;
while (changed[i])
i++;
while (other_changed[++j])
corresponding = i;
}
}
while (runlength != i - start);
while (corresponding < i)
{
changed[--start] = 1;
changed[--i] = 0;
while (other_changed[--j])
continue;
}
}
}
}
| void shift_boundaries(unsigned long a0) {
unsigned int v0;
int tmp_13;
int tmp_18;
int tmp_30;
void* v1;
void* v2;
void* v3;
void* v4;
void* v5;
void* v6;
unsigned long long *v7;
void* v8;
unsigned long v9;
char v11;
void* v12;
void* v13;
for (v0 = 0; v0 <= 1; v0 += 1) {
v5 = *((a0 + v0 * 304 + 280));
v6 = *((a0 + (1 - v0) * 304 + 280));
v7 = *((a0 + v0 * 304 + 248));
v1 = 0;
v2 = 0;
while (true) {
for (v8 = *((a0 + v0 * 304 + 200)); v1 < v8; v1 += 1) {
if (*((v5 + v1)))
break;
if (!*((v5 + v1))) {
do {
tmp_13 = v2;
v2 += 1;
v11 = *(v6 + tmp_13);
} while (v11);
}
}
v12 = v1;
if (v1 == v8)
break;
if (v1 != v8) {
v3 = v1;
do {
v1 += 1;
} while (*((v5 + v1)));
for (; *((v6 + v2)); v2 += 1);
do {
v9 = v1 - v3;
while (v3) {
if (*((-8 + v7 + 0x8 * v3)) != *((-8 + v7 + 0x8 * v1)))
break;
if (*((-8 + v7 + 0x8 * v3)) == *((-8 + v7 + 0x8 * v1))) {
v3 -= 1;
*((v5 + v3)) = 1;
v1 -= 1;
for (*((v5 + v1)) = 0; *((v5 + v3 - 1)); v3 -= 1);
}
do {
v2 -= 1;
} while (*((v6 + v2)));
}
if (*((v6 + v2 - 1)))
v13 = v1;
else
v13 = v8;
v4 = v13;
while (v1 != v8) {
if (*((v7 + 0x8 * v3)) != *((v7 + 0x8 * v1)))
break;
if (*((v7 + 0x8 * v3)) == *((v7 + 0x8 * v1))) {
tmp_18 = v3;
v3 += 1;
*(v5 + tmp_18) = 0;
tmp_30 = v1;
v1 += 1;
for (*(v5 + tmp_30) = 1; *((v5 + v1)); v1 += 1);
}
while (true) {
v2 += 1;
if (!*((v6 + v2)))
break;
v4 = v1;
}
}
} while (v9 != v1 - v3);
}
while (v4 < v1) {
v3 -= 1;
*((v5 + v3)) = 1;
v1 -= 1;
*((v5 + v1)) = 0;
do {
v2 -= 1;
} while (*((v6 + v2)));
}
}
}
return;
}
|
int
sshkey_certify(struct sshkey *k, struct sshkey *ca, const char *alg,
const char *sk_provider, const char *sk_pin)
{
return sshkey_certify_custom(k, ca, alg, sk_provider, sk_pin,
default_key_sign,
((void *)0)
);
}
| long long sshkey_certify(void* a0, unsigned int *a1, char *a2, unsigned long long a3, unsigned long long a4) {
return sshkey_certify_custom(a0, a1, a2, a3, a4, default_key_sign, 0x0);
}
|
static int
dopass (int fd, struct stat const *st, char const *qname, off_t *sizep,
int type, struct randread_source *s,
unsigned long int k, unsigned long int n)
{
off_t size = *sizep;
off_t offset;
time_t thresh ;
time_t now = 0;
size_t lim;
size_t soff;
ssize_t ssize;
size_t page_size = getpagesize ();
_Static_assert ((60 * 1024) % 3 == 0, "verify (" "PERIODIC_OUTPUT_SIZE % 3 == 0" ")");
size_t output_size = periodic_pattern (type)
? (60 * 1024) : (64 * 1024);
unsigned char *pbuf = xalignalloc (page_size, (((output_size + 2) / 3) * 3));
char pass_string[7];
_Bool
write_error =
0
;
_Bool
other_error =
0
;
char previous_offset_buf[((2 * sizeof (uintmax_t) * 8 * 146 / 485 + 1) * (
16
+ 1) -
16
+ 1 + 3) + 1];
char const *previous_human_offset;
_Bool
try_without_directio = 0 < size && size < output_size;
if (! try_without_directio)
direct_mode (fd,
1
);
if (! dorewind (fd, st))
{
error (0,
(*__errno_location ())
, gettext ("%s: cannot rewind"), qname);
other_error =
1
;
goto free_pattern_mem;
}
if (type >= 0)
{
lim = known (size) && size < (((output_size + 2) / 3) * 3) ? size : (((output_size + 2) / 3) * 3);
fillpattern (type, pbuf, lim);
passname (pbuf, pass_string);
}
else
{
passname (0, pass_string);
}
if (n)
{
error (0, 0, gettext ("%s: pass %lu/%lu (%s)..."), qname, k, n, pass_string);
thresh = time (
((void *)0)
) + VERBOSE_UPDATE;
previous_human_offset = "";
}
offset = 0;
while (
1
)
{
lim = output_size;
if (known (size) && size - offset < output_size)
{
if (size < offset)
break;
lim = size - offset;
if (!lim)
break;
}
if (type < 0)
randread (s, pbuf, lim);
for (soff = 0; soff < lim; soff += ssize)
{
ssize = write (fd, pbuf + soff, lim - soff);
if (0 < ssize)
((ssize <= lim - soff) ? (void) 0 : __builtin_unreachable ());
else
{
if (! known (size) && (ssize == 0 ||
(*__errno_location ())
==
28
))
{
if (soff <= ((off_t) (! (! ((off_t) 0 < (off_t) -1)) ? (off_t) -1 : ((((off_t) 1 << ((sizeof (off_t) * 8) - 2)) - 1) * 2 + 1))) - offset)
*sizep = size = offset + soff;
break;
}
else
{
int errnum =
(*__errno_location ())
;
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)];
if (! try_without_directio &&
(*__errno_location ())
==
22
)
{
direct_mode (fd,
0
);
ssize = 0;
try_without_directio =
1
;
continue;
}
error (0, errnum, gettext ("%s: error writing at offset %s"),
qname, umaxtostr (offset + soff, buf));
_Static_assert ((60 * 1024) % SECTOR_SIZE == 0, "verify (" "PERIODIC_OUTPUT_SIZE % SECTOR_SIZE == 0" ")");
_Static_assert ((64 * 1024) % SECTOR_SIZE == 0, "verify (" "NONPERIODIC_OUTPUT_SIZE % SECTOR_SIZE == 0" ")");
if (errnum ==
5
&& known (size)
&& (soff | SECTOR_MASK) < lim)
{
size_t soff1 = (soff | SECTOR_MASK) + 1;
if (lseek (fd, offset + soff1,
0
) != -1)
{
ssize = soff1 - soff;
write_error =
1
;
continue;
}
error (0,
(*__errno_location ())
, gettext ("%s: lseek failed"), qname);
}
other_error =
1
;
goto free_pattern_mem;
}
}
}
if (((off_t) (! (! ((off_t) 0 < (off_t) -1)) ? (off_t) -1 : ((((off_t) 1 << ((sizeof (off_t) * 8) - 2)) - 1) * 2 + 1))) - offset < soff)
{
error (0, 0, gettext ("%s: file too large"), qname);
other_error =
1
;
goto free_pattern_mem;
}
offset += soff;
_Bool
done = offset == size;
if (n && ((done && *previous_human_offset)
|| thresh <= (now = time (
((void *)0)
))))
{
char offset_buf[((2 * sizeof (uintmax_t) * 8 * 146 / 485 + 1) * (
16
+ 1) -
16
+ 1 + 3) + 1];
char size_buf[((2 * sizeof (uintmax_t) * 8 * 146 / 485 + 1) * (
16
+ 1) -
16
+ 1 + 3) + 1];
int human_progress_opts = (human_autoscale | human_SI
| human_base_1024 | human_B);
char const *human_offset
= human_readable (offset, offset_buf,
human_floor | human_progress_opts, 1, 1);
if (done || !(strcmp (previous_human_offset, human_offset) == 0))
{
if (! known (size))
error (0, 0, gettext ("%s: pass %lu/%lu (%s)...%s"),
qname, k, n, pass_string, human_offset);
else
{
uintmax_t off = offset;
int percent = (size == 0
? 100
: (off <= ((uintmax_t) (! (! ((uintmax_t) 0 < (uintmax_t) -1)) ? (uintmax_t) -1 : ((((uintmax_t) 1 << ((sizeof (uintmax_t) * 8) - 2)) - 1) * 2 + 1))) / 100
? off * 100 / size
: off / (size / 100)));
char const *human_size
= human_readable (size, size_buf,
human_ceiling | human_progress_opts,
1, 1);
if (done)
human_offset = human_size;
error (0, 0, gettext ("%s: pass %lu/%lu (%s)...%s/%s %d%%"),
qname, k, n, pass_string, human_offset, human_size,
percent);
}
strcpy (previous_offset_buf, human_offset);
previous_human_offset = previous_offset_buf;
thresh = now + VERBOSE_UPDATE;
if (dosync (fd, qname) != 0)
{
if (
(*__errno_location ())
!=
5
)
{
other_error =
1
;
goto free_pattern_mem;
}
write_error =
1
;
}
}
}
}
if (dosync (fd, qname) != 0)
{
if (
(*__errno_location ())
!=
5
)
{
other_error =
1
;
goto free_pattern_mem;
}
write_error =
1
;
}
free_pattern_mem:
alignfree (pbuf);
return other_error ? -1 : write_error;
}
| long dopass(
unsigned int a1,
long a2,
long a3,
long *a4,
int a5,
long a6,
long a7,
long a8)
{
long v8;
bool v9;
char *v10;
int *v11;
size_t v12;
char *v13;
long v14;
char *v15;
char *v16;
int *v17;
char *v18;
char *v19;
unsigned long v20;
char *v21;
unsigned char v27;
char v28;
char v29;
int errnum;
unsigned int v31;
long v32;
unsigned long v33;
time_t v34;
time_t v35;
unsigned long v36;
unsigned long i;
ssize_t v38;
const char *s1;
char *s2;
long v41;
unsigned long v42;
unsigned char *v43;
long v44;
char v45[7];
char dest[656];
char v47[656];
char v48[664];
unsigned long v49;
v49 = __readfsqword(0x28u);
v32 = *a4;
v35 = 0LL;
v41 = getpagesize();
if ( periodic_pattern(a5) )
v8 = 61440LL;
else
v8 = 0x10000LL;
v42 = v8;
v43 = (unsigned char *)xalignalloc(v41, 3 * ((v8 + 2) / 3uLL));
v27 = 0;
v28 = 0;
v9 = v32 > 0 && v42 > v32;
v29 = v9;
if ( !v9 )
direct_mode(a1, 1);
if ( !dorewind(a1, a2) )
{
v10 = gettext("%s: cannot rewind");
v11 = _errno_location();
error(0, *v11, v10, a3);
v28 = 1;
}
else
{
if ( a5 < 0 )
{
passname(0LL, v45);
}
else
{
if ( known(v32) && 3 * ((v42 + 2) / 3) > v32 )
v12 = v32;
else
v12 = 3 * ((v42 + 2) / 3);
fillpattern(a5, v43, v12);
passname(v43, v45);
}
if ( a8 )
{
v13 = gettext("%s: pass %lu/%lu (%s)...");
error(0, 0, v13, a3, a7, a8, v45);
v34 = time(0LL) + 5;
s1 = locale;
}
v33 = 0LL;
while ( 1 )
{
v36 = v42;
if ( known(v32) && v42 > v32 - v33 )
{
if ( v32 < (long)v33 )
break;
v36 = v32 - v33;
if ( v32 == v33 )
break;
}
if ( a5 < 0 )
randread(a6, v43, v36);
for ( i = 0LL; i < v36; i += v38 )
{
v38 = write(a1, &v43[i], v36 - i);
if ( v38 <= 0 )
{
if ( !known(v32) && (!v38 || *_errno_location() == 28) )
{
if ( i <= 0x7FFFFFFFFFFFFFFFLL - v33 )
{
v32 = v33 + i;
*a4 = v33 + i;
}
break;
}
errnum = *_errno_location();
if ( v29 != 1 && *_errno_location() == 22 )
{
direct_mode(a1, 0);
v38 = 0LL;
v29 = 1;
}
else
{
v14 = umaxtostr(i + v33, v48);
v15 = gettext("%s: error writing at offset %s");
error(0, errnum, v15, a3, v14);
if ( errnum != 5 || !known(v32) || v36 <= (i | 0x1FF) )
goto LABEL_44;
if ( lseek(a1, v33 + (i | 0x1FF) + 1, 0) == -1 )
{
v16 = gettext("%s: lseek failed");
v17 = _errno_location();
error(0, *v17, v16, a3);
LABEL_44:
v28 = 1;
goto LABEL_73;
}
v38 = (i | 0x1FF) + 1 - i;
v27 = 1;
}
}
}
if ( i > 0x7FFFFFFFFFFFFFFFLL - v33 )
{
v18 = gettext("%s: file too large");
error(0, 0, v18, a3);
v28 = 1;
goto LABEL_73;
}
v33 += i;
if ( a8 )
{
if ( v33 == v32 && *s1 || (v35 = time(0LL), v35 >= v34) )
{
s2 = (char *)human_readable(v33, v47, 434LL, 1LL, 1LL);
if ( v33 == v32 || strcmp(s1, s2) )
{
if ( !known(v32) )
{
v19 = gettext("%s: pass %lu/%lu (%s)...%s");
error(0, 0, v19, a3, a7, a8, v45, s2);
}
else
{
if ( v32 )
{
if ( v33 > 0x28F5C28F5C28F5CLL )
v20 = v33 / (v32 / 100);
else
v20 = 100 * v33 / v32;
}
else
{
LODWORD(v20) = 100;
}
v31 = v20;
v44 = human_readable(v32, v48, 432LL, 1LL, 1LL);
if ( v33 == v32 )
s2 = (char *)v44;
v21 = gettext("%s: pass %lu/%lu (%s)...%s/%s %d%%");
error(0, 0, v21, a3, a7, a8, v45, s2, v44, v31);
}
strcpy(dest, s2);
s1 = dest;
v34 = v35 + 5;
if ( (unsigned int)dosync(a1, a3) )
{
if ( *_errno_location() != 5 )
{
v28 = 1;
goto LABEL_73;
}
v27 = 1;
}
}
}
}
}
if ( (unsigned int)dosync(a1, a3) )
{
if ( *_errno_location() == 5 )
v27 = 1;
else
v28 = 1;
}
}
LABEL_73:
alignfree(v43);
if ( v28 )
return 0xFFFFFFFFLL;
else
return v27;
}
|
void
file_removed_diag (const char *name,
_Bool
top_level,
void (*diagfn) (char const *name))
{
if (!top_level &&
(*__errno_location ())
==
2
)
{
do { if ((warning_option & (0x00000040))) do { if (error_hook) error_hook (); error (0, 0, gettext ("%s: File removed before we read it"), quotearg_colon (name)); } while (0); } while (0)
;
set_exit_status (1);
}
else
diagfn (name);
}
| long file_removed_diag(long a1, char a2, long ( *a3)(long))
{
long v3;
char *v4;
if ( a2 == 1 || *_errno_location() != 2 )
return a3(a1);
if ( (warning_option & 0x40) != 0 )
{
if ( error_hook )
error_hook();
v3 = quotearg_colon(a1);
v4 = gettext("%s: File removed before we read it");
error(0, 0, v4, v3);
}
return set_exit_status(1LL);
}
|
static void
x_obstack_grow (struct xheader *xhdr, const char *ptr, size_t length)
{
__extension__ ({ struct obstack *__o = (xhdr->stk); size_t __len = (length); if (__extension__ ({ struct obstack const *__o1 = (__o); (size_t) (__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk (__o, __len); memcpy (__o->next_free, ptr, __len); __o->next_free += __len; (void) 0; });
xhdr->size += length;
}
| void x_obstack_grow(unsigned long long a0[2], void* a1, unsigned long a2) {
unsigned long long v0[5];
unsigned long long v1[5];
unsigned long long v3[2];
v0[0] = a0[0];
v1[0] = v0;
if (v1[4] - v1[3] < a2)
_obstack_newchunk(v0, a2, a2);
memcpy(v0[3], a1, a2);
v0[3] = v0[3] + a2;
v3 = a0;
a0[1] = a0[1] + a2;
return;
}
|
char *
xstrdup(const char *str)
{
size_t len;
char *cp;
len = strlen(str) + 1;
cp = xmalloc(len);
return memcpy(cp, str, len);
}
| long long xstrdup(void* a0) {
unsigned int v0;
void* v1;
*(&v0) = strlen(a0) + 1;
v1 = xmalloc(*(&v0));
return memcpy(v1, a0, *(&v0));
}
|
static inline int parser_eof(void)
{
return tokpushback && lasttoken == 0;
}
| int parser_eof() {
unsigned int v1;
if (tokpushback && !lasttoken)
v1 = 1;
if (!tokpushback || lasttoken)
v1 = 0;
return v1;
}
|
int gzbuffer(file, size)
gzFile file;
unsigned size;
{
gz_statep state;
if (file ==
((void *)0)
)
return -1;
state = (gz_statep)file;
if (state->mode != 7247 && state->mode != 31153)
return -1;
if (state->size != 0)
return -1;
if ((size << 1) < size)
return -1;
if (size < 2)
size = 2;
state->want = size;
return 0;
}
| long gzbuffer(_DWORD *a1, unsigned int a2)
{
int v3;
v3 = a2;
if ( !a1 )
return 0xFFFFFFFFLL;
if ( a1[6] != 7247 && a1[6] != 31153 )
return 0xFFFFFFFFLL;
if ( a1[10] )
return 0xFFFFFFFFLL;
if ( a2 > 2 * a2 )
return 0xFFFFFFFFLL;
if ( a2 <= 1 )
v3 = 2;
a1[11] = v3;
return 0LL;
}
|
u_char *
sshbuf_mutable_ptr(const struct sshbuf *buf)
{
if (sshbuf_check_sanity(buf) != 0 || buf->readonly || buf->refcount > 1)
return
((void *)0)
;
return buf->d + buf->off;
}
| long sshbuf_mutable_ptr(long *param_1)
{
int iVar1;
long lVar2;
iVar1 = sshbuf_check_sanity(param_1);
if (((iVar1 == 0) && (*(int *)(param_1 + 6) == 0)) && (*(uint *)(param_1 + 7) < 2)) {
lVar2 = param_1[2] + *param_1;
}
else {
lVar2 = 0;
}
return lVar2;
}
|
static char *
dumpdir_first (struct dumpdir *dump, int all, struct dumpdir_iter **pitr)
{
struct dumpdir_iter *itr = xmalloc (sizeof (*itr));
itr->dump = dump;
itr->all = all;
itr->next = 0;
*pitr = itr;
return dumpdir_next (itr);
}
| int dumpdir_first(unsigned long a0, unsigned long a1, unsigned long long *a2) {
struct_0 *v0;
v0 = xmalloc(0x18);
v0->field_0 = a0;
v0->field_8 = a1;
v0->field_10 = 0;
*(a2) = v0;
return dumpdir_next(v0);
}
|
const char *
cipher_warning_message(const struct sshcipher_ctx *cc)
{
if (cc ==
((void *)0)
|| cc->cipher ==
((void *)0)
)
return
((void *)0)
;
return
((void *)0)
;
}
| long cipher_warning_message(long a1)
{
if ( a1 && *(_QWORD *)(a1 + 288) )
return 0LL;
else
return 0LL;
}
|
static int
userauth_pubkey(struct ssh *ssh, const char *method)
{
Authctxt *authctxt = ssh->authctxt;
struct passwd *pw = authctxt->pw;
struct sshbuf *b =
((void *)0)
;
struct sshkey *key =
((void *)0)
, *hostkey =
((void *)0)
;
char *pkalg =
((void *)0)
, *userstyle =
((void *)0)
, *key_s =
((void *)0)
, *ca_s =
((void *)0)
;
u_char *pkblob =
((void *)0)
, *sig =
((void *)0)
, have_sig;
size_t blen, slen;
int hostbound, r, pktype;
int req_presence = 0, req_verify = 0, authenticated = 0;
struct sshauthopt *authopts =
((void *)0)
;
struct sshkey_sig_details *sig_details =
((void *)0)
;
hostbound = strcmp(method, "publickey-hostbound-v00@openssh.com") == 0;
if ((r = sshpkt_get_u8(ssh, &have_sig)) != 0 ||
(r = sshpkt_get_cstring(ssh, &pkalg,
((void *)0)
)) != 0 ||
(r = sshpkt_get_string(ssh, &pkblob, &blen)) != 0)
sshfatal("auth2-pubkey.c", __func__, 107, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s packet", method);
if (hostbound) {
if ((r = sshpkt_getb_froms(ssh, &b)) != 0 ||
(r = sshkey_fromb(b, &hostkey)) != 0)
sshfatal("auth2-pubkey.c", __func__, 113, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s hostkey", method);
if (ssh->kex->initial_hostkey ==
((void *)0)
)
sshfatal("auth2-pubkey.c", __func__, 115, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "internal error: initial hostkey not recorded");
if (!sshkey_equal(hostkey, ssh->kex->initial_hostkey))
sshfatal("auth2-pubkey.c", __func__, 117, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s packet contained wrong host key", method);
sshbuf_free(b);
b =
((void *)0)
;
}
if (log_level_get() >= SYSLOG_LEVEL_DEBUG2) {
char *keystring;
struct sshbuf *pkbuf;
if ((pkbuf = sshbuf_from(pkblob, blen)) ==
((void *)0)
)
sshfatal("auth2-pubkey.c", __func__, 127, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_from failed");
if ((keystring = sshbuf_dtob64_string(pkbuf, 0)) ==
((void *)0)
)
sshfatal("auth2-pubkey.c", __func__, 129, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_dtob64 failed");
sshlog("auth2-pubkey.c", __func__, 130, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "%s user %s %s public key %s %s", authctxt->valid ? "valid" : "invalid", authctxt->user, have_sig ? "attempting" : "querying", pkalg, keystring)
;
sshbuf_free(pkbuf);
free(keystring);
}
pktype = sshkey_type_from_name(pkalg);
if (pktype == KEY_UNSPEC) {
sshlog("auth2-pubkey.c", __func__, 140, 1, SYSLOG_LEVEL_VERBOSE,
((void *)0)
, "unsupported public key algorithm: %s", pkalg);
goto done;
}
if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) {
sshlog("auth2-pubkey.c", __func__, 144, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse key");
goto done;
}
if (key ==
((void *)0)
) {
sshlog("auth2-pubkey.c", __func__, 148, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "cannot decode key: %s", pkalg);
goto done;
}
if (key->type != pktype) {
sshlog("auth2-pubkey.c", __func__, 152, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "type mismatch for decoded key " "(received %d, expected %d)", key->type, pktype)
;
goto done;
}
if (sshkey_type_plain(key->type) == KEY_RSA &&
(ssh->compat & 0x00002000) != 0) {
sshlog("auth2-pubkey.c", __func__, 158, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Refusing RSA key because client uses unsafe " "signature scheme")
;
goto done;
}
if (auth2_key_already_used(authctxt, key)) {
sshlog("auth2-pubkey.c", __func__, 163, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "refusing previously-used %s key", sshkey_type(key));
goto done;
}
if (match_pattern_list(pkalg, options.pubkey_accepted_algos, 0) != 1) {
sshlog("auth2-pubkey.c", __func__, 167, 1, SYSLOG_LEVEL_INFO,
((void *)0)
, "signature algorithm %s not in " "PubkeyAcceptedAlgorithms", pkalg)
;
goto done;
}
if ((r = sshkey_check_cert_sigtype(key,
options.ca_sign_algorithms)) != 0) {
sshlog("auth2-pubkey.c", __func__, 173, 1, SYSLOG_LEVEL_INFO, ssh_err(r), "certificate signature algorithm %s", (key->cert ==
((void *)0)
|| key->cert->signature_type ==
((void *)0)
) ? "(null)" : key->cert->signature_type)
;
goto done;
}
if ((r = sshkey_check_rsa_length(key,
options.required_rsa_size)) != 0) {
sshlog("auth2-pubkey.c", __func__, 180, 0, SYSLOG_LEVEL_INFO, ssh_err(r), "refusing %s key", sshkey_type(key));
goto done;
}
key_s = format_key(key);
if (sshkey_is_cert(key))
ca_s = format_key(key->cert->signature_key);
if (have_sig) {
sshlog("auth2-pubkey.c", __func__, 188, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "%s have %s signature for %s%s%s", method, pkalg, key_s, ca_s ==
((void *)0)
? "" : " CA ", ca_s ==
((void *)0)
? "" : ca_s)
;
if ((r = sshpkt_get_string(ssh, &sig, &slen)) != 0 ||
(r = sshpkt_get_end(ssh)) != 0)
sshfatal("auth2-pubkey.c", __func__, 193, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse signature packet");
if ((b = sshbuf_new()) ==
((void *)0)
)
sshfatal("auth2-pubkey.c", __func__, 195, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
if (ssh->compat & 0x00000010) {
if ((r = sshbuf_putb(b, ssh->kex->session_id)) != 0)
sshfatal("auth2-pubkey.c", __func__, 198, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "put old session id");
} else {
if ((r = sshbuf_put_stringb(b,
ssh->kex->session_id)) != 0)
sshfatal("auth2-pubkey.c", __func__, 202, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "put session id");
}
if (!authctxt->valid || authctxt->user ==
((void *)0)
) {
sshlog("auth2-pubkey.c", __func__, 205, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "disabled because of invalid user");
goto done;
}
xasprintf(&userstyle, "%s%s%s", authctxt->user,
authctxt->style ? ":" : "",
authctxt->style ? authctxt->style : "");
if ((r = sshbuf_put_u8(b, 50)) != 0 ||
(r = sshbuf_put_cstring(b, userstyle)) != 0 ||
(r = sshbuf_put_cstring(b, authctxt->service)) != 0 ||
(r = sshbuf_put_cstring(b, method)) != 0 ||
(r = sshbuf_put_u8(b, have_sig)) != 0 ||
(r = sshbuf_put_cstring(b, pkalg)) != 0 ||
(r = sshbuf_put_string(b, pkblob, blen)) != 0)
sshfatal("auth2-pubkey.c", __func__, 219, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "reconstruct %s packet", method);
if (hostbound &&
(r = sshkey_puts(ssh->kex->initial_hostkey, b)) != 0)
sshfatal("auth2-pubkey.c", __func__, 222, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "reconstruct %s packet", method);
authenticated = 0;
if ((use_privsep ? mm_user_key_allowed(ssh, pw, key, 1, &authopts) : user_key_allowed(ssh, pw, key, 1, &authopts)) &&
(use_privsep ? mm_sshkey_verify(key, sig, slen, sshbuf_ptr(b), sshbuf_len(b), (ssh->compat & 0x00000002) == 0 ? pkalg :
((void *)0)
, ssh->compat, &sig_details) : sshkey_verify(key, sig, slen, sshbuf_ptr(b), sshbuf_len(b), (ssh->compat & 0x00000002) == 0 ? pkalg :
((void *)0)
, ssh->compat, &sig_details))
== 0) {
authenticated = 1;
}
if (authenticated == 1 && sig_details !=
((void *)0)
) {
auth2_record_info(authctxt, "signature count = %u",
sig_details->sk_counter);
sshlog("auth2-pubkey.c", __func__, 238, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "sk_counter = %u, sk_flags = 0x%02x", sig_details->sk_counter, sig_details->sk_flags)
;
req_presence = (options.pubkey_auth_options &
(1)) ||
!authopts->no_require_user_presence;
if (req_presence && (sig_details->sk_flags &
0x01) == 0) {
sshlog("auth2-pubkey.c", __func__, 245, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "public key %s signature for %s%s from " "%.128s port %d rejected: user presence " "(authenticator touch) requirement " "not met ", key_s, authctxt->valid ? "" : "invalid user ", authctxt->user, ssh_remote_ipaddr(ssh), ssh_remote_port(ssh))
;
authenticated = 0;
goto done;
}
req_verify = (options.pubkey_auth_options &
(1<<1)) ||
authopts->require_verify;
if (req_verify && (sig_details->sk_flags &
0x04) == 0) {
sshlog("auth2-pubkey.c", __func__, 260, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "public key %s signature for %s%s from " "%.128s port %d rejected: user " "verification requirement not met ", key_s, authctxt->valid ? "" : "invalid user ", authctxt->user, ssh_remote_ipaddr(ssh), ssh_remote_port(ssh))
;
authenticated = 0;
goto done;
}
}
auth2_record_key(authctxt, authenticated, key);
} else {
sshlog("auth2-pubkey.c", __func__, 272, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "%s test pkalg %s pkblob %s%s%s", method, pkalg, key_s, ca_s ==
((void *)0)
? "" : " CA ", ca_s ==
((void *)0)
? "" : ca_s)
;
if ((r = sshpkt_get_end(ssh)) != 0)
sshfatal("auth2-pubkey.c", __func__, 276, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse packet");
if (!authctxt->valid || authctxt->user ==
((void *)0)
) {
sshlog("auth2-pubkey.c", __func__, 279, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "disabled because of invalid user");
goto done;
}
if ((use_privsep ? mm_user_key_allowed(ssh, pw, key, 0,
((void *)0)
) : user_key_allowed(ssh, pw, key, 0,
((void *)0)
))) {
if ((r = sshpkt_start(ssh, 60))
!= 0 ||
(r = sshpkt_put_cstring(ssh, pkalg)) != 0 ||
(r = sshpkt_put_string(ssh, pkblob, blen)) != 0 ||
(r = sshpkt_send(ssh)) != 0 ||
(r = ssh_packet_write_wait(ssh)) != 0)
sshfatal("auth2-pubkey.c", __func__, 297, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send packet");
authctxt->postponed = 1;
}
}
done:
if (authenticated == 1 && auth_activate_options(ssh, authopts) != 0) {
sshlog("auth2-pubkey.c", __func__, 303, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "key options inconsistent with existing");
authenticated = 0;
}
sshlog("auth2-pubkey.c", __func__, 306, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "authenticated %d pkalg %s", authenticated, pkalg);
sshbuf_free(b);
sshauthopt_free(authopts);
sshkey_free(key);
sshkey_free(hostkey);
free(userstyle);
free(pkalg);
free(pkblob);
free(key_s);
free(ca_s);
free(sig);
sshkey_sig_details_free(sig_details);
return authenticated;
}
| long long userauth_pubkey(struct_0 *a0, char *a1) {
unsigned long v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
void* v8;
void* v9;
void* v10;
void* v11;
void* v12;
void* v13;
void* v14;
char v15;
char v16;
void* v17;
void* v18;
void* v19;
unsigned long long v20;
struct_2 *v21;
unsigned long long v22;
unsigned long long v23;
void* v24;
unsigned long long v25;
void* v26;
unsigned long long v27;
unsigned long v28;
unsigned long long v29;
unsigned long v30;
char v31;
unsigned long long v32;
char v33;
char v34;
char v35;
unsigned long long v36;
unsigned long long v37;
unsigned long long v38;
unsigned long long v39;
unsigned long long v40;
unsigned long long v41;
unsigned long long v42;
unsigned long v43;
void* v44;
void* v45;
unsigned long long v48;
unsigned long long v51;
v21 = a0->field_860;
v22 = v21->field_30;
v8 = 0;
v9 = 0;
v10 = 0;
v11 = 0;
v12 = 0;
v19 = 0;
v20 = 0;
v13 = 0;
v14 = 0;
v4 = 0;
v5 = 0;
v3 = 0;
v17 = 0;
v18 = 0;
v6 = !strcmp(a1, "publickey-hostbound-v00@openssh.com");
v2 = sshpkt_get_u8(a0, &v1, &v1);
if (!v2) {
v2 = sshpkt_get_cstring(a0, &v11, 0x0, &v11);
if (!v2) {
v2 = sshpkt_get_string(a0, &v13, &v15, &v13);
if (!v2)
goto LABEL_400255;
}
}
v0 = a1;
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0x6b, 0x1, 0x1, ssh_err(v2), "parse %s packet");
LABEL_400255:
if (v6) {
v2 = sshpkt_getb_froms(a0, &v8, &v8);
if (!v2) {
v2 = sshkey_fromb(v8, &v10, &v10);
if (!v2)
goto LABEL_4002f8;
}
v30 = a1;
v29 = "parse %s hostkey";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0x71, 0x1, 0x1, ssh_err(v2), *(&v31));
LABEL_4002f8:
if (!a0->field_8->field_80) {
v29 = "internal error: initial hostkey not recorded";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0x73, 0x1, 0x1, 0x0, *(&v31));
}
if (!sshkey_equal(v10, a0->field_8->field_80, a0->field_8->field_80)) {
v30 = a1;
v29 = "%s packet contained wrong host key";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0x75, 0x1, 0x1, 0x0, *(&v31));
}
sshbuf_free(v8);
v8 = 0;
}
if (log_level_get() > 5) {
v23 = sshbuf_from(v13, *(&v15), *(&v15));
if (!v23) {
v29 = "sshbuf_from failed";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0x7f, 0x1, 0x1, 0x0, *(&v31));
}
v24 = sshbuf_dtob64_string(v23, 0x0);
if (!v24) {
v29 = "sshbuf_dtob64 failed";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0x81, 0x1, 0x1, 0x0, *(&v31));
}
if (v1)
v36 = "attempting";
else
v36 = "querying";
if (v21->field_c)
v37 = "valid";
else
v37 = "invalid";
v30 = v24;
v29 = v11;
v28 = v36;
v27 = v21->field_20;
v26 = v37;
v25 = "%s user %s %s public key %s %s";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x82, 0x1, 0x6, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
sshbuf_free(v23);
free(v24);
}
v7 = sshkey_type_from_name(v11);
if (v7 == 14) {
v30 = v11;
v29 = "unsupported public key algorithm: %s";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x8c, 0x1, 0x4, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
} else {
v2 = sshkey_from_blob(v13, *(&v15), &v9, *(&v15));
if (v2) {
v29 = "parse key";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x90, 0x1, 0x2, ssh_err(v2), *(&v31), v32, *(&v33), *(&v34), *(&v35));
} else if (!v9) {
v30 = v11;
v29 = "cannot decode key: %s";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x94, 0x1, 0x2, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
} else if (v7 != *(v9)) {
v29 = v7;
v28 = *(v9);
v27 = "type mismatch for decoded key (received %d, expected %d)";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x98, 0x1, 0x2, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
} else {
if (!sshkey_type_plain(*(v9)) && (a0->field_83c & 0x2000)) {
v29 = "Refusing RSA key because client uses unsafe signature scheme";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x9e, 0x0, 0x3, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
goto LABEL_40154a;
}
if (auth2_key_already_used(v21, v9, v9)) {
v30 = sshkey_type(v9);
v29 = "refusing previously-used %s key";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0xa3, 0x0, 0x3, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
} else if (match_pattern_list(v11, *(5244184), 0x0, *(5244184)) != 1) {
v30 = v11;
v29 = "signature algorithm %s not in PubkeyAcceptedAlgorithms";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0xa7, 0x1, 0x3, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
} else {
v2 = sshkey_check_cert_sigtype(v9, *(5244168), *(5244168));
if (v2) {
if (v9[128] && *((v9[128] + 88))) {
v38 = *((v9[128] + 88));
goto LABEL_40086b;
}
v38 = "(null)";
LABEL_40086b:
v30 = v38;
v29 = "certificate signature algorithm %s";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0xad, 0x1, 0x3, ssh_err(v2), *(&v31), v32, *(&v33), *(&v34), *(&v35));
} else {
v2 = sshkey_check_rsa_length(v9, *(5250752), *(5250752));
if (v2) {
v30 = sshkey_type(v9);
v29 = "refusing %s key";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0xb4, 0x0, 0x3, ssh_err(v2), *(&v31), v32, *(&v33), *(&v34), *(&v35));
} else {
v19 = format_key(v9);
if (sshkey_is_cert(v9))
v20 = format_key(*((v9[128] + 80)));
if (v1) {
if (!v20)
v40 = &g_40329b;
else
v40 = v20;
if (!v20)
v42 = &g_40329b;
else
v42 = " CA ";
v30 = v40;
v29 = v42;
v28 = v19;
v27 = v11;
v26 = a1;
v25 = "%s have %s signature for %s%s%s";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0xbc, 0x1, 0x7, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
v2 = sshpkt_get_string(a0, &v14, &v16, &v14);
if (!v2) {
v2 = sshpkt_get_end(a0);
if (!v2)
goto LABEL_400a8d;
}
v29 = "parse signature packet";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0xc1, 0x1, 0x1, ssh_err(v2), *(&v31));
LABEL_400a8d:
v8 = sshbuf_new();
if (!v8) {
v29 = "sshbuf_new failed";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0xc3, 0x1, 0x1, 0x0, *(&v31));
}
if ((a0->field_83c & 16)) {
v2 = sshbuf_putb(v8, a0->field_8->field_70, a0->field_8->field_70);
if (!v2)
goto LABEL_400bdf;
v29 = "put old session id";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0xc6, 0x1, 0x1, ssh_err(v2), *(&v31));
}
v2 = sshbuf_put_stringb(v8, a0->field_8->field_70, a0->field_8->field_70);
if (v2) {
v29 = "put session id";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0xca, 0x1, 0x1, ssh_err(v2), *(&v31));
}
LABEL_400bdf:
if (!v21->field_c) {
LABEL_400bf7:
v29 = "disabled because of invalid user";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0xcd, 0x1, 0x6, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
} else {
if (!v21->field_20)
goto LABEL_400bf7;
if (v21->field_38)
v43 = ":";
else
v43 = &g_40329b;
xasprintf(&v12, "%s%s%s", v21->field_20, v43);
v2 = sshbuf_put_u8(v8, 0x32);
if (!v2) {
v2 = sshbuf_put_cstring(v8, v12, v12);
if (!v2) {
v2 = sshbuf_put_cstring(v8, v21->field_28, v21->field_28);
if (!v2) {
v2 = sshbuf_put_cstring(v8, a1, a1);
if (!v2) {
v2 = sshbuf_put_u8(v8, v1);
if (!v2) {
v2 = sshbuf_put_cstring(v8, v11, v11);
if (!v2) {
v2 = sshbuf_put_string(v8, v13, *(&v15), v13);
if (!v2)
goto LABEL_400e0a;
}
}
}
}
}
}
v30 = a1;
v29 = "reconstruct %s packet";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0xdb, 0x1, 0x1, ssh_err(v2), *(&v31));
LABEL_400e0a:
if (v6) {
v2 = sshkey_puts(a0->field_8->field_80, v8, v8);
if (v2) {
v30 = a1;
v29 = "reconstruct %s packet";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0xde, 0x1, 0x1, ssh_err(v2), *(&v31));
}
}
v3 = 0;
if (!*(&use_privsep))
*(&v43) = user_key_allowed(a0, v22, v9, 0x1, &v17);
else
*(&v43) = mm_user_key_allowed(a0, v22, v9, 0x1, &v17);
if (v43) {
if (*(&use_privsep)) {
if ((a0->field_83c & 2))
v45 = 0;
else
v45 = v11;
v30 = &v18;
v29 = a0->field_83c;
*(&v43) = !mm_sshkey_verify(v9, v14, *(&v16), sshbuf_ptr(v8), sshbuf_len(v8), v45, *(&v31));
} else {
if ((a0->field_83c & 2))
v44 = 0;
else
v44 = v11;
v30 = &v18;
v29 = a0->field_83c;
*(&v43) = !sshkey_verify(v9, v14, *(&v16), sshbuf_ptr(v8), sshbuf_len(v8), v44, *(&v31));
}
if (v43)
v3 = 1;
}
if (v3 == 1 && v18) {
auth2_record_info(v21, "signature count = %u", *(v18));
v29 = v18[4];
v28 = *(v18);
v27 = "sk_counter = %u, sk_flags = 0x%02x";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0xee, 0x1, 0x5, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
if ((*(5244192) & 1)) {
LABEL_4010d3:
*(&v43) = 1;
} else {
if (!v17[128])
goto LABEL_4010d3;
*(&v43) = 0;
}
v4 = v43;
if (v4 && !(v18[4] & 1)) {
if (v21->field_c)
v48 = &g_40329b;
else
v48 = "invalid user ";
v30 = ssh_remote_port(a0);
v29 = ssh_remote_ipaddr(a0);
v28 = v21->field_20;
v27 = v48;
v26 = v19;
v25 = "public key %s signature for %s%s from %.128s port %d rejected: user presence (authenticator touch) requirement not met ";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0xf5, 0x0, 0x2, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
v3 = 0;
goto LABEL_40154a;
}
if ((*(5244192) & 2)) {
LABEL_4011b9:
*(&v43) = 1;
} else {
if (!(!v17[132]))
goto LABEL_4011b9;
*(&v43) = 0;
}
v5 = v43;
if (v5 && !(v18[4] & 4)) {
if (v21->field_c)
v51 = &g_40329b;
else
v51 = "invalid user ";
v30 = ssh_remote_port(a0);
v29 = ssh_remote_ipaddr(a0);
v28 = v21->field_20;
v27 = v51;
v26 = v19;
v25 = "public key %s signature for %s%s from %.128s port %d rejected: user verification requirement not met ";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x104, 0x0, 0x2, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
v3 = 0;
goto LABEL_40154a;
}
}
auth2_record_key(v21, v3, v9, v3);
}
} else {
if (!v20)
v39 = &g_40329b;
else
v39 = v20;
if (!v20)
v41 = &g_40329b;
else
v41 = " CA ";
v30 = v39;
v29 = v41;
v28 = v19;
v27 = v11;
v26 = a1;
v25 = "%s test pkalg %s pkblob %s%s%s";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x110, 0x1, 0x5, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
v2 = sshpkt_get_end(a0);
if (v2) {
v29 = "parse packet";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0x114, 0x1, 0x1, ssh_err(v2), *(&v31));
}
if (!v21->field_c) {
LABEL_401396:
v29 = "disabled because of invalid user";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x117, 0x1, 0x6, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
} else {
if (!v21->field_20)
goto LABEL_401396;
if (!*(&use_privsep))
*(&v39) = user_key_allowed(a0, v22, v9, 0x0, NULL);
else
*(&v39) = mm_user_key_allowed(a0, v22, v9, 0x0, 0x0);
if (v39) {
v2 = sshpkt_start(a0, 0x3c);
if (!v2) {
v2 = sshpkt_put_cstring(a0, v11, v11);
if (!v2) {
v2 = sshpkt_put_string(a0, v13, *(&v15), v13);
if (!v2) {
v2 = sshpkt_send(a0);
if (!v2) {
v2 = ssh_packet_write_wait(a0);
if (!v2)
goto LABEL_40153c;
}
}
}
}
v29 = "send packet";
sshfatal("auth2-pubkey.c", "userauth_pubkey", 0x129, 0x1, 0x1, ssh_err(v2), *(&v31));
LABEL_40153c:
v21->field_8 = 1;
}
}
}
}
}
}
}
}
LABEL_40154a:
if (v3 == 1 && auth_activate_options(a0, v17, v17)) {
v29 = "key options inconsistent with existing";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x12f, 0x1, 0x5, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
v3 = 0;
}
v29 = v11;
v28 = v3;
v27 = "authenticated %d pkalg %s";
sshlog("auth2-pubkey.c", "userauth_pubkey", 0x132, 0x1, 0x6, 0x0, *(&v31), v32, *(&v33), *(&v34), *(&v35));
sshbuf_free(v8);
sshauthopt_free(v17);
sshkey_free(v9);
sshkey_free(v10);
free(v12);
free(v11);
free(v13);
free(v19);
free(v20);
free(v14);
sshkey_sig_details_free(v18);
return v3;
}
|
char *
indirection_level_string ()
{
register int i, j;
char *ps4;
char ps4_firstc[
16
+1];
int ps4_firstc_len, ps4_len, ineed, old;
ps4 = get_string_value ("PS4");
if (indirection_string == 0)
indirection_string = sh_xmalloc((indirection_stringsiz = 100), "print_cmd.c", 457);
indirection_string[0] = '\0';
if (ps4 == 0 || *ps4 == '\0')
return (indirection_string);
old = change_flag ('x', '+');
ps4 = decode_prompt_string (ps4);
if (old)
change_flag ('x', '-');
if (ps4 == 0 || *ps4 == '\0')
{
do { if (ps4) sh_xfree((ps4), "print_cmd.c", 470); } while (0);
return (indirection_string);
}
ps4_len = strnlen (ps4,
(__ctype_get_mb_cur_max ())
);
ps4_firstc_len = ((
(__ctype_get_mb_cur_max ())
> 1) ? mblen ((ps4), (ps4_len)) : 1);
if (ps4_firstc_len == 1 || ps4_firstc_len == 0 || ps4_firstc_len < 0)
{
ps4_firstc[0] = ps4[0];
ps4_firstc[ps4_firstc_len = 1] = '\0';
}
else
memcpy (ps4_firstc, ps4, ps4_firstc_len);
ineed = (ps4_firstc_len * indirection_level) + strlen (ps4);
if (ineed > indirection_stringsiz - 1)
{
indirection_stringsiz = ineed + 1;
indirection_string = sh_xrealloc((indirection_string), (indirection_stringsiz), "print_cmd.c", 495);
}
for (i = j = 0; ps4_firstc[0] && j < indirection_level && i < indirection_stringsiz - 1; i += ps4_firstc_len, j++)
{
if (ps4_firstc_len == 1)
indirection_string[i] = ps4_firstc[0];
else
memcpy (indirection_string+i, ps4_firstc, ps4_firstc_len);
}
for (j = ps4_firstc_len; *ps4 && ps4[j] && i < indirection_stringsiz - 1; i++, j++)
indirection_string[i] = ps4[j];
indirection_string[i] = '\0';
sh_xfree((ps4), "print_cmd.c", 510);
return (indirection_string);
}
| int indirection_level_string() {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
char *v4;
char v5;
unsigned int v7;
unsigned int v8;
void* v9;
char *v10;
v4 = get_string_value("PS4");
if (!indirection_string) {
indirection_stringsiz = 100;
indirection_string = sh_xmalloc(0x64, "print_cmd.c", 0x1c9);
}
*(indirection_string) = 0;
if (v4 && *(v4)) {
v1 = change_flag(0x78, 0x2b);
v4 = decode_prompt_string(v4);
if (v1)
change_flag(0x78, 0x2d);
if (v4 && *(v4)) {
v2 = strnlen(v4, __ctype_get_mb_cur_max());
if (__ctype_get_mb_cur_max() <= 1)
v7 = 1;
else
v7 = mblen(v4, v2);
v0 = v7;
if (v0 == 1 || !v0 || v0 < 0) {
v5 = *(v4);
v0 = 1;
(&v5)[v0] = 0;
} else {
memcpy(&v5, v4, v0);
}
v3 = strlen(v4) + v0 * indirection_level;
if (v3 >= indirection_stringsiz) {
indirection_stringsiz = v3 + 1;
indirection_string = sh_xrealloc(indirection_string, indirection_stringsiz, "print_cmd.c", 0x1ef);
}
v8 = 0;
for (v9 = 0; v5 && v8 < indirection_level && v9 < indirection_stringsiz - 1; v8 += 1) {
if (v0 != 1)
memcpy(indirection_string + v9, &v5, v0);
else
*(indirection_string + v9) = v5;
v9 = v0 + v9;
}
for (v10 = v0; *(v4) && *((v4 + v10)) && v9 < indirection_stringsiz - 1; v10 = v10 + 1) {
*(v9 + indirection_string) = *((v4 + v10));
v9 = v9 + 1;
}
*(v9 + indirection_string) = 0;
sh_xfree(v4, "print_cmd.c", 0x1fe);
v7 = indirection_string;
return v7;
}
if (v4)
sh_xfree(v4, "print_cmd.c", 0x1d6);
v7 = indirection_string;
return v7;
}
v7 = indirection_string;
return v7;
}
|
c_gets(EditLine *el, wchar_t *buf, const wchar_t *prompt)
{
ssize_t len;
wchar_t *cp = el->el_line.buffer, ch;
if (prompt) {
len = (ssize_t)wcslen(prompt);
(void)memcpy(cp, prompt, (size_t)len * sizeof(*cp));
cp += len;
}
len = 0;
for (;;) {
el->el_line.cursor = cp;
*cp = ' ';
el->el_line.lastchar = cp + 1;
re_refresh(el);
if (el_wgetc(el, &ch) != 1) {
ed_end_of_file(el, 0);
len = -1;
break;
}
switch (ch) {
case L'\b':
case 0177:
if (len == 0) {
len = -1;
break;
}
len--;
cp--;
continue;
case 0033:
case L'\r':
case L'\n':
buf[len] = ch;
break;
default:
if (len >= (ssize_t)(((size_t)1024) - 16))
terminal_beep(el);
else {
buf[len++] = ch;
*cp++ = ch;
}
continue;
}
break;
}
el->el_line.buffer[0] = '\0';
el->el_line.lastchar = el->el_line.buffer;
el->el_line.cursor = el->el_line.buffer;
return (int)len;
}
| long c_gets(long a1, long a2, const wchar_t *a3)
{
long v3;
_DWORD *v4;
int v7;
long v8;
void *dest;
unsigned long v10;
v10 = __readfsqword(0x28u);
dest = *(void **)(a1 + 80);
if ( a3 )
{
v8 = wcslen(a3);
memcpy(dest, a3, 4 * v8);
dest = (char *)dest + 4 * v8;
}
v8 = 0LL;
while ( 1 )
{
while ( 1 )
{
*(_QWORD *)(a1 + 88) = dest;
*(_DWORD *)dest = 32;
*(_QWORD *)(a1 + 96) = (char *)dest + 4;
re_refresh(a1);
if ( (unsigned int)el_wgetc(a1, &v7) != 1 )
{
ed_end_of_file(a1, 0LL);
v8 = -1LL;
goto LABEL_22;
}
if ( v7 != 127 )
break;
LABEL_15:
if ( !v8 )
{
v8 = -1LL;
goto LABEL_22;
}
--v8;
dest = (char *)dest - 4;
}
if ( v7 <= 127 )
{
if ( v7 == 27 )
goto LABEL_18;
if ( v7 <= 27 )
{
if ( v7 == 13 )
goto LABEL_18;
if ( v7 <= 13 )
break;
}
}
LABEL_19:
if ( v8 <= 1007 )
{
v3 = v8++;
*(_DWORD *)(a2 + 4 * v3) = v7;
v4 = dest;
dest = (char *)dest + 4;
*v4 = v7;
}
else
{
terminal_beep(a1);
}
}
if ( v7 == 8 )
goto LABEL_15;
if ( v7 != 10 )
goto LABEL_19;
LABEL_18:
*(_DWORD *)(a2 + 4 * v8) = v7;
LABEL_22:
**(_DWORD **)(a1 + 80) = 0;
*(_QWORD *)(a1 + 96) = *(_QWORD *)(a1 + 80);
*(_QWORD *)(a1 + 88) = *(_QWORD *)(a1 + 80);
return v8;
}
|
errcode_t e2fsck_rewrite_extent_tree(e2fsck_t ctx, struct extent_list *list)
{
struct ext2_inode_large inode;
blk64_t blk_count;
errcode_t err;
memset(&inode, 0, sizeof(inode));
err = ext2fs_read_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode),
sizeof(inode));
if (err)
return err;
if (inode.i_flags & 0x10000000)
return 0;
err = rewrite_extent_replay(ctx, list, &inode);
if (err)
return err;
err = ext2fs_count_blocks(ctx->fs, list->ino, EXT2_INODE(&inode),
&blk_count);
if (err)
return err;
err = ext2fs_iblk_set(ctx->fs, EXT2_INODE(&inode), blk_count);
if (err)
return err;
return ext2fs_write_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode),
sizeof(inode));
}
| long long e2fsck_rewrite_extent_tree(unsigned long long *a0, struct_0 *a1) {
char v0;
unsigned long long v1;
char v2;
char v3;
void* v5;
unsigned long long v7;
memset(&v2, 0x0, 0xa0);
v1 = ext2fs_read_inode_full(*(a0), a1->field_28, EXT2_INODE(&v2), 0xa0);
if (v1) {
v5 = v1;
} else if ((*(&v3) & 0x10000000)) {
v5 = 0;
} else {
v1 = rewrite_extent_replay(a0, a1, &v2);
if (v1) {
v5 = v1;
} else {
v1 = ext2fs_count_blocks(*(a0), a1->field_28, EXT2_INODE(&v2), &v0);
if (v1) {
v5 = v1;
} else {
v7 = EXT2_INODE(&v2);
v1 = ext2fs_iblk_set(*(a0), v7, *(&v0), v7);
if (v1)
v5 = v1;
else
v5 = ext2fs_write_inode_full(*(a0), a1->field_28, EXT2_INODE(&v2), 0xa0);
}
}
}
return v5;
}
|
int
xasprintf(char **ret, const char *fmt, ...)
{
va_list ap;
int i;
__builtin_va_start(
ap
,
fmt
)
;
i = xvasprintf(ret, fmt, ap);
__builtin_va_end(
ap
)
;
return i;
}
| long long xasprintf() {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
char v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
unsigned long v10;
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
int v17;
int v18;
unsigned long v19;
unsigned long v20;
unsigned long v21;
unsigned long v22;
unsigned long v23;
char v24;
int v25;
int v26;
int v27;
int v28;
int v29;
int v30;
int v31;
int v32;
unsigned long long *v33;
unsigned long long *v34;
char *v35;
v7 = v20;
v8 = v21;
v9 = v22;
v10 = v23;
if (v24) {
v11 = v25;
v12 = v26;
v13 = v27;
v14 = v28;
v15 = v29;
v16 = v30;
v17 = v31;
v18 = v32;
}
v5 = v33[5];
v1 = 16;
v2 = 48;
v3 = &v19;
v4 = &v6;
v0 = xvasprintf(v34, v35, &v1);
if (!(v5 ^ v33[5]))
return v0;
__stack_chk_fail();
}
|
static void
split_file (void)
{
for (idx_t i = 0; i < control_used; i++)
{
intmax_t j;
if (controls[i].regexpr)
{
for (j = 0; (controls[i].repeat_forever
|| j <= controls[i].repeat); j++)
process_regexp (&controls[i], j);
}
else
{
for (j = 0; (controls[i].repeat_forever
|| j <= controls[i].repeat); j++)
process_line_count (&controls[i], j);
}
}
create_output_file ();
dump_rest_of_file ();
close_output_file ();
}
| void split_file() {
void* v0;
void* v1;
unsigned long long v3;
for (v0 = 0; v0 < control_used; v0 += 1) {
if (!*((((v0 << 1) + v0 << 5) + controls + 30))) {
v1 = 0;
while (true) {
if (!*((((v0 << 1) + v0 << 5) + controls + 28)) && v1 > *((((v0 << 1) + v0 << 5) + controls + 16)))
break;
process_line_count(controls + v0 * 96, v1);
v1 += 1;
}
} else {
v1 = 0;
while (true) {
if (!*((((v0 << 1) + v0 << 5) + controls + 28)) && v1 > *((((v0 << 1) + v0 << 5) + controls + 16)))
break;
process_regexp(controls + v0 * 96, v1);
v1 += 1;
}
}
}
create_output_file();
dump_rest_of_file();
v3 = close_output_file();
return;
}
|
static void pqdownheap(tree, k)
ct_data *tree;
int k;
{
int v = heap[k];
int j = k << 1;
while (j <= heap_len) {
if (j < heap_len && (tree[heap[j+1]].fc.freq < tree[heap[j]].fc.freq || (tree[heap[j+1]].fc.freq == tree[heap[j]].fc.freq && depth[heap[j+1]] <= depth[heap[j]]))) j++;
if ((tree[v].fc.freq < tree[heap[j]].fc.freq || (tree[v].fc.freq == tree[heap[j]].fc.freq && depth[v] <= depth[heap[j]]))) break;
heap[k] = heap[j]; k = j;
j <<= 1;
}
heap[k] = v;
}
| void pqdownheap(unsigned short *a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v5;
v0 = a1;
v2 = heap[v0];
for (v1 = v0 * 2; v1 <= heap_len; v1 *= 2) {
if (v1 < heap_len && ([D] amd64g_calculate_condition(0x2<64>, 0x6<64>, Conv(16->64, Load(addr=(rdi<8> + (Conv(32->s64, Load(addr=stack_base-12, size=4, endness=Iend_LE)) << 0x2<8>)), size=2, endness=Iend_LE)), Conv(16->64, Load(addr=(rdi<8> + (Conv(32->s64, Load(addr=((Conv(32->s64, Load(addr=stack_base-16, size=4, endness=Iend_LE)) << 0x2<8>) + 0x402f00<64>), size=4, endness=Iend_LE)) << 0x2<8>)), size=2, endness=Iend_LE)), cc_ndep<8>) || *(heap[1 + v1] + &depth) <= *(heap[v1] + &depth) && a0[2 * heap[1 + v1]] == a0[2 * heap[v1]]))
v1 += 1;
if ([D] amd64g_calculate_condition(0x2<64>, 0x6<64>, Conv(16->64, Load(addr=(rdi<8> + (Conv(32->s64, Load(addr=stack_base-12, size=4, endness=Iend_LE)) << 0x2<8>)), size=2, endness=Iend_LE)), Conv(16->64, Load(addr=(rdi<8> + (Conv(32->s64, Load(addr=((Conv(32->s64, Load(addr=stack_base-16, size=4, endness=Iend_LE)) << 0x2<8>) + 0x402f00<64>), size=4, endness=Iend_LE)) << 0x2<8>)), size=2, endness=Iend_LE)), cc_ndep<8>))
break;
if (!([D] amd64g_calculate_condition(0x2<64>, 0x6<64>, Conv(16->64, Load(addr=(rdi<8> + (Conv(32->s64, Load(addr=stack_base-12, size=4, endness=Iend_LE)) << 0x2<8>)), size=2, endness=Iend_LE)), Conv(16->64, Load(addr=(rdi<8> + (Conv(32->s64, Load(addr=((Conv(32->s64, Load(addr=stack_base-16, size=4, endness=Iend_LE)) << 0x2<8>) + 0x402f00<64>), size=4, endness=Iend_LE)) << 0x2<8>)), size=2, endness=Iend_LE)), cc_ndep<8>)) && a0[2 * v2] == a0[2 * heap[v1]]) {
if (*(v2 + &depth) <= *(heap[v1] + &depth))
break;
}
heap[v0] = heap[v1];
v0 = v1;
}
v5 = v2;
heap[v0] = v2;
return;
}
|
static void p1p1_to_p3(crypto_sign_ed25519_ref_ge25519 *r, const ge25519_p1p1 *p)
{
p1p1_to_p2((ge25519_p2 *)r, p);
crypto_sign_ed25519_ref_fe25519_mul(&r->t, &p->x, &p->y);
}
| void p1p1_to_p3(unsigned long long a0, unsigned long long a1) {
unsigned long long v1;
p1p1_to_p2(a0, a1);
v1 = crypto_sign_ed25519_ref_fe25519_mul(a0 + 384, a1, a1 + 0x100, a0 + 384);
return;
}
|
static char *
find_field (struct linebuffer const *line)
{
size_t count;
char const *lp = line->buffer;
size_t size = line->length - 1;
size_t i = 0;
for (count = 0; count < skip_fields && i < size; count++)
{
while (i < size && field_sep (lp[i]))
i++;
while (i < size && !field_sep (lp[i]))
i++;
}
i +=
(((
skip_chars
)<(
size - i
))?(
skip_chars
):(
size - i
))
;
return line->buffer + i;
}
| int find_field(unsigned long long a0[3]) {
void* v0;
void* v1;
void* v2;
unsigned long v3;
unsigned long long v6;
v2 = a0[2];
v3 = a0[1] - 1;
v1 = 0;
v0 = 0;
while (true) {
if (v0 >= skip_fields)
break;
if (v1 >= v3)
break;
while (true) {
if (v1 >= v3)
break;
if (!field_sep(*((v1 + v2))))
break;
v1 += 1;
}
while (true) {
if (v1 >= v3)
break;
if (!(field_sep(*((v1 + v2))) ^ 1))
break;
v1 += 1;
}
v0 += 1;
}
v6 = skip_chars;
if (v3 - v1 <= skip_chars)
v6 = v3 - v1;
v1 += v6;
return v1 + a0[2];
}
|
static int
history_and_alias_expand_line (count, ignore)
int count, ignore;
{
char *new_line, *t;
new_line = 0;
new_line = history_expand_line_internal (rl_line_buffer);
if (new_line)
{
char *alias_line;
alias_line = alias_expand (new_line);
sh_xfree((new_line), "bashline.c", 2860);
new_line = alias_line;
}
if (new_line)
{
set_up_new_line (new_line);
return (0);
}
else
{
cleanup_expansion_error ();
return (1);
}
}
| bool history_and_alias_expand_line(void)
{
long lVar1;
long local_18;
lVar1 = history_expand_line_internal(rl_line_buffer);
local_18 = lVar1;
if (lVar1 != 0) {
local_18 = alias_expand(lVar1);
sh_xfree(lVar1,"bashline.c",0xb2c);
}
if (local_18 == 0) {
cleanup_expansion_error();
}
else {
set_up_new_line(local_18);
}
return local_18 == 0;
}
|
SHELL_VAR *
bind_global_variable (name, value, flags)
const char *name;
char *value;
int flags;
{
if (shell_variables == 0)
create_variable_tables ();
return (bind_variable_internal (name, value, global_variables->table, 0, flags));
}
| long bind_global_variable(const char *a1, char *a2, int a3)
{
if ( !shell_variables )
create_variable_tables();
return bind_variable_internal(a1, a2, *(_QWORD *)(global_variables + 32), 0, a3);
}
|
Channel *
channel_lookup(struct ssh *ssh, int id)
{
Channel *c;
if ((c = channel_by_id(ssh, id)) ==
((void *)0)
)
return
((void *)0)
;
switch (c->type) {
case 7:
case 10:
case 12:
case 13:
case 21:
case 22:
case 3:
case 4:
case 17:
case 20:
return c;
}
sshlog("channels.c", __func__, 295, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Non-public channel %d, type %d.", id, c->type);
return
((void *)0)
;
}
| unsigned int * channel_lookup(long a1, unsigned int a2)
{
unsigned int *result;
unsigned int *v3;
v3 = (unsigned int *)channel_by_id(a1, a2);
if ( !v3 )
return 0LL;
switch ( *v3 )
{
case 3u:
case 4u:
case 7u:
case 0xAu:
case 0xCu:
case 0xDu:
case 0x11u:
case 0x14u:
case 0x15u:
case 0x16u:
result = v3;
break;
default:
sshlog("channels.c", "channel_lookup", 295LL, 0LL, 3LL, 0LL, "Non-public channel %d, type %d.", a2, *v3);
result = 0LL;
break;
}
return result;
}
|
static int check_bb_inode_blocks(ext2_filsys fs,
blk_t *block_nr,
int blockcnt __attribute__((unused)),
void *priv_data __attribute__((unused)))
{
if (!*block_nr)
return 0;
if (*block_nr >= ext2fs_blocks_count(fs->super) ||
*block_nr < fs->super->s_first_data_block) {
printf((gettext ("Warning: illegal block %u found in bad block inode. " "Cleared.\n"))
, *block_nr);
*block_nr = 0;
return 1;
}
return 0;
}
| long check_bb_inode_blocks(long a1, unsigned int *a2)
{
unsigned long v3;
unsigned int v4;
char *v5;
if ( !*a2 )
return 0LL;
v3 = *a2;
if ( v3 < ext2fs_blocks_count(*(_QWORD *)(a1 + 32)) && *a2 >= *(_DWORD *)(*(_QWORD *)(a1 + 32) + 20LL) )
return 0LL;
v4 = *a2;
v5 = gettext("Warning: illegal block %u found in bad block inode. Cleared.\n");
printf(v5, v4);
*a2 = 0;
return 1LL;
}
|
static inline __u16 rta_getattr_u16(const struct rtattr *rta)
{
return *(__u16 *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| int rta_getattr_u16(struct_0 *a0) {
return a0->field_4;
}
|
static void cfg_exclude_free(struct cfg_exclude *exc)
{
free(exc);
}
| void cfg_exclude_free(void *param_1)
{
free(param_1);
return;
}
|
static
void default_bzfree ( void* opaque, void* addr )
{
if (addr !=
((void *)0)
) free ( addr );
}
| long long default_bzfree(unsigned long a0, void* a1) {
unsigned long v0;
v0 = a0;
return free(a1);
}
|
int
sshbuf_set_parent(struct sshbuf *child, struct sshbuf *parent)
{
int r;
if ((r = sshbuf_check_sanity(child)) != 0 ||
(r = sshbuf_check_sanity(parent)) != 0)
return r;
if (child->parent !=
((void *)0)
&& child->parent != parent)
return -1;
child->parent = parent;
child->parent->refcount++;
return 0;
}
| int sshbuf_set_parent(struct_0 *a0, unsigned long long a1) {
unsigned int v0;
unsigned int v2;
v0 = sshbuf_check_sanity(a0);
if (!v0) {
v0 = sshbuf_check_sanity(a1);
if (!v0) {
if (a0->field_40 && a1 != a0->field_40) {
v2 = -1;
return v2;
}
a0->field_40 = a1;
a0->field_40->field_38 = a0->field_40->field_38 + 1;
v2 = 0;
return v2;
}
}
v2 = v0;
return v2;
}
|
void mark_buffer_dirty(struct buffer_head *bh)
{
bh->b_dirty = 1;
}
| void mark_buffer_dirty(struct_0 *a0) {
char v0;
struct_0 *v2;
unsigned long long v3;
v2 = a0;
a0->field_18 = a0->field_18 | 1;
v3 = *(&v0);
return;
}
|
search_end(EditLine *el)
{
free(el->el_search.patbuf);
el->el_search.patbuf =
((void *)0)
;
}
| long long search_end(struct_0 *a0) {
free(a0->field_498);
a0->field_498 = 0;
return a0;
}
|
static void
users (char const *filename, int options)
{
size_t n_users;
STRUCT_UTMP *utmp_buf;
if (read_utmp (filename, &n_users, &utmp_buf, options) != 0)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, filename)), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, filename)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, filename)), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
list_entries_users (n_users, utmp_buf);
free (utmp_buf);
}
| void users(unsigned long long a0, unsigned long a1) {
char v0;
char v1;
char v2;
unsigned long long v4;
unsigned long long *v5;
unsigned long long v6;
if (read_utmp(a0, &v0, &v1, a1)) {
v4 = quotearg_n_style_colon(0x0, 0x3, a0);
error(0x1, *(__errno_location()), "%s");
}
list_entries_users(*(&v0), *(&v1));
free(*(&v1));
v6 = *(&v2) ^ v5[5];
return;
}
|
static double
file_sparseness (const struct stat *p)
{
if (0 == p->st_size)
{
if (0 == ((*p).st_blocks))
return 1.0;
else
return ((*p).st_blocks) < 0 ? -
(__builtin_huge_val ())
:
(__builtin_huge_val ())
;
}
else
{
double blklen =
512
* (double)((*p).st_blocks);
return blklen / p->st_size;
}
}
| double file_sparseness(long a1)
{
if ( *(_QWORD *)(a1 + 48) )
return 512.0 * (double)(int)*(_QWORD *)(a1 + 64) / (double)(int)*(_QWORD *)(a1 + 48);
if ( !*(_QWORD *)(a1 + 64) )
return 1.0;
if ( *(long *)(a1 + 64) >= 0 )
return INFINITY;
return -INFINITY;
}
|
void
sh_getopt_dispose_istate (gs)
sh_getopt_state_t *gs;
{
sh_xfree((gs), "getopt.c", 239);
}
| void sh_getopt_dispose_istate(unsigned long long a0) {
unsigned long long v1;
v1 = sh_xfree(a0, "getopt.c", 0xef);
return;
}
|
static inline struct dirent const *
readdir_ignoring_dot_and_dotdot (DIR *dirp)
{
while (
1
)
{
struct dirent const *dp = readdir (dirp);
if (dp ==
((void *)0)
|| ! dot_or_dotdot (dp->d_name))
return dp;
}
}
| int readdir_ignoring_dot_and_dotdot(unsigned long long a0) {
unsigned long v0;
while (true) {
v0 = readdir(a0);
if (!v0)
break;
if ((dot_or_dotdot(v0 + 19) ^ 1))
break;
}
return v0;
}
|
static void
channel_post_auth_listener(struct ssh *ssh, Channel *c)
{
Channel *nc;
int r, newsock;
struct sockaddr_storage addr;
socklen_t addrlen;
if ((c->io_ready & 0x10) == 0)
return;
addrlen = sizeof(addr);
newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen);
if (newsock == -1) {
sshlog("channels.c", __func__, 1850, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "accept from auth socket: %.100s", strerror(
(*__errno_location ())
));
if (
(*__errno_location ())
==
24
||
(*__errno_location ())
==
23
)
c->notbefore = monotime() + 1;
return;
}
nc = channel_new(ssh, "accepted auth socket",
3, newsock, newsock, -1,
c->local_window_max, c->local_maxpacket,
0, "accepted auth socket", 1);
open_preamble(ssh, __func__, nc, "auth-agent@openssh.com");
if ((r = sshpkt_send(ssh)) != 0)
sshfatal("channels.c", __func__, 1861, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i", c->self);
}
| long long channel_post_auth_listener(void* a0, struct_0 *a1) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
void* v4;
char v5;
unsigned int v7;
if ((a1->field_30 & 16)) {
v1 = 128;
v2 = accept(a1->field_28, &v5, &v1);
if (v2 == -1) {
v0 = strerror(*(__errno_location()));
sshlog("channels.c", "channel_post_auth_listener", 0x73a, 0x0, 0x2, 0x0, "accept from auth socket: %.100s");
v7 = *(__errno_location());
if (*(__errno_location()) == 23 || v7 == 24)
a1->field_58 = __addvdi3(monotime(), 0x1);
} else {
v4 = channel_new(a0, "accepted auth socket", 0x3, v2, v2, 0xffffffff, a1->field_b4, a1->field_bc, 0x0, "accepted auth socket", 0x1);
open_preamble(a0, "channel_post_auth_listener", v4, "auth-agent@openssh.com");
v3 = sshpkt_send(a0);
if (v3) {
v0 = a1->field_4;
sshfatal("channels.c", "channel_post_auth_listener", 0x745, 0x1, 0x1, ssh_err(v3));
}
}
}
return 0;
}
|
const char *
atoi_err(const char *nptr, int *val)
{
const char *errstr =
((void *)0)
;
long long num;
if (nptr ==
((void *)0)
|| *nptr == '\0')
return "missing";
num = strtonum(nptr, 0, 0x7fffffff, &errstr);
if (errstr ==
((void *)0)
)
*val = (int)num;
return errstr;
}
| const char * atoi_err(_BYTE *a1, _DWORD *a2)
{
long v3;
long v4;
unsigned long v5;
v5 = __readfsqword(0x28u);
v3 = 0LL;
if ( !a1 || !*a1 )
return "missing";
v4 = strtonum(a1, 0LL, 0x7FFFFFFFLL, &v3);
if ( !v3 )
*a2 = v4;
return (const char *)v3;
}
|
static void print_ila_locid(const char *tag, int attr, struct rtattr *tb[])
{
char abuf[256];
if (tb[attr])
print_addr64(rta_getattr_u64(tb[attr]),
abuf, sizeof(abuf));
else
snprintf(abuf, sizeof(abuf), "-");
print_string(PRINT_ANY, tag, "%-20s", abuf);
}
| void print_ila_locid(unsigned long long a0, unsigned long a1, unsigned long long *a2) {
char v0;
char v1;
unsigned long long *v3;
unsigned long long v4;
if (!a2[a1])
snprintf(&v0, 0x100, "-");
else
print_addr64(rta_getattr_u64(a2[a1]), &v0, 0x100);
print_string(0x4, a0, "%-20s", &v0);
v4 = *(&v1) ^ v3[5];
return;
}
|
static
_Bool
process_file (FTS *fts, FTSENT *ent)
{
char const *file_full_name = ent->fts_path;
char const *file = ent->fts_accpath;
const struct stat *file_stats = ent->fts_statp;
_Bool
ok =
1
;
switch (ent->fts_info)
{
case 1:
if (recurse)
{
if ((root_dev_ino && ((*ent->fts_statp).st_ino == (*root_dev_ino).st_ino && (*ent->fts_statp).st_dev == (*root_dev_ino).st_dev)))
{
do { if ((strcmp (file_full_name, "/") == 0)) error (0, 0, gettext ("it is dangerous to operate recursively on %s"), quotearg_style (shell_escape_always_quoting_style, file_full_name)); else error (0, 0, gettext ("it is dangerous to operate recursively on %s (same as %s)"), quotearg_n_style (0, shell_escape_always_quoting_style, file_full_name), quotearg_n_style (1, shell_escape_always_quoting_style, "/")); error (0, 0, gettext ("use --no-preserve-root to override this failsafe")); } while (0);
rpl_fts_set (fts, ent, 4);
(__extension__ ({ __typeof__ (rpl_fts_read (fts)) __x = (rpl_fts_read (fts)); (void) __x; }));
return
0
;
}
return
1
;
}
break;
case 6:
if (! recurse)
return
1
;
break;
case 10:
if (ent->fts_level == 0 && ent->fts_number == 0)
{
ent->fts_number = 1;
rpl_fts_set (fts, ent, 1);
return
1
;
}
error (0, ent->fts_errno, gettext ("cannot access %s"),
quotearg_style (shell_escape_always_quoting_style, file_full_name));
ok =
0
;
break;
case 7:
error (0, ent->fts_errno, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, file_full_name));
ok =
0
;
break;
case 4:
error (0, ent->fts_errno, gettext ("cannot read directory %s"),
quotearg_style (shell_escape_always_quoting_style, file_full_name));
ok =
0
;
break;
case 2:
if (cycle_warning_required (fts, ent))
{
do { error (0, 0, gettext ("WARNING: Circular directory structure.\nThis almost certainly means that you have a corrupted file system.\nNOTIFY YOUR SYSTEM MANAGER.\nThe following directory is part of the cycle:\n %s\n"), quotearg_n_style_colon (0, shell_escape_quoting_style, file_full_name)); } while (0);
return
0
;
}
break;
default:
break;
}
if (ent->fts_info == 6
&& ok && (root_dev_ino && ((*file_stats).st_ino == (*root_dev_ino).st_ino && (*file_stats).st_dev == (*root_dev_ino).st_dev)))
{
do { if ((strcmp (file_full_name, "/") == 0)) error (0, 0, gettext ("it is dangerous to operate recursively on %s"), quotearg_style (shell_escape_always_quoting_style, file_full_name)); else error (0, 0, gettext ("it is dangerous to operate recursively on %s (same as %s)"), quotearg_n_style (0, shell_escape_always_quoting_style, file_full_name), quotearg_n_style (1, shell_escape_always_quoting_style, "/")); error (0, 0, gettext ("use --no-preserve-root to override this failsafe")); } while (0);
ok =
0
;
}
if (ok)
{
if (verbose)
printf (gettext ("changing security context of %s\n"),
quotearg_style (shell_escape_always_quoting_style, file_full_name));
if (change_file_context (fts->fts_cwd_fd, file) != 0)
ok =
0
;
}
if ( ! recurse)
rpl_fts_set (fts, ent, 4);
return ok;
}
| long process_file(long a1, long a2)
{
long v2;
char *v3;
long v4;
long v5;
char *v6;
char *v7;
long result;
long v9;
char *v10;
const char *v11;
long v12;
char *v13;
long v14;
char *v15;
long v16;
char *v17;
long v18;
long v19;
char *v20;
char *v21;
long v22;
char *v23;
unsigned char v24;
char *s1;
long v26;
s1 = *(char **)(a2 + 56);
v26 = *(_QWORD *)(a2 + 48);
v24 = 1;
switch ( *(_WORD *)(a2 + 104) )
{
case 1:
if ( !recurse )
goto LABEL_21;
if ( !root_dev_ino
|| *(_QWORD *)(a2 + 120) != *(_QWORD *)root_dev_ino
|| *(_QWORD *)(a2 + 112) != *(_QWORD *)(root_dev_ino + 8) )
{
return 1LL;
}
if ( !strcmp(s1, "/") )
{
v2 = quotearg_style(4LL, s1);
v3 = gettext("it is dangerous to operate recursively on %s");
error(0, 0, v3, v2);
}
else
{
v4 = quotearg_n_style(1LL, 4LL, "/");
v5 = quotearg_n_style(0LL, 4LL, s1);
v6 = gettext("it is dangerous to operate recursively on %s (same as %s)");
error(0, 0, v6, v5, v4);
}
v7 = gettext("use --no-preserve-root to override this failsafe");
error(0, 0, v7);
rpl_fts_set(a1, a2, 4LL);
rpl_fts_read(a1);
return 0LL;
case 2:
if ( !(unsigned char)cycle_warning_required(a1, a2) )
goto LABEL_21;
v14 = quotearg_n_style_colon(0LL, 3LL, s1);
v15 = gettext(
"WARNING: Circular directory structure.\n"
"This almost certainly means that you have a corrupted file system.\n"
"NOTIFY YOUR SYSTEM MANAGER.\n"
"The following directory is part of the cycle:\n"
" %s\n");
error(0, 0, v15, v14);
return 0LL;
case 4:
v12 = quotearg_style(4LL, s1);
v13 = gettext("cannot read directory %s");
error(0, *(_DWORD *)(a2 + 64), v13, v12);
v24 = 0;
goto LABEL_21;
case 6:
if ( recurse == 1 )
goto LABEL_21;
result = 1LL;
break;
case 7:
v11 = (const char *)quotearg_n_style_colon(0LL, 3LL, s1);
error(0, *(_DWORD *)(a2 + 64), "%s", v11);
v24 = 0;
goto LABEL_21;
case 0xA:
if ( *(_QWORD *)(a2 + 88) || *(_QWORD *)(a2 + 32) )
{
v9 = quotearg_style(4LL, s1);
v10 = gettext("cannot access %s");
error(0, *(_DWORD *)(a2 + 64), v10, v9);
v24 = 0;
LABEL_21:
if ( *(_WORD *)(a2 + 104) == 6
&& v24
&& root_dev_ino
&& *(_QWORD *)(a2 + 120) == *(_QWORD *)root_dev_ino
&& *(_QWORD *)(a2 + 112) == *(_QWORD *)(root_dev_ino + 8) )
{
if ( !strcmp(s1, "/") )
{
v16 = quotearg_style(4LL, s1);
v17 = gettext("it is dangerous to operate recursively on %s");
error(0, 0, v17, v16);
}
else
{
v18 = quotearg_n_style(1LL, 4LL, "/");
v19 = quotearg_n_style(0LL, 4LL, s1);
v20 = gettext("it is dangerous to operate recursively on %s (same as %s)");
error(0, 0, v20, v19, v18);
}
v21 = gettext("use --no-preserve-root to override this failsafe");
error(0, 0, v21);
v24 = 0;
}
if ( v24 )
{
if ( verbose )
{
v22 = quotearg_style(4LL, s1);
v23 = gettext("changing security context of %s\n");
printf(v23, v22);
}
if ( (unsigned int)change_file_context(*(_DWORD *)(a1 + 44), v26) )
v24 = 0;
}
if ( recurse != 1 )
rpl_fts_set(a1, a2, 4LL);
result = v24;
}
else
{
*(_QWORD *)(a2 + 32) = 1LL;
rpl_fts_set(a1, a2, 1LL);
result = 1LL;
}
break;
default:
goto LABEL_21;
}
return result;
}
|
void
platform_pre_listen(void)
{
oom_adjust_setup();
}
| long long platform_pre_listen() {
return oom_adjust_setup();
}
|
int compress(dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
{
return compress2(dest, destLen, source, sourceLen, (-1));
}
| long compress(long a1, unsigned long *a2, long a3, unsigned long a4)
{
return compress2(a1, a2, a3, a4, 0xFFFFFFFF);
}
|
int
strvis(char *mbdst, const char *mbsrc, int flags)
{
return istrsenvisxl(mbdst,
((void *)0)
, mbsrc, flags, "",
((void *)0)
);
}
| long long strvis(unsigned long a0, char *a1, unsigned long a2) {
return istrsenvisxl(a0, NULL, a1, a2, &g_4018dc, NULL);
}
|
struct fsys_namenode_list *
tar_fsys_namenode_queue_push(struct fsys_namenode_queue *queue,
struct fsys_namenode *namenode)
{
struct fsys_namenode_list *node;
node = tar_pool_alloc(sizeof(*node));
node->namenode = namenode;
node->next =
((void *)0)
;
*queue->tail = node;
queue->tail = &node->next;
return node;
}
| int tar_fsys_namenode_queue_push(struct_0 *a0, unsigned long a1) {
unsigned long long v0[2];
v0[0] = tar_pool_alloc(0x10);
v0[1] = a1;
v0[0] = 0;
a0->field_8->field_0 = v0;
a0->field_8 = &v0[0];
return v0;
}
|
static char const *
trim_leading_zeros (char const *s)
{
char const *p = s;
while (*s == '0')
++s;
if (!*s && s != p)
--s;
return s;
}
| _BYTE * trim_leading_zeros(_BYTE *a1)
{
_BYTE *i;
for ( i = a1; *i == 48; ++i )
;
if ( !*i && i != a1 )
--i;
return i;
}
|
static
_Bool
try_purge_directory (char const *directory_name)
{
char *current_dir;
char *cur, *arc, *p;
char *temp_stub =
((void *)0)
;
struct dumpdir *dump;
if (!is_dumpdir (¤t_stat_info))
return
0
;
current_dir = tar_savedir (directory_name, 0);
if (!current_dir)
return
0
;
if (!dumpdir_ok (current_stat_info.dumpdir))
return
0
;
for (arc = current_stat_info.dumpdir; *arc; arc += strlen (arc) + 1)
{
if (*arc == 'X')
{
size_t len = strlen (arc + 1);
temp_stub = xrealloc (temp_stub, len + 1 + sizeof "tar.XXXXXX");
memcpy (temp_stub, arc + 1, len);
temp_stub[len] = '/';
memcpy (temp_stub + len + 1, "tar.XXXXXX",
sizeof "tar.XXXXXX");
if (!mkdtemp (temp_stub))
{
do { if (error_hook) error_hook (); error (0,
(*__errno_location ())
, gettext ("Cannot create temporary directory using template %s"), quote (temp_stub)); exit_status = 2; } while (0)
;
free (temp_stub);
free (current_dir);
return
0
;
}
}
else if (*arc == 'R')
{
char *src, *dst;
src = arc + 1;
arc += strlen (arc) + 1;
dst = arc + 1;
if (*src)
src = safer_name_suffix (src,
0
, absolute_names_option);
if (*dst)
dst = safer_name_suffix (dst,
0
, absolute_names_option);
if (*src == 0)
src = temp_stub;
else if (*dst == 0)
dst = temp_stub;
if (!rename_directory (src, dst))
{
free (temp_stub);
free (current_dir);
return
0
;
}
}
}
free (temp_stub);
dump = dumpdir_create (current_stat_info.dumpdir);
p =
((void *)0)
;
for (cur = current_dir; *cur; cur += strlen (cur) + 1)
{
const char *entry;
struct stat st;
free (p);
p = make_file_name (directory_name, cur);
if (deref_stat (p, &st) != 0)
{
if (
(*__errno_location ())
!=
2
)
{
stat_diag (p);
do { if (error_hook) error_hook (); error (0, 0, gettext ("%s: Not purging directory: unable to stat"), quotearg_colon (p)); } while (0)
;
}
continue;
}
if (!(entry = dumpdir_locate (dump, cur))
|| (*entry == 'D' && !
((((
st.st_mode
)) & 0170000) == (0040000))
)
|| (*entry == 'Y' &&
((((
st.st_mode
)) & 0170000) == (0040000))
))
{
if (one_file_system_option && st.st_dev != root_device)
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("%s: directory is on a different device: not purging"), quotearg_colon (p)); } while (0)
;
continue;
}
if (! interactive_option || confirm ("delete", p))
{
if (verbose_option)
fprintf (stdlis, gettext ("%s: Deleting %s\n"),
program_name, quote (p));
if (! remove_any_file (p, RECURSIVE_REMOVE_OPTION))
{
int e =
(*__errno_location ())
;
do { if (error_hook) error_hook (); error (0, e, gettext ("%s: Cannot remove"), quotearg_colon (p)); exit_status = 2; } while (0);
}
}
}
}
free (p);
dumpdir_free (dump);
free (current_dir);
return
1
;
}
| int try_purge_directory(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
char *v1;
char *v2;
void* v3;
void* v4;
void* v5;
void* v6;
unsigned long v7;
void* v8;
char *v9;
char *v10;
char v11;
char v12;
unsigned int v15;
unsigned long long v17;
unsigned long long v18;
unsigned long long v19;
unsigned long long v20;
unsigned long long v21;
v4 = 0;
if ((is_dumpdir(¤t_stat_info, a1, a2, a3, a4, a5) ^ 1)) {
v15 = 0;
} else {
v7 = tar_savedir(a0, 0x0);
if (!v7) {
v15 = 0;
} else {
v15 = dumpdir_ok(*(5244192)) ^ 1;
if (v15) {
v15 = 0;
} else {
v2 = *(5244192);
while (true) {
switch (*(v2)) {
case 0:
free(v4);
v8 = dumpdir_create(*(5244192));
v3 = 0;
for (v1 = v7; *(v1); v1 = &v1[v15]) {
free(v3);
v3 = make_file_name(a0, v1, v1);
if (deref_stat(v3, &v11, &v11)) {
v15 = *(__errno_location());
if (v15 != 2) {
stat_diag(v3);
if (*(&error_hook))
*(5243072)();
v17 = quotearg_colon(v3);
error(0x0, 0x0, gettext("%s: Not purging directory: unable to stat"));
}
} else {
v9 = dumpdir_locate(v8, v1);
if (!v9 || *(v9) == 68 && (*(&v12) & 0xf000) != 0x4000 || *(v9) == 89 && (*(&v12) & 0xf000) == 0x4000) {
if (!(!one_file_system_option || *(&v11) == root_device)) {
if (*(&error_hook))
*(5243072)();
v18 = quotearg_colon(v3);
error(0x0, 0x0, gettext("%s: directory is on a different device: not purging"));
} else if ((interactive_option ^ 1) || confirm("delete", v3)) {
if (verbose_option) {
v19 = quote(v3);
fprintf(stdlis, gettext("%s: Deleting %s\n"));
}
if (!remove_any_file(v3, 0x1)) {
v0 = *(__errno_location());
if (*(&error_hook))
*(5243072)();
v20 = quotearg_colon(v3);
error(0x0, v0, gettext("%s: Cannot remove"));
exit_status = 2;
}
}
}
}
v15 = strlen(v1) + 1;
}
free(v3);
dumpdir_free(v8);
free(v7);
v15 = 1;
break;
case 88:
v10 = strlen(v2 + 1);
v4 = xrealloc(v4, v10 + 12, v10 + 12);
memcpy(v4, v2 + 1, v10);
*((v10 + v4)) = 47;
memcpy(v4 + v10 + 1, "tar.XXXXXX", 0xb);
if (!mkdtemp(v4)) {
if (*(&error_hook))
*(5243072)();
v21 = quote(v4);
error(0x0, *(__errno_location()), gettext("Cannot create temporary directory using template %s"));
exit_status = 2;
free(v4);
free(v7);
v15 = 0;
break;
}
case 82:
v5 = v2 + 1;
v2 = &v2[1 + strlen(v2)];
v6 = v2 + 1;
if (*(v5))
v5 = safer_name_suffix(v5, 0x0, absolute_names_option);
if (*(v6))
v6 = safer_name_suffix(v6, 0x0, absolute_names_option);
if (!*(v5)) {
v5 = v4;
} else if (!*(v6)) {
v6 = v4;
}
if ((rename_directory(v5, v6, v6) ^ 1)) {
free(v4);
free(v7);
v15 = 0;
break;
}
default:
v15 = strlen(v2) + 1;
v2 = &v2[v15];
continue;
}
}
}
}
}
return v15;
}
|
static
_Bool
check_name_arg (const char *pred, const char *alt, const char *arg)
{
if (should_issue_warnings () && strchr (arg, '/'))
{
error (0, 0,
gettext ("warning: %s matches against basenames only, " "but the given pattern contains a directory separator (%s), " "thus the expression will evaluate to false all the time. " "Did you mean %s?")
,
safely_quote_err_filename (0, pred),
safely_quote_err_filename (1, "/"),
safely_quote_err_filename (2, alt));
}
return
1
;
}
| int check_name_arg(unsigned long long a0, unsigned long long a1, char *a2) {
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
if (should_issue_warnings() && strchr(a2, 0x2f)) {
v3 = safely_quote_err_filename(0x2, a1);
v4 = safely_quote_err_filename(0x1, "/");
v5 = safely_quote_err_filename(0x0, a0);
error(0x0, 0x0, gettext("warning: %s matches against basenames only, but the given pattern contains a directory separator (%s), thus the expression will evaluate to false all the time. Did you mean %s?"));
}
return 1;
}
|
static int
synchronize_output (void)
{
int exit_status = 0;
int mask = conversions_mask;
conversions_mask &= ~ (C_FDATASYNC | C_FSYNC);
if ((mask & C_FDATASYNC) && ifdatasync (
1
) != 0)
{
if (
(*__errno_location ())
!=
38
&&
(*__errno_location ())
!=
22
)
{
nl_error (0,
(*__errno_location ())
, gettext ("fdatasync failed for %s"), quotearg_style (shell_escape_always_quoting_style, output_file));
exit_status =
1
;
}
mask |= C_FSYNC;
}
if ((mask & C_FSYNC) && ifsync (
1
) != 0)
{
nl_error (0,
(*__errno_location ())
, gettext ("fsync failed for %s"), quotearg_style (shell_escape_always_quoting_style, output_file));
return
1
;
}
return exit_status;
}
| long synchronize_output()
{
int v0;
long v1;
char *v2;
int *v3;
long v4;
long v5;
long v6;
char *v7;
int *v8;
long v9;
long v10;
unsigned int v12;
short v13;
v12 = 0;
v13 = conversions_mask;
v0 = conversions_mask;
BYTE1(v0) = BYTE1(conversions_mask) & 0x3F;
conversions_mask = v0;
if ( (v13 & 0x4000) != 0 && (unsigned int)ifdatasync(1) )
{
if ( *_errno_location() != 38 && *_errno_location() != 22 )
{
v1 = quotearg_style(4LL, output_file);
v2 = gettext("fdatasync failed for %s");
v3 = _errno_location();
nl_error(0, *v3, (long)v2, v1, v4, v5);
v12 = 1;
}
v13 |= 0x8000u;
}
if ( (v13 & 0x8000) == 0 || !(unsigned int)ifsync(1) )
return v12;
v6 = quotearg_style(4LL, output_file);
v7 = gettext("fsync failed for %s");
v8 = _errno_location();
nl_error(0, *v8, (long)v7, v6, v9, v10);
return 1LL;
}
|
static void
simple_flush_read (void)
{
size_t status;
checkpoint_run (
0
);
read_error_count = 0;
if (write_archive_to_stdout && record_start_block != 0)
{
archive =
1
;
status = sys_write_archive_buffer ();
archive =
0
;
if (status != record_size)
archive_write_error (status);
}
for (;;)
{
status = (((archive) >= (1 << 30)) ? rmt_read__ (archive - (1 << 30), record_start->buffer, record_size) : safe_read (archive, record_start->buffer, record_size));
if (status == record_size)
{
records_read++;
return;
}
if (status == ((size_t) -1))
{
archive_read_error ();
continue;
}
break;
}
short_read (status);
}
| long long simple_flush_read(unsigned int a0, unsigned long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned long long v0;
unsigned long long v2;
unsigned long long v3;
checkpoint_run(0x0);
read_error_count = 0;
if (record_start_block) {
archive = 1;
v0 = sys_write_archive_buffer();
archive = 0;
if (v0 != record_size)
archive_write_error(v0);
}
if (!record_start_block || v0 == record_size) {
while (true) {
if (archive > 1073741823)
v2 = rmt_read__(archive - 0x40000000, 0xe87d894830ec8348, record_size, archive - 0x40000000);
else
v2 = safe_read(archive, 0xe87d894830ec8348, record_size, 0xe87d894830ec8348);
v0 = v2;
if (v0 == record_size) {
v3 = 16752697132039570249;
continued_file_offset = 16752697132039570249;
break;
} else if (v0 == -1) {
archive_read_error(a0, 0x30ec8348, a2, a3, a4, a5);
} else {
v3 = short_read(v0, 0xe87d894830ec8348, a2, a3, a4, a5);
break;
}
}
return v3;
}
}
|
static void
rl_display_search (char *search_string, int flags, int where)
{
char *message;
int msglen, searchlen;
searchlen = (search_string && *search_string) ? strlen (search_string) : 0;
message = (char *)xmalloc (searchlen + 64);
msglen = 0;
message[msglen++] = '(';
if (flags & 0x04)
{
strcpy (message + msglen, "failed ");
msglen += 7;
}
if (flags & 0x01)
{
strcpy (message + msglen, "reverse-");
msglen += 8;
}
strcpy (message + msglen, "i-search)`");
msglen += 10;
if (search_string && *search_string)
{
strcpy (message + msglen, search_string);
msglen += searchlen;
}
else
_rl_optimize_redisplay ();
strcpy (message + msglen, "': ");
rl_message ("%s", message);
xfree (message);
}
| long rl_display_search(const char *a1, char a2)
{
int v2;
char *v3;
int v6;
int v7;
int v8;
long v9;
if ( a1 && *a1 )
v2 = strlen(a1);
else
v2 = 0;
v8 = v2;
v9 = xmalloc(v2 + 64);
v6 = 1;
*(_BYTE *)v9 = 40;
if ( (a2 & 4) != 0 )
{
strcpy((char *)(v9 + 1), "failed ");
v6 = 8;
}
if ( (a2 & 1) != 0 )
{
strcpy((char *)(v6 + v9), "reverse-");
v6 += 8;
}
v3 = (char *)(v6 + v9);
strcpy(v3, "i-search)`");
v7 = v6 + 10;
if ( a1 && *a1 )
{
strcpy((char *)(v9 + v7), a1);
v7 += v8;
}
else
{
rl_optimize_redisplay(v3);
}
strcpy((char *)(v7 + v9), "': ");
rl_message("%s", (const char *)v9);
return xfree(v9);
}
|
void
outmem(const char *p, size_t len, struct output *dest)
{
size_t bufsize;
size_t offset;
size_t nleft;
nleft = dest->end - dest->nextc;
if (__builtin_expect(!!(nleft >= len),1)) {
buffered:
dest->nextc = mempcpy(dest->nextc, p, len);
return;
}
bufsize = dest->bufsize;
if (!bufsize) {
;
} else if (dest->buf ==
((void *)0)
) {
offset = 0;
({ suppressint++; ({ __asm__ __volatile__ ("": : :"memory"); }); 0; });
dest->buf = ckrealloc(dest->buf, bufsize);
dest->bufsize = bufsize;
dest->end = dest->buf + bufsize;
dest->nextc = dest->buf + offset;
({ ({ __asm__ __volatile__ ("": : :"memory"); }); if (--suppressint == 0 && intpending) onint(); 0; });
} else {
flushout(dest);
}
nleft = dest->end - dest->nextc;
if (nleft > len)
goto buffered;
if ((xwrite(dest->fd, p, len))) {
dest->flags |= 01;
}
}
| void outmem(void* a0, unsigned int a1, struct_0 *a2) {
struct_0 *v0;
unsigned long v1;
unsigned long long v2;
void* v3;
struct_0 *v7;
v0 = a2;
v1 = a2->field_8 - a2->field_0;
if (a1 > v1) {
v2 = a2->field_18;
if (v2) {
if (a2->field_10) {
flushout(a2);
} else {
v3 = 0;
suppressint = suppressint + 1;
a2->field_10 = ckrealloc(a2->field_10, v2, v2);
a2->field_18 = v2;
a2->field_8 = a2->field_10 + v2;
a2->field_0 = a2->field_10 + v3;
suppressint = suppressint - 1;
if (!suppressint && intpending) {
onint();
flushout(a2);
}
}
}
v1 = a2->field_8 - a2->field_0;
if (v1 <= a1) {
if (!xwrite(a2->field_20, a0, a1))
return;
v7 = a2;
a2->field_24 = a2->field_24 | 1;
return;
}
}
a2->field_0 = mempcpy(a2->field_0, a0, a1);
return;
}
|
static void dane_info(const char *host, const char *proto,
const char *service, unsigned int ca,
unsigned int domain, common_info_st * cinfo)
{
gnutls_pubkey_t pubkey;
gnutls_x509_crt_t crt;
unsigned char digest[64];
gnutls_datum_t t;
int ret;
unsigned int usage, selector, type;
size_t size;
int port = service_to_port(service, proto);
if (proto ==
((void *)0)
)
proto = "tcp";
crt = load_cert(0, cinfo);
if (crt !=
((void *)0)
&& danetool_options.present.x509) {
selector = 0;
size = lbuffer_size;
ret =
gnutls_x509_crt_export(crt, GNUTLS_X509_FMT_DER,
lbuffer, &size);
if (ret < 0) {
fprintf(
stderr
, "export error: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
gnutls_x509_crt_deinit(crt);
} else {
selector = 1;
ret = gnutls_pubkey_init(&pubkey);
if (ret < 0) {
fprintf(
stderr
, "pubkey_init: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (crt !=
((void *)0)
) {
ret = gnutls_pubkey_import_x509(pubkey, crt, 0);
if (ret < 0) {
fprintf(
stderr
, "pubkey_import_x509: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
size = lbuffer_size;
ret =
gnutls_pubkey_export(pubkey,
GNUTLS_X509_FMT_DER,
lbuffer, &size);
if (ret < 0) {
fprintf(
stderr
, "pubkey_export: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
gnutls_x509_crt_deinit(crt);
} else {
pubkey = load_pubkey(1, cinfo);
size = lbuffer_size;
ret =
gnutls_pubkey_export(pubkey,
GNUTLS_X509_FMT_DER,
lbuffer, &size);
if (ret < 0) {
fprintf(
stderr
, "export error: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
}
gnutls_pubkey_deinit(pubkey);
}
if (default_dig != GNUTLS_DIG_SHA256
&& default_dig != GNUTLS_DIG_SHA512) {
if (default_dig != GNUTLS_DIG_UNKNOWN)
fprintf(
stderr
,
"Unsupported digest. Assuming SHA256.\n");
default_dig = GNUTLS_DIG_SHA256;
}
ret = gnutls_hash_fast(default_dig, lbuffer, size, digest);
if (ret < 0) {
fprintf(
stderr
, "hash error: %s\n", gnutls_strerror(ret));
app_exit(1);
}
if (default_dig == GNUTLS_DIG_SHA256)
type = 1;
else
type = 2;
if (domain == 0) {
if (ca)
usage = 0;
else
usage = 1;
} else {
if (ca)
usage = 2;
else
usage = 3;
}
t.data = digest;
t.size = gnutls_hash_get_len(default_dig);
size = lbuffer_size;
ret = gnutls_hex_encode(&t, (void *) lbuffer, &size);
if (ret < 0) {
fprintf(
stderr
, "hex encode error: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
fprintf(outfile, "_%u._%s.%s. IN TLSA ( %.2x %.2x %.2x %s )\n",
port, proto, host, usage, selector, type, lbuffer);
}
| void dane_info(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned long a3, unsigned long a4, unsigned long long a5) {
unsigned long long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned long long v6;
unsigned long v7;
unsigned long long v8;
unsigned long v9;
unsigned int v10;
char v11;
char v12;
unsigned long long *v14;
unsigned long long v15;
v0 = a1;
v4 = service_to_port(a2, v0, v0);
if (!v0)
v0 = "tcp";
v8 = load_cert(0x0, a5);
if (!v8 || !stdout) {
v2 = 1;
v5 = gnutls_pubkey_init(&v6);
if (v5 < 0) {
fprintf(*(&stderr), "pubkey_init: %s\n", gnutls_strerror(v5));
app_exit(0x1);
}
if (!v8) {
v6 = load_pubkey(0x1, a5);
v7 = *(&lbuffer_size);
v5 = gnutls_pubkey_export(v6, 0x0, *(&lbuffer), &v7);
if (v5 < 0) {
fprintf(*(&stderr), "export error: %s\n", gnutls_strerror(v5));
app_exit(0x1);
}
} else {
v5 = gnutls_pubkey_import_x509(v6, v8, 0x0, v8);
if (v5 < 0) {
fprintf(*(&stderr), "pubkey_import_x509: %s\n", gnutls_strerror(v5));
app_exit(0x1);
}
v7 = *(&lbuffer_size);
v5 = gnutls_pubkey_export(v6, 0x0, *(&lbuffer), &v7);
if (v5 < 0) {
fprintf(*(&stderr), "pubkey_export: %s\n", gnutls_strerror(v5));
app_exit(0x1);
}
gnutls_x509_crt_deinit(v8);
}
gnutls_pubkey_deinit(v6);
} else {
v2 = 0;
v7 = *(&lbuffer_size);
v5 = gnutls_x509_crt_export(v8, 0x0, *(&lbuffer), &v7);
if (v5 < 0) {
fprintf(*(&stderr), "export error: %s\n", gnutls_strerror(v5));
app_exit(0x1);
}
gnutls_x509_crt_deinit(v8);
}
switch (default_dig) {
case 6: case 8:
break;
case 0:
default_dig = 6;
break;
default:
fprintf(*(&stderr), "Unsupported digest. Assuming SHA256.\n");
}
v5 = gnutls_hash_fast(default_dig, *(&lbuffer), v7, &v11);
if (v5 < 0) {
fprintf(*(&stderr), "hash error: %s\n", gnutls_strerror(v5));
app_exit(0x1);
}
if (default_dig == 6)
v3 = 1;
else
v3 = 2;
if (a4) {
if (a3)
v1 = 2;
else
v1 = 3;
} else {
if (!a3)
v1 = 1;
else
v1 = 0;
}
v9 = &v11;
v10 = gnutls_hash_get_len(default_dig);
v7 = *(&lbuffer_size);
v5 = gnutls_hex_encode(&v9, *(&lbuffer), &v7, *(&lbuffer));
if (v5 >= 0) {
fprintf(outfile, "_%u._%s.%s. IN TLSA ( %.2x %.2x %.2x %s )\n", v4, v0, a0, v1, v2, v3, *(&lbuffer));
v15 = *(&v12) ^ v14[5];
return;
}
fprintf(*(&stderr), "hex encode error: %s\n", gnutls_strerror(v5));
app_exit(0x1);
}
|
void
ssh_digest_free(struct ssh_digest_ctx *ctx)
{
if (ctx ==
((void *)0)
)
return;
EVP_MD_CTX_free(ctx->mdctx);
freezero(ctx, sizeof(*ctx));
}
| void ssh_digest_free(struct_0 *a0) {
unsigned long long v1;
if (a0) {
EVP_MD_CTX_free(a0->field_8);
v1 = freezero(a0, 0x10);
return;
}
return;
}
|
int64_t read_int(const char *input_str)
{
return read_int_with_default(input_str, 0);
}
| int read_int(unsigned long long a0) {
return read_int_with_default(a0, 0x0);
}
|
static void verify_provable_privkey(common_info_st * cinfo)
{
gnutls_privkey_t pkey;
int ret;
pkey = load_private_key(1, cinfo);
if (cinfo->seed_size > 0) {
ret = gnutls_privkey_verify_seed(pkey, 0, cinfo->seed, cinfo->seed_size);
} else {
ret = gnutls_privkey_verify_seed(pkey, 0,
((void *)0)
, 0);
}
if (ret < 0) {
if (ret == -1250)
fprintf(
stderr
, "The private key type cannot be associated with validated parameters\n");
else
fprintf(
stderr
, "Error verifying private key: %s\n", gnutls_strerror(ret));
app_exit(1);
}
printf("Key was verified\n");
gnutls_privkey_deinit(pkey);
return;
}
| void verify_provable_privkey(struct_0 *a0) {
unsigned int v0;
unsigned long long v1;
unsigned long long v3;
v1 = load_private_key(0x1, a0);
if (!a0->field_98)
v0 = gnutls_privkey_verify_seed(v1, 0x0, 0x0, 0x0);
else
v0 = gnutls_privkey_verify_seed(v1, 0x0, a0->field_90, a0->field_98);
if (v0 >= 0) {
printf("Key was verified\n");
v3 = gnutls_privkey_deinit(v1);
return;
}
if (v0 == -1250)
fprintf(*(&stderr), "The private key type cannot be associated with validated parameters\n");
else
fprintf(*(&stderr), "Error verifying private key: %s\n", gnutls_strerror(v0));
app_exit(0x1);
}
|
static void
set_instdir(const struct cmdinfo *cip, const char *value)
{
instdir = dpkg_fsys_set_dir(value);
}
| long long set_instdir(unsigned long a0, unsigned long long a1) {
unsigned long v0;
v0 = a0;
instdir = dpkg_fsys_set_dir(a1);
return instdir;
}
|
static int do_insmod(int argc, char *argv[])
{
struct kmod_ctx *ctx;
struct kmod_module *mod;
const char *filename;
char *opts =
((void *)0)
;
size_t optslen = 0;
int i, err;
const char *null_config =
((void *)0)
;
unsigned int flags = 0;
for (;;) {
int c, idx = 0;
c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx);
if (c == -1)
break;
switch (c) {
case 'p':
case 's':
break;
case 'f':
flags |= KMOD_PROBE_FORCE_MODVERSION;
flags |= KMOD_PROBE_FORCE_VERMAGIC;
break;
case 'h':
help();
return
0
;
case 'V':
puts("kmod" " version " "30");
puts("-ZSTD -XZ -ZLIB -LIBCRYPTO -EXPERIMENTAL");
return
0
;
case '?':
return
1
;
default:
log_printf(
3
, "unexpected getopt_long() value '%c'.\n", c)
;
return
1
;
}
}
if (optind >= argc) {
log_printf(
3
, "missing filename.\n");
return
1
;
}
filename = argv[optind];
if ((strcmp((filename), ("-")) == 0)) {
log_printf(
3
, "this tool does not support loading from stdin!\n");
return
1
;
}
for (i = optind + 1; i < argc; i++) {
size_t len = strlen(argv[i]);
void *tmp = realloc(opts, optslen + len + 2);
if (tmp ==
((void *)0)
) {
log_printf(
3
, "out of memory\n");
free(opts);
return
1
;
}
opts = tmp;
if (optslen > 0) {
opts[optslen] = ' ';
optslen++;
}
memcpy(opts + optslen, argv[i], len);
optslen += len;
opts[optslen] = '\0';
}
ctx = kmod_new(
((void *)0)
, &null_config);
if (!ctx) {
log_printf(
3
, "kmod_new() failed!\n");
free(opts);
return
1
;
}
err = kmod_module_new_from_path(ctx, filename, &mod);
if (err < 0) {
log_printf(
3
, "could not load module %s: %s\n", filename, strerror(-err))
;
goto end;
}
err = kmod_module_insert_module(mod, flags, opts);
if (err < 0) {
log_printf(
3
, "could not insert module %s: %s\n", filename, mod_strerror(-err))
;
}
kmod_module_unref(mod);
end:
kmod_unref(ctx);
free(opts);
return err >= 0 ?
0
:
1
;
}
| long long do_insmod(unsigned long a0, unsigned long long *a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
void* v5;
void* v6;
void* v7;
char *v8;
unsigned long long v9;
unsigned int v10;
void* v11;
unsigned long long v13;
unsigned long long v15;
unsigned long long v16;
v6 = 0;
v7 = 0;
v5 = 0;
v2 = 0;
while (true) {
v4 = 0;
v3 = getopt_long(a0, a1, "psfVh", &cmdopts, &v4);
if (v3 == -1) {
if (a0 <= optind) {
log_printf(0x3, "missing filename.\n", "psfVh");
v13 = 1;
break;
} else {
v8 = a1[optind];
if (!strcmp(v8, "-")) {
log_printf(0x3, "this tool does not support loading from stdin!\n", "psfVh");
v13 = 1;
break;
} else {
v0 = optind + 1;
while (true) {
if (v0 < a0) {
*(&v10) = strlen(a1[v0]);
v11 = realloc(v6, *(&v10) + v7 + 2);
if (!v11) {
log_printf(0x3, "out of memory\n", v15);
free(v6);
v13 = 1;
break;
} else {
v6 = v11;
if (v7) {
*((v7 + v6)) = 32;
v7 += 1;
}
memcpy(v6 + v7, a1[v0], *(&v10));
v7 += *(&v10);
*((v7 + v6)) = 0;
v0 += 1;
}
} else {
v9 = kmod_new(0x0, &v5);
if (!v9) {
log_printf(0x3, "kmod_new() failed!\n", v16);
free(v6);
v13 = 1;
break;
} else {
v1 = kmod_module_new_from_path(v9, v8, &v4, v8);
if (v1 < 0) {
strerror(-(v1));
log_printf(0x3, "could not load module %s: %s\n", v8);
} else {
v1 = kmod_module_insert_module(*(&v4), v2, v6, v2);
if (v1 < 0) {
mod_strerror(-(v1));
log_printf(0x3, "could not insert module %s: %s\n", v8);
}
kmod_module_unref(*(&v4));
}
kmod_unref(v9);
free(v6);
v13 = v1 >> 31;
break;
}
}
}
}
}
} else {
if (v3 == 63) {
v13 = 1;
break;
} else if (v3 >= 63 && v3 <= 115 && v3 >= 86) {
switch (v3) {
case 86:
puts("kmod version 30");
puts("-ZSTD -XZ -ZLIB -LIBCRYPTO -EXPERIMENTAL");
v13 = 0;
break;
case 102:
v2 |= 2;
v2 |= 1;
case 104:
help();
v13 = 0;
break;
default:
log_printf(0x3, "unexpected getopt_long() value '%c'.\n", v3);
v13 = 1;
break;
}
}
}
}
return v13;
}
|
void test_dict_inflate(compr, comprLen, uncompr, uncomprLen)
Byte *compr, *uncompr;
uLong comprLen, uncomprLen;
{
int err;
z_stream d_stream;
strcpy((char*)uncompr, "garbage");
d_stream.zalloc = zalloc;
d_stream.zfree = zfree;
d_stream.opaque = (voidpf)0;
d_stream.next_in = compr;
d_stream.avail_in = (uInt)comprLen;
err = inflateInit_((&d_stream), "1.2.13", (int)sizeof(z_stream));
{ if (err != 0) { fprintf(
stderr
, "%s error: %d\n", "inflateInit", err); exit(1); } };
d_stream.next_out = uncompr;
d_stream.avail_out = (uInt)uncomprLen;
for (;;) {
err = inflate(&d_stream, 0);
if (err == 1) break;
if (err == 2) {
if (d_stream.adler != dictId) {
fprintf(
stderr
, "unexpected dictionary");
exit(1);
}
err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,
(int)sizeof(dictionary));
}
{ if (err != 0) { fprintf(
stderr
, "%s error: %d\n", "inflate with dict", err); exit(1); } };
}
err = inflateEnd(&d_stream);
{ if (err != 0) { fprintf(
stderr
, "%s error: %d\n", "inflateEnd", err); exit(1); } };
if (strcmp((char*)uncompr, hello)) {
fprintf(
stderr
, "bad inflate with dict\n");
exit(1);
} else {
printf("inflate with dictionary: %s\n", (char *)uncompr);
}
}
| void test_dict_inflate(unsigned long a0, unsigned long a1, char *a2, unsigned long a3) {
unsigned int v0;
unsigned long v1;
unsigned int v2;
unsigned long v3;
unsigned int v4;
unsigned long v5;
unsigned long v6;
void* v7;
char v8;
char v9;
unsigned long long *v12;
unsigned long long v13;
strcpy(a2, "garbage");
v5 = zalloc;
v6 = zfree;
v7 = 0;
v1 = a0;
v2 = a1;
v0 = inflateInit_(&v1, "1.2.13", 0x70);
if (v0) {
fprintf(*(&stderr), "%s error: %d\n", &g_401c20, v0);
exit(0x1);
}
v3 = a2;
v4 = a3;
while (true) {
v0 = inflate(&v1, 0x0);
if (v0 == 1)
break;
if (v0 == 2) {
if (*(&v8) != dictId) {
fprintf(*(&stderr), "unexpected dictionary");
exit(0x1);
}
v0 = inflateSetDictionary(&v1, "hello", 0x6);
}
if (*(&v8) == dictId || v0 != 2) {
if (!v0)
continue;
fprintf(*(&stderr), "%s error: %d\n", &g_401d4b, v0);
exit(0x1);
}
}
v0 = inflateEnd(&v1);
if (v0) {
fprintf(*(&stderr), "%s error: %d\n", &g_401c34, v0);
exit(0x1);
} else if (strcmp(a2, "hello,")) {
fprintf(*(&stderr), "bad inflate with dict\n");
exit(0x1);
} else {
printf("inflate with dictionary: %s\n", a2);
v13 = *(&v9) ^ v12[5];
return;
}
}
|
static int
handle_to_flags(int handle)
{
if (handle_is_ok(handle, HANDLE_FILE))
return handles[handle].flags;
return 0;
}
| int handle_to_flags(unsigned long a0) {
return (!handle_is_ok(a0, 0x2) ? *((a0 * 56 + handles + 20)) : 0);
}
|
static int
setenv_TZ (char const *tz)
{
return tz ? setenv ("TZ", tz, 1) : unsetenv ("TZ");
}
| int setenv_TZ(char *a0) {
unsigned long long v1;
if (!a0)
v1 = unsetenv("TZ");
else
v1 = setenv("TZ", a0, 0x1);
return v1;
}
|
static __inline int
__get_cpuid (unsigned int __leaf,
unsigned int *__eax, unsigned int *__ebx,
unsigned int *__ecx, unsigned int *__edx)
{
unsigned int __ext = __leaf & 0x80000000;
unsigned int __maxlevel = __get_cpuid_max (__ext, 0);
if (__maxlevel == 0 || __maxlevel < __leaf)
return 0;
__asm__ __volatile__ ("cpuid\n\t" : "=a" (*__eax), "=b" (*__ebx), "=c" (*__ecx), "=d" (*__edx) : "0" (__leaf));
return 1;
}
| int __get_cpuid(unsigned long a0, unsigned int *a1, unsigned int *a2, unsigned int *a3, unsigned int *a4) {
unsigned int v0;
unsigned int v1;
unsigned int v3;
unsigned int v4;
v0 = a0 & 0x80000000;
v1 = __get_cpuid_max(v0, NULL, a2, a3);
if (v1 && v1 >= a0) {
[D] t4294967295 = DIRTY 1 TODO(effects) ::: amd64g_dirtyhelper_CPUID_avx2(GSPTR)
[D] MBusEvent-Imbe_Fence
*(a1) = a0;
*(a2) = v4;
*(a3) = a3;
*(a4) = a2;
v3 = 1;
}
if (!v1 || v1 < a0)
v3 = 0;
return v3;
}
|
static void print_cache_flags(FILE *fp, __u32 flags)
{
json_writer_t *jw = get_json_writer();
flags &= ~0xFFFF;
if (jw) {
jsonw_name(jw, "cache");
jsonw_start_array(jw);
} else {
fprintf(fp, "%s cache ", _SL_);
if (flags == 0)
return;
putc('<', fp);
}
if (flags & 0x80000000) { flags &= ~0x80000000; if (jw) jsonw_string(jw, "local"); else fprintf(fp, "%s%s", "local", flags ? "," : "> "); };
if (flags & 0x40000000) { flags &= ~0x40000000; if (jw) jsonw_string(jw, "reject"); else fprintf(fp, "%s%s", "reject", flags ? "," : "> "); };
if (flags & 0x20000000) { flags &= ~0x20000000; if (jw) jsonw_string(jw, "mc"); else fprintf(fp, "%s%s", "mc", flags ? "," : "> "); };
if (flags & 0x10000000) { flags &= ~0x10000000; if (jw) jsonw_string(jw, "brd"); else fprintf(fp, "%s%s", "brd", flags ? "," : "> "); };
if (flags & 0x08000000) { flags &= ~0x08000000; if (jw) jsonw_string(jw, "dst-nat"); else fprintf(fp, "%s%s", "dst-nat", flags ? "," : "> "); };
if (flags & 0x00800000) { flags &= ~0x00800000; if (jw) jsonw_string(jw, "src-nat"); else fprintf(fp, "%s%s", "src-nat", flags ? "," : "> "); };
if (flags & 0x00400000) { flags &= ~0x00400000; if (jw) jsonw_string(jw, "masq"); else fprintf(fp, "%s%s", "masq", flags ? "," : "> "); };
if (flags & 0x00020000) { flags &= ~0x00020000; if (jw) jsonw_string(jw, "dst-direct"); else fprintf(fp, "%s%s", "dst-direct", flags ? "," : "> "); };
if (flags & 0x04000000) { flags &= ~0x04000000; if (jw) jsonw_string(jw, "src-direct"); else fprintf(fp, "%s%s", "src-direct", flags ? "," : "> "); };
if (flags & 0x00040000) { flags &= ~0x00040000; if (jw) jsonw_string(jw, "redirected"); else fprintf(fp, "%s%s", "redirected", flags ? "," : "> "); };
if (flags & 0x01000000) { flags &= ~0x01000000; if (jw) jsonw_string(jw, "redirect"); else fprintf(fp, "%s%s", "redirect", flags ? "," : "> "); };
if (flags & 0x00200000) { flags &= ~0x00200000; if (jw) jsonw_string(jw, "fastroute"); else fprintf(fp, "%s%s", "fastroute", flags ? "," : "> "); };
if (flags & 0x00010000) { flags &= ~0x00010000; if (jw) jsonw_string(jw, "notify"); else fprintf(fp, "%s%s", "notify", flags ? "," : "> "); };
if (flags & 0x00080000) { flags &= ~0x00080000; if (jw) jsonw_string(jw, "proxy"); else fprintf(fp, "%s%s", "proxy", flags ? "," : "> "); };
if (flags)
print_hex(PRINT_ANY, "flags", "%x>", flags);
if (jw)
jsonw_end_array(jw);
}
| int print_cache_flags(FILE *a1, int a2)
{
int result;
const char *v3;
const char *v4;
const char *v5;
const char *v6;
const char *v7;
const char *v8;
const char *v9;
const char *v10;
const char *v11;
const char *v12;
const char *v13;
const char *v14;
const char *v15;
const char *v16;
unsigned int v17;
long json_writer;
json_writer = get_json_writer();
v17 = a2 & 0xFFFF0000;
if ( json_writer )
{
jsonw_name(json_writer, "cache");
jsonw_start_array(json_writer);
}
else
{
result = fprintf(a1, "%s cache ", SL_);
if ( !v17 )
return result;
putc(60, a1);
}
if ( a2 < 0 )
{
v17 = a2 & 0x7FFF0000;
if ( json_writer )
{
jsonw_string(json_writer, "local");
}
else
{
if ( v17 )
v3 = ",";
else
v3 = "> ";
fprintf(a1, "%s%s", "local", v3);
}
}
if ( (v17 & 0x40000000) != 0 )
{
v17 &= ~0x40000000u;
if ( json_writer )
{
jsonw_string(json_writer, "reject");
}
else
{
if ( v17 )
v4 = ",";
else
v4 = "> ";
fprintf(a1, "%s%s", "reject", v4);
}
}
if ( (v17 & 0x20000000) != 0 )
{
v17 &= ~0x20000000u;
if ( json_writer )
{
jsonw_string(json_writer, "mc");
}
else
{
if ( v17 )
v5 = ",";
else
v5 = "> ";
fprintf(a1, "%s%s", "mc", v5);
}
}
if ( (v17 & 0x10000000) != 0 )
{
v17 &= ~0x10000000u;
if ( json_writer )
{
jsonw_string(json_writer, "brd");
}
else
{
if ( v17 )
v6 = ",";
else
v6 = "> ";
fprintf(a1, "%s%s", "brd", v6);
}
}
if ( (v17 & 0x8000000) != 0 )
{
v17 &= ~0x8000000u;
if ( json_writer )
{
jsonw_string(json_writer, "dst-nat");
}
else
{
if ( v17 )
v7 = ",";
else
v7 = "> ";
fprintf(a1, "%s%s", "dst-nat", v7);
}
}
if ( (v17 & 0x800000) != 0 )
{
v17 &= ~0x800000u;
if ( json_writer )
{
jsonw_string(json_writer, "src-nat");
}
else
{
if ( v17 )
v8 = ",";
else
v8 = "> ";
fprintf(a1, "%s%s", "src-nat", v8);
}
}
if ( (v17 & 0x400000) != 0 )
{
v17 &= ~0x400000u;
if ( json_writer )
{
jsonw_string(json_writer, "masq");
}
else
{
if ( v17 )
v9 = ",";
else
v9 = "> ";
fprintf(a1, "%s%s", "masq", v9);
}
}
if ( (v17 & 0x20000) != 0 )
{
v17 &= ~0x20000u;
if ( json_writer )
{
jsonw_string(json_writer, "dst-direct");
}
else
{
if ( v17 )
v10 = ",";
else
v10 = "> ";
fprintf(a1, "%s%s", "dst-direct", v10);
}
}
if ( (v17 & 0x4000000) != 0 )
{
v17 &= ~0x4000000u;
if ( json_writer )
{
jsonw_string(json_writer, "src-direct");
}
else
{
if ( v17 )
v11 = ",";
else
v11 = "> ";
fprintf(a1, "%s%s", "src-direct", v11);
}
}
if ( (v17 & 0x40000) != 0 )
{
v17 &= ~0x40000u;
if ( json_writer )
{
jsonw_string(json_writer, "redirected");
}
else
{
if ( v17 )
v12 = ",";
else
v12 = "> ";
fprintf(a1, "%s%s", "redirected", v12);
}
}
if ( (v17 & 0x1000000) != 0 )
{
v17 &= ~0x1000000u;
if ( json_writer )
{
jsonw_string(json_writer, "redirect");
}
else
{
if ( v17 )
v13 = ",";
else
v13 = "> ";
fprintf(a1, "%s%s", "redirect", v13);
}
}
if ( (v17 & 0x200000) != 0 )
{
v17 &= ~0x200000u;
if ( json_writer )
{
jsonw_string(json_writer, "fastroute");
}
else
{
if ( v17 )
v14 = ",";
else
v14 = "> ";
fprintf(a1, "%s%s", "fastroute", v14);
}
}
if ( (v17 & 0x10000) != 0 )
{
v17 &= ~0x10000u;
if ( json_writer )
{
jsonw_string(json_writer, "notify");
}
else
{
if ( v17 )
v15 = ",";
else
v15 = "> ";
fprintf(a1, "%s%s", "notify", v15);
}
}
result = v17 & 0x80000;
if ( (v17 & 0x80000) != 0 )
{
v17 &= ~0x80000u;
if ( json_writer )
{
result = jsonw_string(json_writer, "proxy");
}
else
{
if ( v17 )
v16 = ",";
else
v16 = "> ";
result = fprintf(a1, "%s%s", "proxy", v16);
}
}
if ( v17 )
result = print_hex(4u, (long)"flags", (long)"%x>", v17);
if ( json_writer )
return jsonw_end_array(json_writer);
return result;
}
|
static int
conalloc(char *iname, char *oname, int keytype)
{
char *namebase, *name, *namelist;
int s;
namebase = namelist = xstrdup(iname);
do {
name = xstrsep(&namelist, ",");
if (!name) {
free(namebase);
return (-1);
}
} while ((s = tcpconnect(name)) < 0);
if (s >= maxfd)
sshfatal("ssh-keyscan.c", __func__, 403, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "conalloc: fdno %d too high", s);
if (fdcon[s].c_status)
sshfatal("ssh-keyscan.c", __func__, 405, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "conalloc: attempt to reuse fdno %d", s);
sshlog("ssh-keyscan.c", __func__, 407, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "oname %s kt %d", oname, keytype);
fdcon[s].c_fd = s;
fdcon[s].c_status = 1;
fdcon[s].c_namebase = namebase;
fdcon[s].c_name = name;
fdcon[s].c_namelist = namelist;
fdcon[s].c_output_name = xstrdup(oname);
fdcon[s].c_data = (char *) &fdcon[s].c_plen;
fdcon[s].c_len = 4;
fdcon[s].c_off = 0;
fdcon[s].c_keytype = keytype;
monotime_ts(&fdcon[s].c_ts);
fdcon[s].c_ts.tv_sec += timeout;
do { (&fdcon[s])->c_link.tqe_next =
((void *)0)
; (&fdcon[s])->c_link.tqe_prev = (&tq)->tqh_last; *(&tq)->tqh_last = (&fdcon[s]); (&tq)->tqh_last = &(&fdcon[s])->c_link.tqe_next; } while (0);
read_wait[s].fd = s;
read_wait[s].events =
0x001
;
ncon++;
return (s);
}
| int conalloc(unsigned long long a0, unsigned long long a1, unsigned long a2) {
struct_8 *v0;
unsigned int v1;
void* v2;
void* v3;
unsigned long long v4;
unsigned int v6;
v2 = xstrdup(a0);
v3 = v2;
do {
v4 = xstrsep(&v2, ",");
if (!v4) {
free(v3);
v6 = -1;
goto LABEL_400f80;
}
v1 = tcpconnect(v4);
} while (v1 < 0);
if (v1 >= 3850979413) {
v0 = v1;
sshfatal("ssh-keyscan.c", "conalloc", 0x193, 0x0, 0x1, 0x0, "conalloc: fdno %d too high");
} else if (*(((v1 * 7 << 4) + 7267821926853935944))) {
v0 = v1;
sshfatal("ssh-keyscan.c", "conalloc", 0x195, 0x0, 0x1, 0x0, "conalloc: attempt to reuse fdno %d");
} else {
sshlog("ssh-keyscan.c", "conalloc", 0x197, 0x1, 0x7, 0x0, "oname %s kt %d", a1);
*((7267821926853935944 + v1 * 112 + 4)) = v1;
*((v1 * 112 + 7267821926853935944)) = 1;
*((7267821926853935944 + v1 * 112 + 32)) = v3;
*((7267821926853935944 + v1 * 112 + 40)) = v4;
*((7267821926853935944 + v1 * 112 + 48)) = v2;
*((7267821926853935944 + v1 * 112 + 56)) = xstrdup(a1);
*((v1 * 112 + 7267821926853936008)) = 7267821926853935944 + v1 * 112 + 8;
*((v1 * 112 + 7267821926853935956)) = 4;
*((v1 * 112 + 7267821926853935960)) = 0;
*((7267821926853935944 + v1 * 112 + 20)) = a2;
monotime_ts(v1 * 112 + 7267821926853936024, 7267821926853935944 + v1 * 112, v1, 0x64dc7d8930ec8348);
*((7267821926853935944 + v1 * 112 + 80)) = __addvdi3(*((v1 * 112 + 7267821926853936024)), timeout, v1, *((v1 * 112 + 7267821926853936024)));
*((v1 * 112 + 7267821926853936040)) = 0;
*((7267821926853935944 + v1 * 112 + 104)) = &g_8d48c031f8458948;
g_8d48c031f8458948 = v1 * 112 + 7267821926853935944;
g_400018 = v1 * 112 + 7267821926853936040;
*((v1 * 8 + 7267821926853935944)) = v1;
*((7267821926853935944 + v1 * 8 + 4)) = 1;
ncon = __addvsi3(0x30ec8348e5894855, 0x1, v1 * 8, 0x64dc7d8930ec8348);
v6 = v1;
}
LABEL_400f80:
return v6;
}
|
int
compgen_builtin (list)
WORD_LIST *list;
{
int rval;
unsigned long acts, copts;
COMPSPEC *cs;
STRINGLIST *sl;
char *word, **matches;
char *old_line;
int old_ind;
if (list == 0)
return (0);
acts = copts = (unsigned long)0L;
Garg = Warg = Parg = Sarg = Xarg = Farg = Carg = (char *)
((void *)0)
;
cs = (COMPSPEC *)
((void *)0)
;
rval = build_actions (list, (struct _optflags *)
((void *)0)
, &acts, &copts);
if (rval == 258)
return (rval);
if (rval == 1)
return (0);
list = loptend;
word = (list && list->word) ? list->word->word : "";
if (Farg)
builtin_error (gettext("warning: -F option may not work as you expect"));
if (Carg)
builtin_error (gettext("warning: -C option may not work as you expect"));
cs = compspec_create ();
cs->actions = acts;
cs->options = copts;
cs->refcount = 1;
cs->globpat = ((Garg) ? (char *)strcpy (sh_xmalloc((1 + strlen (Garg)), "./complete.def", 706), (Garg)) : (char *)
((void *)0)
);
cs->words = ((Warg) ? (char *)strcpy (sh_xmalloc((1 + strlen (Warg)), "./complete.def", 707), (Warg)) : (char *)
((void *)0)
);
cs->prefix = ((Parg) ? (char *)strcpy (sh_xmalloc((1 + strlen (Parg)), "./complete.def", 708), (Parg)) : (char *)
((void *)0)
);
cs->suffix = ((Sarg) ? (char *)strcpy (sh_xmalloc((1 + strlen (Sarg)), "./complete.def", 709), (Sarg)) : (char *)
((void *)0)
);
cs->funcname = ((Farg) ? (char *)strcpy (sh_xmalloc((1 + strlen (Farg)), "./complete.def", 710), (Farg)) : (char *)
((void *)0)
);
cs->command = ((Carg) ? (char *)strcpy (sh_xmalloc((1 + strlen (Carg)), "./complete.def", 711), (Carg)) : (char *)
((void *)0)
);
cs->filterpat = ((Xarg) ? (char *)strcpy (sh_xmalloc((1 + strlen (Xarg)), "./complete.def", 712), (Xarg)) : (char *)
((void *)0)
);
rval = 1;
old_line = pcomp_line;
old_ind = pcomp_ind;
pcomp_line = (char *)
((void *)0)
;
pcomp_ind = 0;
sl = gen_compspec_completions (cs, "compgen", word, 0, 0, 0);
pcomp_line = old_line;
pcomp_ind = old_ind;
if ((sl == 0 || sl->list_len == 0) && (copts & (1<<6)))
{
matches = bash_default_completion (word, 0, 0, 0, 0);
sl = completions_to_stringlist (matches);
strvec_dispose (matches);
}
if ((sl == 0 || sl->list_len == 0) && (copts & (1<<1)))
{
matches = rl_completion_matches (word, rl_filename_completion_function);
strlist_dispose (sl);
sl = completions_to_stringlist (matches);
strvec_dispose (matches);
}
if (sl)
{
if (sl->list && sl->list_len)
{
rval = 0;
strlist_print (sl, (char *)
((void *)0)
);
}
strlist_dispose (sl);
}
compspec_dispose (cs);
return (rval);
}
| long compgen_builtin(long a1)
{
void *v2;
char *v3;
char *v4;
const char *v5;
size_t v6;
char *v7;
char *v8;
const char *v9;
size_t v10;
char *v11;
char *v12;
const char *v13;
size_t v14;
char *v15;
char *v16;
const char *v17;
size_t v18;
char *v19;
char *v20;
const char *v21;
size_t v22;
char *v23;
char *v24;
const char *v25;
size_t v26;
char *v27;
char *v28;
const char *v29;
size_t v30;
char *v31;
char *v32;
int v33;
unsigned int v34;
int v35;
long v36;
long v37;
long v38;
long v39;
void *v40;
long v41;
long v42;
unsigned long v43;
v43 = __readfsqword(0x28u);
if ( !a1 )
return 0LL;
v37 = 0LL;
v36 = 0LL;
Carg = 0LL;
Farg = 0LL;
Xarg = 0LL;
Sarg = 0LL;
Parg = 0LL;
Warg = 0LL;
Garg = 0LL;
v39 = 0LL;
v33 = build_actions(a1, 0LL, &v36, &v37);
if ( v33 == 258 )
return 258LL;
if ( v33 == 1 )
return 0LL;
if ( loptend && *(_QWORD *)(loptend + 8LL) )
v2 = **(void ***)(loptend + 8LL);
else
v2 = &unk_1D81;
v40 = v2;
if ( Farg )
{
v3 = gettext("warning: -F option may not work as you expect");
builtin_error(v3, 0LL);
}
if ( Carg )
{
v4 = gettext("warning: -C option may not work as you expect");
builtin_error(v4, 0LL);
}
v39 = compspec_create();
*(_QWORD *)(v39 + 8) = v36;
*(_QWORD *)(v39 + 16) = v37;
*(_DWORD *)v39 = 1;
if ( Garg )
{
v5 = Garg;
v6 = strlen(Garg);
v7 = (char *)sh_xmalloc(v6 + 1, "./complete.def", 706LL);
v8 = strcpy(v7, v5);
}
else
{
v8 = 0LL;
}
*(_QWORD *)(v39 + 24) = v8;
if ( Warg )
{
v9 = Warg;
v10 = strlen(Warg);
v11 = (char *)sh_xmalloc(v10 + 1, "./complete.def", 707LL);
v12 = strcpy(v11, v9);
}
else
{
v12 = 0LL;
}
*(_QWORD *)(v39 + 32) = v12;
if ( Parg )
{
v13 = Parg;
v14 = strlen(Parg);
v15 = (char *)sh_xmalloc(v14 + 1, "./complete.def", 708LL);
v16 = strcpy(v15, v13);
}
else
{
v16 = 0LL;
}
*(_QWORD *)(v39 + 40) = v16;
if ( Sarg )
{
v17 = Sarg;
v18 = strlen(Sarg);
v19 = (char *)sh_xmalloc(v18 + 1, "./complete.def", 709LL);
v20 = strcpy(v19, v17);
}
else
{
v20 = 0LL;
}
*(_QWORD *)(v39 + 48) = v20;
if ( Farg )
{
v21 = Farg;
v22 = strlen(Farg);
v23 = (char *)sh_xmalloc(v22 + 1, "./complete.def", 710LL);
v24 = strcpy(v23, v21);
}
else
{
v24 = 0LL;
}
*(_QWORD *)(v39 + 56) = v24;
if ( Carg )
{
v25 = Carg;
v26 = strlen(Carg);
v27 = (char *)sh_xmalloc(v26 + 1, "./complete.def", 711LL);
v28 = strcpy(v27, v25);
}
else
{
v28 = 0LL;
}
*(_QWORD *)(v39 + 64) = v28;
if ( Xarg )
{
v29 = Xarg;
v30 = strlen(Xarg);
v31 = (char *)sh_xmalloc(v30 + 1, "./complete.def", 712LL);
v32 = strcpy(v31, v29);
}
else
{
v32 = 0LL;
}
*(_QWORD *)(v39 + 80) = v32;
v34 = 1;
v41 = pcomp_line;
v35 = pcomp_ind;
pcomp_line = 0LL;
pcomp_ind = 0;
v38 = gen_compspec_completions(v39, "compgen", v40, 0LL, 0LL, 0LL);
pcomp_line = v41;
pcomp_ind = v35;
if ( (!v38 || !*(_DWORD *)(v38 + 12)) && (v37 & 0x40) != 0 )
{
v42 = bash_default_completion(v40, 0LL, 0LL, 0LL, 0LL);
v38 = completions_to_stringlist(v42);
strvec_dispose(v42);
}
if ( (!v38 || !*(_DWORD *)(v38 + 12)) && (v37 & 2) != 0 )
{
v42 = rl_completion_matches(v40, &rl_filename_completion_function);
strlist_dispose(v38);
v38 = completions_to_stringlist(v42);
strvec_dispose(v42);
}
if ( v38 )
{
if ( *(_QWORD *)v38 )
{
if ( *(_DWORD *)(v38 + 12) )
{
v34 = 0;
strlist_print(v38, 0LL);
}
}
strlist_dispose(v38);
}
compspec_dispose(v39);
return v34;
}
|
static void
channel_before_prepare_io_rdynamic(struct ssh *ssh, Channel *c)
{
const u_char *p;
u_int have, len;
int r, ret;
have = sshbuf_len(c->output);
sshlog("channels.c", __func__, 1610, 0, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "channel %d: pre_rdynamic: have %d", c->self, have);
if (c->flags & 0x08) {
if ((r = sshbuf_consume(c->output, have)) != 0)
sshfatal("channels.c", __func__, 1615, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %d: consume", c->self);
rdynamic_close(ssh, c);
return;
}
if (have < 3)
return;
p = sshbuf_ptr(c->output);
switch (p[0]) {
case 0x04:
ret = channel_decode_socks4(c, c->output, c->input);
break;
case 0x05:
ret = channel_decode_socks5(c, c->output, c->input);
break;
default:
ret = -1;
break;
}
if (ret < 0) {
rdynamic_close(ssh, c);
} else if (ret == 0) {
sshlog("channels.c", __func__, 1639, 0, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "channel %d: pre_rdynamic: need more", c->self);
len = sshbuf_len(c->input);
if (len > 0 && len < c->remote_window) {
if ((r = sshpkt_start(ssh, 94)) != 0 ||
(r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
(r = sshpkt_put_stringb(ssh, c->input)) != 0 ||
(r = sshpkt_send(ssh)) != 0) {
sshfatal("channels.c", __func__, 1647, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i: rdynamic", c->self);
}
if ((r = sshbuf_consume(c->input, len)) != 0)
sshfatal("channels.c", __func__, 1650, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %d: consume", c->self);
c->remote_window -= len;
}
} else if (rdynamic_connect_finish(ssh, c) < 0) {
rdynamic_close(ssh, c);
}
}
| void channel_before_prepare_io_rdynamic(undefined8 param_1,long param_2)
{
uint uVar1;
long lVar2;
int iVar3;
undefined8 uVar4;
char **ppcVar5;
char **ppcVar6;
char *pcStack88;
ulong uStack80;
long local_48;
undefined8 local_40;
int local_30;
int local_2c;
uint local_28;
uint local_24;
char *local_20;
ppcVar5 = (char **)&local_48;
ppcVar6 = (char **)&local_48;
uStack80 = 0x1048be;
local_48 = param_2;
local_40 = param_1;
local_28 = sshbuf_len(*(undefined8 *)(param_2 + 0x70));
pcStack88 = (char *)(ulong)local_28;
sshlog("channels.c","channel_before_prepare_io_rdynamic",0x64a,0,6,0,
"channel %d: pre_rdynamic: have %d",*(undefined4 *)(local_48 + 4));
if ((*(uint *)(local_48 + 0x18) & 8) != 0) {
uStack80 = 0x10492f;
local_30 = sshbuf_consume(*(undefined8 *)(local_48 + 0x70),local_28);
if (local_30 != 0) {
uVar1 = *(uint *)(local_48 + 4);
uStack80 = 0x104949;
uVar4 = ssh_err(local_30);
ppcVar5 = &pcStack88;
pcStack88 = "channel %d: consume";
uStack80 = (ulong)uVar1;
sshfatal("channels.c","channel_before_prepare_io_rdynamic",0x64f,1,1,uVar4);
}
lVar2 = local_48;
*(undefined8 *)((long)ppcVar5 + -8) = 0x104990;
rdynamic_close(local_40,lVar2);
return;
}
if (local_28 < 3) {
return;
}
uStack80 = 0x1049af;
local_20 = (char *)sshbuf_ptr(*(undefined8 *)(local_48 + 0x70));
if (*local_20 == '\x04') {
uStack80 = 0x1049e8;
local_2c = channel_decode_socks4
(local_48,*(undefined8 *)(local_48 + 0x70),*(undefined8 *)(local_48 + 0x68)
);
}
else if (*local_20 == '\x05') {
uStack80 = 0x104a0c;
local_2c = channel_decode_socks5
(local_48,*(undefined8 *)(local_48 + 0x70),*(undefined8 *)(local_48 + 0x68)
);
}
else {
local_2c = -1;
}
if (local_2c < 0) {
uStack80 = 0x104a32;
rdynamic_close(local_40,local_48);
return;
}
if (local_2c != 0) {
uStack80 = 0x104bf7;
iVar3 = rdynamic_connect_finish(local_40,local_48);
if (-1 < iVar3) {
return;
}
uStack80 = 0x104c0e;
rdynamic_close(local_40,local_48);
return;
}
uStack80 = (ulong)*(uint *)(local_48 + 4);
pcStack88 = "channel %d: pre_rdynamic: need more";
sshlog("channels.c","channel_before_prepare_io_rdynamic",0x667,0,6,0);
uStack80 = 0x104a93;
local_24 = sshbuf_len(*(undefined8 *)(local_48 + 0x68));
if (local_24 == 0) {
return;
}
if (*(uint *)(local_48 + 0xa8) <= local_24) {
return;
}
uStack80 = 0x104ac4;
local_30 = sshpkt_start(local_40,0x5e);
if (local_30 == 0) {
uStack80 = 0x104ae2;
local_30 = sshpkt_put_u32(local_40,*(undefined4 *)(local_48 + 8));
if (local_30 == 0) {
uStack80 = 0x104b02;
local_30 = sshpkt_put_stringb(local_40,*(undefined8 *)(local_48 + 0x68));
if (local_30 == 0) {
uStack80 = 0x104b17;
local_30 = sshpkt_send(local_40);
if (local_30 == 0) goto LAB_00104b65;
}
}
}
uVar1 = *(uint *)(local_48 + 4);
uStack80 = 0x104b31;
uVar4 = ssh_err(local_30);
ppcVar6 = &pcStack88;
pcStack88 = "channel %i: rdynamic";
uStack80 = (ulong)uVar1;
sshfatal("channels.c","channel_before_prepare_io_rdynamic",0x66f,1,1,uVar4);
LAB_00104b65:
uVar4 = *(undefined8 *)(local_48 + 0x68);
*(undefined8 *)((long)ppcVar6 + -8) = 0x104b7b;
local_30 = sshbuf_consume(uVar4,local_24);
if (local_30 != 0) {
uVar1 = *(uint *)(local_48 + 4);
*(undefined8 *)((long)ppcVar6 + -8) = 0x104b95;
uVar4 = ssh_err(local_30);
*(ulong *)((long)ppcVar6 + -8) = (ulong)uVar1;
*(char **)((long)ppcVar6 + -0x10) = "channel %d: consume";
*(undefined8 *)((long)ppcVar6 + -0x18) = 0x104bc9;
sshfatal("channels.c","channel_before_prepare_io_rdynamic",0x672,1,1,uVar4);
}
*(uint *)(local_48 + 0xa8) = *(int *)(local_48 + 0xa8) - local_24;
return;
}
|
dev_t *
get_mounted_devices (size_t *n)
{
size_t alloc_size = 0u;
size_t used = 0u;
struct mount_entry *entries, *entry;
dev_t *result =
((void *)0)
;
for (entry = entries = read_file_system_list (
0
);
entry;
entry = entry->me_next)
{
void *p = extendbuf (result, sizeof(dev_t)*(used+1), &alloc_size);
if (p)
{
result = p;
if (0 == set_fstype_devno (entry))
{
result[used] = entry->me_dev;
++used;
}
}
else
{
free (result);
result =
((void *)0)
;
}
}
free_file_system_list (entries);
if (result)
{
*n = used;
}
return result;
}
| long long get_mounted_devices(unsigned long long *a0) {
void* v0;
void* v1;
unsigned long long v2[7];
void* v3;
void* v4;
unsigned long v5;
v0 = 0;
v1 = 0;
v3 = 0;
v4 = read_file_system_list(0x0);
for (v2[0] = v4; v2; v2[0] = v2[6]) {
v5 = extendbuf(v3, (v1 + 1) * 8, &v0, (v1 + 1) * 8);
if (v5) {
v3 = v5;
if (!set_fstype_devno(v2)) {
*((0x8 * v1 + v3)) = v2[4];
v1 += 1;
}
} else {
free(v3);
v3 = 0;
}
}
free_file_system_list(v4);
if (v3) {
*(a0) = v1;
return v3;
}
return v3;
}
|
int
kex_verify_host_key(struct ssh *ssh, struct sshkey *server_host_key)
{
struct kex *kex = ssh->kex;
if (kex->verify_host_key ==
((void *)0)
) {
sshlog("kex.c", __func__, 1168, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "missing hostkey verifier");
return -10;
}
if (server_host_key->type != kex->hostkey_type ||
(kex->hostkey_type == KEY_ECDSA &&
server_host_key->ecdsa_nid != kex->hostkey_nid))
return -13;
if (kex->verify_host_key(server_host_key, ssh) == -1)
return -21;
return 0;
}
| long long kex_verify_host_key(struct_0 *a0, unsigned int a1[7]) {
struct_1 *v0;
unsigned long long v2;
v0 = a0->field_8;
if (!v0->field_a0) {
sshlog("kex.c", "kex_verify_host_key", 0x490, 0x1, 0x2, 0x0, "missing hostkey verifier");
v2 = 4294967286;
return v2;
} else if (a1[0] != v0->field_30) {
v2 = 4294967283;
return v2;
} else {
if (v0->field_30 == 2 && a1[6] != v0->field_34) {
v2 = 4294967283;
return v2;
}
v2 = (v0->field_a0(a1, a0, a0, v0->field_a0) == -1 ? 0 : 4294967275);
return v2;
}
}
|
void
udequote_pathname (pathname)
char *pathname;
{
register int i, j;
for (i = j = 0; pathname && pathname[i]; )
{
if (pathname[i] == '\\')
i++;
pathname[j++] = pathname[i++];
if (pathname[i - 1] == 0)
break;
}
if (pathname)
pathname[j] = '\0';
}
| void udequote_pathname(long param_1)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
iVar2 = 0;
iVar4 = 0;
do {
if ((param_1 == 0) || (*(char *)(param_1 + iVar2) == '\0')) break;
if (*(char *)(param_1 + iVar2) == '\\') {
iVar2 = iVar2 + 1;
}
iVar3 = iVar2 + 1;
iVar1 = iVar4 + 1;
*(undefined *)(iVar4 + param_1) = *(undefined *)(iVar2 + param_1);
iVar2 = iVar3;
iVar4 = iVar1;
} while (*(char *)(param_1 + (long)iVar3 + -1) != '\0');
if (param_1 != 0) {
*(undefined *)(param_1 + iVar4) = 0;
}
return;
}
|
vi_alias(EditLine *el, wint_t c __attribute__((__unused__)))
{
char alias_name[3];
const char *alias_text;
if (el->el_chared.c_aliasfun ==
((void *)0)
)
return 6;
alias_name[0] = '_';
alias_name[2] = 0;
if (el_getc(el, &alias_name[1]) != 1)
return 6;
alias_text = (*el->el_chared.c_aliasfun)(el->el_chared.c_aliasarg,
alias_name);
if (alias_text !=
((void *)0)
)
el_wpush(el, ct_decode_string(alias_text, &el->el_scratch));
return 0;
}
| long long vi_alias(unsigned long long a0[126], unsigned long a1) {
unsigned int v0;
unsigned long long v1;
char v2;
char v3;
char v4;
unsigned long long v6;
unsigned long long v7;
v0 = a1;
if (!a0[123]) {
v6 = 6;
} else {
v2 = 95;
v4 = 0;
if (el_getc(a0, &v3, &v3) != 1) {
v6 = 6;
} else {
v1 = a0[123](a0[125], &v2, &v2, a0[123]);
if (v1) {
v7 = ct_decode_string(v1, &a0[1 + 31], &a0[1 + 31]);
el_wpush(a0, v7, v7);
}
v6 = 0;
}
}
return v6;
}
|
static inline void *
ptr_align (void *ptr, size_t alignment)
{
char *p0 = ptr;
char *p1 = p0 + alignment - 1;
return p1 - (size_t) p1 % alignment;
}
| void ptr_align(unsigned long a0, unsigned long a1) {
unsigned long v0;
char v1;
unsigned long v3;
unsigned long long v4;
v0 = a0 + a1 - 1;
v3 = v0 + -((0 CONCAT v0) /m a1 >> 64);
v4 = *(&v1);
return;
}
|
void
warnc(int code, const char *format, ...)
{
va_list ap;
__builtin_va_start(
ap
,
format
)
;
vwarnc(code, format, ap);
__builtin_va_end(
ap
)
;
}
| long long warnc(unsigned long a0, char *a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) {
unsigned int v0;
unsigned int v1;
unsigned long v2;
unsigned long v3;
unsigned long v4;
char v5;
unsigned long v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
int v10;
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
int v17;
unsigned long v18;
char v19;
int v20;
int v21;
int v22;
int v23;
int v24;
int v25;
int v26;
int v27;
unsigned long long *v28;
v6 = a2;
v7 = a3;
v8 = a4;
v9 = a5;
if (v19) {
v10 = v20;
v11 = v21;
v12 = v22;
v13 = v23;
v14 = v24;
v15 = v25;
v16 = v26;
v17 = v27;
}
v4 = v28[5];
v0 = 16;
v1 = 48;
v2 = &v18;
v3 = &v5;
vwarnc(a0, a1, &v0);
if (!(v4 ^ v28[5]))
return 0;
__stack_chk_fail();
}
|
static
_Bool
parse_newer (const struct parser_table* entry, char **argv, int *arg_ptr)
{
struct predicate *our_pred;
struct stat stat_newer;
const char *arg;
set_stat_placeholders (&stat_newer);
if (collect_arg_stat_info (argv, arg_ptr, &stat_newer, &arg))
{
our_pred = insert_primary (entry, arg);
our_pred->args.reftime.ts = get_stat_mtime (&stat_newer);
our_pred->args.reftime.xval = XVAL_MTIME;
our_pred->args.reftime.kind = COMP_GT;
our_pred->est_success_rate = estimate_timestamp_success_rate (stat_newer.
st_mtim.tv_sec
);
return
1
;
}
return
0
;
}
| long long parse_newer(unsigned long long a0, unsigned long long a1, unsigned long long a2) {
char v0;
struct_0 *v1;
char v2;
char v3;
unsigned long long v5;
struct_0 *v6;
unsigned int v7;
set_stat_placeholders(&v2);
if (!collect_arg_stat_info(a1, a2, &v2, &v0)) {
v5 = 0;
} else {
v1 = insert_primary(a0, *(&v0), *(&v0));
v6 = v1;
v6->field_40 = get_stat_mtime(&v2);
v6->field_48 = a2;
v1->field_38 = 3;
v1->field_3c = 0;
estimate_timestamp_success_rate(*(&v3));
v1->field_24 = v7;
v5 = 1;
}
return v5;
}
|
static
void sushell(struct passwd *pwd)
{
char shell[128];
char home[128];
char *p;
char *sushell;
if (chdir(pwd->pw_dir) < 0) {
if (chdir("/") < 0)
fprintf(
stderr
, "sulogin: change of working directory failed: %m\n\r");
}
if ((p = getenv("SUSHELL")) !=
((void *)0)
)
sushell = p;
else if ((p = getenv("sushell")) !=
((void *)0)
)
sushell = p;
else {
if (pwd->pw_shell[0])
sushell = pwd->pw_shell;
else
sushell = "/bin/sh";
}
if ((p = strrchr(sushell, '/')) ==
((void *)0)
)
p = sushell;
else
p++;
snprintf(shell, sizeof(shell), profile ? "-%s" : "%s", p);
if (getcwd(home, sizeof(home)) == (char*)0)
strcpy(home, "/");
setenv("HOME", home, 1);
setenv("LOGNAME", "root", 1);
setenv("USER", "root", 1);
if (!profile)
setenv("SHLVL","0",1);
setenv("SHELL", sushell, 1);
signal(
2
, saved_sigint);
signal(
20
, saved_sigtstp);
signal(
3
, saved_sigquit);
signal(
1
,
((__sighandler_t) 0)
);
execl(sushell, shell,
((void *)0)
);
perror(sushell);
setenv("SHELL", "/bin/sh", 1);
execl("/bin/sh", profile ? "-sh" : "sh",
((void *)0)
);
perror("/bin/sh");
setenv("SHELL", "/bin/sash", 1);
execl("/bin/sash", "/bin/sash",
((void *)0)
);
perror("/bin/sash");
}
| void sushell(unsigned long long a0[6]) {
unsigned long long v0;
unsigned long long v1;
char v2;
char v3;
char v4;
unsigned long long v6;
unsigned long long v7;
unsigned long long *v8;
unsigned long long v9;
if (chdir(a0[4]) < 0 && chdir("/") < 0)
fprintf(stderr, "sulogin: change of working directory failed: %m\n\r");
v0 = getenv("SUSHELL");
if (v0) {
v1 = v0;
} else {
v0 = getenv("sushell");
if (v0) {
v1 = v0;
} else if (!*(a0[5])) {
v1 = "/bin/sh";
} else {
v1 = a0[5];
}
}
v0 = strrchr(v1, 0x2f);
if (!v0)
v0 = v1;
else
v0 += 1;
if (profile)
v6 = "-%s";
else
v6 = "%s";
snprintf(&v2, 0x80, v6);
if (!getcwd(&v3, 0x80))
strcpy(&v3, "/");
setenv("HOME", &v3, 0x1);
setenv("LOGNAME", "root", 0x1);
setenv("USER", "root", 0x1);
if (!profile)
setenv("SHLVL", "0", 0x1);
setenv("SHELL", v1, 0x1);
signal(0x2, saved_sigint);
signal(0x14, saved_sigtstp);
signal(0x3, saved_sigquit);
signal(0x1, 0x0);
execl(v1, &v2);
perror(v1);
setenv("SHELL", "/bin/sh", 0x1);
if (profile)
v7 = "-sh";
else
v7 = "sh";
execl("/bin/sh", v7);
perror("/bin/sh");
setenv("SHELL", "/bin/sash", 0x1);
execl("/bin/sash", "/bin/sash");
perror("/bin/sash");
v9 = *(&v4) ^ v8[5];
return;
}
|
static void open_files (
_Bool
readonly)
{
if (!readonly) {
if (pw_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, pw_dbname ());
fail_exit (1);
}
pw_locked =
1
;
}
if (pw_open (readonly ?
00
:
0100
|
02
) == 0) {
fprintf (
stderr
, gettext ("%s: cannot open %s\n"), Prog, pw_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
4
, "cannot open %s", pw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
fail_exit (1);
}
if (!readonly) {
if (spw_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, spw_dbname ());
fail_exit (1);
}
spw_locked =
1
;
}
if (spw_open (readonly ?
00
:
0100
|
02
) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot open %s\n"), Prog, spw_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
4
, "cannot open %s", spw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
fail_exit (1);
}
}
| void open_files(char param_1)
{
int iVar1;
undefined4 uVar2;
undefined8 uVar3;
char *pcVar4;
undefined8 uVar5;
char *local_38;
char *local_30;
if (param_1 != '\x01') {
iVar1 = pw_lock();
if (iVar1 == 0) {
uVar3 = pw_dbname();
uVar5 = Prog;
pcVar4 = (char *)gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr,pcVar4,uVar5,uVar3);
fail_exit(1);
}
pw_locked = 1;
}
if (param_1 == '\0') {
uVar2 = 0x42;
}
else {
uVar2 = 0;
}
iVar1 = pw_open(uVar2);
if (iVar1 == 0) {
uVar3 = pw_dbname();
uVar5 = Prog;
pcVar4 = (char *)gettext("%s: cannot open %s\n");
fprintf(stderr,pcVar4,uVar5,uVar3);
pcVar4 = setlocale(6,(char *)0x0);
local_38 = (char *)0x0;
if (pcVar4 != (char *)0x0) {
local_38 = strdup(pcVar4);
}
if (local_38 != (char *)0x0) {
setlocale(6,"C");
}
uVar5 = pw_dbname();
syslog(4,"cannot open %s",uVar5);
if (local_38 != (char *)0x0) {
setlocale(6,local_38);
free(local_38);
}
fail_exit(1);
}
if (param_1 != '\x01') {
iVar1 = spw_lock();
if (iVar1 == 0) {
uVar3 = spw_dbname();
uVar5 = Prog;
pcVar4 = (char *)gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr,pcVar4,uVar5,uVar3);
fail_exit(1);
}
spw_locked = 1;
}
if (param_1 == '\0') {
uVar2 = 0x42;
}
else {
uVar2 = 0;
}
iVar1 = spw_open(uVar2);
if (iVar1 == 0) {
uVar3 = spw_dbname();
uVar5 = Prog;
pcVar4 = (char *)gettext("%s: cannot open %s\n");
fprintf(stderr,pcVar4,uVar5,uVar3);
pcVar4 = setlocale(6,(char *)0x0);
local_30 = (char *)0x0;
if (pcVar4 != (char *)0x0) {
local_30 = strdup(pcVar4);
}
if (local_30 != (char *)0x0) {
setlocale(6,"C");
}
uVar5 = spw_dbname();
syslog(4,"cannot open %s",uVar5);
if (local_30 != (char *)0x0) {
setlocale(6,local_30);
free(local_30);
}
fail_exit(1);
}
return;
}
|
static inline void inet_prefix_reset(inet_prefix *p)
{
p->flags = 0;
}
| void inet_prefix_reset(unsigned short *a0) {
char v0;
unsigned short *v2;
unsigned long long v3;
v2 = a0;
*(a0) = 0;
v3 = *(&v0);
return;
}
|
static int
option_clear_or_none(const char *o)
{
return o ==
((void *)0)
|| strcasecmp(o, "none") == 0;
}
| undefined8 option_clear_or_none(char *param_1)
{
int iVar1;
if ((param_1 != (char *)0x0) && (iVar1 = strcasecmp(param_1,"none"), iVar1 != 0)) {
return 0;
}
return 1;
}
|
static void
initialize_dynamic_variables ()
{
SHELL_VAR *v;
v = init_seconds_var ();
do { v = bind_variable ("BASH_ARGV0", ((char *)
((void *)0)
), 0); v->dynamic_value = get_bash_argv0; v->assign_func = assign_bash_argv0; } while (0);
do { v = bind_variable ("BASH_COMMAND", ((char *)
((void *)0)
), 0); v->dynamic_value = get_bash_command; v->assign_func = (sh_var_assign_func_t *)
((void *)0)
; } while (0);
do { v = bind_variable ("BASH_SUBSHELL", ((char *)
((void *)0)
), 0); v->dynamic_value = get_subshell; v->assign_func = assign_subshell; } while (0);
do { v = bind_variable ("RANDOM", ((char *)
((void *)0)
), 0); v->dynamic_value = get_random; v->assign_func = assign_random; } while (0);
((v)->attributes |= (0x0000010));
do { v = bind_variable ("SRANDOM", ((char *)
((void *)0)
), 0); v->dynamic_value = get_urandom; v->assign_func = (sh_var_assign_func_t *)
((void *)0)
; } while (0);
((v)->attributes |= (0x0000010));
do { v = bind_variable ("LINENO", ((char *)
((void *)0)
), 0); v->dynamic_value = get_lineno; v->assign_func = assign_lineno; } while (0);
((v)->attributes |= (0x0040000));
do { v = bind_variable ("BASHPID", ((char *)
((void *)0)
), 0); v->dynamic_value = get_bashpid; v->assign_func = null_assign; } while (0);
((v)->attributes |= (0x0000010));
do { v = bind_variable ("EPOCHSECONDS", ((char *)
((void *)0)
), 0); v->dynamic_value = get_epochseconds; v->assign_func = null_assign; } while (0);
((v)->attributes |= (0x0040000));
do { v = bind_variable ("EPOCHREALTIME", ((char *)
((void *)0)
), 0); v->dynamic_value = get_epochrealtime; v->assign_func = null_assign; } while (0);
((v)->attributes |= (0x0040000));
do { v = bind_variable ("HISTCMD", ((char *)
((void *)0)
), 0); v->dynamic_value = get_histcmd; v->assign_func = (sh_var_assign_func_t *)
((void *)0)
; } while (0);
((v)->attributes |= (0x0000010));
do { v = bind_variable ("COMP_WORDBREAKS", ((char *)
((void *)0)
), 0); v->dynamic_value = get_comp_wordbreaks; v->assign_func = assign_comp_wordbreaks; } while (0);
v = init_dynamic_array_var ("DIRSTACK", get_dirstack, assign_dirstack, 0);
v = init_dynamic_array_var ("GROUPS", get_groupset, null_array_assign, 0x0004000);
v = init_dynamic_array_var ("BASH_ARGC", get_bashargcv, null_array_assign, 0x0004000|0x0002000);
v = init_dynamic_array_var ("BASH_ARGV", get_bashargcv, null_array_assign, 0x0004000|0x0002000);
v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, 0x0004000|0x0002000);
v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, 0x0004000|0x0002000);
v = init_dynamic_assoc_var ("BASH_CMDS", get_hashcmd, assign_hashcmd, 0x0020000);
v = init_dynamic_assoc_var ("BASH_ALIASES", get_aliasvar, assign_aliasvar, 0x0020000);
v = init_funcname_var ();
}
| void initialize_dynamic_variables(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned long v0;
v0 = init_seconds_var(a0, a1, a2);
v0[0] = bind_variable("BASH_ARGV0", 0x0, 0x0);
v0[3] = get_bash_argv0;
v0[4] = assign_bash_argv0;
v0[0] = bind_variable("BASH_COMMAND", 0x0, 0x0);
v0[3] = get_bash_command;
v0[4] = 0;
v0[0] = bind_variable("BASH_SUBSHELL", 0x0, 0x0);
v0[3] = get_subshell;
v0[4] = assign_subshell;
v0 = bind_variable("RANDOM", 0x0, 0x0);
v0[3] = get_random;
v0[4] = assign_random;
v0->field_28 = v0->field_28 | 16;
v0 = bind_variable("SRANDOM", 0x0, 0x0);
v0[3] = get_urandom;
v0[4] = 0;
v0->field_28 = v0->field_28 | 16;
v0 = bind_variable("LINENO", 0x0, 0x0);
v0[3] = get_lineno;
v0[4] = assign_lineno;
v0->field_28 = v0->field_28 | 0x40000;
v0 = bind_variable("BASHPID", 0x0, 0x0);
v0[3] = get_bashpid;
v0[4] = null_assign;
v0->field_28 = v0->field_28 | 16;
v0 = bind_variable("EPOCHSECONDS", 0x0, 0x0);
v0[3] = get_epochseconds;
v0[4] = null_assign;
v0->field_28 = v0->field_28 | 0x40000;
v0 = bind_variable("EPOCHREALTIME", 0x0, 0x0);
v0[3] = get_epochrealtime;
v0[4] = null_assign;
v0->field_28 = v0->field_28 | 0x40000;
v0 = bind_variable("HISTCMD", 0x0, 0x0);
v0[3] = get_histcmd;
v0[4] = 0;
v0->field_28 = v0->field_28 | 16;
v0[0] = bind_variable("COMP_WORDBREAKS", 0x0, 0x0);
v0[3] = get_comp_wordbreaks;
v0[4] = assign_comp_wordbreaks;
v0 = init_dynamic_array_var("DIRSTACK", get_dirstack, assign_dirstack, 0x0, a4, a5);
v0 = init_dynamic_array_var("GROUPS", get_groupset, null_array_assign, 0x4000, a4, a5);
v0 = init_dynamic_array_var("BASH_ARGC", get_bashargcv, null_array_assign, 0x6000, a4, a5);
v0 = init_dynamic_array_var("BASH_ARGV", get_bashargcv, null_array_assign, 0x6000, a4, a5);
v0 = init_dynamic_array_var("BASH_SOURCE", get_self, null_array_assign, 0x6000, a4, a5);
v0 = init_dynamic_array_var("BASH_LINENO", get_self, null_array_assign, 0x6000, a4, a5);
v0 = init_dynamic_assoc_var("BASH_CMDS", get_hashcmd, assign_hashcmd, 0x20000);
v0 = init_dynamic_assoc_var("BASH_ALIASES", get_aliasvar, assign_aliasvar, 0x20000);
*(&v0) = init_funcname_var("BASH_ALIASES", get_aliasvar, assign_aliasvar, 0x20000, a4, a5);
return;
}
|
static inline void
simplesort(const unsigned char **a, int n, int b, const unsigned char *tr,
unsigned int endch)
{
unsigned char ch;
const unsigned char **ak, **ai, *s, *t;
for (ak = a+1; --n >= 1; ak++)
for (ai = ak; ai > a; ai--) {
for (s = ai[0] + b, t = ai[-1] + b;
(ch = tr[*s]) != endch; s++, t++)
if (ch != tr[*t])
break;
if (ch >= tr[*t])
break;
s = ai[0], ai[0] = ai[-1], ai[-1] = s;
}
}
| void simplesort(long *param_1,int param_2,int param_3,long param_4,uint param_5)
{
byte bVar1;
long lVar2;
int local_44;
long *local_28;
long *local_20;
byte *local_18;
byte *local_10;
local_28 = param_1 + 1;
local_44 = param_2;
do {
local_44 = local_44 + -1;
if (local_44 < 1) {
return;
}
for (local_20 = local_28; param_1 < local_20; local_20 = local_20 + -1) {
local_18 = (byte *)((long)param_3 + *local_20);
local_10 = (byte *)((long)param_3 + local_20[-1]);
while ((bVar1 = *(byte *)(param_4 + (ulong)*local_18), param_5 != bVar1 &&
(bVar1 == *(byte *)(param_4 + (ulong)*local_10)))) {
local_18 = local_18 + 1;
local_10 = local_10 + 1;
}
if (*(byte *)(param_4 + (ulong)*local_10) <= bVar1) break;
lVar2 = *local_20;
*local_20 = local_20[-1];
local_20[-1] = lVar2;
}
local_28 = local_28 + 1;
} while( true );
}
|
int
do_mkdir(struct sftp_conn *conn, const char *path, Attrib *a, int print_flag)
{
u_int status, id;
sshlog("sftp-client.c", __func__, 873, 0, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "Sending SSH2_FXP_MKDIR \"%s\"", path);
id = conn->msg_id++;
send_string_attrs_request(conn, id, 14, path,
strlen(path), a);
status = get_status(conn, id);
if (status != 0 && print_flag)
sshlog("sftp-client.c", __func__, 881, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "remote mkdir \"%s\": %s", path, fx2txt(status));
return status == 0 ? 0 : -1;
}
| undefined8 do_mkdir(long param_1,char *param_2,undefined8 param_3,int param_4)
{
int iVar1;
size_t sVar2;
undefined8 uVar3;
undefined8 uVar4;
sshlog("sftp-client.c",__func___13067,0x369,0,6,0,"Sending SSH2_FXP_MKDIR \"%s\"",param_2);
iVar1 = *(int *)(param_1 + 0x18);
*(int *)(param_1 + 0x18) = iVar1 + 1;
sVar2 = strlen(param_2);
send_string_attrs_request(param_1,iVar1,0xe,param_2,sVar2 & 0xffffffff,param_3);
iVar1 = get_status(param_1,iVar1);
if ((iVar1 != 0) && (param_4 != 0)) {
uVar4 = 0x1035c1;
uVar3 = fx2txt(iVar1);
sshlog("sftp-client.c",__func___13067,0x371,0,2,0,"remote mkdir \"%s\": %s",param_2,uVar3,uVar4)
;
}
if (iVar1 == 0) {
uVar3 = 0;
}
else {
uVar3 = 0xffffffff;
}
return uVar3;
}
|
static void
listen_on_addrs(struct listenaddr *la)
{
int ret, listen_sock;
struct addrinfo *ai;
char ntop[
1025
], strport[
32
];
for (ai = la->addrs; ai; ai = ai->ai_next) {
if (ai->ai_family !=
2
&& ai->ai_family !=
10
)
continue;
if (num_listen_socks >= 16)
sshfatal("sshd.c", __func__, 1039, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Too many listen sockets. " "Enlarge MAX_LISTEN_SOCKS")
;
if ((ret = getnameinfo(ai->ai_addr, ai->ai_addrlen,
ntop, sizeof(ntop), strport, sizeof(strport),
1
|
2
)) != 0) {
sshlog("sshd.c", __func__, 1044, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "getnameinfo failed: %.100s", ssh_gai_strerror(ret))
;
continue;
}
listen_sock = socket(ai->ai_family, ai->ai_socktype,
ai->ai_protocol);
if (listen_sock == -1) {
sshlog("sshd.c", __func__, 1053, 0, SYSLOG_LEVEL_VERBOSE,
((void *)0)
, "socket: %.100s", strerror(
(*__errno_location ())
));
continue;
}
if (set_nonblock(listen_sock) == -1) {
close(listen_sock);
continue;
}
if (fcntl(listen_sock,
2
,
1
) == -1) {
sshlog("sshd.c", __func__, 1061, 0, SYSLOG_LEVEL_VERBOSE,
((void *)0)
, "socket: CLOEXEC: %s", strerror(
(*__errno_location ())
));
close(listen_sock);
continue;
}
set_reuseaddr(listen_sock);
if (la->rdomain !=
((void *)0)
&&
set_rdomain(listen_sock, la->rdomain) == -1) {
close(listen_sock);
continue;
}
if (ai->ai_family ==
10
)
sock_set_v6only(listen_sock);
sshlog("sshd.c", __func__, 1077, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Bind to port %s on %s.", strport, ntop);
if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) == -1) {
sshlog("sshd.c", __func__, 1081, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Bind to port %s on %s failed: %.200s.", strport, ntop, strerror(
(*__errno_location ())
))
;
close(listen_sock);
continue;
}
listen_socks[num_listen_socks] = listen_sock;
num_listen_socks++;
if (listen(listen_sock, 128) == -1)
sshfatal("sshd.c", __func__, 1091, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "listen on [%s]:%s: %.100s", ntop, strport, strerror(
(*__errno_location ())
))
;
sshlog("sshd.c", __func__, 1093, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Server listening on %s port %s%s%s.", ntop, strport, la->rdomain ==
((void *)0)
? "" : " rdomain ", la->rdomain ==
((void *)0)
? "" : la->rdomain)
;
}
}
| void listen_on_addrs(long *param_1)
{
socklen_t sVar1;
int __type;
int __domain;
sockaddr *psVar2;
int iVar3;
undefined8 uVar4;
int *piVar5;
char *pcVar6;
undefined *puVar7;
undefined *puVar8;
long in_FS_OFFSET;
undefined auStack1112 [8];
long *local_450;
int local_448;
int local_444;
long local_440;
char local_438 [32];
char local_418 [1032];
long local_10;
puVar8 = auStack1112;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_440 = param_1[1];
local_450 = param_1;
do {
if (local_440 == 0) {
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)(puVar8 + -8) = 0x1028d3;
__stack_chk_fail();
}
return;
}
if ((*(int *)(local_440 + 4) == 2) || (*(int *)(local_440 + 4) == 10)) {
if (0xf < num_listen_socks) {
*(char **)(puVar8 + -0x10) = "Too many listen sockets. Enlarge MAX_LISTEN_SOCKS";
*(undefined8 *)(puVar8 + -0x18) = 0x102454;
sshfatal("sshd.c","listen_on_addrs",0x40f,0,1,0);
puVar8 = puVar8 + -0x10;
}
sVar1 = *(socklen_t *)(local_440 + 0x10);
psVar2 = *(sockaddr **)(local_440 + 0x18);
*(undefined8 *)(puVar8 + -0x10) = 3;
*(undefined8 *)(puVar8 + -0x18) = 0x102493;
local_448 = getnameinfo(psVar2,sVar1,local_418,0x401,local_438,0x20,*(uint *)(puVar8 + -0x10))
;
if (local_448 == 0) {
iVar3 = *(int *)(local_440 + 0xc);
__type = *(int *)(local_440 + 8);
__domain = *(int *)(local_440 + 4);
*(undefined8 *)(puVar8 + -8) = 0x10251a;
local_444 = socket(__domain,__type,iVar3);
if (local_444 == -1) {
*(undefined8 *)(puVar8 + -8) = 0x10252e;
piVar5 = __errno_location();
iVar3 = *piVar5;
*(undefined8 *)(puVar8 + -8) = 0x102537;
pcVar6 = strerror(iVar3);
*(char **)(puVar8 + -8) = pcVar6;
*(char **)(puVar8 + -0x10) = "socket: %.100s";
*(undefined8 *)(puVar8 + -0x18) = 0x10256e;
sshlog("sshd.c","listen_on_addrs",0x41d,0,4,0);
}
else {
*(undefined8 *)(puVar8 + -8) = 0x102584;
iVar3 = set_nonblock();
if (iVar3 == -1) {
*(undefined8 *)(puVar8 + -8) = 0x102596;
close(local_444);
}
else {
*(undefined8 *)(puVar8 + -8) = 0x1025b7;
iVar3 = fcntl(local_444,2,1);
if (iVar3 == -1) {
*(undefined8 *)(puVar8 + -8) = 0x1025c1;
piVar5 = __errno_location();
iVar3 = *piVar5;
*(undefined8 *)(puVar8 + -8) = 0x1025ca;
pcVar6 = strerror(iVar3);
*(char **)(puVar8 + -8) = pcVar6;
*(char **)(puVar8 + -0x10) = "socket: CLOEXEC: %s";
*(undefined8 *)(puVar8 + -0x18) = 0x102601;
sshlog("sshd.c","listen_on_addrs",0x425,0,4,0);
*(undefined8 *)(puVar8 + -8) = 0x102612;
close(local_444);
}
else {
*(undefined8 *)(puVar8 + -8) = 0x102624;
set_reuseaddr();
if (*local_450 != 0) {
*(undefined8 *)(puVar8 + -8) = 0x10264d;
iVar3 = set_rdomain();
if (iVar3 == -1) {
*(undefined8 *)(puVar8 + -8) = 0x10265f;
close(local_444);
goto LAB_0010289e;
}
}
if (*(int *)(local_440 + 4) == 10) {
*(undefined8 *)(puVar8 + -8) = 0x102680;
sock_set_v6only(local_444);
}
*(char **)(puVar8 + -0x10) = local_418;
*(char **)(puVar8 + -0x18) = local_438;
*(char **)(puVar8 + -0x20) = "Bind to port %s on %s.";
*(undefined8 *)(puVar8 + -0x28) = 0x1026ca;
sshlog("sshd.c","listen_on_addrs",0x435,0,5,0);
sVar1 = *(socklen_t *)(local_440 + 0x10);
psVar2 = *(sockaddr **)(local_440 + 0x18);
*(undefined8 *)(puVar8 + -8) = 0x1026f6;
iVar3 = bind(local_444,psVar2,sVar1);
if (iVar3 == -1) {
*(undefined8 *)(puVar8 + -8) = 0x102700;
piVar5 = __errno_location();
iVar3 = *piVar5;
*(undefined8 *)(puVar8 + -8) = 0x102709;
pcVar6 = strerror(iVar3);
*(char **)(puVar8 + -8) = pcVar6;
*(char **)(puVar8 + -0x10) = local_418;
*(char **)(puVar8 + -0x18) = local_438;
*(char **)(puVar8 + -0x20) = "Bind to port %s on %s failed: %.200s.";
*(undefined8 *)(puVar8 + -0x28) = 0x102750;
sshlog("sshd.c","listen_on_addrs",0x439,0,2,0);
*(undefined8 *)(puVar8 + -8) = 0x102761;
close(local_444);
}
else {
*(int *)(listen_socks + (long)num_listen_socks * 4) = local_444;
*(undefined8 *)(puVar8 + -8) = 0x102798;
num_listen_socks = __addvsi3(num_listen_socks,1);
*(undefined8 *)(puVar8 + -8) = 0x1027b0;
iVar3 = listen(local_444,0x80);
if (iVar3 == -1) {
*(undefined8 *)(puVar8 + -8) = 0x1027ba;
piVar5 = __errno_location();
iVar3 = *piVar5;
*(undefined8 *)(puVar8 + -8) = 0x1027c3;
pcVar6 = strerror(iVar3);
*(char **)(puVar8 + -8) = pcVar6;
*(char **)(puVar8 + -0x10) = local_438;
*(char **)(puVar8 + -0x18) = local_418;
*(char **)(puVar8 + -0x20) = "listen on [%s]:%s: %.100s";
*(undefined8 *)(puVar8 + -0x28) = 0x10280a;
sshfatal("sshd.c","listen_on_addrs",0x443,0,1,0);
puVar8 = puVar8 + -0x20;
}
if (*local_450 == 0) {
puVar7 = &DAT_0010737c;
}
else {
puVar7 = (undefined *)*local_450;
}
if (*local_450 == 0) {
pcVar6 = "";
}
else {
pcVar6 = " rdomain ";
}
*(undefined **)(puVar8 + -0x10) = puVar7;
*(char **)(puVar8 + -0x18) = pcVar6;
*(char **)(puVar8 + -0x20) = local_438;
*(char **)(puVar8 + -0x28) = local_418;
*(char **)(puVar8 + -0x30) = "Server listening on %s port %s%s%s.";
*(undefined8 *)(puVar8 + -0x38) = 0x102897;
sshlog("sshd.c","listen_on_addrs",0x445,0,3,0);
}
}
}
}
}
else {
*(undefined8 *)(puVar8 + -8) = 0x1024b3;
uVar4 = ssh_gai_strerror(local_448);
*(undefined8 *)(puVar8 + -8) = uVar4;
*(char **)(puVar8 + -0x10) = "getnameinfo failed: %.100s";
*(undefined8 *)(puVar8 + -0x18) = 0x1024ea;
sshlog("sshd.c","listen_on_addrs",0x414,0,2,0);
}
}
LAB_0010289e:
local_440 = *(long *)(local_440 + 0x28);
} while( true );
}
|
static
_Bool
extra_mode (mode_t input)
{
mode_t mask =
((0400|0200|0100) | ((0400|0200|0100) >> 3) | (((0400|0200|0100) >> 3) >> 3))
|
0170000
;
return !! (input & ~ mask);
}
| int extra_mode(unsigned long a0) {
unsigned int v0;
unsigned int v2;
v0 = 61951;
v2 = !(v0) & a0;
*(&v2) = (!(v0) & a0);
return v2;
}
|
void
usage (int status)
{
if (status !=
0
)
do { fprintf (
stderr
, gettext ("Try '%s --help' for more information.\n"), program_name); } while (0);
else
{
printf (gettext ("Usage: %s [OPTION]... DIRECTORY...\n"), program_name);
fputs_unlocked (gettext ("Create the DIRECTORY(ies), if they do not already exist.\n"),
stdout
)
;
emit_mandatory_arg_note ();
fputs_unlocked (gettext (" -m, --mode=MODE set file mode (as in chmod), not a=rwx - umask\n -p, --parents no error if existing, make parent directories as needed,\n with their file modes unaffected by any -m option.\n -v, --verbose print a message for each created directory\n"),
stdout
)
;
fputs_unlocked (gettext (" -Z set SELinux security context of each created directory\n to the default type\n --context[=CTX] like -Z, or if CTX is specified then set the SELinux\n or SMACK security context to CTX\n"),
stdout
)
;
fputs_unlocked (gettext (" --help display this help and exit\n"),
stdout
);
fputs_unlocked (gettext (" --version output version information and exit\n"),
stdout
);
emit_ancillary_info ("mkdir");
}
exit (status);
}
| void usage(unsigned long a0) {
unsigned long v0;
unsigned long v2;
v0 = v2;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s [OPTION]... DIRECTORY...\n"));
fputs_unlocked(gettext("Create the DIRECTORY(ies), if they do not already exist.\n"), stdout);
emit_mandatory_arg_note();
fputs_unlocked(gettext(" -m, --mode=MODE set file mode (as in chmod), not a=rwx - umask\n -p, --parents no error if existing, make parent directories as needed,\n with their file modes unaffected by any -m option.\n -v, --verbose print a message for each created directory\n"), stdout);
fputs_unlocked(gettext(" -Z set SELinux security context of each created directory\n to the default type\n --context[=CTX] like -Z, or if CTX is specified then set the SELinux\n or SMACK security context to CTX\n"), stdout);
fputs_unlocked(gettext(" --help display this help and exit\n"), stdout);
fputs_unlocked(gettext(" --version output version information and exit\n"), stdout);
emit_ancillary_info("mkdir");
}
exit(a0);
}
|
static int
maintscript_set_exec_context(struct command *cmd)
{
return setexecfilecon(cmd->filename, "dpkg_script_t");
}
| void maintscript_set_exec_context(long param_1)
{
setexecfilecon(*(undefined8 *)(param_1 + 8),"dpkg_script_t");
return;
}
|
char *
sshbuf_dup_string(struct sshbuf *buf)
{
const u_char *p =
((void *)0)
, *s = sshbuf_ptr(buf);
size_t l = sshbuf_len(buf);
char *r;
if (s ==
((void *)0)
|| l >
(18446744073709551615UL)
)
return
((void *)0)
;
if (l > 0 && (p = memchr(s, '\0', l)) !=
((void *)0)
) {
if (p != s + l - 1)
return
((void *)0)
;
l--;
}
if ((r = malloc(l + 1)) ==
((void *)0)
)
return
((void *)0)
;
if (l > 0)
memcpy(r, s, l);
r[l] = '\0';
return r;
}
| int sshbuf_dup_string(unsigned long long a0) {
char *v0;
void* v1;
void* v2;
char *v3;
unsigned int v5;
v1 = 0;
v2 = sshbuf_ptr(a0);
v0 = sshbuf_len(a0);
if (!v2) {
v5 = 0;
} else {
if (v0) {
v1 = memchr(v2, 0x0, v0);
if (v1) {
if (v1 != v2 + v0 + 1)
v5 = 0;
else
v0 += 1;
}
}
if (!v1 || !v0 || v1 == v2 + v0 + 1) {
v3 = malloc(v0 + 1);
if (!v3) {
v5 = 0;
} else {
if (v0)
memcpy(v3, v2, v0);
*((v0 + v3)) = 0;
v5 = v3;
}
}
}
return v5;
}
|
char *
array_subrange (a, start, nelem, starsub, quoted, pflags)
ARRAY *a;
arrayind_t start, nelem;
int starsub, quoted, pflags;
{
ARRAY *a2;
ARRAY_ELEMENT *h, *p;
arrayind_t i;
char *t;
WORD_LIST *wl;
p = a ? ((a)->head) : 0;
if (p == 0 || ((a)->num_elements == 0) || start > ((a)->max_index))
return ((char *)
((void *)0)
);
for (p = ((p)->next); p != ((a)->head) && start > ((p)->ind); p = ((p)->next))
;
if (p == a->head)
return ((char *)
((void *)0)
);
for (i = 0, h = p; p != a->head && i < nelem; i++, p = ((p)->next))
;
a2 = array_slice(a, h, p);
wl = array_to_word_list(a2);
array_dispose(a2);
if (wl == 0)
return (char *)
((void *)0)
;
t = string_list_pos_params(starsub ? '*' : '@', wl, quoted, pflags);
dispose_words(wl);
return t;
}
| long long array_subrange(unsigned int a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) {
unsigned long long v0[3];
unsigned long long v1[3];
void* v2;
unsigned long long v3[3];
void* v4;
unsigned long long v5;
unsigned long long v6;
void* v8;
unsigned long long v9;
void* v10;
*(&v0[0]) = a0;
if (v0)
v8 = v0[2];
else
v8 = 0;
v1 = v8;
if (v1 && v0[1] && a1 <= v0[0]) {
for (v1[0] = v1[16]; v1 != v0[2]; v1[0] = v1[2]) {
if (a1 <= v1[0])
break;
}
if (v1 == v0[2]) {
v10 = 0;
} else {
v2 = 0;
for (v3[0] = v1; v1 != v0[2]; v1[0] = v1[2]) {
if (v2 >= a2)
break;
v2 += 1;
}
v4 = array_slice(v0, v3, v1);
v5 = array_to_word_list(v4);
array_dispose(v4);
if (!v5) {
v10 = 0;
} else {
if (a3)
v9 = 42;
else
v9 = 64;
v6 = string_list_pos_params(v9, v5, a4, a5);
dispose_words(v5);
v10 = v6;
}
}
}
if (!v0[1] || !v1 || a1 > v0[0])
v10 = 0;
return v10;
}
|
static void
chacha_ivsetup(chacha_ctx *x,const u8 *iv)
{
x->input[12] = 0;
x->input[13] = 0;
x->input[14] = (((u32)((iv + 0)[0]) ) | ((u32)((iv + 0)[1]) << 8) | ((u32)((iv + 0)[2]) << 16) | ((u32)((iv + 0)[3]) << 24));
x->input[15] = (((u32)((iv + 4)[0]) ) | ((u32)((iv + 4)[1]) << 8) | ((u32)((iv + 4)[2]) << 16) | ((u32)((iv + 4)[3]) << 24));
}
| void chacha_ivsetup(long param_1,undefined4 *param_2)
{
*(undefined4 *)(param_1 + 0x30) = 0;
*(undefined4 *)(param_1 + 0x34) = 0;
*(undefined4 *)(param_1 + 0x38) = *param_2;
*(undefined4 *)(param_1 + 0x3c) = param_2[1];
return;
}
|
static void
init_column_info (size_t max_cols)
{
size_t i;
static size_t column_info_alloc;
if (column_info_alloc < max_cols)
{
size_t new_column_info_alloc;
size_t *p;
if (!max_idx || max_cols < max_idx / 2)
{
column_info = xnrealloc (column_info, max_cols,
2 * sizeof *column_info);
new_column_info_alloc = 2 * max_cols;
}
else
{
column_info = xnrealloc (column_info, max_idx, sizeof *column_info);
new_column_info_alloc = max_idx;
}
{
size_t column_info_growth = new_column_info_alloc - column_info_alloc;
size_t s = column_info_alloc + 1 + new_column_info_alloc;
size_t t = s * column_info_growth;
if (s < new_column_info_alloc || t / column_info_growth != s)
xalloc_die ();
p = xnmalloc (t / 2, sizeof *p);
}
for (i = column_info_alloc; i < new_column_info_alloc; i++)
{
column_info[i].col_arr = p;
p += i + 1;
}
column_info_alloc = new_column_info_alloc;
}
for (i = 0; i < max_cols; ++i)
{
size_t j;
column_info[i].valid_len =
1
;
column_info[i].line_len = (i + 1) * MIN_COLUMN_WIDTH;
for (j = 0; j <= i; ++j)
column_info[i].col_arr[j] = MIN_COLUMN_WIDTH;
}
}
| void init_column_info(unsigned long long a0) {
void* v0;
unsigned long long v1;
unsigned long v2;
void* v3;
unsigned long v4;
unsigned long v5;
unsigned long v6;
void* v8;
if (a0 <= column_info_alloc.10449) {
LABEL_409dbf:
v0 = 0;
while (true) {
v8 = v0;
if (v0 >= a0)
break;
*((v0 * 24 + column_info)) = 1;
*((column_info + v0 * 24 + 8)) = (v0 + 1) * 3;
for (v3 = 0; v3 <= v0; v3 += 1) {
*((*((v0 * 24 + column_info + 16)) + v3 * 8)) = 3;
}
v0 += 1;
}
return;
} else {
if (!max_idx) {
LABEL_409c93:
column_info = xnrealloc(column_info, a0, 0x30, a0);
v1 = a0 * 2;
} else {
if (a0 < max_idx >> 1)
goto LABEL_409c93;
column_info = xnrealloc(column_info, max_idx, 0x18, max_idx);
v1 = max_idx;
}
v4 = v1 - column_info_alloc.10449;
v5 = v1 + column_info_alloc.10449 + 1;
v6 = v4 * v5;
if (v5 >= v1 && v5 == (0 CONCAT v6) /m v4) {
v2 = xnmalloc(v6 >> 1, 0x8);
for (v0 = column_info_alloc.10449; v0 < v1; v0 += 1) {
*((column_info + v0 * 24 + 16)) = v2;
v2 += (v0 + 1) * 8;
}
column_info_alloc.10449 = v1;
goto LABEL_409dbf;
}
xalloc_die();
}
}
|
int crypto_sign_ed25519_keypair(
unsigned char *pk,
unsigned char *sk
)
{
crypto_sign_ed25519_ref_sc25519 scsk;
crypto_sign_ed25519_ref_ge25519 gepk;
unsigned char extsk[64];
int i;
arc4random_buf((sk), (32));
crypto_hash_sha512(extsk, sk, 32);
extsk[0] &= 248;
extsk[31] &= 127;
extsk[31] |= 64;
crypto_sign_ed25519_ref_sc25519_from32bytes(&scsk,extsk);
crypto_sign_ed25519_ref_scalarmult_base(&gepk, &scsk);
crypto_sign_ed25519_ref_pack(pk, &gepk);
for(i=0;i<32;i++)
sk[32 + i] = pk[i];
return 0;
}
| undefined8 crypto_sign_ed25519_keypair(long param_1,long param_2)
{
int iVar1;
long in_FS_OFFSET;
int local_2ec;
undefined local_2e8 [128];
undefined local_268 [512];
byte local_68 [31];
byte local_49;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
arc4random_buf(param_2,0x20);
crypto_hash_sha512(local_68,param_2,0x20);
local_68[0] = local_68[0] & 0xf8;
local_49 = local_49 & 0x7f | 0x40;
crypto_sign_ed25519_ref_sc25519_from32bytes(local_2e8,local_68);
crypto_sign_ed25519_ref_scalarmult_base(local_268,local_2e8);
crypto_sign_ed25519_ref_pack(param_1,local_268);
for (local_2ec = 0; local_2ec < 0x20; local_2ec = __addvsi3(local_2ec,1)) {
iVar1 = __addvsi3(local_2ec,0x20);
*(undefined *)(iVar1 + param_2) = *(undefined *)(local_2ec + param_1);
}
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return 0;
}
|
static char const *
scan_varname (char const *str)
{
if (str[1] == '{' && (c_isalpha (str[2]) || str[2] == '_'))
{
char const *end = str + 3;
while (c_isalnum (*end) || *end == '_')
++end;
if (*end == '}')
return end;
}
return
((void *)0)
;
}
| int scan_varname(char a0[3]) {
char *v0;
unsigned int v2;
if (a0[1] == 123) {
v2 = c_isalpha(a0[2]);
if (a0[2] == 95 || v2) {
v0 = &a0[1];
while (true) {
v2 = c_isalnum(*(v0));
if (!v2) {
if (*(v0) != 95)
break;
}
v0 += 1;
}
if (*(v0) == 125)
v2 = v0;
}
}
if (a0[1] != 123 || *(v0) != 125 || !v2 && a0[2] != 95)
v2 = 0;
return v2;
}
|
int
brand ()
{
unsigned int ret;
rseed = intrand32 (rseed);
if (shell_compatibility_level > 50)
ret = (rseed >> 16) ^ (rseed & 65535);
else
ret = rseed;
return (ret & 32767);
}
| uint brand(void)
{
uint local_c;
rseed = intrand32(rseed);
local_c = rseed;
if (0x32 < shell_compatibility_level) {
local_c = rseed & 0xffff ^ rseed >> 0x10;
}
return local_c & 0x7fff;
}
|
HIST_ENTRY *
remove_history(int num)
{
HIST_ENTRY *he;
HistEvent ev;
if (h ==
((void *)0)
|| e ==
((void *)0)
)
rl_initialize();
if ((he = malloc(sizeof(*he))) ==
((void *)0)
)
return
((void *)0)
;
if (history(h, &ev, 24, num, &he->data) != 0) {
free(he);
return
((void *)0)
;
}
he->line = ev.str;
if (history(h, &ev, 2) == 0)
history_length = ev.num;
return he;
}
| _QWORD * remove_history(unsigned int a1)
{
_QWORD *ptr;
int v3;
long v4;
unsigned long v5;
v5 = __readfsqword(0x28u);
if ( !h || !e )
rl_initialize();
ptr = malloc(0x10uLL);
if ( !ptr )
return 0LL;
if ( (unsigned int)history(h, &v3, 24LL, a1) )
{
free(ptr);
return 0LL;
}
else
{
*ptr = v4;
if ( !(unsigned int)history(h, &v3, 2LL, &v3) )
history_length = v3;
return ptr;
}
}
|
int
rl_delete (int count, int key)
{
int xpoint;
if (count < 0)
return (_rl_rubout_char (-count, key));
if (rl_point == rl_end)
{
rl_ding ();
return 1;
}
if (count > 1 || rl_explicit_arg)
{
xpoint = rl_point;
if (
(__ctype_get_mb_cur_max ())
> 1 && rl_byte_oriented == 0)
rl_forward_char (count, key);
else
rl_forward_byte (count, key);
rl_kill_text (xpoint, rl_point);
rl_point = xpoint;
}
else
{
xpoint = ((
(__ctype_get_mb_cur_max ())
> 1 && rl_byte_oriented == 0) ? _rl_find_next_mbchar ((rl_line_buffer), (rl_point), (1), (0x01)) : ((rl_point) + (1)));
rl_delete_text (rl_point, xpoint);
}
return 0;
}
| void rl_delete(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long long a3) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
unsigned long long v4;
unsigned long v5;
void* v6;
v0 = a0;
if (a0 < 0) {
v3 = _rl_rubout_char(-(v0), a1, -(v0), a3);
return;
} else if (rl_point != rl_end) {
if (a0 > 1 || rl_explicit_arg) {
v1 = rl_point;
if (__ctype_get_mb_cur_max() <= 1 || *(&rl_byte_oriented))
rl_forward_byte(a0, a1);
else
rl_forward_char(a0, a1);
rl_kill_text(v1, rl_point, rl_point);
rl_point = v1;
} else {
if (__ctype_get_mb_cur_max() <= 1 || *(&rl_byte_oriented))
v5 = rl_point + 1;
else
v5 = _rl_find_next_mbchar(rl_line_buffer, rl_point, 0x1, 0x1);
v1 = v5;
rl_delete_text(rl_point, v1);
}
v6 = 0;
return;
} else {
rl_ding();
v4 = 1;
return;
}
}
|
static
_Bool
set_libstdbuf_options (void)
{
_Bool
env_set =
0
;
for (size_t i = 0; i < (sizeof (stdbuf) / sizeof *(stdbuf)); i++)
{
if (stdbuf[i].optarg)
{
char *var;
int ret;
if (*stdbuf[i].optarg == 'L')
ret = asprintf (&var, "%s%c=L", "_STDBUF_",
toupper (stdbuf[i].optc));
else
ret = asprintf (&var, "%s%c=%"
"l" "u"
, "_STDBUF_",
toupper (stdbuf[i].optc),
(uintmax_t) stdbuf[i].size);
if (ret < 0)
xalloc_die ();
if (putenv (var) != 0)
{
((!!sizeof (struct { _Static_assert (EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext (\"failed to update the environment with %s\"), quote (var)), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_CANCELED,
(*__errno_location ())
, gettext ("failed to update the environment with %s"), quote (var)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_CANCELED,
(*__errno_location ())
, gettext ("failed to update the environment with %s"), quote (var)), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
env_set =
1
;
}
}
return env_set;
}
| int set_libstdbuf_options() {
char v0;
unsigned int v1;
char v2;
void* v3;
unsigned long long v5;
unsigned long long v6;
v0 = 0;
v3 = 0;
while (true) {
if (v3 <= 2) {
if (*((0x10 * v3 + 0x8 * v3 + &g_400ef0[0]))) {
if (*(*((0x10 * v3 + 0x8 * v3 + &g_400ef0[0]))) == 76)
v1 = asprintf(&v2, "%s%c=L", &g_401669, toupper(*((0x18 * v3 + &g_400ee8))));
else
v1 = asprintf(&v2, "%s%c=%lu", &g_401669, toupper(*((0x18 * v3 + &g_400ee8))), *((0x18 * v3 + &stdbuf)));
if (v1 < 0)
xalloc_die();
v5 = putenv(*(&v2));
if (v5) {
v6 = quote(*(&v2));
error(0x7d, *(__errno_location()), gettext("failed to update the environment with %s"));
}
v0 = 1;
}
if (!*((0x10 * v3 + 0x8 * v3 + &g_400ef0[0])) || !v5 && v1 >= 0)
v3 += 1;
} else {
return v0;
}
}
}
|
static WORD_LIST *
make_arith_for_expr (s)
char *s;
{
WORD_LIST *result;
WORD_DESC *wd;
if (s == 0 || *s == '\0')
return ((WORD_LIST *)
((void *)0)
);
wd = make_word (s);
wd->flags |= (1 << 5)|(1 << 4)|(1 << 1)|(1 << 12)|(1 << 20);
result = make_word_list (wd, (WORD_LIST *)
((void *)0)
);
return result;
}
| _QWORD * make_arith_for_expr(const char *a1)
{
long word;
if ( !a1 || !*a1 )
return 0LL;
word = make_word(a1);
*(_DWORD *)(word + 8) |= 0x101032u;
return make_word_list(word, 0LL);
}
|
ptrdiff_t
Pexecute (void *vcp, char const *buf, idx_t size, idx_t *match_size,
char const *start_ptr)
{
char const *p = start_ptr ? start_ptr : buf;
_Bool
bol = p[-1] == eolbyte;
char const *line_start = buf;
int e =
(-1)
;
char const *line_end;
struct pcre_comp *pc = vcp;
size_t
*sub =
pcre2_get_ovector_pointer_8
(pc->data);
char const *subject = buf;
do
{
line_end = rawmemchr (p, eolbyte);
if (
(18446744073709551615UL)
< line_end - p)
((!!sizeof (struct { _Static_assert (EXIT_TROUBLE, "verify_expr (" "EXIT_TROUBLE" ", " "(error (EXIT_TROUBLE, 0, gettext(\"exceeded PCRE's line length limit\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_TROUBLE, 0, gettext("exceeded PCRE's line length limit")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_TROUBLE, 0, gettext("exceeded PCRE's line length limit")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
for (;;)
{
while (localeinfo.sbclen[to_uchar (*p)] == -1)
{
p++;
subject = p;
bol =
0
;
}
idx_t search_offset = p - subject;
if (p == line_end)
{
sub[0] = sub[1] = search_offset;
e = pc->empty_match[bol];
break;
}
int options = 0;
if (!bol)
options |=
0x00000001u
;
e = jit_exec (pc, subject, line_end - subject,
search_offset, options);
if (!bad_utf8_from_pcre2 (e))
break;
idx_t valid_bytes =
pcre2_get_startchar_8
(pc->data);
if (search_offset <= valid_bytes)
{
if (valid_bytes == 0)
{
sub[0] = valid_bytes;
sub[1] = 0;
e = pc->empty_match[bol];
}
else
e = jit_exec (pc, subject, valid_bytes, search_offset,
options |
0x40000000u
|
0x00000002u
);
if (e !=
(-1)
)
break;
p = subject + valid_bytes + 1;
bol =
0
;
}
subject += valid_bytes + 1;
}
if (e !=
(-1)
)
break;
bol =
1
;
p = subject = line_start = line_end + 1;
}
while (p < buf + size);
if (e <= 0)
{
switch (e)
{
case
(-1)
:
break;
case
(-48)
:
((!!sizeof (struct { _Static_assert (EXIT_TROUBLE, "verify_expr (" "EXIT_TROUBLE" ", " "(error (EXIT_TROUBLE, 0, gettext(\"%s: memory exhausted\"), input_filename ()), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_TROUBLE, 0, gettext("%s: memory exhausted"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_TROUBLE, 0, gettext("%s: memory exhausted"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
case
(-46)
:
((!!sizeof (struct { _Static_assert (EXIT_TROUBLE, "verify_expr (" "EXIT_TROUBLE" ", " "(error (EXIT_TROUBLE, 0, gettext(\"%s: exhausted PCRE JIT stack\"), input_filename ()), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_TROUBLE, 0, gettext("%s: exhausted PCRE JIT stack"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_TROUBLE, 0, gettext("%s: exhausted PCRE JIT stack"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
case
(-47)
:
((!!sizeof (struct { _Static_assert (EXIT_TROUBLE, "verify_expr (" "EXIT_TROUBLE" ", " "(error (EXIT_TROUBLE, 0, gettext(\"%s: exceeded PCRE's backtracking limit\"), input_filename ()), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_TROUBLE, 0, gettext("%s: exceeded PCRE's backtracking limit"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_TROUBLE, 0, gettext("%s: exceeded PCRE's backtracking limit"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
case
(-53)
:
((!!sizeof (struct { _Static_assert (EXIT_TROUBLE, "verify_expr (" "EXIT_TROUBLE" ", " "(error (EXIT_TROUBLE, 0, gettext(\"%s: exceeded PCRE's nested backtracking limit\"), input_filename ()), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_TROUBLE, 0, gettext("%s: exceeded PCRE's nested backtracking limit"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_TROUBLE, 0, gettext("%s: exceeded PCRE's nested backtracking limit"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
case
(-52)
:
((!!sizeof (struct { _Static_assert (EXIT_TROUBLE, "verify_expr (" "EXIT_TROUBLE" ", " "(error (EXIT_TROUBLE, 0, gettext(\"%s: PCRE detected recurse loop\"), input_filename ()), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_TROUBLE, 0, gettext("%s: PCRE detected recurse loop"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_TROUBLE, 0, gettext("%s: PCRE detected recurse loop"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
case
(-63)
:
((!!sizeof (struct { _Static_assert (EXIT_TROUBLE, "verify_expr (" "EXIT_TROUBLE" ", " "(error (EXIT_TROUBLE, 0, gettext(\"%s: exceeded PCRE's heap limit\"), input_filename ()), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_TROUBLE, 0, gettext("%s: exceeded PCRE's heap limit"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_TROUBLE, 0, gettext("%s: exceeded PCRE's heap limit"), input_filename ()), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
default:
((!!sizeof (struct { _Static_assert (EXIT_TROUBLE, "verify_expr (" "EXIT_TROUBLE" ", " "(error (EXIT_TROUBLE, 0, gettext(\"%s: internal PCRE error: %d\"), input_filename (), e), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_TROUBLE, 0, gettext("%s: internal PCRE error: %d"), input_filename (), e), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_TROUBLE, 0, gettext("%s: internal PCRE error: %d"), input_filename (), e), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
return -1;
}
else
{
char const *matchbeg = subject + sub[0];
char const *matchend = subject + sub[1];
char const *beg;
char const *end;
if (start_ptr)
{
beg = matchbeg;
end = matchend;
}
else
{
beg = line_start;
end = line_end + 1;
}
*match_size = end - beg;
return beg - buf;
}
}
| long Pexecute(_QWORD *a1, char *a2, long a3, _QWORD *a4, char *a5)
{
char *v5;
long v6;
char *v7;
long v8;
char *v9;
long v10;
char *v11;
long v12;
char *v13;
long v14;
char *v15;
long v16;
char *v17;
long v18;
char *v19;
bool v24;
int v25;
_BOOL4 v26;
char *s;
long v28;
long v29;
long v30;
char *v31;
_QWORD *ovector_pointer_8;
char *v33;
long v34;
long startchar_8;
if ( a5 )
v5 = a5;
else
v5 = a2;
s = v5;
v24 = *(v5 - 1) == eolbyte;
v28 = (long)a2;
ovector_pointer_8 = (_QWORD *)pcre2_get_ovector_pointer_8(a1[3]);
v29 = (long)a2;
do
{
v33 = (char *)rawmemchr(s, eolbyte);
while ( 1 )
{
while ( *((_BYTE *)&localeinfo + (unsigned char)to_uchar((unsigned int)*s) + 3) == 0xFF )
{
v29 = (long)++s;
v24 = 0;
}
v34 = (long)&s[-v29];
if ( s == v33 )
break;
v26 = !v24;
v25 = jit_exec(a1, v29, (long)&v33[-v29], v34, v26);
if ( (unsigned char)bad_utf8_from_pcre2() != 1 )
goto LABEL_18;
startchar_8 = pcre2_get_startchar_8(a1[3]);
if ( v34 <= startchar_8 )
{
if ( startchar_8 )
{
v25 = jit_exec(a1, v29, startchar_8, v34, v26 | 0x40000002u);
}
else
{
*ovector_pointer_8 = 0LL;
ovector_pointer_8[1] = 0LL;
v25 = *((_DWORD *)a1 + v24 + 12);
}
if ( v25 != -1 )
goto LABEL_18;
s = (char *)(startchar_8 + 1 + v29);
v24 = 0;
}
v29 += startchar_8 + 1;
}
ovector_pointer_8[1] = v34;
*ovector_pointer_8 = ovector_pointer_8[1];
v25 = *((_DWORD *)a1 + v24 + 12);
LABEL_18:
if ( v25 != -1 )
break;
v24 = 1;
v28 = (long)(v33 + 1);
v29 = (long)(v33 + 1);
s = v33 + 1;
}
while ( v33 + 1 < &a2[a3] );
if ( v25 <= 0 )
{
if ( v25 > -46 )
{
if ( v25 == -1 )
return -1LL;
}
else if ( v25 >= -63 )
{
switch ( v25 )
{
case -63:
goto LABEL_31;
case -53:
goto LABEL_29;
case -52:
goto LABEL_30;
case -48:
v6 = input_filename();
v7 = gettext("%s: memory exhausted");
error(2, 0, v7, v6);
goto LABEL_27;
case -47:
goto LABEL_28;
case -46:
LABEL_27:
v8 = input_filename();
v9 = gettext("%s: exhausted PCRE JIT stack");
error(2, 0, v9, v8);
LABEL_28:
v10 = input_filename();
v11 = gettext("%s: exceeded PCRE's backtracking limit");
error(2, 0, v11, v10);
LABEL_29:
v12 = input_filename();
v13 = gettext("%s: exceeded PCRE's nested backtracking limit");
error(2, 0, v13, v12);
LABEL_30:
v14 = input_filename();
v15 = gettext("%s: PCRE detected recurse loop");
error(2, 0, v15, v14);
LABEL_31:
v16 = input_filename();
v17 = gettext("%s: exceeded PCRE's heap limit");
error(2, 0, v17, v16);
break;
default:
break;
}
}
v18 = input_filename();
v19 = gettext("%s: internal PCRE error: %d");
error(2, 0, v19, v18, (unsigned int)v25);
return -1LL;
}
if ( a5 )
{
v30 = *ovector_pointer_8 + v29;
v31 = (char *)(ovector_pointer_8[1] + v29);
}
else
{
v30 = v28;
v31 = v33 + 1;
}
*a4 = &v31[-v30];
return v30 - (_QWORD)a2;
}
|
static void
mp_factor_using_pollard_rho (mpz_t n, unsigned long int a,
struct mp_factors *factors)
{
mpz_t x, z, y, P;
mpz_t t, t2;
do { if (dev_debug) fprintf (
stderr
, "[pollard-rho (%lu)] ", a); } while (0);
__gmpz_inits
(t, t2,
((void *)0)
);
__gmpz_init_set_si
(y, 2);
__gmpz_init_set_si
(x, 2);
__gmpz_init_set_si
(z, 2);
__gmpz_init_set_ui
(P, 1);
unsigned long long int k = 1;
unsigned long long int l = 1;
while (
(__builtin_constant_p (
1
) && (
1
) == 0 ? ((
n
)->_mp_size < 0 ? -1 : (
n
)->_mp_size > 0) : __gmpz_cmp_ui (
n
,
1
))
!= 0)
{
for (;;)
{
do
{
__gmpz_mul
(t, x, x);
__gmpz_mod
(x, t, n);
__gmpz_add_ui
(x, x, a);
__gmpz_sub
(t, z, x);
__gmpz_mul
(t2, P, t);
__gmpz_mod
(P, t2, n);
if (k % 32 == 1)
{
__gmpz_gcd
(t, P, n);
if (
(__builtin_constant_p (
1
) && (
1
) == 0 ? ((
t
)->_mp_size < 0 ? -1 : (
t
)->_mp_size > 0) : __gmpz_cmp_ui (
t
,
1
))
!= 0)
goto factor_found;
__gmpz_set
(y, x);
}
}
while (--k != 0);
__gmpz_set
(z, x);
k = l;
l = 2 * l;
for (unsigned long long int i = 0; i < k; i++)
{
__gmpz_mul
(t, x, x);
__gmpz_mod
(x, t, n);
__gmpz_add_ui
(x, x, a);
}
__gmpz_set
(y, x);
}
factor_found:
do
{
__gmpz_mul
(t, y, y);
__gmpz_mod
(y, t, n);
__gmpz_add_ui
(y, y, a);
__gmpz_sub
(t, z, y);
__gmpz_gcd
(t, t, n);
}
while (
(__builtin_constant_p (
1
) && (
1
) == 0 ? ((
t
)->_mp_size < 0 ? -1 : (
t
)->_mp_size > 0) : __gmpz_cmp_ui (
t
,
1
))
== 0);
__gmpz_divexact
(n, n, t);
if (!mp_prime_p (t))
{
do { if (dev_debug) fprintf (
stderr
, "[composite factor--restarting pollard-rho] "); } while (0);
mp_factor_using_pollard_rho (t, a + 1, factors);
}
else
{
mp_factor_insert (factors, t);
}
if (mp_prime_p (n))
{
mp_factor_insert (factors, n);
break;
}
__gmpz_mod
(x, x, n);
__gmpz_mod
(z, z, n);
__gmpz_mod
(y, y, n);
}
__gmpz_clears
(P, t2, t, z, x, y,
((void *)0)
);
}
| long long mp_factor_using_pollard_rho(unsigned long long a0, unsigned long a1, void* a2, unsigned long long a3, unsigned long long a4) {
void* v0;
unsigned long long v1;
unsigned long long v2;
void* v3;
char v4;
char v5;
char v6;
char v7;
char v8;
char v9;
unsigned long long v12;
unsigned long long v13;
if (dev_debug)
fprintf(stderr, "[pollard-rho (%lu)] ", a1);
__gmpz_inits(&v8, &v9, 0x0, &v9, a4);
__gmpz_init_set_si(&v6, 0x2);
__gmpz_init_set_si(&v4, 0x2);
__gmpz_init_set_si(&v5, 0x2);
__gmpz_init_set_ui(&v7, 0x1, 0x0);
v1 = 1;
v2 = 1;
while (true) {
if (!__gmpz_cmp_ui(a0, 0x1, a2))
break;
while (true) {
__gmpz_mul(&v8, &v4, &v4, &v4);
__gmpz_mod(&v4, &v8, a0, &v8);
__gmpz_add_ui(&v4, &v4, a1, &v4);
__gmpz_sub(&v8, &v5, &v4, &v5);
__gmpz_mul(&v9, &v7, &v8, &v7);
__gmpz_mod(&v7, &v9, a0, &v9);
if ((v1 & 31) == 1) {
__gmpz_gcd(&v8, &v7, a0, &v7);
v12 = __gmpz_cmp_ui(&v8, 0x1, a2);
if (!v12) {
__gmpz_set(&v6, &v4, &v4, &v7);
} else {
while (true) {
__gmpz_mul(&v8, &v6, &v6, &v6);
__gmpz_mod(&v6, &v8, a0, &v8);
__gmpz_add_ui(&v6, &v6, a1, &v6);
__gmpz_sub(&v8, &v5, &v6, &v5);
__gmpz_gcd(&v8, &v8, a0, &v8);
v13 = __gmpz_cmp_ui(&v8, 0x1, a2);
if (v13)
break;
}
}
}
if (!v12 || (v1 & 31) != 1) {
v1 -= 1;
if (v1)
continue;
__gmpz_set(&v5, &v4, &v4, a3);
v1 = v2;
v2 *= 2;
for (v3 = 0; v3 < v1; v3 += 1) {
__gmpz_mul(&v8, &v4, &v4, &v4);
__gmpz_mod(&v4, &v8, a0, &v8);
__gmpz_add_ui(&v4, &v4, a1, &v4);
}
__gmpz_set(&v6, &v4, &v4, a3);
}
}
__gmpz_divexact(a0, a0, &v8, a0);
*(&v13) = mp_prime_p(&v8, a1, &v8) ^ 1;
if (v13) {
if (dev_debug)
fprintf(stderr, "[composite factor--restarting pollard-rho] ");
mp_factor_using_pollard_rho(&v8, a1 + 1, a2, a1 + 1, a4);
} else {
mp_factor_insert(a2, &v8);
}
if (mp_prime_p(a0, a1, a2)) {
mp_factor_insert(a2, a0);
break;
} else {
__gmpz_mod(&v4, &v4, a0, &v4);
__gmpz_mod(&v5, &v5, a0, &v5);
__gmpz_mod(&v6, &v6, a0, &v6);
}
}
v0 = 0;
__gmpz_clears(&v7, &v9, &v8, &v5, &v4);
return 0;
}
|
int
_rl_vi_domove_motion_cleanup (int c, _rl_vimotion_cxt *m)
{
int r;
rl_end = m->end;
rl_line_buffer[rl_end] = '\0';
_rl_fix_point (0);
if (rl_mark == rl_point)
{
if (((1 && (1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)m->key
))] & (unsigned short int) _ISlower)
)) ? toupper((unsigned char)(m->key)) : (m->key)) == 'C' && _rl_vi_motion_command (c))
return (vidomove_dispatch (m));
(rl_readline_state &= ~(0x0100000));
return (-1);
}
if ((((1 && (1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)c
))] & (unsigned short int) _ISlower)
)) ? toupper((unsigned char)(c)) : (c)) == 'W') && rl_point < rl_end && rl_point > rl_mark &&
!(((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t')))
rl_point--;
if (m->key == 'c' && rl_point >= rl_mark && (((1 && (1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)c
))] & (unsigned short int) _ISlower)
)) ? toupper((unsigned char)(c)) : (c)) == 'W'))
{
while (rl_point > rl_mark && (((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t')))
rl_point--;
if (rl_point == rl_mark)
_rl_vi_advance_point ();
else
{
if (rl_point >= 0 && rl_point < (rl_end - 1) && !(((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t')))
_rl_vi_advance_point ();
}
}
if (rl_mark < rl_point)
do { int t; t = rl_point; rl_point = rl_mark; rl_mark = t; } while (0);
if ((rl_readline_state & (0x0080000)))
(*rl_redisplay_function)();
r = vidomove_dispatch (m);
return (r);
}
| void _rl_vi_domove_motion_cleanup(unsigned long a0, unsigned int a1[8], unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
unsigned int v1;
unsigned int v4;
unsigned int v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned int v10;
unsigned long long v11;
unsigned long long v12;
rl_end = a1[6];
*((rl_end + rl_line_buffer)) = 0;
_rl_fix_point(0x0);
if (rl_mark == rl_point) {
v4 = *((a1[7] * 2 + *(__ctype_b_loc()))) & 0x200;
if (v4)
*(&v4) = toupper(a1[7]) == 67;
else
*(&v4) = a1[7] == 67;
if (v4) {
v7 = _rl_vi_motion_command(a0);
if (v7)
v9 = vidomove_dispatch(a1, a1, a2, a3, a4, a5);
}
if (!v7 || !v4) {
rl_readline_state = rl_readline_state & -1048577;
v8 = 4294967295;
}
} else {
v6 = *((*(__ctype_b_loc()) + a0 * 2)) & 0x200;
if (v6)
*(&v6) = toupper(a0) == 87;
else
*(&v6) = a0 == 87;
if (v6 && rl_point < rl_end && rl_point > rl_mark && *((rl_point + rl_line_buffer)) != 32 && *((rl_point + rl_line_buffer)) != 9)
rl_point = rl_point - 1;
if (a1[7] == 99 && rl_point >= rl_mark) {
*(&v6) = *((*(__ctype_b_loc()) + a0 * 2));
v10 = v6 & 0x200;
if (v10)
*(&v10) = toupper(a0) == 87;
else
*(&v10) = a0 == 87;
if (v10) {
for (; rl_point > rl_mark; rl_point = rl_point - 1) {
if (*((rl_point + rl_line_buffer)) != 32) {
if (*((rl_point + rl_line_buffer)) != 9)
break;
}
}
if (rl_point == rl_mark) {
_rl_vi_advance_point();
} else if (rl_point >= 0 && rl_end - 1 > rl_point && *((rl_point + rl_line_buffer)) != 32 && *((rl_point + rl_line_buffer)) != 9) {
_rl_vi_advance_point();
}
}
}
v11 = rl_mark;
if (rl_mark < rl_point) {
v0 = rl_point;
rl_point = rl_mark;
rl_mark = v0;
}
if ((rl_readline_state & 0x80000))
*(5243464)();
v1 = vidomove_dispatch(a1, a1, v11, a3, a4, a5);
v12 = v1;
}
return;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.