input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
static void
unblock_signal (int sig)
{
sigset_t unblock_set;
sigemptyset (&unblock_set);
sigaddset (&unblock_set, sig);
if (sigprocmask (
1
, &unblock_set,
((void *)0)
) != 0)
error (0,
(*__errno_location ())
, gettext ("warning: sigprocmask"));
}
| void unblock_signal(int param_1)
{
int iVar1;
undefined8 uVar2;
int *piVar3;
long in_FS_OFFSET;
sigset_t local_a8;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
sigemptyset(&local_a8);
sigaddset(&local_a8,param_1);
iVar1 = sigprocmask(1,&local_a8,(sigset_t *)0x0);
if (iVar1 != 0) {
uVar2 = gettext("warning: sigprocmask");
piVar3 = __errno_location();
error(0,*piVar3,uVar2);
}
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
static char *
get_socket_address(int sock, int remote, int flags)
{
struct sockaddr_storage addr;
socklen_t addrlen;
char ntop[
1025
];
int r;
addrlen = sizeof(addr);
memset(&addr, 0, sizeof(addr));
if (remote) {
if (getpeername(sock, (struct sockaddr *)&addr, &addrlen) != 0)
return
((void *)0)
;
} else {
if (getsockname(sock, (struct sockaddr *)&addr, &addrlen) != 0)
return
((void *)0)
;
}
if (addr.ss_family ==
10
) {
addrlen = sizeof(struct sockaddr_in6);
ipv64_normalise_mapped(&addr, &addrlen);
}
switch (addr.ss_family) {
case
2
:
case
10
:
if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop,
sizeof(ntop),
((void *)0)
, 0, flags)) != 0) {
sshlog("canohost.c", __func__, 99, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "getnameinfo %d failed: %s", flags, ssh_gai_strerror(r))
;
return
((void *)0)
;
}
return xstrdup(ntop);
case
1
:
return xstrdup(((struct sockaddr_un *)&addr)->sun_path);
default:
return
((void *)0)
;
}
}
| long get_socket_address(int a1, int a2, int a3)
{
const char *v4;
socklen_t len;
unsigned int v7;
sockaddr s[8];
char host[1032];
unsigned long v10;
v10 = __readfsqword(0x28u);
len = 128;
memset(s, 0, sizeof(s));
if ( a2 )
{
if ( getpeername(a1, s, &len) )
return 0LL;
}
else if ( getsockname(a1, s, &len) )
{
return 0LL;
}
if ( s[0].sa_family == 10 )
{
len = 28;
ipv64_normalise_mapped(s, &len);
}
if ( s[0].sa_family == 10 )
goto LABEL_12;
if ( s[0].sa_family > 0xAu )
return 0LL;
if ( s[0].sa_family == 1 )
return xstrdup(s[0].sa_data);
if ( s[0].sa_family != 2 )
return 0LL;
LABEL_12:
v7 = getnameinfo(s, len, host, 0x401u, 0LL, 0, a3);
if ( !v7 )
return xstrdup(host);
v4 = (const char *)ssh_gai_strerror(v7);
sshlog("canohost.c", "get_socket_address", 99LL, 1LL, 2LL, 0LL, "getnameinfo %d failed: %s", (unsigned int)a3, v4);
return 0LL;
}
|
static intmax_t primary(int token, union yystype *val, int op, int noeval)
{
intmax_t result;
again:
switch (token) {
case 34:
result = assignment(op, noeval);
if (last_token != 35)
yyerror("expecting ')'");
last_token = yylex();
return result;
case 5:
last_token = op;
return val->val;
case 6:
last_token = op;
return noeval ? val->val : lookupvarint(val->name);
case 18:
token = op;
*val = yylval;
op = yylex();
goto again;
case 20:
*val = yylval;
return -primary(op, val, yylex(), noeval);
case 7:
*val = yylval;
return !primary(op, val, yylex(), noeval);
case 36:
*val = yylval;
return ~primary(op, val, yylex(), noeval);
default:
yyerror("expecting primary");
}
}
| int primary(unsigned long a0, unsigned long long *a1, unsigned long a2, unsigned long a3) {
unsigned int v0;
unsigned int v1;
unsigned long v2;
unsigned int v4;
v1 = a0;
v0 = a2;
while (true) {
switch (v1) {
case 5:
last_token = v0;
v4 = *(a1);
break;
case 6:
last_token = v0;
if (a3) {
v4 = *(a1);
break;
} else {
v4 = lookupvarint(*(a1));
break;
}
case 7:
*(a1) = -541125437600005304;
v4 = !primary(v0, a1, yylex(), a3);
break;
case 18:
v1 = v0;
*(a1) = -541125437600005304;
v0 = yylex();
continue;
case 20:
*(a1) = -541125437600005304;
v4 = -(primary(v0, a1, yylex(), a3));
break;
case 34:
v2 = assignment(v0, a3);
if (last_token != 35)
yyerror("expecting ')'");
last_token = yylex();
v4 = v2;
break;
case 36:
*(a1) = -541125437600005304;
v4 = !(primary(v0, a1, yylex(), a3));
break;
default:
yyerror("expecting primary");
}
}
return v4;
}
|
void
skip_space(char **cpp)
{
char *cp;
for (cp = *cpp; *cp == ' ' || *cp == '\t'; cp++)
;
*cpp = cp;
}
| long long skip_space(unsigned long long *a0) {
char *v0;
v0 = *(a0);
while (true) {
if (*(v0) != 32) {
if (*(v0) != 9)
break;
}
v0 += 1;
}
*(a0) = v0;
return a0;
}
|
int
crossload_dir(struct sftp_conn *from, struct sftp_conn *to,
const char *from_path, const char *to_path,
Attrib *dirattrib, int preserve_flag, int print_flag, int follow_link_flag)
{
char *from_path_canon;
int ret;
if ((from_path_canon = do_realpath(from, from_path)) ==
((void *)0)
) {
sshlog("sftp-client.c", __func__, 2750, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "crossload \"%s\": path canonicalization failed", from_path)
;
return -1;
}
ret = crossload_dir_internal(from, to, from_path_canon, to_path, 0,
dirattrib, preserve_flag, print_flag, follow_link_flag);
free(from_path_canon);
return ret;
}
| long crossload_dir(
unsigned int *a1,
unsigned int *a2,
const char *a3,
const char *a4,
int *a5,
int a6,
int a7,
int a8)
{
unsigned int v13;
char *ptr;
ptr = (char *)do_realpath(a1, a3);
if ( ptr )
{
v13 = crossload_dir_internal(a1, a2, ptr, a4, 0, a5, a6, a7, a8);
free(ptr);
return v13;
}
else
{
sshlog(
"sftp-client.c",
"crossload_dir",
2750LL,
0LL,
2LL,
0LL,
"crossload \"%s\": path canonicalization failed",
a3);
return 0xFFFFFFFFLL;
}
}
|
static char *
fmt_time(time_t seconds)
{
int day, hr, min;
static char buf[128];
min = (seconds / 60) % 60;
hr = (seconds / 60 / 60) % 24;
day = seconds / 60 / 60 / 24;
if (day > 0)
snprintf(buf, sizeof buf, "%dd %d:%02d", day, hr, min);
else
snprintf(buf, sizeof buf, "%d:%02d", hr, min);
return buf;
}
| int fmt_time(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
v0 = ((a0 * 9838263505978427529 >> 64) + a0 >> 5) - (a0 >> 63) - __mulvdi3((((((a0 * 9838263505978427529 >> 64) + a0 >> 5) - (a0 >> 63)) * 9838263505978427529 >> 64) + ((a0 * 9838263505978427529 >> 64) + a0 >> 5) - (a0 >> 63) >> 5) - (((a0 * 9838263505978427529 >> 64) + a0 >> 5) - (a0 >> 63) >> 63), 0x3c, (((((a0 * 9838263505978427529 >> 64) + a0 >> 5) - (a0 >> 63)) * 9838263505978427529 >> 64) + ((a0 * 9838263505978427529 >> 64) + a0 >> 5) - (a0 >> 63) >> 5) - (((a0 * 9838263505978427529 >> 64) + a0 >> 5) - (a0 >> 63) >> 63), a0);
v1 = (a0 * 5247073869855161349 >> 64 >> 10) - (a0 >> 63) - __mulvdi3((((a0 * 5247073869855161349 >> 64 >> 10) - (a0 >> 63)) * 3074457345618258603 >> 64 >> 2) - ((a0 * 5247073869855161349 >> 64 >> 10) - (a0 >> 63) >> 63), 0x18, (((a0 * 5247073869855161349 >> 64 >> 10) - (a0 >> 63)) * 3074457345618258603 >> 64 >> 2) - ((a0 * 5247073869855161349 >> 64 >> 10) - (a0 >> 63) >> 63), a0);
v2 = (a0 * 1749024623285053783 >> 64 >> 13) - (a0 >> 63);
if (v2 <= 0)
snprintf(&buf.17754, 0x80, "%d:%02d", v1, v0);
else
snprintf(&buf.17754, 0x80, "%dd %d:%02d", v2, v1, v0);
return &buf.17754;
}
|
static int rule_dump_check_magic(void)
{
int ret;
__u32 magic = 0;
if (isatty(
0
)) {
fprintf(
stderr
, "Can't restore rule dump from a terminal\n");
return -1;
}
ret = fread(&magic, sizeof(magic), 1,
stdin
);
if (magic != rule_dump_magic) {
fprintf(
stderr
, "Magic mismatch (%d elems, %x magic)\n",
ret, magic);
return -1;
}
return 0;
}
| long rule_dump_check_magic()
{
unsigned int ptr;
unsigned int v2;
unsigned long v3;
v3 = __readfsqword(0x28u);
ptr = 0;
if ( isatty(0) )
{
fprintf(stderr, "Can't restore rule dump from a terminal\n");
return 0xFFFFFFFFLL;
}
else
{
v2 = fread(&ptr, 4uLL, 1uLL, stdin);
if ( ptr == rule_dump_magic )
{
return 0LL;
}
else
{
fprintf(stderr, "Magic mismatch (%d elems, %x magic)\n", v2, ptr);
return 0xFFFFFFFFLL;
}
}
}
|
static void
output_one_tex_line (void)
{
BLOCK key;
BLOCK after;
char *cursor;
printf ("\\%s ", macro_name);
putchar_unlocked ('{');
print_field (tail);
fputs_unlocked ("}{",
stdout
);
print_field (before);
fputs_unlocked ("}{",
stdout
);
key.start = keyafter.start;
after.end = keyafter.end;
cursor = keyafter.start;
if (word_regex.string) { regoff_t count; count = re_match (&word_regex.pattern, cursor, keyafter.end - cursor, 0,
((void *)0)
); if (count == -2) matcher_error (); cursor += count == -1 ? 1 : count; } else if (word_fastmap[to_uchar (*cursor)]) while (cursor < keyafter.end && word_fastmap[to_uchar (*cursor)]) cursor++; else cursor++;
key.end = cursor;
after.start = cursor;
print_field (key);
fputs_unlocked ("}{",
stdout
);
print_field (after);
fputs_unlocked ("}{",
stdout
);
print_field (head);
putchar_unlocked ('}');
if (auto_reference || input_reference)
{
putchar_unlocked ('{');
print_field (reference);
putchar_unlocked ('}');
}
putchar_unlocked ('\n');
}
| void output_one_tex_line() {
unsigned int v0;
char *v1;
char *v2;
char *v3;
char *v4;
char *v5;
unsigned long long v10;
printf("\\%s ", macro_name);
putchar_unlocked(0x7b);
print_field(tail, g_404288);
fputs_unlocked("}{", stdout);
|
int
exportable_function_name (string)
const char *string;
{
if (absolute_program (string))
return 0;
if (mbschr (string, '=') != 0)
return 0;
return 1;
}
| _BOOL8 exportable_function_name(long a1)
{
return !absolute_program(a1) && mbschr(a1, 61LL) == 0;
}
|
static const char *
fmt_intarg(OpCodes code, int val)
{
if (val == -1)
return "unset";
switch (code) {
case oAddressFamily:
return fmt_multistate_int(val, multistate_addressfamily);
case oVerifyHostKeyDNS:
case oUpdateHostkeys:
return fmt_multistate_int(val, multistate_yesnoask);
case oStrictHostKeyChecking:
return fmt_multistate_int(val, multistate_strict_hostkey);
case oControlMaster:
return fmt_multistate_int(val, multistate_controlmaster);
case oTunnel:
return fmt_multistate_int(val, multistate_tunnel);
case oRequestTTY:
return fmt_multistate_int(val, multistate_requesttty);
case oSessionType:
return fmt_multistate_int(val, multistate_sessiontype);
case oCanonicalizeHostname:
return fmt_multistate_int(val, multistate_canonicalizehostname);
case oAddKeysToAgent:
return fmt_multistate_int(val, multistate_yesnoaskconfirm);
case oPubkeyAuthentication:
return fmt_multistate_int(val, multistate_pubkey_auth);
case oFingerprintHash:
return ssh_digest_alg_name(val);
default:
switch (val) {
case 0:
return "no";
case 1:
return "yes";
default:
return "UNKNOWN";
}
}
}
| int fmt_intarg(unsigned long a0, unsigned long a1) {
unsigned int v1;
if (a1 == -1) {
v1 = &g_40c972;
} else {
switch (a0) {
case 19:
v1 = fmt_multistate_int(a1, &multistate_yesnoaskconfirm);
break;
case 29:
v1 = fmt_multistate_int(a1, &multistate_strict_hostkey);
break;
case 38:
v1 = fmt_multistate_int(a1, &multistate_pubkey_auth);
break;
case 53: case 90:
v1 = fmt_multistate_int(a1, &multistate_yesnoask);
break;
case 55:
v1 = fmt_multistate_int(a1, &multistate_addressfamily);
break;
case 64:
v1 = fmt_multistate_int(a1, &multistate_controlmaster);
break;
case 67:
v1 = fmt_multistate_int(a1, &multistate_tunnel);
break;
case 75:
v1 = fmt_multistate_int(a1, &multistate_requesttty);
break;
case 76:
v1 = fmt_multistate_int(a1, &multistate_sessiontype);
break;
case 82:
v1 = fmt_multistate_int(a1, &multistate_canonicalizehostname);
break;
case 89:
v1 = ssh_digest_alg_name(a1);
break;
default:
if (!a1) {
v1 = &g_40b7b9;
break;
} else if (a1 == 1) {
v1 = &g_40b7b5;
break;
} else {
v1 = &g_40c96a;
break;
}
}
}
return v1;
}
|
static void p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p)
{
crypto_sign_ed25519_ref_fe25519_mul(&r->x, &p->x, &p->t);
crypto_sign_ed25519_ref_fe25519_mul(&r->y, &p->y, &p->z);
crypto_sign_ed25519_ref_fe25519_mul(&r->z, &p->z, &p->t);
}
| void p1p1_to_p2(unsigned long long a0, unsigned long long a1) {
unsigned long long v1;
crypto_sign_ed25519_ref_fe25519_mul(a0, a1, a1 + 384, a1);
crypto_sign_ed25519_ref_fe25519_mul(a0 - -128, a1 + 0x100, a1 + 128, a1 + 0x100);
v1 = crypto_sign_ed25519_ref_fe25519_mul(a0 + 0x100, a1 + 128, a1 + 384, a1 + 128);
return;
}
|
SHELL_VAR *
builtin_bind_variable (name, value, flags)
char *name;
char *value;
int flags;
{
SHELL_VAR *v;
int vflags, bindflags;
vflags = assoc_expand_once ? (0x001|0x002) : 0;
bindflags = flags | (assoc_expand_once ? 0x0080 : 0) | 0x0800;
if (flags & 0x0080)
vflags |= 0x001;
if (flags & 0x1000)
vflags |= 0x002;
if (valid_array_reference (name, vflags) == 0)
v = bind_variable (name, value, flags);
else
v = assign_array_element (name, value, bindflags, (array_eltstate_t *)0);
if (v && ((((v)->attributes) & (0x0000002))) == 0 && ((((v)->attributes) & (0x0004000))) == 0)
((v)->attributes &= ~(0x0001000));
return v;
}
| long long builtin_bind_variable(unsigned long long a0, unsigned long long a1, unsigned long a2) {
unsigned int v0;
int tmp_25;
int tmp_17;
unsigned int v1;
struct_0 *v2;
unsigned long long v6;
unsigned long long v7;
v0 = (!assoc_expand_once ? 3 : 0);
v6 = (!assoc_expand_once ? 128 : 0) | a2;
*(&v6) = v6 | 8;
tmp_25 = v6;
v1 = tmp_25;
if ((a2 & 128))
v0 |= 1;
if ((a2 & 0x1000))
v0 |= 2;
if (!valid_array_reference(a0, v0, v0))
v2 = bind_variable(a0, a1, a2, a1);
else
v2 = assign_array_element(a0, a1, v1, 0x0);
if (v2 && !(v2->field_28 & 2) && !(v2->field_28 & 0x4000)) {
v7 = v2->field_28;
*(&v7) = (v2->field_28 >> 8) & 239;
tmp_17 = v7;
v2->field_28 = tmp_17;
}
return v2;
}
|
static
void applySavedTimeInfoToOutputFile ( Char *dstName )
{
IntNative retVal;
struct utimbuf uTimBuf;
uTimBuf.actime = fileMetaInfo.
st_atim.tv_sec
;
uTimBuf.modtime = fileMetaInfo.
st_mtim.tv_sec
;
retVal = utime ( dstName, &uTimBuf );
{ if ((retVal) != 0) ioError(); };
}
| void applySavedTimeInfoToOutputFile(char *a0) {
unsigned int v0;
unsigned long v1;
unsigned long v2;
char v3;
unsigned long long *v5;
unsigned long long v6;
v1 = g_4052c8;
v2 = g_4052d8;
v0 = utime(a0, &v1);
if (v0)
ioError();
v6 = *(&v3) - v5[5];
return;
}
|
&& 0 != strcmp(".", ent->d_name)
&& 0 != strcmp("..", ent->d_name)) {
char *path = malloc(rlen);
snprintf(path, rlen, "%s/%s", startdir, ent->d_name);
r = findtty(res, path, rlen, dev);
free(path);
if (0 == r) {
closedir(dir);
chdir_int(olddir);
return 0;
}
continue;
}
| int strcmp(char *__s1,char *__s2)
{
halt_baddata();
}
|
char *
string_list_internal (list, sep)
WORD_LIST *list;
char *sep;
{
register WORD_LIST *t;
char *result, *r;
size_t word_len, sep_len, result_size;
if (list == 0)
return ((char *)
((void *)0)
);
if (list->next == 0)
return ((char *)strcpy (sh_xmalloc((1 + strlen (list->word->word)), "subst.c", 2807), (list->word->word)));
sep_len = (((sep) && (sep)[0]) ? ((sep)[1] ? ((sep)[2] ? strlen(sep) : 2) : 1) : 0);
result_size = 0;
for (t = list; t; t = t->next)
{
if (t != list)
result_size += sep_len;
result_size += strlen (t->word->word);
}
r = result = (char *)sh_xmalloc((result_size + 1), "subst.c", 2820);
for (t = list; t; t = t->next)
{
if (t != list && sep_len)
{
if (sep_len > 1)
{
__builtin_memcpy ((r), (sep), (sep_len));
r += sep_len;
}
else
*r++ = sep[0];
}
word_len = strlen (t->word->word);
__builtin_memcpy ((r), (t->word->word), (word_len));
r += word_len;
}
*r = '\0';
return (result);
}
| int string_list_internal(struct_0 *a0, char a1[3]) {
char *v0;
void* v1;
unsigned long long v2;
char *v3;
unsigned int v4;
unsigned long long v6;
struct_0 *v7;
struct_0 *v8;
if (!a0) {
v6 = 0;
return v6;
} else if (a0->field_0) {
if (!a1 || !a1[0]) {
v6 = 0;
} else if (!a1[1]) {
v6 = 1;
} else if (!a1[2]) {
v6 = 2;
} else {
v6 = strlen(a1);
}
v2 = v6;
v1 = 0;
for (v7 = a0; v7; v7 = v7->field_0) {
if (v7 != a0)
v1 += v2;
v1 += strlen(v7->field_8->field_0);
}
v3 = sh_xmalloc(v1 + 1, "subst.c", 0xb04);
v0 = v3;
for (v8 = a0; v8; v8 = v8->field_0) {
if (v8 != a0 && v2) {
if (v2 <= 1) {
v6 = v0;
v0 += 1;
*(v6) = a1[0];
} else {
memcpy(v0, a1, v2);
v0 = &v0[v2];
}
}
*(&v4) = strlen(v8->field_8->field_0);
memcpy(v0, v8->field_8->field_0, *(&v4));
v0 = &v0[*(&v4)];
}
*(v0) = 0;
v6 = v3;
return v6;
} else {
v6 = strcpy(sh_xmalloc(strlen(a0->field_8->field_0) + 1, "subst.c", 0xaf7), a0->field_8->field_0);
return v6;
}
}
|
static int cert_verify_ocsp(gnutls_session_t session)
{
gnutls_x509_crt_t cert, issuer;
const gnutls_datum_t *cert_list;
unsigned int cert_list_size = 0, ok = 0;
unsigned failed = 0;
int deinit_issuer = 0, deinit_cert = 0;
gnutls_datum_t resp;
unsigned char noncebuf[23];
gnutls_datum_t nonce = { noncebuf, sizeof(noncebuf) };
int ret;
unsigned it;
cert_list = gnutls_certificate_get_peers(session, &cert_list_size);
if (cert_list_size == 0) {
fprintf(
stderr
, "No certificates found!\n");
return 0;
}
for (it = 0; it < cert_list_size; it++) {
if (deinit_cert)
gnutls_x509_crt_deinit(cert);
ret = gnutls_x509_crt_init(&cert);
if (ret < 0) {
fprintf(
stderr
, "Memory error: %s\n", gnutls_strerror(ret));
goto cleanup;
}
deinit_cert = 1;
ret = gnutls_x509_crt_import(cert, &cert_list[it], GNUTLS_X509_FMT_DER);
if (ret < 0) {
fprintf(
stderr
, "Decoding error: %s\n", gnutls_strerror(ret));
goto cleanup;
}
if (deinit_issuer) {
gnutls_x509_crt_deinit(issuer);
deinit_issuer = 0;
}
ret = gnutls_certificate_get_issuer(xcred, cert, &issuer, 0);
if (ret < 0 && cert_list_size - it > 1) {
ret = gnutls_x509_crt_init(&issuer);
if (ret < 0) {
fprintf(
stderr
, "Memory error: %s\n", gnutls_strerror(ret));
goto cleanup;
}
deinit_issuer = 1;
ret = gnutls_x509_crt_import(issuer, &cert_list[it + 1], GNUTLS_X509_FMT_DER);
if (ret < 0) {
fprintf(
stderr
, "Decoding error: %s\n", gnutls_strerror(ret));
goto cleanup;
}
} else if (ret < 0) {
if (it == 0)
fprintf(
stderr
, "Cannot find issuer: %s\n", gnutls_strerror(ret));
goto cleanup;
}
ret = gnutls_rnd(GNUTLS_RND_NONCE, nonce.data, nonce.size);
if (ret < 0) {
fprintf(
stderr
, "gnutls_rnd: %s", gnutls_strerror(ret));
goto cleanup;
}
ret = send_ocsp_request(
((void *)0)
, cert, issuer, &resp, &nonce);
if (ret == -56) {
continue;
}
if (ret < 0) {
fprintf(
stderr
, "Cannot contact OCSP server\n");
goto cleanup;
}
ret = check_ocsp_response(cert, issuer, &resp, &nonce, verbose);
free(resp.data);
if (ret == 1)
ok++;
else if (ret == 0) {
failed++;
break;
}
}
cleanup:
if (deinit_issuer)
gnutls_x509_crt_deinit(issuer);
if (deinit_cert)
gnutls_x509_crt_deinit(cert);
if (failed > 0)
return -1;
return ok >= 1 ? (int) ok : -1;
}
| int cert_verify_ocsp(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
char v7;
char v8;
unsigned long v9;
char v10;
unsigned long long v11;
unsigned int v12;
char v13;
unsigned int v15;
v0 = 0;
v1 = 0;
v2 = 0;
v3 = 0;
v4 = 0;
v11 = &v13;
v12 = 23;
v9 = gnutls_certificate_get_peers(a0, &v0, &v0);
if (!v0) {
fprintf(*(&stderr), "No certificates found!\n");
v15 = 0;
} else {
v5 = 0;
while (true) {
if (v5 >= v0)
break;
if (v4)
gnutls_x509_crt_deinit(*(&v7));
v6 = gnutls_x509_crt_init(&v7);
if (v6 < 0) {
fprintf(*(&stderr), "Memory error: %s\n", gnutls_strerror(v6));
break;
}
v4 = 1;
v6 = gnutls_x509_crt_import(*(&v7), v5 * 16 + v9, 0x0, v5 * 16 + v9);
if (v6 < 0) {
fprintf(*(&stderr), "Decoding error: %s\n", gnutls_strerror(v6));
break;
}
if (v3) {
gnutls_x509_crt_deinit(*(&v8));
v3 = 0;
}
v6 = gnutls_certificate_get_issuer(xcred, *(&v7), &v8, 0x0);
if (v6 < 0 && v0 - v5 > 1) {
v6 = gnutls_x509_crt_init(&v8);
if (v6 < 0) {
fprintf(*(&stderr), "Memory error: %s\n", gnutls_strerror(v6));
break;
} else {
v3 = 1;
v6 = gnutls_x509_crt_import(*(&v8), (v5 + 1) * 16 + v9, 0x0, (v5 + 1) * 16 + v9);
if (v6 < 0) {
fprintf(*(&stderr), "Decoding error: %s\n", gnutls_strerror(v6));
break;
}
}
}
if (v6 < 0) {
if (!v5)
fprintf(*(&stderr), "Cannot find issuer: %s\n", gnutls_strerror(v6));
break;
}
v6 = gnutls_rnd(0x0, v11, v12);
if (v6 < 0) {
fprintf(*(&stderr), "gnutls_rnd: %s", gnutls_strerror(v6));
break;
} else {
v6 = send_ocsp_request(0x0, *(&v7), *(&v8), &v10, &v11);
if (v6 != -56) {
if (v6 < 0) {
fprintf(*(&stderr), "Cannot contact OCSP server\n");
break;
} else {
v6 = check_ocsp_response(*(&v7), *(&v8), &v10, &v11, verbose);
free(*(&v10));
if (v6 == 1) {
v1 += 1;
} else if (!v6) {
v2 += 1;
break;
}
}
}
v5 += 1;
}
}
if (v3)
gnutls_x509_crt_deinit(*(&v8));
if (v4)
gnutls_x509_crt_deinit(*(&v7));
if (v2) {
v15 = -1;
} else if (!v1) {
v15 = -1;
} else {
v15 = v1;
}
}
return v15;
}
|
static inline void
emit_stdin_note (void)
{
fputs_unlocked (gettext ("\nWith no FILE, or when FILE is -, read standard input.\n"),
stdout
)
;
}
| void emit_stdin_note() {
unsigned long long v1;
v1 = fputs_unlocked(gettext("\nWith no FILE, or when FILE is -, read standard input.\n"), stdout);
return;
}
|
static void
accumulate_host_timing_secret(struct sshbuf *server_cfg,
struct sshkey *key)
{
static struct ssh_digest_ctx *ctx;
u_char *hash;
size_t len;
struct sshbuf *buf;
int r;
if (ctx ==
((void *)0)
&& (ctx = ssh_digest_start(4)) ==
((void *)0)
)
sshfatal("sshd.c", __func__, 1498, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "ssh_digest_start");
if (key ==
((void *)0)
) {
if (ssh_digest_update(ctx, sshbuf_ptr(server_cfg),
sshbuf_len(server_cfg)) != 0)
sshfatal("sshd.c", __func__, 1503, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "ssh_digest_update");
len = ssh_digest_bytes(4);
hash = xmalloc(len);
if (ssh_digest_final(ctx, hash, len) != 0)
sshfatal("sshd.c", __func__, 1507, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "ssh_digest_final");
options.timing_secret = (((u_int64_t)(((const u_char *)(hash))[0]) << 56) | ((u_int64_t)(((const u_char *)(hash))[1]) << 48) | ((u_int64_t)(((const u_char *)(hash))[2]) << 40) | ((u_int64_t)(((const u_char *)(hash))[3]) << 32) | ((u_int64_t)(((const u_char *)(hash))[4]) << 24) | ((u_int64_t)(((const u_char *)(hash))[5]) << 16) | ((u_int64_t)(((const u_char *)(hash))[6]) << 8) | (u_int64_t)(((const u_char *)(hash))[7]));
freezero(hash, len);
ssh_digest_free(ctx);
ctx =
((void *)0)
;
return;
}
if ((buf = sshbuf_new()) ==
((void *)0)
)
sshfatal("sshd.c", __func__, 1515, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "could not allocate buffer");
if ((r = sshkey_private_serialize(key, buf)) != 0)
sshfatal("sshd.c", __func__, 1517, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "decode key");
if (ssh_digest_update(ctx, sshbuf_ptr(buf), sshbuf_len(buf)) != 0)
sshfatal("sshd.c", __func__, 1519, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "ssh_digest_update");
sshbuf_reset(buf);
sshbuf_free(buf);
}
| void accumulate_host_timing_secret(undefined8 param_1,long param_2)
{
long lVar1;
int iVar2;
undefined8 uVar3;
undefined8 uVar4;
char **ppcVar5;
undefined *puVar6;
undefined *puVar7;
char *apcStack144 [9];
long local_48;
undefined8 local_40;
int local_34;
long local_30;
undefined8 local_28;
byte *local_20;
local_48 = param_2;
ppcVar5 = (char **)&local_48;
local_40 = param_1;
if (ctx_21501 == 0) {
apcStack144[8] = (char *)0x103bc3;
ctx_21501 = ssh_digest_start(4);
ppcVar5 = (char **)&local_48;
if (ctx_21501 == 0) {
ppcVar5 = apcStack144 + 7;
apcStack144[7] = "ssh_digest_start";
sshfatal("sshd.c","accumulate_host_timing_secret",0x5da,1,1,0);
}
}
if (local_48 == 0) {
*(undefined8 *)((long)ppcVar5 + -8) = 0x103c27;
uVar3 = sshbuf_len(local_40);
*(undefined8 *)((long)ppcVar5 + -8) = 0x103c36;
uVar4 = sshbuf_ptr(local_40);
*(undefined8 *)((long)ppcVar5 + -8) = 0x103c4e;
iVar2 = ssh_digest_update(ctx_21501,uVar4,uVar3);
puVar7 = (undefined *)ppcVar5;
if (iVar2 != 0) {
puVar7 = (undefined *)((long)ppcVar5 + -0x10);
*(char **)((long)ppcVar5 + -0x10) = "ssh_digest_update";
*(undefined8 *)((long)ppcVar5 + -0x18) = 0x103c8c;
sshfatal("sshd.c","accumulate_host_timing_secret",0x5df,1,1,0);
}
*(undefined8 *)(puVar7 + -8) = 0x103c96;
local_28 = ssh_digest_bytes(4);
*(undefined8 *)(puVar7 + -8) = 0x103ca6;
local_20 = (byte *)xmalloc(local_28);
*(undefined8 *)(puVar7 + -8) = 0x103cc4;
iVar2 = ssh_digest_final(ctx_21501,local_20,local_28);
puVar6 = puVar7;
if (iVar2 != 0) {
puVar6 = puVar7 + -0x10;
*(char **)(puVar7 + -0x10) = "ssh_digest_final";
*(undefined8 *)(puVar7 + -0x18) = 0x103d02;
sshfatal("sshd.c","accumulate_host_timing_secret",0x5e3,1,1,0);
}
options._7856_8_ =
(ulong)local_20[7] |
(ulong)*local_20 << 0x38 | (ulong)local_20[1] << 0x30 | (ulong)local_20[2] << 0x28 |
(ulong)local_20[3] << 0x20 | (ulong)local_20[4] << 0x18 | (ulong)local_20[5] << 0x10 |
(ulong)local_20[6] << 8;
*(undefined8 *)(puVar6 + -8) = 0x103dbc;
freezero(local_20,local_28);
*(undefined8 *)(puVar6 + -8) = 0x103dcb;
ssh_digest_free(ctx_21501);
ctx_21501 = 0;
}
else {
*(undefined8 *)((long)ppcVar5 + -8) = 0x103de0;
local_30 = sshbuf_new();
puVar7 = (undefined *)ppcVar5;
if (local_30 == 0) {
puVar7 = (undefined *)((long)ppcVar5 + -0x10);
*(char **)((long)ppcVar5 + -0x10) = "could not allocate buffer";
*(undefined8 *)((long)ppcVar5 + -0x18) = 0x103e25;
sshfatal("sshd.c","accumulate_host_timing_secret",0x5eb,1,1,0);
}
lVar1 = local_48;
*(undefined8 *)(puVar7 + -8) = 0x103e38;
local_34 = sshkey_private_serialize(lVar1,local_30);
puVar6 = puVar7;
if (local_34 != 0) {
*(undefined8 *)(puVar7 + -8) = 0x103e4b;
uVar3 = ssh_err(local_34);
puVar6 = puVar7 + -0x10;
*(char **)(puVar7 + -0x10) = "decode key";
*(undefined8 *)(puVar7 + -0x18) = 0x103e82;
sshfatal("sshd.c","accumulate_host_timing_secret",0x5ed,1,1,uVar3);
}
*(undefined8 *)(puVar6 + -8) = 0x103e8e;
uVar3 = sshbuf_len(local_30);
*(undefined8 *)(puVar6 + -8) = 0x103e9d;
uVar4 = sshbuf_ptr(local_30);
*(undefined8 *)(puVar6 + -8) = 0x103eb5;
iVar2 = ssh_digest_update(ctx_21501,uVar4,uVar3);
puVar7 = puVar6;
if (iVar2 != 0) {
puVar7 = puVar6 + -0x10;
*(char **)(puVar6 + -0x10) = "ssh_digest_update";
*(undefined8 *)(puVar6 + -0x18) = 0x103ef3;
sshfatal("sshd.c","accumulate_host_timing_secret",0x5ef,1,1,0);
}
*(undefined8 *)(puVar7 + -8) = 0x103eff;
sshbuf_reset(local_30);
*(undefined8 *)(puVar7 + -8) = 0x103f0b;
sshbuf_free(local_30);
}
return;
}
|
static int
input_kex_dh_gex_reply(int type, u_int32_t seq, struct ssh *ssh)
{
struct kex *kex = ssh->kex;
BIGNUM *dh_server_pub =
((void *)0)
;
const BIGNUM *pub_key, *dh_p, *dh_g;
struct sshbuf *shared_secret =
((void *)0)
;
struct sshbuf *tmp =
((void *)0)
, *server_host_key_blob =
((void *)0)
;
struct sshkey *server_host_key =
((void *)0)
;
u_char *signature =
((void *)0)
;
u_char hash[64];
size_t slen, hashlen;
int r;
sshlog("kexgexc.c", __func__, 158, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "SSH2_MSG_KEX_DH_GEX_REPLY received");
ssh_dispatch_set(ssh, 33, &kex_protocol_error);
if ((r = sshpkt_getb_froms(ssh, &server_host_key_blob)) != 0)
goto out;
if ((tmp = sshbuf_fromb(server_host_key_blob)) ==
((void *)0)
) {
r = -2;
goto out;
}
if ((r = sshkey_fromb(tmp, &server_host_key)) != 0 ||
(r = kex_verify_host_key(ssh, server_host_key)) != 0)
goto out;
if ((r = sshpkt_get_bignum2(ssh, &dh_server_pub)) != 0 ||
(r = sshpkt_get_string(ssh, &signature, &slen)) != 0 ||
(r = sshpkt_get_end(ssh)) != 0)
goto out;
if ((shared_secret = sshbuf_new()) ==
((void *)0)
) {
r = -2;
goto out;
}
if ((r = kex_dh_compute_key(kex, dh_server_pub, shared_secret)) != 0)
goto out;
if (ssh->compat & 0x00004000)
kex->min = kex->max = -1;
DH_get0_key(kex->dh, &pub_key,
((void *)0)
);
DH_get0_pqg(kex->dh, &dh_p,
((void *)0)
, &dh_g);
hashlen = sizeof(hash);
if ((r = kexgex_hash(
kex->hash_alg,
kex->client_version,
kex->server_version,
kex->my,
kex->peer,
server_host_key_blob,
kex->min, kex->nbits, kex->max,
dh_p, dh_g,
pub_key,
dh_server_pub,
sshbuf_ptr(shared_secret), sshbuf_len(shared_secret),
hash, &hashlen)) != 0)
goto out;
if ((r = sshkey_verify(server_host_key, signature, slen, hash,
hashlen, kex->hostkey_alg, ssh->compat,
((void *)0)
)) != 0)
goto out;
if ((r = kex_derive_keys(ssh, hash, hashlen, shared_secret)) != 0 ||
(r = kex_send_newkeys(ssh)) != 0)
goto out;
if ((kex->flags & 0x0002) != 0) {
if (kex->initial_hostkey !=
((void *)0)
|| kex->initial_sig !=
((void *)0)
) {
r = -1;
goto out;
}
if ((kex->initial_sig = sshbuf_new()) ==
((void *)0)
) {
r = -2;
goto out;
}
if ((r = sshbuf_put(kex->initial_sig, signature, slen)) != 0)
goto out;
kex->initial_hostkey = server_host_key;
server_host_key =
((void *)0)
;
}
out:
explicit_bzero(hash, sizeof(hash));
DH_free(kex->dh);
kex->dh =
((void *)0)
;
BN_clear_free(dh_server_pub);
sshbuf_free(shared_secret);
sshkey_free(server_host_key);
sshbuf_free(tmp);
sshbuf_free(server_host_key_blob);
free(signature);
return r;
}
| long long input_kex_dh_gex_reply(unsigned long a0, unsigned long a1, struct_0 *a2) {
char v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
void* v7;
char v8;
char v9;
char v10;
void* v11;
void* v12;
void* v13;
char v14;
unsigned long long v15;
void* v16;
void* v17;
struct_1 *v18;
char v19;
v5 = a0;
v4 = a1;
v18 = a2->field_8;
v7 = 0;
v16 = 0;
v17 = 0;
v11 = 0;
v12 = 0;
v13 = 0;
sshlog("kexgexc.c", "input_kex_dh_gex_reply", 0x9e, 0x0, 0x5, 0x0, "SSH2_MSG_KEX_DH_GEX_REPLY received", *(&v0), *(&v1));
ssh_dispatch_set(a2, 0x21, got.kex_protocol_error);
v6 = sshpkt_getb_froms(a2, &v11, &v11);
if (!v6) {
v17 = sshbuf_fromb(v11);
if (!v17) {
v6 = -2;
} else {
v6 = sshkey_fromb(v17, &v12, &v12);
if (!v6) {
v6 = kex_verify_host_key(a2, v12, v12);
if (!v6) {
v6 = sshpkt_get_bignum2(a2, &v7, &v7);
if (!v6) {
v6 = sshpkt_get_string(a2, &v13, &v14, &v13);
if (!v6) {
v6 = sshpkt_get_end(a2);
if (!v6) {
v16 = sshbuf_new();
if (!v16) {
v6 = -2;
goto LABEL_400aa2;
} else {
v6 = kex_dh_compute_key(v18, v7, v16, v7);
if (!v6) {
if ((a2->field_83c & 0x4000)) {
v18->field_124 = -1;
v18->field_120 = v18->field_124;
}
DH_get0_key(v18->field_118, &v8, 0x0, &v8);
DH_get0_pqg(v18->field_118, &v9, 0x0, &v10);
v15 = 64;
v3 = v18->field_124;
v2 = v18->field_128;
v6 = kexgex_hash(v18->field_90, v18->field_60, v18->field_68, v18->field_50, v18->field_58, v11, v18->field_120, v2, v3, *(&v9), *(&v10), *(&v8), v7, sshbuf_ptr(v16), sshbuf_len(v16), &v19);
if (!v6) {
v6 = sshkey_verify(v12, v13, *(&v14), &v19, v15, v18->field_28, a2->field_83c);
if (!v6) {
v6 = kex_derive_keys(a2, &v19, v15, v16);
if (!v6) {
v6 = kex_send_newkeys(a2);
if (!v6 && (v18->field_8c & 2)) {
if (v18->field_80) {
LABEL_4009f9:
v6 = -1;
goto LABEL_400aa2;
} else {
if (!(!v18->field_78))
goto LABEL_4009f9;
v18->field_78 = sshbuf_new();
if (!v18->field_78) {
v6 = -2;
goto LABEL_400aa2;
} else {
v6 = sshbuf_put(v18->field_78, v13, *(&v14), v13);
if (!v6) {
v18->field_80 = v12;
v12 = 0;
goto LABEL_400aa2;
}
}
}
}
}
goto LABEL_400aa2;
}
}
}
}
}
}
}
goto LABEL_400aa2;
}
}
}
}
LABEL_400aa2:
explicit_bzero(&v19, 0x40);
DH_free(v18->field_118);
v18->field_118 = 0;
BN_clear_free(v7);
sshbuf_free(v16);
sshkey_free(v12);
sshbuf_free(v17);
sshbuf_free(v11);
free(v13);
return v6;
}
|
static int in_file(const char *string, FILE * file, int error) {
char line[131072];
char *endp;
if (fseek(file, 0L,
0
))
return (error);
while (fgets(line, 131072, file)) {
if (line[0] != '\0') {
endp = &line[strlen(line) - 1];
if (*endp != '\n')
return (error);
*endp = '\0';
if (0 == strcmp(line, string))
return (1);
}
}
if (ferror(file))
return (error);
return (0);
}
| undefined4 in_file(char *param_1,FILE *param_2,undefined4 param_3)
{
undefined *puVar1;
int iVar2;
size_t sVar3;
char *pcVar4;
undefined *puVar5;
long in_FS_OFFSET;
undefined4 uStack131132;
FILE *pFStack131128;
char *pcStack131120;
undefined8 uStack131104;
char acStack131096 [16];
undefined auStack131080 [131064];
long local_10;
puVar1 = &stack0xfffffffffffffff8;
do {
puVar5 = puVar1;
*(undefined8 *)(puVar5 + -0x1000) = *(undefined8 *)(puVar5 + -0x1000);
puVar1 = puVar5 + -0x1000;
} while (puVar5 + -0x1000 != auStack131080);
local_10 = *(long *)(in_FS_OFFSET + 0x28);
*(undefined8 *)(puVar5 + -0x1048) = 0x10044d;
iVar2 = fseek(param_2,0,0);
uStack131132 = param_3;
pFStack131128 = param_2;
pcStack131120 = param_1;
if (iVar2 == 0) {
do {
do {
*(undefined8 *)(puVar5 + -0x1048) = 0x1004ea;
pcVar4 = fgets(acStack131096,0x20000,pFStack131128);
if (pcVar4 == (char *)0x0) {
*(undefined8 *)(puVar5 + -0x1048) = 0x100502;
iVar2 = ferror(pFStack131128);
if (iVar2 == 0) {
uStack131132 = 0;
}
goto LAB_00100513;
}
} while (acStack131096[0] == '\0');
*(undefined8 *)(puVar5 + -0x1048) = 0x100476;
sVar3 = strlen(acStack131096);
uStack131104 = acStack131096 + (sVar3 - 1);
if (*uStack131104 != '\n') goto LAB_00100513;
*uStack131104 = '\0';
*(undefined8 *)(puVar5 + -0x1048) = 0x1004c4;
iVar2 = strcmp(acStack131096,pcStack131120);
} while (iVar2 != 0);
uStack131132 = 1;
}
LAB_00100513:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uStack131132;
}
*(undefined8 *)(puVar5 + -0x1048) = 0x100527;
__stack_chk_fail();
}
|
void pkcs8_info_int(gnutls_datum_t *data, unsigned format,
unsigned ignore_err, FILE *out, const char *tab)
{
int ret;
unsigned schema;
unsigned cipher;
unsigned char salt[32];
char hex[64+1];
unsigned salt_size = sizeof(salt);
unsigned iter_count;
gnutls_datum_t bin;
size_t hex_size = sizeof(hex);
const char *str;
char *oid =
((void *)0)
;
ret = gnutls_pkcs8_info(data, format,
&schema, &cipher, salt, &salt_size, &iter_count, &oid);
if (ret == -6) {
fprintf(out, "PKCS #8 information:\n");
fprintf(out, "\tSchema: unsupported (%s)\n", oid);
goto cleanup;
} else if (ret == -50) {
fprintf(out, "PKCS #8 information:\n");
fprintf(out, "\tSchema: unencrypted key\n");
goto cleanup;
}
if (ret < 0) {
if (ignore_err)
return;
fprintf(
stderr
, "PKCS #8 read error: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
fprintf(out, "%sPKCS #8 information:\n", tab);
fprintf(out, "%s\tCipher: %s\n", tab, gnutls_cipher_get_name(cipher));
str = gnutls_pkcs_schema_get_name(schema);
if (str !=
((void *)0)
) {
fprintf(out, "%s\tSchema: %s (%s)\n", tab, str, gnutls_pkcs_schema_get_oid(schema));
}
bin.data = salt;
bin.size = salt_size;
ret = gnutls_hex_encode(&bin, hex, &hex_size);
if (ret < 0) {
fprintf(
stderr
, "hex encode error: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
fprintf(out, "%s\tSalt: %s\n", tab, hex);
fprintf(out, "%s\tSalt size: %u\n", tab, salt_size);
fprintf(out, "%s\tIteration count: %u\n\n", tab, iter_count);
cleanup:
gnutls_free((void *) (oid)), oid=
((void *)0)
;
}
| void pkcs8_info_int(unsigned long long a0, unsigned long a1, unsigned long a2, void* a3, unsigned long long a4) {
unsigned int v0;
unsigned int v1;
unsigned long long v2;
char v3;
char v4;
unsigned int v5;
char v6;
unsigned int v7;
unsigned long long v8;
void* v9;
unsigned long v10;
unsigned long v11;
unsigned int v12;
char v13;
char v14;
char v15;
unsigned long long *v18;
unsigned long long v19;
v2 = a0;
v1 = a1;
v0 = a2;
v5 = 32;
v8 = 65;
v9 = 0;
v7 = gnutls_pkcs8_info(v2, v1, &v3, &v4, &v13, &v5, &v6, &v9, a4, a3, *(&v0));
if (v7 == -6) {
fprintf(a3, "PKCS #8 information:\n");
fprintf(a3, "\tSchema: unsupported (%s)\n", v9);
} else if (v7 != -50) {
if (v7 >= 0) {
fprintf(a3, "%sPKCS #8 information:\n", a4);
fprintf(a3, "%s\tCipher: %s\n", a4, gnutls_cipher_get_name(*(&v4)));
v10 = gnutls_pkcs_schema_get_name(*(&v3));
if (v10)
fprintf(a3, "%s\tSchema: %s (%s)\n", a4, v10, gnutls_pkcs_schema_get_oid(*(&v3)));
v11 = &v13;
v12 = v5;
v7 = gnutls_hex_encode(&v11, &v14, &v8, &v14);
if (v7 < 0) {
fprintf(*(&stderr), "hex encode error: %s\n", gnutls_strerror(v7));
app_exit(0x1);
}
fprintf(a3, "%s\tSalt: %s\n", a4, &v14);
fprintf(a3, "%s\tSalt size: %u\n", a4, v5);
fprintf(a3, "%s\tIteration count: %u\n\n", a4, *(&v6));
} else if (!v0) {
fprintf(*(&stderr), "PKCS #8 read error: %s\n", gnutls_strerror(v7));
app_exit(0x1);
}
}
if (v7 == -50) {
fprintf(a3, "PKCS #8 information:\n");
fprintf(a3, "\tSchema: unencrypted key\n");
}
if (v7 == -50 || v7 == -6 || v7 >= 0 && v7 >= 0) {
*(5243720)(v9);
v9 = 0;
}
if (v7 == -50 || v7 == -6 || v7 < 0 && v0 || v7 >= 0 && v7 >= 0) {
v19 = *(&v15) ^ v18[5];
return;
}
}
|
static int
inflate_fixed(void)
{
int i;
struct huft *tl;
struct huft *td;
int bl;
int bd;
unsigned l[288];
for (i = 0; i < 144; i++)
l[i] = 8;
for (; i < 256; i++)
l[i] = 9;
for (; i < 280; i++)
l[i] = 7;
for (; i < 288; i++)
l[i] = 8;
bl = 7;
if ((i = huft_build(l, 288, 257, cplens, cplext, &tl, &bl)) != 0)
return i;
for (i = 0; i < 30; i++)
l[i] = 5;
bd = 5;
if ((i = huft_build(l, 30, 0, cpdist, cpdext, &td, &bd)) > 1)
{
huft_free(tl);
return i;
}
if (inflate_codes(tl, td, bl, bd))
return 1;
huft_free(tl);
huft_free(td);
return 0;
}
| void inflate_fixed() {
unsigned int v0;
unsigned int v1;
unsigned int v2;
char v3;
char v4;
char v5;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
void* v10;
for (v2 = 0; v2 <= 143; v2 += 1) {
*(&(&v5)[4 * v2]) = 8;
}
for (; v2 <= 255; v2 += 1) {
*(&(&v5)[4 * v2]) = 9;
}
for (; v2 <= 279; v2 += 1) {
*(&(&v5)[4 * v2]) = 7;
}
for (; v2 <= 287; v2 += 1) {
*(&(&v5)[4 * v2]) = 8;
}
v0 = 7;
v2 = huft_build(&v5, 0x120, 0x101, &cplens, &cplext, &v3, &v0);
if (v2) {
v7 = v2;
} else {
for (v2 = 0; v2 <= 29; v2 += 1) {
*(&(&v5)[4 * v2]) = 5;
}
v1 = 5;
v2 = huft_build(&v5, 0x1e, 0x0, &cpdist, &cpdext, &v4, &v1);
if (v2 > 1) {
huft_free(*(&v3));
v8 = v2;
} else if (inflate_codes(*(&v3), *(&v4), v0, v1)) {
v9 = 1;
} else {
huft_free(*(&v3));
huft_free(*(&v4));
v10 = 0;
}
}
return;
}
|
static void
output_diff3 (FILE *outputfile, struct diff3_block *diff,
int const mapping[3], int const rev_mapping[3])
{
int i;
int oddoneout;
char *cp;
struct diff3_block *ptr;
lin line;
size_t length;
int dontprint;
static int skew_increment[3] = { 2, 3, 1 };
char const *line_prefix = initial_tab ? "\t" : " ";
for (ptr = diff; ptr; ptr = ((ptr)->next))
{
char x[2];
switch (ptr->correspond)
{
case DIFF_ALL:
x[0] = 0;
dontprint = 3;
oddoneout = 3;
break;
case DIFF_1ST:
case DIFF_2ND:
case DIFF_3RD:
oddoneout = rev_mapping[ptr->correspond - DIFF_1ST];
x[0] = oddoneout + '1';
x[1] = 0;
dontprint = oddoneout == 0;
break;
default:
fatal ("internal error: invalid diff type passed to output");
}
fprintf (outputfile, "====%s\n", x);
for (i = 0; i < 3;
i = (oddoneout == 1 ? skew_increment[i] : i + 1))
{
int realfile = mapping[i];
lin lowt = ((ptr)->ranges[realfile][0]);
lin hight = ((ptr)->ranges[realfile][1]);
printint llowt = lowt;
printint lhight = hight;
fprintf (outputfile, "%d:", i + 1);
switch (lowt - hight)
{
case 1:
fprintf (outputfile, "%""l""da\n", llowt - 1);
break;
case 0:
fprintf (outputfile, "%""l""dc\n", llowt);
break;
default:
fprintf (outputfile, "%""l""d,%""l""dc\n", llowt, lhight);
break;
}
if (i == dontprint) continue;
if (lowt <= hight)
{
line = 0;
do
{
fputs_unlocked (line_prefix,outputfile);
cp = ((ptr)->lines[realfile][line]);
length = ((ptr)->lengths[realfile][line]);
fwrite_unlocked (cp,sizeof (char),length,outputfile);
}
while (++line < hight - lowt + 1);
if (cp[length - 1] != '\n')
fprintf (outputfile, "\n\\ %s\n",
gettext ("No newline at end of file"));
}
}
}
}
| void output_diff3(void* a0, unsigned long a1, unsigned int *a2, unsigned int *a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
struct_2 *v4;
void* v5;
unsigned long long v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
unsigned long v10;
char *v11;
unsigned int v12;
char v13;
char v14;
char v15;
unsigned long long v17;
unsigned long long *v18;
unsigned long long v19;
if (initial_tab)
v17 = "\t";
else
v17 = " ";
v6 = v17;
v4 = a1;
while (true) {
if (!v4) {
v19 = *(&v15) ^ v18[5];
return;
}
if (*(&v4->field_0) == 4) {
v13 = 0;
v2 = 3;
v1 = 3;
} else {
if (*(&v4->field_0) < 4)
break;
if (*(&v4->field_0) - 5 > 2)
break;
v1 = a3[5 + *(&v4->field_0)];
v13 = v1 + 49;
v14 = 0;
v2 = !v1;
}
fprintf(a0, "====%s\n", &v13);
for (v0 = 0; v0 <= 2; v0 = v17) {
v3 = a2[v0];
v7 = *(&v4->padding_1[7 + 16 * v3]);
v8 = *(&v4->padding_1[15 + 16 * v3]);
v9 = v7;
v10 = v8;
fprintf(a0, "%d:", v0 + 1);
if (!v7 - v8) {
fprintf(a0, "%ldc\n", v9);
} else if (v7 - v8 == 1) {
fprintf(a0, "%lda\n", (v9 - 1));
} else {
fprintf(a0, "%ld,%ldc\n", v9, v10);
}
if (v0 != v2 && v7 <= v8) {
v5 = 0;
do {
fputs_unlocked(v6, a0);
v11 = *((*(&v4->padding_1[55 + 8 * v3]) + v5 * 8));
*(&v12) = *((*(&v4->padding_1[79 + 8 * v3]) + v5 * 8));
fwrite_unlocked(v11, 0x1, *(&v12), a0);
v5 += 1;
} while (v5 <= v8 - v7);
if (v11[1 + *(&v12)] != 10)
fprintf(a0, "\n\\ %s\n", gettext("No newline at end of file"));
}
if (v1 != 1)
*(&v17) = v0 + 1;
else
*(&v17) = *((4 * v0 + &skew_increment.5610));
}
v4 = v4->field_68;
}
fatal("internal error: invalid diff type passed to output");
}
|
static int
expand_and_print_history (list)
WORD_LIST *list;
{
char *s;
int r, result;
if (hist_last_line_pushed == 0 && hist_last_line_added && bash_delete_last_history () == 0)
return 1;
result = 0;
while (list)
{
r = history_expand (list->word->word, &s);
if (r < 0)
{
builtin_error (gettext("%s: history expansion failed"), list->word->word);
result = 1;
}
else
{
fputs (s,
stdout
);
putchar ('\n');
}
do { if (s) sh_xfree((s), "./history.def", 457); } while (0);
list = list->next;
}
fflush (
stdout
);
return result;
}
| void expand_and_print_history(unsigned long a0) {
struct_0 *v0;
unsigned int v1;
unsigned int v2;
char v3;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
v0 = a0;
if (!hist_last_line_pushed && hist_last_line_added) {
v5 = bash_delete_last_history();
if (!v5)
v6 = 1;
}
if (!hist_last_line_added || hist_last_line_pushed || v5) {
for (v1 = 0; v0; v0 = v0->field_0) {
v2 = history_expand(v0->field_8->field_0, &v3, &v3);
if (v2 < 0) {
builtin_error(gettext("%s: history expansion failed"));
v1 = 1;
} else {
fputs(*(&v3), stdout);
putchar(0xa);
}
if (*(&v3))
sh_xfree(*(&v3), "./history.def", 0x1c9);
}
fflush(stdout);
v7 = v1;
}
return;
}
|
int crypto_sign_ed25519_ref_unpackneg_vartime(crypto_sign_ed25519_ref_ge25519 *r, const unsigned char p[32])
{
unsigned char par;
crypto_sign_ed25519_ref_fe25519 t, chk, num, den, den2, den4, den6;
crypto_sign_ed25519_ref_fe25519_setone(&r->z);
par = p[31] >> 7;
crypto_sign_ed25519_ref_fe25519_unpack(&r->y, p);
crypto_sign_ed25519_ref_fe25519_square(&num, &r->y);
crypto_sign_ed25519_ref_fe25519_mul(&den, &num, &ge25519_ecd);
crypto_sign_ed25519_ref_fe25519_sub(&num, &num, &r->z);
crypto_sign_ed25519_ref_fe25519_add(&den, &r->z, &den);
crypto_sign_ed25519_ref_fe25519_square(&den2, &den);
crypto_sign_ed25519_ref_fe25519_square(&den4, &den2);
crypto_sign_ed25519_ref_fe25519_mul(&den6, &den4, &den2);
crypto_sign_ed25519_ref_fe25519_mul(&t, &den6, &num);
crypto_sign_ed25519_ref_fe25519_mul(&t, &t, &den);
crypto_sign_ed25519_ref_fe25519_pow2523(&t, &t);
crypto_sign_ed25519_ref_fe25519_mul(&t, &t, &num);
crypto_sign_ed25519_ref_fe25519_mul(&t, &t, &den);
crypto_sign_ed25519_ref_fe25519_mul(&t, &t, &den);
crypto_sign_ed25519_ref_fe25519_mul(&r->x, &t, &den);
crypto_sign_ed25519_ref_fe25519_square(&chk, &r->x);
crypto_sign_ed25519_ref_fe25519_mul(&chk, &chk, &den);
if (!crypto_sign_ed25519_ref_fe25519_iseq_vartime(&chk, &num))
crypto_sign_ed25519_ref_fe25519_mul(&r->x, &r->x, &ge25519_sqrtm1);
crypto_sign_ed25519_ref_fe25519_square(&chk, &r->x);
crypto_sign_ed25519_ref_fe25519_mul(&chk, &chk, &den);
if (!crypto_sign_ed25519_ref_fe25519_iseq_vartime(&chk, &num))
return -1;
if(crypto_sign_ed25519_ref_fe25519_getparity(&r->x) != (1-par))
crypto_sign_ed25519_ref_fe25519_neg(&r->x, &r->x);
crypto_sign_ed25519_ref_fe25519_mul(&r->t, &r->x, &r->y);
return 0;
}
| long crypto_sign_ed25519_ref_unpackneg_vartime(long a1, long a2)
{
unsigned char v3;
char v4[128];
char v5[128];
char v6[128];
char v7[128];
char v8[128];
char v9[128];
char v10[136];
unsigned long v11;
v11 = __readfsqword(0x28u);
crypto_sign_ed25519_ref_fe25519_setone(a1 + 256);
v3 = *(_BYTE *)(a2 + 31) >> 7;
crypto_sign_ed25519_ref_fe25519_unpack(a1 + 128, a2);
crypto_sign_ed25519_ref_fe25519_square(v6, a1 + 128);
crypto_sign_ed25519_ref_fe25519_mul(v7, v6, &ge25519_ecd);
crypto_sign_ed25519_ref_fe25519_sub(v6, v6, a1 + 256);
crypto_sign_ed25519_ref_fe25519_add(v7, a1 + 256, v7);
crypto_sign_ed25519_ref_fe25519_square(v8, v7);
crypto_sign_ed25519_ref_fe25519_square(v9, v8);
crypto_sign_ed25519_ref_fe25519_mul(v10, v9, v8);
crypto_sign_ed25519_ref_fe25519_mul(v4, v10, v6);
crypto_sign_ed25519_ref_fe25519_mul(v4, v4, v7);
crypto_sign_ed25519_ref_fe25519_pow2523(v4, v4);
crypto_sign_ed25519_ref_fe25519_mul(v4, v4, v6);
crypto_sign_ed25519_ref_fe25519_mul(v4, v4, v7);
crypto_sign_ed25519_ref_fe25519_mul(v4, v4, v7);
crypto_sign_ed25519_ref_fe25519_mul(a1, v4, v7);
crypto_sign_ed25519_ref_fe25519_square(v5, a1);
crypto_sign_ed25519_ref_fe25519_mul(v5, v5, v7);
if ( !(unsigned int)crypto_sign_ed25519_ref_fe25519_iseq_vartime(v5, v6) )
crypto_sign_ed25519_ref_fe25519_mul(a1, a1, &ge25519_sqrtm1);
crypto_sign_ed25519_ref_fe25519_square(v5, a1);
crypto_sign_ed25519_ref_fe25519_mul(v5, v5, v7);
if ( !(unsigned int)crypto_sign_ed25519_ref_fe25519_iseq_vartime(v5, v6) )
return 0xFFFFFFFFLL;
if ( (unsigned char)crypto_sign_ed25519_ref_fe25519_getparity(a1) != 1 - v3 )
crypto_sign_ed25519_ref_fe25519_neg(a1, a1);
crypto_sign_ed25519_ref_fe25519_mul(a1 + 384, a1, a1 + 128);
return 0LL;
}
|
static void
maybe_restore_getopt_state (gs)
sh_getopt_state_t *gs;
{
if (gs->gs_flags & 1)
sh_getopt_restore_istate (gs);
else
sh_xfree((gs), "execute_cmd.c", 5007);
}
| long long maybe_restore_getopt_state(struct_0 *a0) {
unsigned long long v1;
if (!(a0->field_1c & 1))
v1 = sh_xfree(a0, "execute_cmd.c", 0x138f);
else
v1 = sh_getopt_restore_istate(a0);
return v1;
}
|
void
_rl_fix_mark (void)
{
do { if (rl_mark > rl_end) rl_mark = rl_end; else if (rl_mark < 0) rl_mark = 0; } while (0);
}
| void _rl_fix_mark() {
unsigned long long v1;
unsigned long long v2;
if (rl_mark > rl_end) {
v1 = rl_end;
rl_mark = rl_end;
} else {
v2 = rl_mark;
if (rl_mark < 0)
rl_mark = 0;
}
return;
}
|
int
cipher_get_keyiv_len(const struct sshcipher_ctx *cc)
{
const struct sshcipher *c = cc->cipher;
if ((c->flags & (1<<1)) != 0)
return 0;
else if ((c->flags & (1<<2)) != 0)
return sizeof(cc->ac_ctx.ctr);
return
EVP_CIPHER_CTX_get_iv_length
(cc->evp);
}
| long cipher_get_keyiv_len(long a1)
{
long v2;
v2 = *(_QWORD *)(a1 + 288);
if ( (*(_DWORD *)(v2 + 24) & 2) != 0 )
return 0LL;
if ( (*(_DWORD *)(v2 + 24) & 4) != 0 )
return 16LL;
return EVP_CIPHER_CTX_get_iv_length(*(_QWORD *)(a1 + 8));
}
|
static void
re_fastputc(EditLine *el, wint_t c)
{
wint_t *lastline;
int w;
w = wcwidth(c);
while (w > 1 && el->el_cursor.h + w > el->el_terminal.t_size.h)
re_fastputc(el, ' ');
terminal__putc(el, c);
el->el_display[el->el_cursor.v][el->el_cursor.h++] = c;
while (--w > 0)
el->el_display[el->el_cursor.v][el->el_cursor.h++]
= ((wint_t)-1);
if (el->el_cursor.h >= el->el_terminal.t_size.h) {
el->el_cursor.h = 0;
if (el->el_cursor.v + 1 >= el->el_terminal.t_size.v) {
int i, lins = el->el_terminal.t_size.v;
lastline = el->el_display[0];
for(i = 1; i < lins; i++)
el->el_display[i - 1] = el->el_display[i];
el->el_display[i - 1] = lastline;
} else {
el->el_cursor.v++;
lastline = el->el_display[++el->el_refresh.r_oldcv];
}
re__copy_and_pad((wchar_t *)lastline, L"",
(size_t)el->el_terminal.t_size.h);
if (((el)->el_terminal.t_flags & 0x080)) {
if (((el)->el_terminal.t_flags & 0x100)) {
terminal__putc(el, ' ');
terminal__putc(el, '\b');
}
} else {
terminal__putc(el, '\r');
terminal__putc(el, '\n');
}
}
}
| void re_fastputc(struct_0 *a0, unsigned long a1) {
unsigned int v0;
int tmp_61;
int tmp_62;
struct_2 *v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned long long v5;
unsigned int *v7;
unsigned int *v8;
unsigned long long v9;
unsigned long long *v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
v1 = &a0->padding_0;
v0 = a1;
v2 = wcwidth(v0);
while (v2 > 1) {
if (a0->field_30 + v2 <= a0->field_90)
break;
re_fastputc(a0, 0x20);
}
terminal__putc(a0, v0);
v7 = a0->field_38[a0->field_34].field_0;
tmp_61 = a0->field_30;
a0->field_30 = a0->field_30 + 1;
v7[tmp_61] = v0;
while (true) {
v2 -= 1;
if (v2 <= 0)
break;
v8 = a0->field_38[a0->field_34].field_0;
tmp_62 = a0->field_30;
a0->field_30 = a0->field_30 + 1;
v8[tmp_62] = -1;
}
v9 = a0->field_90;
if (a0->field_30 >= a0->field_90) {
a0->field_30 = 0;
if (a0->field_34 + 1 >= a0->field_94) {
v4 = a0->field_94;
v5 = a0->field_38->field_0;
for (v3 = 1; v3 < v4; v3 += 1) {
a0->field_38[1 + v3].field_0 = a0->field_38[v3].field_0;
}
a0->field_38[1 + v3].field_0 = v5;
} else {
a0->field_34 = a0->field_34 + 1;
v10 = a0->field_38;
a0->field_318 = a0->field_318 + 1;
v5 = v10[a0->field_318];
}
re__copy_and_pad(v5, &g_401f24, a0->field_90);
if ((a0->field_98 & 128)) {
v11 = a0->field_98 & 0x100;
if ((a0->field_98 & 0x100)) {
terminal__putc(a0, 0x20);
v13 = terminal__putc(a0, 0x8);
}
} else {
terminal__putc(a0, 0xd);
v12 = terminal__putc(a0, 0xa);
}
}
return;
}
|
void __attribute__((visibility ("hidden"))) _tr_init(s)
deflate_state *s;
{
tr_static_init();
s->l_desc.dyn_tree = s->dyn_ltree;
s->l_desc.stat_desc = &static_l_desc;
s->d_desc.dyn_tree = s->dyn_dtree;
s->d_desc.stat_desc = &static_d_desc;
s->bl_desc.dyn_tree = s->bl_tree;
s->bl_desc.stat_desc = &static_bl_desc;
s->bi_buf = 0;
s->bi_valid = 0;
init_block(s);
}
| long long _tr_init(struct_0 *a0) {
tr_static_init();
a0->field_b58 = &a0->padding_0[212];
a0->field_b68 = &static_l_desc;
a0->field_b70 = &a0->padding_0[2504];
a0->field_b80 = &static_d_desc;
a0->field_b88 = &a0->padding_0[2748];
a0->field_b98 = &static_bl_desc;
a0->field_1730 = 0;
a0->field_1734 = 0;
return init_block(a0);
}
|
static void
apply_nonancestor_delayed_set_stat (char const *file_name,
_Bool
after_links)
{
size_t file_name_len = strlen (file_name);
_Bool
check_for_renamed_directories = 0;
while (delayed_set_stat_head)
{
struct delayed_set_stat *data = delayed_set_stat_head;
_Bool
skip_this_one = 0;
struct stat st;
mode_t current_mode = data->current_mode;
mode_t current_mode_mask = data->current_mode_mask;
check_for_renamed_directories |= data->after_links;
if (after_links < data->after_links
|| (data->file_name_len < file_name_len
&& file_name[data->file_name_len]
&& (
((
file_name[data->file_name_len]
) == '/')
||
((
file_name[data->file_name_len - 1]
) == '/')
)
&& memcmp (file_name, data->file_name, data->file_name_len) == 0))
break;
chdir_do (data->change_dir);
if (check_for_renamed_directories)
{
if (fstatat (chdir_fd, data->file_name, &st, data->atflag) != 0)
{
stat_error (data->file_name);
skip_this_one = 1;
}
else
{
current_mode = st.st_mode;
current_mode_mask = ((mode_t) ~ (mode_t) 0);
if (! (st.st_dev == data->dev && st.st_ino == data->ino))
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("%s: Directory renamed before its status could be extracted"), quotearg_colon (data->file_name)); exit_status = 2; } while (0)
;
skip_this_one = 1;
}
}
}
if (! skip_this_one)
{
struct tar_stat_info sb;
sb.stat.st_mode = data->mode;
sb.stat.st_uid = data->uid;
sb.stat.st_gid = data->gid;
sb.atime = data->atime;
sb.mtime = data->mtime;
sb.cntx_name = data->cntx_name;
sb.acls_a_ptr = data->acls_a_ptr;
sb.acls_a_len = data->acls_a_len;
sb.acls_d_ptr = data->acls_d_ptr;
sb.acls_d_len = data->acls_d_len;
sb.xattr_map = data->xattr_map;
sb.xattr_map_size = data->xattr_map_size;
set_stat (data->file_name, &sb,
-1, current_mode, current_mode_mask,
'5', data->interdir, data->atflag);
}
delayed_set_stat_head = data->next;
free_delayed_set_stat (data);
}
}
| unsigned long apply_nonancestor_delayed_set_stat(const char *a1, unsigned char a2)
{
long v2;
char *v3;
long v4;
long v5;
bool v7;
char v8;
int st_mode;
int v10;
size_t v11;
long v12;
struct stat buf;
char v14[48];
long v15;
long v16;
long v17;
long v18;
long v19;
int v20;
int v21;
int v22;
long v23;
long v24;
long v25;
long v26;
long v27;
long v28;
unsigned long v29;
v29 = __readfsqword(0x28u);
v11 = strlen(a1);
v7 = 0;
while ( delayed_set_stat_head )
{
v12 = delayed_set_stat_head;
v8 = 0;
st_mode = *(_DWORD *)(delayed_set_stat_head + 72);
v10 = *(_DWORD *)(delayed_set_stat_head + 76);
v7 = (unsigned char)(v7 | *(_BYTE *)(delayed_set_stat_head + 88)) != 0;
if ( a2 < *(_BYTE *)(delayed_set_stat_head + 88) )
break;
if ( v11 > *(_QWORD *)(delayed_set_stat_head + 152)
&& a1[*(_QWORD *)(delayed_set_stat_head + 152)]
&& (a1[*(_QWORD *)(delayed_set_stat_head + 152)] == 47 || a1[*(_QWORD *)(delayed_set_stat_head + 152) - 1] == 47)
&& !memcmp(a1, *(const void **)(delayed_set_stat_head + 160), *(_QWORD *)(delayed_set_stat_head + 152)) )
{
break;
}
chdir_do(*(unsigned int *)(v12 + 92));
if ( v7 )
{
if ( fstatat(chdir_fd, *(const char **)(v12 + 160), &buf, *(_DWORD *)(v12 + 84)) )
{
stat_error(*(_QWORD *)(v12 + 160));
v8 = 1;
}
else
{
st_mode = buf.st_mode;
v10 = -1;
if ( buf.st_dev != *(_QWORD *)(v12 + 8) || buf.st_ino != *(_QWORD *)(v12 + 16) )
{
if ( error_hook )
error_hook();
v2 = quotearg_colon(*(_QWORD *)(v12 + 160));
v3 = gettext("%s: Directory renamed before its status could be extracted");
error(0, 0, v3, v2);
exit_status = 2;
v8 = 1;
}
}
}
if ( v8 != 1 )
{
v20 = *(_DWORD *)(v12 + 24);
v21 = *(_DWORD *)(v12 + 28);
v22 = *(_DWORD *)(v12 + 32);
v4 = *(_QWORD *)(v12 + 48);
v23 = *(_QWORD *)(v12 + 40);
v24 = v4;
v5 = *(_QWORD *)(v12 + 64);
v25 = *(_QWORD *)(v12 + 56);
v26 = v5;
v15 = *(_QWORD *)(v12 + 96);
v16 = *(_QWORD *)(v12 + 104);
v17 = *(_QWORD *)(v12 + 112);
v18 = *(_QWORD *)(v12 + 120);
v19 = *(_QWORD *)(v12 + 128);
v28 = *(_QWORD *)(v12 + 144);
v27 = *(_QWORD *)(v12 + 136);
set_stat(
*(const char **)(v12 + 160),
(long)v14,
-1,
st_mode,
v10,
53,
*(_BYTE *)(v12 + 80),
*(_DWORD *)(v12 + 84));
}
delayed_set_stat_head = *(_QWORD *)v12;
free_delayed_set_stat(v12);
}
return __readfsqword(0x28u) ^ v29;
}
|
static void
direct_mode (int fd,
_Bool
enable)
{
if (
040000
)
{
int fd_flags =
rpl_fcntl
(fd,
3
);
if (0 < fd_flags)
{
int new_flags = (enable
? (fd_flags |
040000
)
: (fd_flags & ~
040000
));
if (new_flags != fd_flags)
rpl_fcntl
(fd,
4
, new_flags);
}
}
}
| void direct_mode(unsigned long a0, unsigned long a1) {
unsigned long long v0;
unsigned int v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
v3 = rpl_fcntl(a0, 0x3);
*(&v0) = v3;
if (v0 > 0) {
if (!a1)
*(&v3) = v0;
else
*(&v3) = v0;
v1 = v3;
v4 = v1;
if (v1 != v0)
v5 = rpl_fcntl(a0, 0x4);
}
return;
}
|
static wchar_t *
parse_collwcsym (p, vp)
wchar_t *p;
wint_t *vp;
{
register int pc;
wint_t val;
p++;
for (pc = 0; p[pc]; pc++)
if (p[pc] == L'.' && p[pc+1] == L']')
break;
if (p[pc] == 0)
{
if (vp)
*vp =
(0xffffffffu)
;
return (p + pc);
}
val = collwcsym (p, pc);
if (vp)
*vp = val;
return (p + pc + 2);
}
| long parse_collwcsym(long param_1,undefined4 *param_2)
{
undefined4 uVar1;
long lVar2;
int iVar3;
param_1 = param_1 + 4;
iVar3 = 0;
while ((*(int *)(param_1 + (long)iVar3 * 4) != 0 &&
((*(int *)(param_1 + (long)iVar3 * 4) != 0x2e ||
(*(int *)(param_1 + ((long)iVar3 + 1) * 4) != 0x5d))))) {
iVar3 = iVar3 + 1;
}
if (*(int *)(param_1 + (long)iVar3 * 4) == 0) {
if (param_2 != (undefined4 *)0x0) {
*param_2 = 0xffffffff;
}
lVar2 = (long)iVar3;
}
else {
uVar1 = collwcsym(param_1,iVar3);
if (param_2 != (undefined4 *)0x0) {
*param_2 = uVar1;
}
lVar2 = (long)iVar3 + 2;
}
return param_1 + lVar2 * 4;
}
|
static int get_string(char *p, int size, FILE *f)
{
int c;
while ((c = getc(f)) !=
(-1)
&& c != '\n') {
if (--size > 0)
*p++ = c;
}
*p = '\0';
return (c !=
(-1)
) && (size > 0);
}
| void get_string(unsigned long long a0, unsigned long a1, void* a2) {
unsigned int v0;
char *v1;
unsigned int v2;
char *v4;
void* v5;
unsigned long long v6;
v1 = a0;
v0 = a1;
while (true) {
v2 = getc(a2);
if (v2 == -1)
break;
if (v2 == 10)
break;
v0 = v0 - 1;
if (v0 <= 0)
continue;
v4 = v1;
v1 += 1;
*(v4) = v2;
}
*(v1) = 0;
if (v2 != -1 && v0 > 0) {
v6 = 1;
goto LABEL_400584;
}
v5 = 0;
LABEL_400584:
return;
}
|
int
defaultcon (struct selabel_handle *selabel_handle,
char const *path, mode_t mode)
{
int rc = -1;
char *scon =
((void *)0)
;
char *tcon =
((void *)0)
;
context_t scontext = 0, tcontext = 0;
char const *contype;
char *constr;
char *newpath =
((void *)0)
;
if (! (((path)[0]) == '/'))
{
newpath = canonicalize_filename_mode (path, CAN_MISSING);
if (! newpath)
goto quit;
path = newpath;
}
if (selabel_lookup (selabel_handle, &scon, path, mode) < 0)
{
if (
(*__errno_location ())
==
2
)
(*__errno_location ())
=
61
;
goto quit;
}
if (computecon (path, mode, &tcon) < 0)
goto quit;
if (!(scontext = context_new (scon)))
goto quit;
if (!(tcontext = context_new (tcon)))
goto quit;
if (!(contype = context_type_get (scontext)))
goto quit;
if (context_type_set (tcontext, contype))
goto quit;
if (!(constr = context_str (tcontext)))
goto quit;
rc = setfscreatecon (constr);
quit:;
int err =
(*__errno_location ())
;
context_free (scontext);
context_free (tcontext);
freecon (scon);
freecon (tcon);
free (newpath);
(*__errno_location ())
= err;
return rc;
}
| long defaultcon(long a1, _BYTE *a2, unsigned int a3)
{
_BYTE *v5;
unsigned int v6;
int v7;
long v8;
long v9;
long v10;
long v11;
void *ptr;
long v13;
long v14;
unsigned long v15;
v5 = a2;
v15 = __readfsqword(0x28u);
v6 = -1;
v8 = 0LL;
v9 = 0LL;
v10 = 0LL;
v11 = 0LL;
ptr = 0LL;
if ( *a2 != 47 )
{
ptr = (void *)canonicalize_filename_mode(a2, 2LL);
if ( !ptr )
goto LABEL_14;
v5 = ptr;
}
if ( (int)selabel_lookup(a1, &v8, v5, a3) >= 0 )
{
if ( (int)computecon((long)v5, a3, (long)&v9) >= 0 )
{
v10 = context_new(v8);
if ( v10 )
{
v11 = context_new(v9);
if ( v11 )
{
v13 = context_type_get(v10);
if ( v13 )
{
if ( !(unsigned int)context_type_set(v11, v13) )
{
v14 = context_str(v11);
if ( v14 )
v6 = setfscreatecon(v14);
}
}
}
}
}
}
else if ( *_errno_location() == 2 )
{
*_errno_location() = 61;
}
LABEL_14:
v7 = *_errno_location();
context_free(v10);
context_free(v11);
freecon(v8);
freecon(v9);
free(ptr);
*_errno_location() = v7;
return v6;
}
|
static char *
get_sys_tmpdir ()
{
if (sys_tmpdir)
return sys_tmpdir;
sys_tmpdir =
"/tmp"
;
if (file_iswdir (sys_tmpdir))
return sys_tmpdir;
sys_tmpdir = "/tmp";
if (file_iswdir (sys_tmpdir))
return sys_tmpdir;
sys_tmpdir = "/var/tmp";
if (file_iswdir (sys_tmpdir))
return sys_tmpdir;
sys_tmpdir = "/usr/tmp";
if (file_iswdir (sys_tmpdir))
return sys_tmpdir;
sys_tmpdir = ".";
return sys_tmpdir;
}
| int get_sys_tmpdir() {
unsigned int v1;
if (sys_tmpdir) {
v1 = sys_tmpdir;
} else {
sys_tmpdir = "/tmp";
if (file_iswdir(sys_tmpdir)) {
v1 = sys_tmpdir;
} else {
sys_tmpdir = "/tmp";
if (file_iswdir(sys_tmpdir)) {
v1 = sys_tmpdir;
} else {
sys_tmpdir = "/var/tmp";
if (file_iswdir(sys_tmpdir)) {
v1 = sys_tmpdir;
} else {
sys_tmpdir = "/usr/tmp";
if (file_iswdir(sys_tmpdir)) {
v1 = sys_tmpdir;
} else {
sys_tmpdir = ".";
v1 = sys_tmpdir;
}
}
}
}
}
return v1;
}
|
static __attribute__((unused)) inline int ERR_GET_LIB(unsigned long errcode)
{
if ((((errcode) & ((unsigned int)0x7fffffff + 1)) != 0))
return 2;
return (errcode >> 23L) & 0xFF;
}
| int ERR_GET_LIB(unsigned long a0) {
unsigned int v1;
if ((a0 & 0x80000000))
v1 = 2;
else
v1 = a0 / &g_800000;
return v1;
}
|
static void grp_update (void)
{
add_cleanup (cleanup_report_del_group_group, group_name);
if (is_shadow_grp) {
add_cleanup (cleanup_report_del_group_gshadow, group_name);
}
if (gr_remove (group_name) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot remove entry '%s' from %s\n"),
Prog, group_name, gr_dbname ());
exit (10);
}
if (is_shadow_grp && (sgr_locate (group_name) !=
((void *)0)
)) {
if (sgr_remove (group_name) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot remove entry '%s' from %s\n"),
Prog, group_name, sgr_dbname ());
exit (10);
}
}
}
| long long grp_update() {
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
add_cleanup(got.cleanup_report_del_group_group, group_name);
if (is_shadow_grp)
add_cleanup(got.cleanup_report_del_group_gshadow, group_name);
if (!gr_remove(group_name)) {
v3 = gr_dbname();
fprintf(*(&stderr), gettext("%s: cannot remove entry '%s' from %s\n"));
exit(0xa);
}
v2 = is_shadow_grp;
if (is_shadow_grp) {
v2 = sgr_locate(group_name);
if (v2) {
v2 = sgr_remove(group_name);
if (!v2) {
v4 = sgr_dbname();
fprintf(*(&stderr), gettext("%s: cannot remove entry '%s' from %s\n"));
exit(0xa);
}
}
}
if (!is_shadow_grp || !v2 || v2)
return v2;
}
|
void
sv_tz (name)
char *name;
{
SHELL_VAR *v;
v = find_variable (name);
if (v && ((((v)->attributes) & (0x0000001))))
array_needs_making = 1;
else if (v == 0)
array_needs_making = 1;
if (array_needs_making)
{
maybe_make_export_env ();
tzset ();
}
}
| long long sv_tz(unsigned long long a0) {
struct_0 *v0;
unsigned long long v2;
v0 = find_variable(a0);
if (!(!v0 || !(v0->field_28 & 1))) {
array_needs_making = 1;
} else if (!v0) {
array_needs_making = 1;
}
v2 = array_needs_making;
if (array_needs_making) {
maybe_make_export_env();
v2 = tzset();
return v2;
}
return v2;
}
|
void
hash_reset_tuning (Hash_tuning *tuning)
{
*tuning = default_tuning;
}
| long long hash_reset_tuning(struct_0 *a0) {
a0->field_0 = 0;
a0->field_4 = 0x3f4ccccd3f800000;
a0->field_8 = 4590573145673223373;
a0->field_c = 4453159313471766004;
a0->field_10 = 0;
return a0;
}
|
static int cert_callback(gnutls_session_t session)
{
const gnutls_datum_t *cert_list;
unsigned int cert_list_size = 0;
int ret;
unsigned i;
gnutls_datum_t t;
struct priv_st *priv;
cert_list = gnutls_certificate_get_peers(session, &cert_list_size);
if (cert_list_size == 0) {
fprintf(
stderr
, "no certificates sent by server!\n");
return -1;
}
priv = gnutls_session_get_ptr(session);
for (i=0;i<cert_list_size;i++) {
ret = gnutls_pem_base64_encode2("CERTIFICATE", &cert_list[i], &t);
if (ret < 0) {
fprintf(
stderr
, "error[%d]: %s\n", 614,
gnutls_strerror(ret));
app_exit(1);
}
write(priv->fd, t.data, t.size);
gnutls_free((void *) (t.data)), t.data=
((void *)0)
;
}
priv->found = 1;
return -1;
}
| long long cert_callback(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long v3;
unsigned int v4[2];
char v5;
char v6;
v0 = 0;
v3 = gnutls_certificate_get_peers(a0, &v0, &v0);
if (!v0) {
fprintf(*(&stderr), "no certificates sent by server!\n");
} else {
*(&v4[0]) = gnutls_session_get_ptr(a0);
for (v1 = 0; v1 < v0; v1 += 1) {
v2 = gnutls_pem_base64_encode2("CERTIFICATE", v1 * 16 + v3, &v5, v1 * 16 + v3);
if (v2 >= 0) {
write(v4[0], v5, *(&v6));
*(5243160)(v5);
v5 = 0;
} else {
fprintf(*(&stderr), "error[%d]: %s\n", 614, gnutls_strerror(v2));
app_exit(0x1);
}
}
v4[1] = 1;
}
return 4294967295;
}
|
static struct vertex *vertex_new(struct mod *mod, struct vertex *parent)
{
struct vertex *v;
v = malloc(sizeof(*v));
if (v ==
((void *)0)
)
return
((void *)0)
;
v->parent = parent;
v->mod = mod;
return v;
}
| int vertex_new(unsigned long a0, unsigned long a1) {
unsigned long long v0[2];
unsigned int v2;
v0[0] = malloc(0x10);
if (!v0) {
v2 = 0;
return v2;
}
v0[0] = a1;
v0[1] = a0;
v2 = v0;
return v2;
}
|
int
builtin_arrayref_flags (w, baseflags)
WORD_DESC *w;
int baseflags;
{
char *t;
int vflags;
vflags = baseflags;
if (w->flags & (1 << 9))
vflags |= 0x002|0x001;
return vflags;
}
| uint builtin_arrayref_flags(long param_1,uint param_2)
{
uint local_c;
local_c = param_2;
if ((*(uint *)(param_1 + 8) & 0x200) != 0) {
local_c = param_2 | 3;
}
return local_c;
}
|
static
_Bool
null (VALUE *v)
{
switch (v->type)
{
case integer:
return
((
v->u.i
)->_mp_size < 0 ? -1 : (
v->u.i
)->_mp_size > 0)
== 0;
case string:
{
char const *cp = v->u.s;
if (*cp == '\0')
return
1
;
cp += (*cp == '-');
do
{
if (*cp != '0')
return
0
;
}
while (*++cp);
return
1
;
}
default:
abort ();
}
}
| int null(struct_0 *a0) {
char *v0;
unsigned int v2;
unsigned int v3;
if (!a0->field_0) {
if (*((&a0->field_8 + 4)) >= 0 && *((&a0->field_8 + 4)) <= 0) {
v2 = 1;
goto LABEL_400cc8;
}
v2 = 0;
LABEL_400cc8:
v3 = v2 & 1;
} else if (a0->field_0 != 1) {
abort();
} else {
v0 = a0->field_8;
if (!*(v0)) {
v3 = 1;
} else {
v0 = &v0[*(v0) == 45];
do {
if (*(v0) != 48) {
v3 = 0;
goto LABEL_400d2c;
}
v0 += 1;
} while (*(v0));
v3 = 1;
}
}
LABEL_400d2c:
return v3;
}
|
errcode_t e2fsck_check_rebuild_extents(e2fsck_t ctx, ext2_ino_t ino,
struct ext2_inode *inode,
struct problem_context *pctx)
{
struct extent_tree_info eti;
struct ext2_extent_info info, top_info;
struct ext2fs_extent extent;
ext2_extent_handle_t ehandle;
ext2_filsys fs = ctx->fs;
errcode_t retval;
if (!(inode->i_flags & 0x00080000) &&
!(inode->i_flags & 0x10000000) &&
(ctx->options & 0x4000)) {
return e2fsck_rebuild_extents_later(ctx, ino);
}
if (!(inode->i_flags & 0x00080000))
return 0;
memset(&eti, 0, sizeof(eti));
eti.ino = ino;
retval = ext2fs_extent_open2(fs, ino, inode, &ehandle);
if (retval)
return 0;
retval = ext2fs_extent_get_info(ehandle, &top_info);
if (retval)
goto out;
pctx->ino = ino;
pctx->blk = top_info.max_depth;
pctx->blk2 = ext2fs_max_extent_depth(ehandle);
if (pctx->blk2 < pctx->blk &&
fix_problem(ctx, 0x01007F, pctx))
eti.force_rebuild = 1;
pctx->blk = 5;
if (pctx->blk2 > pctx->blk)
fix_problem(ctx, 0x014005, pctx);
if (ctx->options & 0x8000)
goto out;
retval = ext2fs_extent_get(ehandle, 0x0001, &extent);
if (retval)
goto out;
do {
retval = ext2fs_extent_get_info(ehandle, &info);
if (retval)
break;
if (info.curr_entry == 1 &&
!(extent.e_flags & 0x0004) &&
!eti.force_rebuild) {
struct extent_tree_level *etl;
etl = eti.ext_info + info.curr_level;
etl->num_extents += info.num_entries;
etl->max_extents += info.max_entries;
if (info.curr_level &&
info.num_entries < info.max_entries)
etl->max_extents--;
}
if (extent.e_flags & 0x0001) {
retval = ext2fs_extent_get(ehandle,
0x0004,
&extent);
if (retval)
break;
}
retval = ext2fs_extent_get(ehandle, 0x0009, &extent);
} while (retval == 0);
out:
ext2fs_extent_free(ehandle);
return e2fsck_should_rebuild_extents(ctx, pctx, &eti, &top_info);
}
| long e2fsck_check_rebuild_extents(long a1, unsigned int a2, long a3, long a4)
{
long v7;
long v8;
long info;
_DWORD *v10;
char v11[20];
int v12;
int v13;
int v14;
int v15;
int v16;
char v17[16];
int v18;
_QWORD s[8];
s[7] = __readfsqword(0x28u);
v8 = *(_QWORD *)a1;
if ( (*(_DWORD *)(a3 + 32) & 0x80000) == 0
&& (*(_DWORD *)(a3 + 32) & 0x10000000) == 0
&& (*(_DWORD *)(a1 + 76) & 0x4000) != 0 )
{
return e2fsck_rebuild_extents_later((_QWORD *)a1, a2);
}
if ( (*(_DWORD *)(a3 + 32) & 0x80000) == 0 )
return 0LL;
memset(s, 0, 0x30uLL);
LODWORD(s[0]) = a2;
info = ext2fs_extent_open2(v8, a2, a3, &v7);
if ( info )
return 0LL;
info = ext2fs_extent_get_info(v7, v17);
if ( !info )
{
*(_DWORD *)(a4 + 8) = a2;
*(_QWORD *)(a4 + 40) = v18;
*(_QWORD *)(a4 + 48) = ext2fs_max_extent_depth(v7);
if ( *(_QWORD *)(a4 + 48) < *(_QWORD *)(a4 + 40) && (unsigned int)fix_problem(a1, 65663LL, a4) )
HIDWORD(s[0]) = 1;
*(_QWORD *)(a4 + 40) = 5LL;
if ( *(_QWORD *)(a4 + 48) > *(_QWORD *)(a4 + 40) )
fix_problem(a1, 81925LL, a4);
if ( (*(_DWORD *)(a1 + 76) & 0x8000) == 0 )
{
for ( info = ext2fs_extent_get(v7, 1LL, v11); !info; info = ext2fs_extent_get(v7, 9LL, v11) )
{
info = ext2fs_extent_get_info(v7, &v13);
if ( info )
break;
if ( v13 == 1 && (v12 & 4) == 0 && !HIDWORD(s[0]) )
{
v10 = &s[v14 + 1];
*v10 += v15;
v10[1] += v16;
if ( v14 )
{
if ( v15 < v16 )
--v10[1];
}
}
if ( (v12 & 1) != 0 )
{
info = ext2fs_extent_get(v7, 4LL, v11);
if ( info )
break;
}
}
}
}
ext2fs_extent_free(v7);
return e2fsck_should_rebuild_extents(a1, a4, (unsigned int *)s, (long)v17);
}
|
static void
channel_post_mux_client_write(struct ssh *ssh, Channel *c)
{
ssize_t len;
int r;
if ((c->io_ready & 0x02) == 0)
return;
if (sshbuf_len(c->output) == 0)
return;
len = write(c->wfd, sshbuf_ptr(c->output), sshbuf_len(c->output));
if (len == -1 && (
(*__errno_location ())
==
4
||
(*__errno_location ())
==
11
))
return;
if (len <= 0) {
chan_mark_dead(ssh, c);
return;
}
if ((r = sshbuf_consume(c->output, len)) != 0)
sshfatal("channels.c", __func__, 2287, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i: consume", c->self);
}
| void channel_post_mux_client_write(undefined8 param_1,long param_2)
{
undefined4 uVar1;
int iVar2;
long lVar3;
size_t __n;
void *__buf;
ssize_t sVar4;
int *piVar5;
undefined8 uVar6;
if (((*(uint *)(param_2 + 0x30) & 2) != 0) &&
(lVar3 = sshbuf_len(*(undefined8 *)(param_2 + 0x70)), lVar3 != 0)) {
__n = sshbuf_len(*(undefined8 *)(param_2 + 0x70));
__buf = (void *)sshbuf_ptr();
sVar4 = write(*(int *)(param_2 + 0x20),__buf,__n);
if ((sVar4 != -1) ||
((piVar5 = __errno_location(), *piVar5 != 4 && (piVar5 = __errno_location(), *piVar5 != 0xb))
)) {
if (sVar4 < 1) {
chan_mark_dead(param_1,param_2);
}
else {
iVar2 = sshbuf_consume(*(undefined8 *)(param_2 + 0x70),sVar4);
if (iVar2 != 0) {
uVar1 = *(undefined4 *)(param_2 + 4);
uVar6 = ssh_err(iVar2);
sshfatal("channels.c","channel_post_mux_client_write",0x8ef,1,1,uVar6,
"channel %i: consume",uVar1);
}
}
}
}
return;
}
|
get_stat_atime (struct stat const *st)
{
return ((st)->st_atim);
}
| void get_stat_atime(void)
{
halt_baddata();
}
|
static int options_from_array(char **args, int nargs, char **output)
{
char *opts =
((void *)0)
;
size_t optslen = 0;
int i, err = 0;
for (i = 1; i < nargs; i++) {
size_t len = strlen(args[i]);
size_t qlen = 0;
const char *value;
void *tmp;
value = strchr(args[i], '=');
if (value) {
value++;
if (*value != '"' && *value != '\'') {
if (strchr(value, ' '))
qlen = 2;
}
}
tmp = realloc(opts, optslen + len + qlen + 2);
if (!tmp) {
err = -
(*__errno_location ())
;
free(opts);
opts =
((void *)0)
;
log_printf(
3
, "could not gather module options: out-of-memory\n");
break;
}
opts = tmp;
if (optslen > 0) {
opts[optslen] = ' ';
optslen++;
}
if (qlen == 0) {
memcpy(opts + optslen, args[i], len + 1);
optslen += len;
} else {
size_t keylen = value - args[i];
size_t valuelen = len - keylen;
memcpy(opts + optslen, args[i], keylen);
optslen += keylen;
opts[optslen] = '"';
optslen++;
memcpy(opts + optslen, value, valuelen);
optslen += valuelen;
opts[optslen] = '"';
optslen++;
opts[optslen] = '\0';
}
}
*output = opts;
return err;
}
| int options_from_array(unsigned long long *a0, unsigned long a1, unsigned long long *a2) {
unsigned int v0;
unsigned int v1;
void* v2;
void* v3;
unsigned long long v4;
char *v5;
unsigned long v6;
unsigned long v7;
unsigned int v8;
unsigned int v9;
v2 = 0;
v3 = 0;
v1 = 0;
v0 = 1;
while (true) {
if (v0 >= a1)
break;
v6 = strlen(a0[v0]);
v4 = 0;
v5 = strchr(a0[v0], 0x3d);
if (v5) {
v5 += 1;
switch (*(v5)) {
case 34: case 39:
break;
default:
if (strchr(v5, 0x20)) {
v4 = 2;
break;
}
}
}
v7 = realloc(v2, v4 + v3 + v6 + 2);
if (v7) {
v2 = v7;
if (v3) {
*((v3 + v2)) = 32;
v3 += 1;
}
if (!v4) {
memcpy(v3 + v2, a0[v0], v6 + 1);
v3 += v6;
} else {
*(&v8) = &v5[-1 * a0[v0]];
*(&v9) = v6 - *(&v8);
memcpy(v2 + v3, a0[v0], *(&v8));
v3 += *(&v8);
*((v3 + v2)) = 34;
v3 += 1;
memcpy(v2 + v3, v5, *(&v9));
v3 += *(&v9);
*((v3 + v2)) = 34;
v3 += 1;
*((v3 + v2)) = 0;
}
v0 += 1;
} else {
v1 = -(*(__errno_location()));
free(v2);
v2 = 0;
log_printf(0x3, "could not gather module options: out-of-memory\n", a2);
break;
}
}
*(a2) = v2;
return v1;
}
|
static int modinfo_do(struct kmod_module *mod)
{
struct kmod_list *l, *list =
((void *)0)
;
struct param *params =
((void *)0)
;
int err, is_builtin;
const char *filename = kmod_module_get_path(mod);
is_builtin = (filename ==
((void *)0)
);
if (is_builtin) {
if (field ==
((void *)0)
)
printf("%-16s%s%c", "name:",
kmod_module_get_name(mod), separator);
else if (field !=
((void *)0)
&& (strcmp((field), ("name")) == 0))
printf("%s%c", kmod_module_get_name(mod), separator);
filename = "(builtin)";
}
if (field !=
((void *)0)
&& (strcmp((field), ("filename")) == 0)) {
printf("%s%c", filename, separator);
return 0;
} else if (field ==
((void *)0)
) {
printf("%-16s%s%c", "filename:",
filename, separator);
}
err = kmod_module_get_info(mod, &list);
if (err < 0) {
if (is_builtin && err == -
2
) {
return 0;
}
log_printf(
3
, "could not get modinfo from '%s': %s\n", kmod_module_get_name(mod), strerror(-err))
;
return err;
}
if (field !=
((void *)0)
&& (strcmp((field), ("parm")) == 0)) {
err = modinfo_params_do(list);
goto end;
}
for (l = list; l !=
((void *)0)
; l = kmod_list_next(list, l)) {
const char *key = kmod_module_info_get_key(l);
const char *value = kmod_module_info_get_value(l);
int keylen;
if (field !=
((void *)0)
) {
if (!(strcmp((field), (key)) == 0))
continue;
printf("%s%c", value, separator);
continue;
}
if ((strcmp((key), ("parm")) == 0) || (strcmp((key), ("parmtype")) == 0)) {
err = process_parm(key, value, ¶ms);
if (err < 0)
goto end;
continue;
}
if (separator == '\0') {
printf("%s=%s%c", key, value, separator);
continue;
}
keylen = strlen(key);
printf("%s:%-*s%s%c", key, 15 - keylen, "", value, separator);
}
if (field !=
((void *)0)
)
goto end;
while (params !=
((void *)0)
) {
struct param *p = params;
params = p->next;
if (p->param ==
((void *)0)
)
printf("%-16s%.*s:%.*s%c", "parm:",
p->namelen, p->name, p->typelen, p->type,
separator);
else if (p->type !=
((void *)0)
)
printf("%-16s%.*s:%.*s (%.*s)%c", "parm:",
p->namelen, p->name,
p->paramlen, p->param,
p->typelen, p->type,
separator);
else
printf("%-16s%.*s:%.*s%c",
"parm:",
p->namelen, p->name,
p->paramlen, p->param,
separator);
free(p);
}
end:
while (params !=
((void *)0)
) {
void *tmp = params;
params = params->next;
free(tmp);
}
kmod_module_info_free_list(list);
return err;
}
| int modinfo_do(undefined8 param_1)
{
undefined8 *puVar1;
undefined8 *puVar2;
undefined8 *puVar3;
undefined8 *puVar4;
uint *puVar5;
undefined8 *puVar6;
undefined8 *puVar7;
int iVar8;
undefined8 uVar9;
char *pcVar10;
size_t sVar11;
uint uVar12;
long in_FS_OFFSET;
bool bVar13;
int local_6c;
long local_60;
undefined8 *local_58;
long local_50;
char *local_48;
undefined8 *local_40;
char *local_38;
undefined8 local_30;
undefined8 *local_28;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_60 = 0;
local_58 = (undefined8 *)0x0;
local_48 = (char *)kmod_module_get_path(param_1);
bVar13 = local_48 == (char *)0x0;
if (bVar13) {
if (field == (char *)0x0) {
uVar9 = kmod_module_get_name(param_1);
printf("%-16s%s%c","name:",uVar9);
}
else if ((field != (char *)0x0) && (iVar8 = strcmp(field,"name"), iVar8 == 0)) {
uVar12 = (uint)separator;
uVar9 = kmod_module_get_name(param_1);
printf("%s%c",uVar9,(ulong)uVar12);
}
local_48 = "(builtin)";
}
if ((field != (char *)0x0) && (iVar8 = strcmp(field,"filename"), iVar8 == 0)) {
printf("%s%c",local_48,(ulong)(uint)(int)separator);
local_6c = 0;
goto LAB_00100f9d;
}
if (field == (char *)0x0) {
printf("%-16s%s%c","filename:",local_48);
}
uVar9 = 0x100be3;
local_6c = kmod_module_get_info(param_1,&local_60);
if (local_6c < 0) {
if ((bVar13) && (local_6c == -2)) {
local_6c = 0;
}
else {
pcVar10 = strerror(-local_6c);
uVar9 = kmod_module_get_name(param_1);
log_printf(3,"could not get modinfo from \'%s\': %s\n",uVar9,pcVar10);
}
goto LAB_00100f9d;
}
if (field == (char *)0x0) {
LAB_00100c7b:
for (local_50 = local_60; local_50 != 0; local_50 = kmod_list_next(local_60,local_50)) {
local_38 = (char *)kmod_module_info_get_key(local_50);
local_30 = kmod_module_info_get_value(local_50);
if (field == (char *)0x0) {
iVar8 = strcmp(local_38,"parm");
if ((iVar8 == 0) || (iVar8 = strcmp(local_38,"parmtype"), iVar8 == 0)) {
local_6c = process_parm(local_38,local_30,&local_58);
if (local_6c < 0) goto LAB_00100f85;
}
else if (separator == '\0') {
printf("%s=%s%c",local_38,local_30);
}
else {
sVar11 = strlen(local_38);
printf("%s:%-*s%s%c",local_38,(ulong)(0xf - (int)sVar11),&DAT_0010021d,local_30,
(ulong)(uint)(int)separator);
}
}
else {
iVar8 = strcmp(field,local_38);
if (iVar8 == 0) {
printf("%s%c",local_30,(ulong)(uint)(int)separator);
}
}
uVar9 = 0x100de8;
}
if (field == (char *)0x0) {
while (local_58 != (undefined8 *)0x0) {
local_40 = local_58;
puVar7 = (undefined8 *)*local_58;
if (local_58[2] == 0) {
puVar1 = local_58 + 3;
puVar2 = local_58 + 5;
puVar3 = local_58 + 1;
puVar4 = local_58 + 4;
local_58 = puVar7;
printf("%-16s%.*s:%.*s%c","parm:",(ulong)*(uint *)puVar4,*puVar3,(ulong)*(uint *)puVar2,
*puVar1,(ulong)(uint)(int)separator,uVar9);
}
else if (local_58[3] == 0) {
puVar1 = local_58 + 2;
puVar5 = (uint *)((long)local_58 + 0x24);
puVar2 = local_58 + 1;
puVar3 = local_58 + 4;
local_58 = puVar7;
printf("%-16s%.*s:%.*s%c","parm:",(ulong)*(uint *)puVar3,*puVar2,(ulong)*puVar5,*puVar1,
(ulong)(uint)(int)separator,uVar9);
}
else {
puVar1 = local_58 + 3;
puVar2 = local_58 + 5;
puVar3 = local_58 + 2;
puVar5 = (uint *)((long)local_58 + 0x24);
puVar4 = local_58 + 1;
puVar6 = local_58 + 4;
local_58 = puVar7;
printf("%-16s%.*s:%.*s (%.*s)%c","parm:",(ulong)*(uint *)puVar6,*puVar4,(ulong)*puVar5,
*puVar3,(ulong)*(uint *)puVar2,*puVar1,(ulong)(uint)(int)separator);
}
uVar9 = 0x100f54;
free(local_40);
}
}
}
else {
uVar9 = 0x100c63;
iVar8 = strcmp(field,"parm");
if (iVar8 != 0) goto LAB_00100c7b;
local_6c = modinfo_params_do(local_60);
}
LAB_00100f85:
while (puVar7 = local_58, local_58 != (undefined8 *)0x0) {
local_28 = local_58;
local_58 = (undefined8 *)*local_58;
free(puVar7);
}
kmod_module_info_free_list(local_60);
LAB_00100f9d:
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_6c;
}
__stack_chk_fail();
}
|
em_copy_region(EditLine *el, wint_t c __attribute__((__unused__)))
{
wchar_t *kp, *cp;
if (!el->el_chared.c_kill.mark)
return 6;
if (el->el_chared.c_kill.mark > el->el_line.cursor) {
cp = el->el_line.cursor;
kp = el->el_chared.c_kill.buf;
while (cp < el->el_chared.c_kill.mark)
*kp++ = *cp++;
el->el_chared.c_kill.last = kp;
} else {
cp = el->el_chared.c_kill.mark;
kp = el->el_chared.c_kill.buf;
while (cp < el->el_line.cursor)
*kp++ = *cp++;
el->el_chared.c_kill.last = kp;
}
return 0;
}
| long long em_copy_region(unsigned long long a0[115], unsigned long a1) {
unsigned int v0;
int tmp_10;
unsigned long long v1;
unsigned int *v2;
unsigned long long v4;
unsigned int *v5;
unsigned int *v6;
v0 = a1;
if (!a0[114]) {
v4 = 6;
return v4;
} else if (a0[114] > a0[11]) {
v2 = a0[11];
for (v1 = a0[112]; v2 < a0[114]; *(v6) = *(tmp_10)) {
tmp_10 = v2;
v2 = v2 + 1;
v6 = v1;
v1 += 4;
}
a0[113] = v1;
v4 = 0;
return v4;
} else {
v2 = a0[114];
for (v1 = a0[112]; v2 < a0[11]; *(v5) = *(tmp_10)) {
tmp_10 = v2;
v2 = v2 + 1;
v5 = v1;
v1 += 4;
}
a0[113] = v1;
v4 = 0;
return v4;
}
}
|
static int
_rl_subseq_getchar (int key)
{
int k;
if (key == (('[') & 0x1f))
(rl_readline_state |= (0x0000010));
(rl_readline_state |= (0x0000040));
k = rl_read_key ();
(rl_readline_state &= ~(0x0000040));
if (key == (('[') & 0x1f))
(rl_readline_state &= ~(0x0000010));
return k;
}
| undefined4 _rl_subseq_getchar(int param_1)
{
ulong uVar1;
undefined4 uVar2;
if (param_1 == 0x1b) {
rl_readline_state = rl_readline_state | 0x10;
}
rl_readline_state = rl_readline_state | 0x40;
uVar2 = rl_read_key();
uVar1 = rl_readline_state & 0xffffffffffffffbf;
if (param_1 == 0x1b) {
uVar1 = rl_readline_state & 0xffffffffffffffaf;
}
rl_readline_state = uVar1;
return uVar2;
}
|
long
get_clk_tck ()
{
static long retval = 0;
if (retval != 0)
return (retval);
retval = sysconf (
_SC_CLK_TCK
);
return (retval);
}
| long long get_clk_tck() {
unsigned long long v1;
if (retval.3359) {
v1 = retval.3359;
} else {
retval.3359 = sysconf(0x2);
v1 = retval.3359;
}
return v1;
}
|
static int
grow_dst(char **dst, size_t *sz, size_t maxsz, char **dp, size_t need)
{
char *tp;
size_t tsz;
if (*dp + need < *dst + *sz)
return 0;
tsz = *sz + 128;
if (tsz > maxsz)
tsz = maxsz;
if ((tp = recallocarray(*dst, *sz, tsz, 1)) ==
((void *)0)
)
return -1;
*dp = tp + (*dp - *dst);
*dst = tp;
*sz = tsz;
return 0;
}
| int grow_dst(unsigned long long *a0, unsigned long long *a1, unsigned long long a2, unsigned long long *a3, unsigned long a4) {
unsigned long long v0;
unsigned long v1;
unsigned int v3;
if (*(a3) + a4 < *(a1) + *(a0)) {
v3 = 0;
return v3;
}
v0 = *(a1) - -128;
if (v0 > a2)
v0 = a2;
v1 = recallocarray(*(a0), *(a1), v0, 0x1);
if (!v1) {
v3 = -1;
return v3;
}
*(a3) = __subvdi3(*(a3), *(a0), *(a0)) + v1;
*(a0) = v1;
*(a1) = v0;
v3 = 0;
return v3;
}
|
static void
chan_send_eof2(struct ssh *ssh, Channel *c)
{
int r;
sshlog("nchan.c", __func__, 188, 0, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "channel %d: send eof", c->self);
switch (c->istate) {
case 1:
if (!c->have_remote_id)
sshfatal("nchan.c", __func__, 192, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "channel %d: no remote_id", c->self);
if ((r = sshpkt_start(ssh, 96)) != 0 ||
(r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
sshfatal("nchan.c", __func__, 196, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send CHANNEL_EOF");
c->flags |= 0x04;
break;
default:
sshlog("nchan.c", __func__, 200, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "channel %d: cannot send eof for istate %d", c->self, c->istate)
;
break;
}
}
| void chan_send_eof2(undefined8 param_1,long param_2)
{
undefined4 uVar1;
undefined8 uVar2;
char **ppcVar3;
char *pcStack56;
ulong uStack48;
long local_28;
undefined8 local_20;
int local_c;
uStack48 = (ulong)*(uint *)(param_2 + 4);
pcStack56 = "channel %d: send eof";
local_28 = param_2;
local_20 = param_1;
sshlog("nchan.c","chan_send_eof2",0xbc,0,6,0);
ppcVar3 = (char **)&local_28;
if (*(int *)(local_28 + 0x10) != 1) {
pcStack56 = (char *)(ulong)*(uint *)(local_28 + 0x10);
sshlog("nchan.c","chan_send_eof2",200,0,2,0,"channel %d: cannot send eof for istate %d",
*(undefined4 *)(local_28 + 4));
return;
}
if (*(int *)(local_28 + 0xc) == 0) {
uStack48 = (ulong)*(uint *)(local_28 + 4);
ppcVar3 = &pcStack56;
pcStack56 = "channel %d: no remote_id";
sshfatal("nchan.c","chan_send_eof2",0xc0,1,1,0);
}
*(undefined8 *)((long)ppcVar3 + -8) = 0x100676;
local_c = sshpkt_start(local_20,0x60);
if (local_c == 0) {
uVar1 = *(undefined4 *)(local_28 + 8);
*(undefined8 *)((long)ppcVar3 + -8) = 0x100694;
local_c = sshpkt_put_u32(local_20,uVar1);
if (local_c == 0) {
*(undefined8 *)((long)ppcVar3 + -8) = 0x1006a9;
local_c = sshpkt_send(local_20);
if (local_c == 0) goto LAB_001006f3;
}
}
*(undefined8 *)((long)ppcVar3 + -8) = 0x1006bc;
uVar2 = ssh_err(local_c);
*(char **)((long)ppcVar3 + -0x10) = "send CHANNEL_EOF";
*(undefined8 *)((long)ppcVar3 + -0x18) = 0x1006f3;
sshfatal("nchan.c","chan_send_eof2",0xc4,1,1,uVar2);
LAB_001006f3:
*(uint *)(local_28 + 0x18) = *(uint *)(local_28 + 0x18) | 4;
return;
}
|
!ext2fs_has_feature_quota(sb))
return;
for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
pctx.dir = 2;
pctx.ino = *quota_sb_inump(sb, qtype);
pctx.num = qtype;
quota_ino = quota_type2inum(qtype, fs->super);
if (pctx.ino && (pctx.ino != quota_ino) &&
fix_problem(ctx, 0x000041, &pctx)) {
if (move_quota_inode(fs, pctx.ino, quota_ino, qtype))
continue;
*quota_sb_inump(sb, qtype) = quota_ino;
ext2fs_mark_super_dirty(fs);
}
}
| int ext2fs_has_feature_quota(struct_0 *a0) {
return (a0->field_64 & 0x100);
}
|
char *
svis(char *mbdst, int c, int flags, int nextc, const char *mbextra)
{
char cc[2];
int ret;
cc[0] = c;
cc[1] = nextc;
ret = istrsenvisx(&mbdst,
((void *)0)
, cc, 1, flags, mbextra,
((void *)0)
);
if (ret < 0)
return
((void *)0)
;
return mbdst + ret;
}
| long long svis(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, void* a4) {
char v0;
unsigned int v1;
char v2;
char v3;
void* v5;
v2 = a1;
v3 = a3;
v1 = istrsenvisx(&v0, NULL, &v2, 0x1, a2, a4, 0x0);
if (v1 < 0)
v5 = 0;
else
v5 = v1 + a0;
return v5;
}
|
static int
it_init_bindings (itp)
ITEMLIST *itp;
{
char **blist;
STRINGLIST *sl;
blist = (char **)rl_funmap_names ();
sl = strlist_create (0);
sl->list = blist;
sl->list_size = 0;
sl->list_len = strvec_len (sl->list);
itp->flags |= 0x020;
itp->slist = sl;
return 0;
}
| long long it_init_bindings(struct_0 *a0) {
struct_0 *v0;
unsigned long v1;
struct_1 *v2;
v0 = a0;
v1 = rl_funmap_names();
v2 = strlist_create(0x0);
v2->field_0 = v1;
v2->field_8 = 0;
v2->field_c = strvec_len(v2->field_0);
a0->field_0 = a0->field_0 | 32;
a0->field_10 = v2;
return 0;
}
|
static gnutls_digest_algorithm_t get_dig(gnutls_x509_crt_t crt, common_info_st * cinfo)
{
gnutls_digest_algorithm_t dig;
gnutls_pubkey_t pubkey;
int result;
result = gnutls_pubkey_init(&pubkey);
if (result < 0) {
fprintf(
stderr
, "memory error\n");
app_exit(1);
}
result = gnutls_pubkey_import_x509(pubkey, crt, 0);
if (result < 0) {
{
fprintf(
stderr
, "gnutls_pubkey_import_x509: %s\n",
gnutls_strerror(result));
app_exit(1);
}
}
dig = get_dig_for_pub(pubkey, cinfo);
gnutls_pubkey_deinit(pubkey);
return dig;
}
| long get_dig(long a1, long a2)
{
const char *v2;
int v4;
unsigned int dig_for_pub;
long v6[2];
v6[1] = __readfsqword(0x28u);
if ( (int)gnutls_pubkey_init(v6) < 0 )
{
fprintf(stderr, "memory error\n");
app_exit(1);
}
v4 = gnutls_pubkey_import_x509(v6[0], a1, 0LL);
if ( v4 < 0 )
{
v2 = (const char *)gnutls_strerror((unsigned int)v4);
fprintf(stderr, "gnutls_pubkey_import_x509: %s\n", v2);
app_exit(1);
}
dig_for_pub = get_dig_for_pub(v6[0], a2);
gnutls_pubkey_deinit(v6[0]);
return dig_for_pub;
}
|
static int
client_input_channel_open(int type, u_int32_t seq, struct ssh *ssh)
{
Channel *c =
((void *)0)
;
char *ctype =
((void *)0)
;
int r;
u_int rchan;
size_t len;
u_int rmaxpack, rwindow;
if ((r = sshpkt_get_cstring(ssh, &ctype, &len)) != 0 ||
(r = sshpkt_get_u32(ssh, &rchan)) != 0 ||
(r = sshpkt_get_u32(ssh, &rwindow)) != 0 ||
(r = sshpkt_get_u32(ssh, &rmaxpack)) != 0)
goto out;
sshlog("clientloop.c", __func__, 1679, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "client_input_channel_open: ctype %s rchan %d win %d max %d", ctype, rchan, rwindow, rmaxpack)
;
if (strcmp(ctype, "forwarded-tcpip") == 0) {
c = client_request_forwarded_tcpip(ssh, ctype, rchan, rwindow,
rmaxpack);
} else if (strcmp(ctype, "forwarded-streamlocal@openssh.com") == 0) {
c = client_request_forwarded_streamlocal(ssh, ctype, rchan);
} else if (strcmp(ctype, "x11") == 0) {
c = client_request_x11(ssh, ctype, rchan);
} else if (strcmp(ctype, "auth-agent@openssh.com") == 0) {
c = client_request_agent(ssh, ctype, rchan);
}
if (c !=
((void *)0)
&& c->type == 16) {
sshlog("clientloop.c", __func__, 1693, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "proxied to downstream: %s", ctype);
} else if (c !=
((void *)0)
) {
sshlog("clientloop.c", __func__, 1695, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "confirm %s", ctype);
c->remote_id = rchan;
c->have_remote_id = 1;
c->remote_window = rwindow;
c->remote_maxpacket = rmaxpack;
if (c->type != 12) {
if ((r = sshpkt_start(ssh, 91)) != 0 ||
(r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
(r = sshpkt_put_u32(ssh, c->self)) != 0 ||
(r = sshpkt_put_u32(ssh, c->local_window)) != 0 ||
(r = sshpkt_put_u32(ssh, c->local_maxpacket)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
sshpkt_fatal(ssh, r, "%s: send reply", __func__);
}
} else {
sshlog("clientloop.c", __func__, 1710, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "failure %s", ctype);
if ((r = sshpkt_start(ssh, 92)) != 0 ||
(r = sshpkt_put_u32(ssh, rchan)) != 0 ||
(r = sshpkt_put_u32(ssh, 1)) != 0 ||
(r = sshpkt_put_cstring(ssh, "open failed")) != 0 ||
(r = sshpkt_put_cstring(ssh, "")) != 0 ||
(r = sshpkt_send(ssh)) != 0)
sshpkt_fatal(ssh, r, "%s: send failure", __func__);
}
r = 0;
out:
free(ctype);
return r;
}
| long long client_input_channel_open(unsigned long a0, unsigned long a1, void* a2) {
unsigned long long v0;
void* v1;
unsigned long v2;
unsigned long v3;
unsigned long long v4;
void* v5;
unsigned int v6;
unsigned int v7;
char v8;
char v9;
char v10;
unsigned int v11;
void* v12;
char v13;
void* v14;
v7 = a0;
v6 = a1;
v14 = 0;
v12 = 0;
v11 = sshpkt_get_cstring(a2, &v12, &v13, &v12);
if (!v11) {
v11 = sshpkt_get_u32(a2, &v8, &v8);
if (!v11) {
v11 = sshpkt_get_u32(a2, &v10, &v10);
if (!v11) {
v11 = sshpkt_get_u32(a2, &v9, &v9);
if (!v11) {
v4 = *(&v9);
v3 = *(&v10);
v2 = *(&v8);
v1 = v12;
v0 = "client_input_channel_open: ctype %s rchan %d win %d max %d";
sshlog("clientloop.c", "client_input_channel_open", 0x68f, 0x0, 0x5, 0x0);
if (!strcmp(v12, "forwarded-tcpip")) {
v14 = client_request_forwarded_tcpip(a2, v12, *(&v8), *(&v10), *(&v9));
} else if (!strcmp(v12, "forwarded-streamlocal@openssh.com")) {
v14 = client_request_forwarded_streamlocal(a2, v12, *(&v8));
} else if (!strcmp(v12, "x11")) {
v14 = client_request_x11(a2, v12, *(&v8));
} else if (!strcmp(v12, "auth-agent@openssh.com")) {
v14 = client_request_agent(a2, v12, *(&v8));
}
if (v14 && *(v14) == 16) {
v5 = v12;
v4 = "proxied to downstream: %s";
sshlog("clientloop.c", "client_input_channel_open", 0x69d, 0x0, 0x7, 0x0);
goto LABEL_404ea9;
}
if (v14) {
v5 = v12;
v4 = "confirm %s";
sshlog("clientloop.c", "client_input_channel_open", 0x69f, 0x0, 0x5, 0x0);
*(&v14[8]) = *(&v8);
*(&v14[12]) = 1;
*(&v14[168]) = *(&v10);
*(&v14[172]) = *(&v9);
if (*(v14) == 12)
goto LABEL_404ea9;
v11 = sshpkt_start(a2, 0x5b);
if (!v11) {
v11 = sshpkt_put_u32(a2, v14[8]);
if (!v11) {
v11 = sshpkt_put_u32(a2, v14[4]);
if (!v11) {
v11 = sshpkt_put_u32(a2, v14[176]);
if (!v11) {
v11 = sshpkt_put_u32(a2, v14[188]);
if (!v11) {
v11 = sshpkt_send(a2);
if (!v11)
goto LABEL_404ea9;
}
}
}
}
}
sshpkt_fatal(a2, v11, "%s: send reply", "client_input_channel_open");
}
v5 = v12;
v4 = "failure %s";
sshlog("clientloop.c", "client_input_channel_open", 0x6ae, 0x0, 0x5, 0x0);
v11 = sshpkt_start(a2, 0x5c);
if (!v11) {
v11 = sshpkt_put_u32(a2, *(&v8));
if (!v11) {
v11 = sshpkt_put_u32(a2, 0x1);
if (!v11) {
v11 = sshpkt_put_cstring(a2, "open failed");
if (!v11) {
v11 = sshpkt_put_cstring(a2, &g_408c6c);
if (!v11) {
v11 = sshpkt_send(a2);
if (!v11)
goto LABEL_404ea9;
}
}
}
}
}
sshpkt_fatal(a2, v11, "%s: send failure", "client_input_channel_open");
LABEL_404ea9:
v11 = 0;
}
}
}
}
free(v12);
return v11;
}
|
int
ssh_local_port(struct ssh *ssh)
{
(void)ssh_remote_ipaddr(ssh);
return ssh->local_port;
}
| long long ssh_local_port(struct_0 *a0) {
ssh_remote_ipaddr(a0);
return a0->field_28;
}
|
static int
funopen_seek(void *cookie, off64_t *offset, int whence)
{
struct funopen_cookie *cookiewrap = cookie;
off_t soff = *offset;
if (cookiewrap->seekfn ==
((void *)0)
) {
(*__errno_location ())
=
29
;
return -1;
}
soff = cookiewrap->seekfn(cookiewrap->orig_cookie, soff, whence);
*offset = soff;
return *offset;
}
| long funopen_seek(long a1, _QWORD *a2, unsigned int a3)
{
if ( *(_QWORD *)(a1 + 24) )
{
*a2 = (*(long ( **)(_QWORD, _QWORD, _QWORD))(a1 + 24))(*(_QWORD *)a1, *a2, a3);
return *a2;
}
else
{
*_errno_location() = 29;
return 0xFFFFFFFFLL;
}
}
|
void
_rl_prep_non_filename_text (void)
{
if (_rl_color_indicator[C_END].string !=
((void *)0)
)
_rl_put_indicator (&_rl_color_indicator[C_END]);
else
{
_rl_put_indicator (&_rl_color_indicator[C_LEFT]);
_rl_put_indicator (&_rl_color_indicator[C_RESET]);
_rl_put_indicator (&_rl_color_indicator[C_RIGHT]);
}
}
| long long _rl_prep_non_filename_text() {
unsigned long long v1;
if (strcpy) {
v1 = _rl_put_indicator(xmalloc);
} else {
_rl_put_indicator(&_rl_color_indicator);
_rl_put_indicator(lstat);
v1 = _rl_put_indicator(strlen);
}
return v1;
}
|
void
init_mail_dates ()
{
if (mailfiles == 0)
remember_mail_dates ();
}
| long long init_mail_dates() {
unsigned long long v1;
v1 = mailfiles;
if (!mailfiles)
v1 = remember_mail_dates();
return v1;
}
|
static int __errcode_to_errno(errcode_t err, const char *func, int line)
{
if (err == 0)
return 0;
fprintf(
stderr
, "Error \"%s\" encountered in function %s at line %d\n",
error_message(err), func, line);
if (err <= 256)
return -err;
return -
14
;
}
| int __errcode_to_errno(unsigned long long a0, unsigned long a1, unsigned long a2) {
unsigned int v1;
if (!a0) {
v1 = 0;
} else {
fprintf(stderr, "Error \"%s\" encountered in function %s at line %d\n", error_message(a0), a1, a2);
if (a0 <= 0x100)
v1 = -(a0);
else
v1 = -14;
}
return v1;
}
|
void *
client_new_escape_filter_ctx(int escape_char)
{
struct escape_filter_ctx *ret;
ret = xcalloc(1, sizeof(*ret));
ret->escape_pending = 0;
ret->escape_char = escape_char;
return (void *)ret;
}
| undefined4 * client_new_escape_filter_ctx(undefined4 param_1)
{
undefined4 *puVar1;
puVar1 = (undefined4 *)xcalloc(1,8);
*puVar1 = 0;
puVar1[1] = param_1;
return puVar1;
}
|
static void print_encap_rpl(FILE *fp, struct rtattr *encap)
{
struct rtattr *tb[(__RPL_IPTUNNEL_MAX - 1) + 1];
struct ipv6_rpl_sr_hdr *srh;
(parse_rtattr_flags((tb), ((__RPL_IPTUNNEL_MAX - 1)), ((void*)(((char*)(encap)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), ((int)((encap)->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), (1 << 15)));
if (!tb[RPL_IPTUNNEL_SRH])
return;
srh = ((void*)(((char*)(tb[RPL_IPTUNNEL_SRH])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
print_rpl_srh(fp, srh);
}
| unsigned long print_encap_rpl(FILE *a1, unsigned short *a2)
{
char v3[8];
long v4;
unsigned long v5;
v5 = __readfsqword(0x28u);
parse_rtattr_flags(v3, 1LL, a2 + 2, (unsigned int)*a2 - 4, 0x8000LL);
if ( v4 )
print_rpl_srh(a1, v4 + 4);
return __readfsqword(0x28u) ^ v5;
}
|
static inline __u32 rta_getattr_u32(const struct rtattr *rta)
{
return *(__u32 *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| int rta_getattr_u32(struct_0 *a0) {
return a0->field_4;
}
|
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 VALUE *
int_value (unsigned long int i)
{
VALUE *v = xmalloc (sizeof *v);
v->type = integer;
__gmpz_init_set_ui
(v->u.i, i);
return v;
}
| undefined4 * int_value(undefined8 param_1)
{
undefined4 *puVar1;
puVar1 = (undefined4 *)xmalloc(0x18);
*puVar1 = 0;
__gmpz_init_set_ui(puVar1 + 2,param_1);
return puVar1;
}
|
static struct nh_entry *ipnh_cache_add(__u32 nh_id)
{
struct nlmsghdr *answer =
((void *)0)
;
struct nh_entry *nhe =
((void *)0)
;
if (nh_cache_rth.fd < 0 && rtnl_open(&nh_cache_rth, 0) < 0) {
nh_cache_rth.fd = -1;
goto out;
}
if (__ipnh_get_id(&nh_cache_rth, nh_id, &answer) < 0)
goto out;
nhe = malloc(sizeof(*nhe));
if (!nhe)
goto out;
if (__ipnh_cache_parse_nlmsg(answer, nhe))
goto out_free_nhe;
ipnh_cache_link_entry(nhe);
out:
if (answer)
free(answer);
return nhe;
out_free_nhe:
free(nhe);
nhe =
((void *)0)
;
goto out;
}
| int ipnh_cache_add(unsigned long a0) {
void* v0;
void* v1;
unsigned long v2;
unsigned long long *v4;
v2 = v4[5];
v0 = 0;
v1 = 0;
if (!(nh_cache_rth >= 0 || rtnl_open(&nh_cache_rth, 0x0) >= 0)) {
nh_cache_rth = -1;
} else if (__ipnh_get_id(&nh_cache_rth, a0, &v0) >= 0) {
v1 = malloc(0x70);
if (v1) {
if (__ipnh_cache_parse_nlmsg(v0, v1)) {
free(v1);
v1 = 0;
} else {
ipnh_cache_link_entry(v1);
}
}
}
if (v0)
free(v0);
if ((v2 ^ v4[5]))
__stack_chk_fail();
return v1;
}
|
BUCKET_CONTENTS *
hash_remove (string, table, flags)
const char *string;
HASH_TABLE *table;
int flags;
{
int bucket;
BUCKET_CONTENTS *prev, *temp;
unsigned int hv;
if (table == 0 || ((table) ? (table)->nentries : 0) == 0)
return (BUCKET_CONTENTS *)
((void *)0)
;
bucket = (((hv) = hash_string (string)) & ((table)->nbuckets - 1));
prev = (BUCKET_CONTENTS *)
((void *)0)
;
for (temp = table->bucket_array[bucket]; temp; temp = temp->next)
{
if (hv == temp->khash && ((temp->key)[0] == (string)[0] && strcmp(temp->key, string) == 0))
{
if (prev)
prev->next = temp->next;
else
table->bucket_array[bucket] = temp->next;
table->nentries--;
return (temp);
}
prev = temp;
}
return ((BUCKET_CONTENTS *)
((void *)0)
);
}
| long * hash_remove(char *a1, long a2)
{
int v3;
int v4;
_QWORD *v5;
long *i;
if ( !a2 || !*(_DWORD *)(a2 + 12) )
return 0LL;
v3 = hash_string(a1);
v4 = v3 & (*(_DWORD *)(a2 + 8) - 1);
v5 = 0LL;
for ( i = *(long **)(8LL * v4 + *(_QWORD *)a2); ; i = (long *)*i )
{
if ( !i )
return 0LL;
if ( v3 == *((_DWORD *)i + 6) && *(_BYTE *)i[1] == *a1 && !strcmp((const char *)i[1], a1) )
break;
v5 = i;
}
if ( v5 )
*v5 = *i;
else
*(_QWORD *)(*(_QWORD *)a2 + 8LL * v4) = *i;
--*(_DWORD *)(a2 + 12);
return i;
}
|
static int
find_matching_open (char *string, int from, int closer)
{
register int i;
int opener, level, delimiter;
switch (closer)
{
case ']': opener = '['; break;
case '}': opener = '{'; break;
case ')': opener = '('; break;
default:
return (-1);
}
level = 1;
delimiter = 0;
for (i = from; i > -1; i--)
{
if (delimiter && (string[i] == delimiter))
delimiter = 0;
else if (rl_basic_quote_characters && strchr (rl_basic_quote_characters, string[i]))
delimiter = string[i];
else if (!delimiter && (string[i] == closer))
level++;
else if (!delimiter && (string[i] == opener))
level--;
if (!level)
break;
}
return (i);
}
| long find_matching_open(long a1, unsigned int a2, int a3)
{
int v6;
int v7;
int v8;
if ( a3 == 125 )
{
v6 = 123;
}
else
{
if ( a3 > 125 )
return 0xFFFFFFFFLL;
if ( a3 != 41 )
{
if ( a3 == 93 )
{
v6 = 91;
goto LABEL_9;
}
return 0xFFFFFFFFLL;
}
v6 = 40;
}
LABEL_9:
v7 = 1;
v8 = 0;
while ( (a2 & 0x80000000) == 0 )
{
if ( v8 && v8 == *(char *)((int)a2 + a1) )
{
v8 = 0;
}
else if ( rl_basic_quote_characters && strchr(rl_basic_quote_characters, *(char *)((int)a2 + a1)) )
{
v8 = *(char *)((int)a2 + a1);
}
else if ( v8 || a3 != *(char *)((int)a2 + a1) )
{
if ( !v8 && v6 == *(char *)((int)a2 + a1) )
--v7;
}
else
{
++v7;
}
if ( !v7 )
break;
--a2;
}
return a2;
}
|
static inline void
emit_ancillary_info (char const *program)
{
struct infomap { char const *program; char const *node; } const infomap[] = {
{ "[", "test invocation" },
{ "coreutils", "Multi-call invocation" },
{ "sha224sum", "sha2 utilities" },
{ "sha256sum", "sha2 utilities" },
{ "sha384sum", "sha2 utilities" },
{ "sha512sum", "sha2 utilities" },
{
((void *)0)
,
((void *)0)
}
};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && ! (strcmp (program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
}
| unsigned long emit_ancillary_info(const char *a1)
{
char *v1;
FILE *v2;
char *v3;
const char *v4;
char *v5;
const char *v6;
char *v7;
const char *v9;
long *i;
const char *v11;
const char *v12;
long v13[15];
unsigned long v14;
v14 = __readfsqword(0x28u);
v13[0] = (long)"[";
v13[1] = (long)"test invocation";
v13[2] = (long)"coreutils";
v13[3] = (long)"Multi-call invocation";
v13[4] = (long)"sha224sum";
v13[5] = (long)"sha2 utilities";
v13[6] = (long)"sha256sum";
v13[7] = (long)"sha2 utilities";
v13[8] = (long)"sha384sum";
v13[9] = (long)"sha2 utilities";
v13[10] = (long)"sha512sum";
v13[11] = (long)"sha2 utilities";
v13[12] = 0LL;
v13[13] = 0LL;
v9 = a1;
for ( i = v13; *i && strcmp(a1, (const char *)*i); i += 2 )
;
if ( i[1] )
v9 = (const char *)i[1];
v1 = gettext("\n%s online help: <%s>\n");
printf(v1, "GNU coreutils", "https:
v11 = setlocale(5, 0LL);
if ( v11 && strncmp(v11, "en_", 3uLL) )
{
v2 = stdout;
v3 = gettext("Report any translation bugs to <https:
fputs_unlocked(v3, v2);
}
if ( !strcmp(a1, "[") )
v4 = "test";
else
v4 = a1;
v12 = v4;
v5 = gettext("Full documentation <%s%s>\n");
printf(v5, "https:
if ( v9 == a1 )
v6 = " invocation";
else
v6 = locale;
v7 = gettext("or available locally via: info '(coreutils) %s%s'\n");
printf(v7, v9, v6);
return __readfsqword(0x28u) ^ v14;
}
|
char *
stnputs(const char *s, size_t n, char *p)
{
p = makestrspace(n, p);
p = mempcpy(p, s, n);
return p;
}
| void * stnputs(void *param_1,size_t param_2,undefined8 param_3)
{
void *pvVar1;
pvVar1 = (void *)makestrspace(param_2,param_3);
pvVar1 = mempcpy(pvVar1,param_1,param_2);
return pvVar1;
}
|
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]...\n"), program_name);
if (uname_mode == 1)
{
fputs_unlocked (gettext ("Print certain system information. With no OPTION, same as -s.\n\n -a, --all print all information, in the following order,\n except omit -p and -i if unknown:\n -s, --kernel-name print the kernel name\n -n, --nodename print the network node hostname\n -r, --kernel-release print the kernel release\n"),
stdout
)
;
fputs_unlocked (gettext (" -v, --kernel-version print the kernel version\n -m, --machine print the machine hardware name\n -p, --processor print the processor type (non-portable)\n -i, --hardware-platform print the hardware platform (non-portable)\n -o, --operating-system print the operating system\n"),
stdout
)
;
}
else
{
fputs_unlocked (gettext ("Print machine architecture.\n\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 ((uname_mode == 1 ? "uname" : "arch"));
}
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]...\n"));
if (uname_mode != 1) {
fputs_unlocked(gettext("Print machine architecture.\n\n"), *(&stdout));
} else {
fputs_unlocked(gettext("Print certain system information. With no OPTION, same as -s.\n\n -a, --all print all information, in the following order,\n except omit -p and -i if unknown:\n -s, --kernel-name print the kernel name\n -n, --nodename print the network node hostname\n -r, --kernel-release print the kernel release\n"), *(&stdout));
fputs_unlocked(gettext(" -v, --kernel-version print the kernel version\n -m, --machine print the machine hardware name\n -p, --processor print the processor type (non-portable)\n -i, --hardware-platform print the hardware platform (non-portable)\n -o, --operating-system print the operating system\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((uname_mode == 1 ? "arch" : "uname"));
}
exit(a0);
}
|
void
channel_add_permission(struct ssh *ssh, int who, int where,
char *host, int port)
{
int local = where == (1<<1);
struct permission_set *pset = permission_set_get(ssh, where);
sshlog("channels.c", __func__, 4306, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "allow %s forwarding to host %s port %d", fwd_ident(who, where), host, port)
;
permission_set_add(ssh, who, where,
local ? host : 0, local ? port : 0,
local ?
((void *)0)
: host,
((void *)0)
, local ? 0 : port,
((void *)0)
);
pset->all_permitted = 0;
}
| long channel_add_permission(long a1, unsigned int a2, unsigned int a3, const char *a4, int a5)
{
const char *v5;
int v6;
const char *v7;
int v8;
const char *v9;
long result;
_BOOL4 v14;
long v15;
v14 = a3 == 2;
v15 = permission_set_get(a1, a3);
v5 = fwd_ident(a2, a3);
sshlog(
"channels.c",
"channel_add_permission",
4306LL,
0LL,
5LL,
0LL,
"allow %s forwarding to host %s port %d",
v5,
a4,
(unsigned int)a5);
if ( v14 )
v6 = 0;
else
v6 = a5;
if ( v14 )
v7 = 0LL;
else
v7 = a4;
if ( v14 )
v8 = a5;
else
v8 = 0;
if ( v14 )
v9 = a4;
else
v9 = 0LL;
permission_set_add(a1, a2, a3, (long)v9, v8, (long)v7, 0LL, v6, 0LL);
result = v15;
*(_DWORD *)(v15 + 32) = 0;
return result;
}
|
static void
pubkey_prepare(struct ssh *ssh, Authctxt *authctxt)
{
struct identity *id, *id2, *tmp;
struct idlist agent, files, *preferred;
struct sshkey *key;
int agent_fd = -1, i, r, found;
size_t j;
struct ssh_identitylist *idlist;
char *ident;
do { (&agent)->tqh_first =
((void *)0)
; (&agent)->tqh_last = &(&agent)->tqh_first; } while (0);
do { (&files)->tqh_first =
((void *)0)
; (&files)->tqh_last = &(&files)->tqh_first; } while (0);
preferred = &authctxt->keys;
do { (preferred)->tqh_first =
((void *)0)
; (preferred)->tqh_last = &(preferred)->tqh_first; } while (0);
for (i = 0; i < options.num_identity_files; i++) {
key = options.identity_keys[i];
if (key && key->cert &&
key->cert->type != 1) {
sshlog("sshconnect2.c", __func__, 1723, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "ignoring certificate %s: not a user " "certificate", options.identity_files[i])
;
continue;
}
if (key && sshkey_is_sk(key) && options.sk_provider ==
((void *)0)
) {
sshlog("sshconnect2.c", __func__, 1728, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "ignoring authenticator-hosted key %s as no " "SecurityKeyProvider has been specified", options.identity_files[i])
;
continue;
}
options.identity_keys[i] =
((void *)0)
;
id = xcalloc(1, sizeof(*id));
id->agent_fd = -1;
id->key = key;
id->filename = xstrdup(options.identity_files[i]);
id->userprovided = options.identity_file_userprovided[i];
do { (id)->next.tqe_next =
((void *)0)
; (id)->next.tqe_prev = (&files)->tqh_last; *(&files)->tqh_last = (id); (&files)->tqh_last = &(id)->next.tqe_next; } while (0);
}
for (i = 0; i < options.num_certificate_files; i++) {
key = options.certificates[i];
if (!sshkey_is_cert(key) || key->cert ==
((void *)0)
||
key->cert->type != 1) {
sshlog("sshconnect2.c", __func__, 1746, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "ignoring certificate %s: not a user " "certificate", options.identity_files[i])
;
continue;
}
if (key && sshkey_is_sk(key) && options.sk_provider ==
((void *)0)
) {
sshlog("sshconnect2.c", __func__, 1751, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "ignoring authenticator-hosted key " "certificate %s as no " "SecurityKeyProvider has been specified", options.identity_files[i])
;
continue;
}
id = xcalloc(1, sizeof(*id));
id->agent_fd = -1;
id->key = key;
id->filename = xstrdup(options.certificate_files[i]);
id->userprovided = options.certificate_file_userprovided[i];
do { (id)->next.tqe_next =
((void *)0)
; (id)->next.tqe_prev = (preferred)->tqh_last; *(preferred)->tqh_last = (id); (preferred)->tqh_last = &(id)->next.tqe_next; } while (0);
}
if ((r = get_agent_identities(ssh, &agent_fd, &idlist)) == 0) {
for (j = 0; j < idlist->nkeys; j++) {
if ((r = sshkey_check_rsa_length(idlist->keys[j],
options.required_rsa_size)) != 0) {
sshlog("sshconnect2.c", __func__, 1769, 1, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "ignoring %s agent key", sshkey_ssh_name(idlist->keys[j]))
;
continue;
}
found = 0;
for((id) = ((&files)->tqh_first); (id) !=
((void *)0)
; (id) = ((id)->next.tqe_next)) {
if (sshkey_equal(idlist->keys[j], id->key)) {
do { if (((id)->next.tqe_next) !=
((void *)0)
) (id)->next.tqe_next->next.tqe_prev = (id)->next.tqe_prev; else (&files)->tqh_last = (id)->next.tqe_prev; *(id)->next.tqe_prev = (id)->next.tqe_next; ; ; } while (0);
do { (id)->next.tqe_next =
((void *)0)
; (id)->next.tqe_prev = (preferred)->tqh_last; *(preferred)->tqh_last = (id); (preferred)->tqh_last = &(id)->next.tqe_next; } while (0);
id->agent_fd = agent_fd;
found = 1;
break;
}
}
if (!found && !options.identities_only) {
id = xcalloc(1, sizeof(*id));
id->key = idlist->keys[j];
id->filename = idlist->comments[j];
idlist->keys[j] =
((void *)0)
;
idlist->comments[j] =
((void *)0)
;
id->agent_fd = agent_fd;
do { (id)->next.tqe_next =
((void *)0)
; (id)->next.tqe_prev = (&agent)->tqh_last; *(&agent)->tqh_last = (id); (&agent)->tqh_last = &(id)->next.tqe_next; } while (0);
}
}
ssh_free_identitylist(idlist);
do { if (!(((&agent)->tqh_first) ==
((void *)0)
)) { *(preferred)->tqh_last = (&agent)->tqh_first; (&agent)->tqh_first->next.tqe_prev = (preferred)->tqh_last; (preferred)->tqh_last = (&agent)->tqh_last; do { ((&agent))->tqh_first =
((void *)0)
; ((&agent))->tqh_last = &((&agent))->tqh_first; } while (0); } } while (0);
authctxt->agent_fd = agent_fd;
}
for ((id) = ((&files)->tqh_first); (id) !=
((void *)0)
&& ((tmp) = ((id)->next.tqe_next), 1); (id) = (tmp)) {
if (id->key ==
((void *)0)
|| (id->key->flags & 0x0001) == 0)
continue;
found = 0;
for((id2) = ((&files)->tqh_first); (id2) !=
((void *)0)
; (id2) = ((id2)->next.tqe_next)) {
if (id2->key ==
((void *)0)
||
(id2->key->flags & 0x0001) != 0)
continue;
if (sshkey_equal(id->key, id2->key)) {
do { if (((id)->next.tqe_next) !=
((void *)0)
) (id)->next.tqe_next->next.tqe_prev = (id)->next.tqe_prev; else (&files)->tqh_last = (id)->next.tqe_prev; *(id)->next.tqe_prev = (id)->next.tqe_next; ; ; } while (0);
do { (id)->next.tqe_next =
((void *)0)
; (id)->next.tqe_prev = (preferred)->tqh_last; *(preferred)->tqh_last = (id); (preferred)->tqh_last = &(id)->next.tqe_next; } while (0);
found = 1;
break;
}
}
if (!found && options.identities_only) {
do { if (((id)->next.tqe_next) !=
((void *)0)
) (id)->next.tqe_next->next.tqe_prev = (id)->next.tqe_prev; else (&files)->tqh_last = (id)->next.tqe_prev; *(id)->next.tqe_prev = (id)->next.tqe_next; ; ; } while (0);
freezero(id, sizeof(*id));
}
}
do { if (!(((&files)->tqh_first) ==
((void *)0)
)) { *(preferred)->tqh_last = (&files)->tqh_first; (&files)->tqh_first->next.tqe_prev = (preferred)->tqh_last; (preferred)->tqh_last = (&files)->tqh_last; do { ((&files))->tqh_first =
((void *)0)
; ((&files))->tqh_last = &((&files))->tqh_first; } while (0); } } while (0);
for ((id) = ((preferred)->tqh_first); (id) !=
((void *)0)
&& ((id2) = ((id)->next.tqe_next), 1); (id) = (id2)) {
if (id->key !=
((void *)0)
&& !key_type_allowed_by_config(id->key)) {
sshlog("sshconnect2.c", __func__, 1830, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Skipping %s key %s - " "corresponding algo not in PubkeyAcceptedAlgorithms", sshkey_ssh_name(id->key), id->filename)
;
do { if (((id)->next.tqe_next) !=
((void *)0)
) (id)->next.tqe_next->next.tqe_prev = (id)->next.tqe_prev; else (preferred)->tqh_last = (id)->next.tqe_prev; *(id)->next.tqe_prev = (id)->next.tqe_next; ; ; } while (0);
sshkey_free(id->key);
free(id->filename);
memset(id, 0, sizeof(*id));
continue;
}
}
for ((id) = ((preferred)->tqh_first); (id) !=
((void *)0)
&& ((id2) = ((id)->next.tqe_next), 1); (id) = (id2)) {
ident = format_identity(id);
sshlog("sshconnect2.c", __func__, 1843, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Will attempt key: %s", ident);
free(ident);
}
sshlog("sshconnect2.c", __func__, 1846, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "done");
}
| void pubkey_prepare(unsigned long long a0, struct_0 *a1) {
unsigned long v0;
unsigned long v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
char v6;
void* v7;
void* v8;
void* v9;
struct_7 *v10;
void* v11;
void* v12;
struct_8 *v13;
void* v14;
unsigned long long *v15;
void* v16;
unsigned long long *v17;
char v18;
unsigned long long v20;
struct_1 *v21;
unsigned long long *v22;
unsigned long long v23;
v2 = -1;
v14 = 0;
v15 = &v14;
v16 = 0;
v17 = &v16;
v10 = &a1->padding_0[56];
v10->field_0 = 0;
v10->field_8 = &v10->field_0;
v3 = 0;
while (true) {
if (v3 >= g_500324)
break;
v13 = *((5244888 + 8 * v3));
if (v13 && v13->field_80 && v13->field_80->field_8 != 1) {
v1 = *((5243688 + 8 * v3));
sshlog("sshconnect2.c", "pubkey_prepare", 0x6bb, 0x1, 0x5, 0x0, "ignoring certificate %s: not a user certificate");
goto LABEL_404868;
}
if (v13 && sshkey_is_sk(v13) && !__errno_location) {
v1 = *((5243688 + 8 * v3));
sshlog("sshconnect2.c", "pubkey_prepare", 0x6c0, 0x1, 0x5, 0x0, "ignoring authenticator-hosted key %s as no SecurityKeyProvider has been specified");
goto LABEL_404868;
}
*((5244888 + 8 * v3)) = 0;
v7 = xcalloc(0x1, 0x38, (v3 + 250) * 8);
v7->field_10 = -1;
v7->field_18 = v13;
v7->field_20 = xstrdup(*((5243688 + 8 * v3)));
v7->field_30 = *((5244488 + 4 * v3));
v7->field_0 = 0;
v7->field_8 = v17;
*(v17) = v7;
v17 = v7;
LABEL_404868:
v3 = __addvsi3(v3, 0x1);
}
v3 = 0;
while (true) {
if (v3 >= *(5245688))
break;
v13 = (&options)[502 + v3];
if (!sshkey_is_cert(v13)) {
LABEL_4048f7:
v1 = *((5243688 + 8 * v3));
sshlog("sshconnect2.c", "pubkey_prepare", 0x6d2, 0x1, 0x5, 0x0, "ignoring certificate %s: not a user certificate");
goto LABEL_404a90;
} else {
if (!v13->field_80)
goto LABEL_4048f7;
if (!(v13->field_80->field_8 == 1))
goto LABEL_4048f7;
if (v13 && sshkey_is_sk(v13) && !__errno_location) {
v1 = *((5243688 + 8 * v3));
sshlog("sshconnect2.c", "pubkey_prepare", 0x6d7, 0x1, 0x5, 0x0, "ignoring authenticator-hosted key certificate %s as no SecurityKeyProvider has been specified");
goto LABEL_404a90;
}
v7 = xcalloc(0x1, 0x38, v20);
v7->field_10 = -1;
v7->field_18 = v13;
v7->field_20 = xstrdup((&options)[352 + v3]);
v7->field_30 = *((3616 + 4 * v3 + &options));
v7->field_0 = 0;
v7->field_8 = v10->field_8;
v10->field_8->field_0 = v7;
v10->field_8 = &v7->field_0;
LABEL_404a90:
v3 = __addvsi3(v3, 0x1);
}
}
v5 = get_agent_identities(a0, &v2, &v6);
if (!v5) {
for (v9 = 0; v9 < *(*(&v6)); v9 += 1) {
v5 = sshkey_check_rsa_length(*((*((*(&v6) + 8)) + v9 * 8)), *(5248792), *(5248792));
if (v5) {
v1 = sshkey_ssh_name(*((*((*(&v6) + 8)) + v9 * 8)));
sshlog("sshconnect2.c", "pubkey_prepare", 0x6e9, 0x1, 0x5, ssh_err(v5), "ignoring %s agent key");
} else {
v4 = 0;
v7 = v16;
while (true) {
if (!v7)
break;
if (!sshkey_equal(*((*((*(&v6) + 8)) + (v9 << 3))), v7[24], v7[24])) {
v7 = *(v7);
} else {
if (*(v7))
*((*(v7) + 8)) = v7->field_8;
else
v17 = v7[8];
*(v7[8]) = *(v7);
*(v7) = 0;
v7->field_8 = v10->field_8;
v10->field_8->field_0 = v7;
v10->field_8 = v7;
v7->field_10 = v2;
v4 = 1;
break;
}
}
if (!v4 && !*(5247800)) {
v7 = xcalloc(0x1, 0x38, v2);
v7->field_18 = *((*((*(&v6) + 8)) + v9 * 8));
v7->field_20 = *((*((*(&v6) + 16)) + v9 * 8));
*((*((*(&v6) + 8)) + v9 * 8)) = 0;
*((*((*(&v6) + 16)) + v9 * 8)) = 0;
v7->field_10 = v2;
v7->field_0 = 0;
v7->field_8 = v15;
*(v15) = v7;
v15 = v7;
}
}
}
ssh_free_identitylist(*(&v6));
if (v14) {
v10->field_8->field_0 = v14;
*(&v14[8]) = v10->field_8;
v10->field_8 = v15;
v14 = 0;
v15 = &v14;
}
a1->field_48 = v2;
}
v7 = v16;
while (true) {
if (!v7)
break;
v12 = *(v7);
if (v7[24] && (*((v7[24] + 4)) & 1)) {
v4 = 0;
v8 = v16;
while (true) {
if (!v8)
break;
if (v8[24] && !(*((v8[24] + 4)) & 1) && sshkey_equal(v7[24], v8[24], v8[24])) {
if (*(v7))
*((*(v7) + 8)) = v7->field_8;
else
v17 = v7[8];
*(v7[8]) = *(v7);
*(v7) = 0;
v7->field_8 = v10->field_8;
v10->field_8->field_0 = v7;
v10->field_8 = v7;
v4 = 1;
break;
}
v8 = *(v8);
}
if (!v4 && *(5247800)) {
if (*(v7))
*((*(v7) + 8)) = v7->field_8;
else
v17 = v7[8];
v21 = *(v7);
*(v7[8]) = *(v7);
freezero(v7, 0x38, v21);
}
}
v7 = v12;
}
if (v16) {
v10->field_8->field_0 = v16;
*(&v16[8]) = v10->field_8;
v10->field_8 = v17;
v16 = 0;
v17 = &v16;
}
for (v7 = v10->field_0; v7; v7 = &v8[0]) {
v8[0] = v7->field_0;
if (v7[24] && !key_type_allowed_by_config(v7->field_18)) {
v0 = sshkey_ssh_name(v7->field_18);
sshlog("sshconnect2.c", "pubkey_prepare", 0x726, 0x0, 0x5, 0x0, "Skipping %s key %s - corresponding algo not in PubkeyAcceptedAlgorithms");
if (*(v7))
*((*(v7) + 8)) = v7->field_8;
else
v10->field_8 = v7->field_8;
v7->field_8->field_0 = v7->field_0;
sshkey_free(v7->field_18);
free(v7->field_20);
memset(v7, 0x0, 0x38);
}
}
for (v7 = v10->field_0; v7; v7 = v8) {
v8 = *(v7);
v11 = format_identity(v7);
v1 = v11;
sshlog("sshconnect2.c", "pubkey_prepare", 0x733, 0x0, 0x5, 0x0, "Will attempt key: %s");
free(v11);
}
sshlog("sshconnect2.c", "pubkey_prepare", 0x736, 0x1, 0x6, 0x0, "done");
v23 = *(&v18) ^ v22[5];
return;
}
|
time_t
_long_to_time(long tlong)
{
if (sizeof(long) == sizeof(int32_t))
return(_time32_to_time(tlong));
return((time_t)tlong);
}
| long long _long_to_time(unsigned long a0) {
return a0;
}
|
static size_t
read_and_xlate (char *buf, size_t size)
{
size_t bytes_read = plain_read (buf, size);
for (size_t i = 0; i < bytes_read; i++)
buf[i] = xlate[to_uchar (buf[i])];
return bytes_read;
}
| ulong read_and_xlate(long param_1,undefined8 param_2)
{
byte bVar1;
ulong uVar2;
ulong local_18;
uVar2 = plain_read(param_1,param_2);
for (local_18 = 0; local_18 < uVar2; local_18 = local_18 + 1) {
bVar1 = to_uchar((int)*(char *)(local_18 + param_1));
*(undefined1 *)(local_18 + param_1) = xlate[(int)(uint)bVar1];
}
return uVar2;
}
|
static
_Bool
decode_record (struct xheader *xhdr,
char **ptr,
void (*handler) (void *, char const *, char const *, size_t),
void *data)
{
char *start = *ptr;
char *p = start;
size_t len;
char *len_lim;
char const *keyword;
char *nextp;
size_t len_max = xhdr->buffer + xhdr->size - start;
while (*p == ' ' || *p == '\t')
p++;
if (! ((unsigned) (*p) - '0' <= 9))
{
if (*p)
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed extended header: missing length")); exit_status = 2; } while (0);
return
0
;
}
len = strtoumax (p, &len_lim, 10);
if (len_max < len)
{
int len_len = len_lim - p;
do { if (error_hook) error_hook (); error (0, 0, gettext ("Extended header length %*s is out of range"), len_len, p); exit_status = 2; } while (0)
;
return
0
;
}
nextp = start + len;
for (p = len_lim; *p == ' ' || *p == '\t'; p++)
continue;
if (p == len_lim)
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed extended header: missing blank after length")); exit_status = 2; } while (0)
;
return
0
;
}
keyword = p;
p = strchr (p, '=');
if (! (p && p < nextp))
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed extended header: missing equal sign")); exit_status = 2; } while (0);
return
0
;
}
if (nextp[-1] != '\n')
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed extended header: missing newline")); exit_status = 2; } while (0);
return
0
;
}
*p = nextp[-1] = '\0';
handler (data, keyword, p + 1, nextp - p - 2);
*p = '=';
nextp[-1] = '\n';
*ptr = nextp;
return
1
;
}
| undefined8 decode_record(long param_1,char **param_2,code *param_3,undefined8 param_4)
{
int iVar1;
undefined8 uVar2;
long in_FS_OFFSET;
char *local_48;
char *local_40;
char *local_38;
ulong local_30;
uintmax_t local_28;
char *local_20;
char *local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_38 = *param_2;
local_30 = (*(long *)(param_1 + 8) + *(long *)(param_1 + 0x10)) - (long)local_38;
for (local_40 = local_38; (*local_40 == ' ' || (*local_40 == '\t')); local_40 = local_40 + 1) {
}
if ((int)*local_40 - 0x30U < 10) {
local_28 = strtoumax(local_40,&local_48,10);
if (local_30 < local_28) {
iVar1 = (int)local_40;
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar2 = gettext("Extended header length %*s is out of range");
error(0,0,uVar2,(int)local_48 - iVar1,local_40);
_exit_status = 2;
uVar2 = 0;
}
else {
local_20 = local_38 + local_28;
for (local_40 = local_48; (*local_40 == ' ' || (*local_40 == '\t')); local_40 = local_40 + 1)
{
}
if (local_40 == local_48) {
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar2 = gettext("Malformed extended header: missing blank after length");
error(0,0,uVar2);
_exit_status = 2;
uVar2 = 0;
}
else {
local_18 = local_40;
local_40 = strchr(local_40,0x3d);
if ((local_40 == (char *)0x0) || (local_20 <= local_40)) {
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar2 = gettext("Malformed extended header: missing equal sign");
error(0,0,uVar2);
_exit_status = 2;
uVar2 = 0;
}
else if (local_20[-1] == '\n') {
local_20[-1] = '\0';
*local_40 = local_20[-1];
(*param_3)(param_4,local_18,local_40 + 1,local_20 + (-2 - (long)local_40));
*local_40 = '=';
local_20[-1] = '\n';
*param_2 = local_20;
uVar2 = 1;
}
else {
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar2 = gettext("Malformed extended header: missing newline");
error(0,0,uVar2);
_exit_status = 2;
uVar2 = 0;
}
}
}
}
else {
if (*local_40 != '\0') {
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar2 = gettext("Malformed extended header: missing length");
error(0,0,uVar2);
_exit_status = 2;
}
uVar2 = 0;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
}
|
union block *
find_next_block (void)
{
if (current_block == record_end)
{
if (hit_eof)
return 0;
flush_archive ();
if (current_block == record_end)
{
hit_eof =
1
;
return 0;
}
}
return current_block;
}
| int find_next_block() {
unsigned int v1;
if (false) {
v1 = 820806472;
return v1;
} else if (!hit_eof) {
flush_archive();
if (false) {
v1 = 820806472;
return v1;
}
hit_eof = 1;
v1 = 0;
return v1;
} else {
v1 = 0;
return v1;
}
}
|
int
zwrite (fd, buf, nb)
int fd;
char *buf;
size_t nb;
{
int n, i, nt;
for (n = nb, nt = 0;;)
{
i = write (fd, buf, n);
if (i > 0)
{
n -= i;
if (n <= 0)
return nb;
buf += i;
}
else if (i == 0)
{
if (++nt > 3)
return (nb - n);
}
else if (
(*__errno_location ())
!=
4
)
return -1;
}
}
| ulong zwrite(int param_1,void *param_2,ulong param_3)
{
int iVar1;
ssize_t sVar2;
int *piVar3;
void *local_28;
int local_14;
int local_10;
local_10 = 0;
local_28 = param_2;
local_14 = (int)param_3;
while( true ) {
while( true ) {
sVar2 = write(param_1,local_28,(long)local_14);
iVar1 = (int)sVar2;
if (0 < iVar1) break;
if (iVar1 == 0) {
local_10 = local_10 + 1;
if (3 < local_10) {
return (ulong)(uint)((int)param_3 - local_14);
}
}
else {
piVar3 = __errno_location();
if (*piVar3 != 4) {
return 0xffffffff;
}
}
}
local_14 = local_14 - iVar1;
if (local_14 < 1) break;
local_28 = (void *)((long)local_28 + (long)iVar1);
}
return param_3;
}
|
void
redirection_error (temp, error, fn)
REDIRECT *temp;
int error;
char *fn;
{
char *filename, *allocname;
int oflags;
allocname = 0;
if ((temp->rflags & 0x01) && error < 0)
filename = allocname = (char *)strcpy (sh_xmalloc((1 + strlen (temp->redirector.filename->word)), "redir.c", 146), (temp->redirector.filename->word));
else if ((temp->rflags & 0x01) == 0 && temp->redirector.dest < 0)
filename = gettext("file descriptor out of range");
else if (error != -2 && temp->redirector.dest >= 0 && error ==
9
)
{
switch (temp->instruction)
{
case r_duplicating_input:
case r_duplicating_output:
case r_move_input:
case r_move_output:
filename = allocname = itos (temp->redirectee.dest);
break;
case r_duplicating_input_word:
if (temp->redirector.dest == 0)
filename = temp->redirectee.filename->word;
else
filename = allocname = itos (temp->redirector.dest);
break;
case r_duplicating_output_word:
if (temp->redirector.dest == 1)
filename = temp->redirectee.filename->word;
else
filename = allocname = itos (temp->redirector.dest);
break;
default:
filename = allocname = itos (temp->redirector.dest);
break;
}
}
else if (fn)
filename = fn;
else if (expandable_redirection_filename (temp))
{
oflags = temp->redirectee.filename->flags;
if (posixly_correct && interactive_shell == 0)
temp->redirectee.filename->flags |= (1 << 5);
temp->redirectee.filename->flags |= (1 << 10);
filename = allocname = redirection_expand (temp->redirectee.filename);
temp->redirectee.filename->flags = oflags;
if (filename == 0)
filename = temp->redirectee.filename->word;
}
else if (temp->redirectee.dest < 0)
filename = gettext("file descriptor out of range");
else
filename = allocname = itos (temp->redirectee.dest);
switch (error)
{
case -1:
internal_error (gettext("%s: ambiguous redirect"), filename);
break;
case -2:
internal_error (gettext("%s: cannot overwrite existing file"), filename);
break;
case -3:
internal_error (gettext("%s: restricted: cannot redirect output"), filename);
break;
case -4:
internal_error (gettext("cannot create temp file for here-document: %s"), strerror (heredoc_errno));
break;
case -5:
internal_error (gettext("%s: cannot assign fd to variable"), filename);
break;
default:
internal_error ("%s: %s", filename, strerror (error));
break;
}
do { if (allocname) sh_xfree((allocname), "redir.c", 231); } while (0);
}
| void redirection_error(long param_1,int param_2,char *param_3)
{
uint uVar1;
undefined4 uVar2;
int iVar3;
size_t sVar4;
char *__dest;
undefined8 uVar5;
char *pcVar6;
char *local_28;
char *local_20;
local_20 = (char *)0x0;
if (((*(uint *)(param_1 + 0x10) & 1) != 0) && (param_2 < 0)) {
pcVar6 = **(char ***)(param_1 + 8);
sVar4 = strlen(**(char ***)(param_1 + 8));
__dest = (char *)sh_xmalloc(sVar4 + 1,"redir.c",0x92);
local_20 = strcpy(__dest,pcVar6);
local_28 = local_20;
goto LAB_001002c7;
}
if (((*(uint *)(param_1 + 0x10) & 1) == 0) && (*(int *)(param_1 + 8) < 0)) {
local_28 = (char *)gettext();
goto LAB_001002c7;
}
if (((param_2 == -2) || (*(int *)(param_1 + 8) < 0)) || (param_2 != 9)) {
local_28 = param_3;
if (param_3 == (char *)0x0) {
iVar3 = expandable_redirection_filename(param_1);
if (iVar3 == 0) {
if (*(int *)(param_1 + 0x20) < 0) {
local_28 = (char *)gettext();
}
else {
local_28 = (char *)itos();
local_20 = local_28;
}
}
else {
uVar2 = *(undefined4 *)(*(long *)(param_1 + 0x20) + 8);
if ((posixly_correct != 0) && (interactive_shell == 0)) {
*(uint *)(*(long *)(param_1 + 0x20) + 8) = *(uint *)(*(long *)(param_1 + 0x20) + 8) | 0x20
;
}
*(uint *)(*(long *)(param_1 + 0x20) + 8) = *(uint *)(*(long *)(param_1 + 0x20) + 8) | 0x400;
local_20 = (char *)redirection_expand();
*(undefined4 *)(*(long *)(param_1 + 0x20) + 8) = uVar2;
local_28 = local_20;
if (local_20 == (char *)0x0) {
local_28 = **(char ***)(param_1 + 0x20);
}
}
}
goto LAB_001002c7;
}
uVar1 = *(uint *)(param_1 + 0x18);
if (uVar1 < 0x11) {
if (0xe < uVar1) {
LAB_00100113:
local_28 = (char *)itos();
local_20 = local_28;
goto LAB_001002c7;
}
if (uVar1 == 0xe) {
if (*(int *)(param_1 + 8) == 1) {
local_28 = **(char ***)(param_1 + 0x20);
}
else {
local_28 = (char *)itos();
local_20 = local_28;
}
goto LAB_001002c7;
}
if (uVar1 < 0xf) {
if (uVar1 < 8) {
if (5 < uVar1) goto LAB_00100113;
}
else if (uVar1 == 0xd) {
if (*(int *)(param_1 + 8) == 0) {
local_28 = **(char ***)(param_1 + 0x20);
}
else {
local_28 = (char *)itos();
local_20 = local_28;
}
goto LAB_001002c7;
}
}
}
local_28 = (char *)itos();
local_20 = local_28;
LAB_001002c7:
switch(param_2) {
default:
pcVar6 = strerror(param_2);
internal_error("%s: %s",local_28,pcVar6);
break;
case -5:
uVar5 = gettext("%s: cannot assign fd to variable");
internal_error(uVar5,local_28);
break;
case -4:
pcVar6 = strerror(heredoc_errno);
uVar5 = gettext("cannot create temp file for here-document: %s");
internal_error(uVar5,pcVar6);
break;
case -3:
uVar5 = gettext("%s: restricted: cannot redirect output");
internal_error(uVar5,local_28);
break;
case -2:
uVar5 = gettext("%s: cannot overwrite existing file");
internal_error(uVar5,local_28);
break;
case -1:
uVar5 = gettext("%s: ambiguous redirect");
internal_error(uVar5,local_28);
}
if (local_20 != (char *)0x0) {
sh_xfree(local_20,"redir.c",0xe7);
}
return;
}
|
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]...\n"), program_name);
fputs_unlocked (gettext ("Print the file name of the terminal connected to standard input.\n\n -s, --silent, --quiet print nothing, only return an exit status\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 ("tty");
}
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]...\n"));
fputs_unlocked(gettext("Print the file name of the terminal connected to standard input.\n\n -s, --silent, --quiet print nothing, only return an exit status\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("tty");
}
exit(a0);
}
|
static int
execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
COMMAND *command;
int asynchronous, pipe_in, pipe_out;
struct fd_bitmap *fds_to_close;
{
int prev, fildes[2], new_bitmap_size, dummyfd, ignore_return, exec_result;
int lstdin, lastpipe_flag, lastpipe_jid, old_frozen, stdin_valid;
COMMAND *cmd;
struct fd_bitmap *fd_bitmap;
pid_t lastpid;
sigset_t set, oset;
do { sigemptyset (&set); sigaddset (&set,
17
); sigemptyset (&oset); sigprocmask (
0
, &set, &oset); } while (0);
ignore_return = (command->flags & 0x08) != 0;
stdin_valid = sh_validfd (0);
prev = pipe_in;
cmd = command;
while (cmd && cmd->type == cm_connection &&
cmd->value.Connection && cmd->value.Connection->connector == '|')
{
if (pipe (fildes) < 0)
{
sys_error (gettext("pipe error"));
terminate_current_pipeline ();
kill_current_pipeline ();
sigprocmask (
2
, &oset, (sigset_t *)
((void *)0)
);
last_command_exit_value = 1;
throw_to_top_level ();
return (1);
}
new_bitmap_size = (fildes[0] < fds_to_close->size)
? fds_to_close->size
: fildes[0] + 8;
fd_bitmap = new_fd_bitmap (new_bitmap_size);
xbcopy ((char *)fds_to_close->bitmap, (char *)fd_bitmap->bitmap, fds_to_close->size);
fd_bitmap->bitmap[fildes[0]] = 1;
begin_unwind_frame ("pipe-file-descriptors");
add_unwind_protect (dispose_fd_bitmap, fd_bitmap);
add_unwind_protect (close_fd_bitmap, fd_bitmap);
if (prev >= 0)
add_unwind_protect (close, prev);
dummyfd = fildes[1];
add_unwind_protect (close, dummyfd);
add_unwind_protect (restore_signal_mask, &oset);
if (ignore_return && cmd->value.Connection->first)
cmd->value.Connection->first->flags |= 0x08;
execute_command_internal (cmd->value.Connection->first, asynchronous,
prev, fildes[1], fd_bitmap);
if (prev >= 0)
close (prev);
prev = fildes[0];
close (fildes[1]);
dispose_fd_bitmap (fd_bitmap);
discard_unwind_frame ("pipe-file-descriptors");
cmd = cmd->value.Connection->second;
}
lastpid = last_made_pid;
if (ignore_return && cmd)
cmd->flags |= 0x08;
lastpipe_flag = 0;
begin_unwind_frame ("lastpipe-exec");
lstdin = -2;
if (lastpipe_opt && job_control == 0 && asynchronous == 0 && pipe_out == -1 && prev >= 0)
{
lstdin = (prev > 0 && stdin_valid) ? move_to_high_fd (0, 1, -1) : -1;
if (lstdin > 0 || lstdin == -1)
{
do_piping (prev, pipe_out);
prev = -1;
add_unwind_protect (restore_stdin, lstdin);
lastpipe_flag = 1;
old_frozen = freeze_jobs_list ();
lastpipe_jid = stop_pipeline (0, (COMMAND *)
((void *)0)
);
add_unwind_protect (lastpipe_cleanup, old_frozen);
sigprocmask (
2
, &oset, (sigset_t *)
((void *)0)
);
}
if (cmd)
cmd->flags |= 0x2000;
}
if (prev >= 0)
add_unwind_protect (close, prev);
exec_result = execute_command_internal (cmd, asynchronous, prev, pipe_out, fds_to_close);
if (prev >= 0)
close (prev);
if (lstdin > 0 || lstdin == -1)
restore_stdin (lstdin);
sigprocmask (
2
, &oset, (sigset_t *)
((void *)0)
);
do { if (terminating_signal) termsig_handler (terminating_signal); if (interrupt_state) throw_to_top_level (); } while (0);
if (lastpipe_flag)
{
if (((lastpipe_jid) < 0 || (lastpipe_jid) >= js.j_jobslots || (jobs[(lastpipe_jid)]) == 0) == 0)
{
append_process ((char *)strcpy (sh_xmalloc((1 + strlen (the_printed_command_except_trap)), "execute_cmd.c", 2654), (the_printed_command_except_trap)), dollar_dollar_pid, exec_result, lastpipe_jid);
lstdin = wait_for (lastpid, 0);
}
else
{
lstdin = wait_for_single_pid (lastpid, 0);
if (lstdin > 256)
lstdin = 127;
}
if (((lastpipe_jid) < 0 || (lastpipe_jid) >= js.j_jobslots || (jobs[(lastpipe_jid)]) == 0) == 0)
exec_result = job_exit_status (lastpipe_jid);
else if (pipefail_opt)
exec_result = exec_result | lstdin;
set_jobs_list_frozen (old_frozen);
}
discard_unwind_frame ("lastpipe-exec");
return (exec_result);
}
| long long execute_pipeline(struct_1 *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, struct_0 *a4, unsigned long long a5) {
unsigned int v0;
int tmp_17;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
struct_2 *v11;
struct_4 *v12;
char v13;
char v14;
char v15;
char v16;
unsigned int v18;
unsigned long long v19;
sigemptyset(&v15);
sigaddset(&v15, 0x11);
sigemptyset(&v16);
sigprocmask(0x0, &v15, &v16);
v6 = (a0->field_4 & 8);
v7 = sh_validfd(0x0);
v0 = a2;
v11 = &a0->field_0;
while (true) {
if (!v11) {
LABEL_4040c1:
v10 = last_made_pid;
if (v6 && v11)
v11->field_4 = v11->field_4 | 8;
v3 = 0;
begin_unwind_frame("lastpipe-exec");
v2 = -2;
if (!lastpipe_opt) {
LABEL_40425c:
if (v0 >= 0)
add_unwind_protect(got.close, v0);
v1 = execute_command_internal(v11, a1, v0, a3, a4, a5);
if (v0 >= 0)
close(v0);
if (v2 <= 0 && !(v2 == -1))
goto LABEL_4042ec;
restore_stdin(v2);
LABEL_4042ec:
sigprocmask(0x2, &v16, NULL);
if (terminating_signal)
termsig_handler(terminating_signal);
if (interrupt_state)
throw_to_top_level();
if (!v3) {
LABEL_40449d:
discard_unwind_frame("lastpipe-exec");
v19 = v1;
break;
}
if (v4 >= 0 && v4 < g_50042c && *((jobs + (v4 << 3)))) {
v18 = 0;
LABEL_40437a:
if (!v18) {
append_process(strcpy(sh_xmalloc(strlen(0xbaec7d8920ec8348) + 1, "execute_cmd.c", 0xa5e), 0xbaec7d8920ec8348), dollar_dollar_pid, v1, v4);
v2 = wait_for(v10, 0x0);
} else {
v2 = wait_for_single_pid(v10, 0x0);
if (v2 > 0x100)
v2 = 127;
}
if (v4 >= 0 && v4 < g_50042c && *((jobs + (v4 << 3)))) {
v18 = 0;
LABEL_404461:
if (!v18) {
v1 = job_exit_status(v4);
} else if (pipefail_opt) {
v1 |= v2;
}
set_jobs_list_frozen(v5);
goto LABEL_40449d;
}
v18 = 1;
goto LABEL_404461;
}
v18 = 1;
goto LABEL_40437a;
}
if (!(!job_control))
goto LABEL_40425c;
if (!(!a1))
goto LABEL_40425c;
if (!(a3 == -1))
goto LABEL_40425c;
if (v0 < 0)
goto LABEL_40425c;
if (v0 > 0 && v7) {
v18 = move_to_high_fd(0x0, 0x1, 0xffffffff);
goto LABEL_404189;
}
v18 = -1;
LABEL_404189:
v2 = v18;
if (v2 <= 0 && !(v2 == -1))
goto LABEL_404239;
do_piping(v0, a3);
v0 = -1;
add_unwind_protect(restore_stdin, v2);
v3 = 1;
v5 = freeze_jobs_list(restore_stdin, a1, a2, a3, v12, a5);
v4 = stop_pipeline(0x0, 0x0);
add_unwind_protect(lastpipe_cleanup, v5);
sigprocmask(0x2, &v16, NULL);
LABEL_404239:
if (v11) {
v18 = v11->field_4;
*(&v18) = (v11->field_4 >> 8) | 32;
tmp_17 = v18;
v11->field_4 = tmp_17;
goto LABEL_40425c;
}
} else {
if (!(v11->field_0 == 6))
goto LABEL_4040c1;
if (!v11->field_18)
goto LABEL_4040c1;
if (!(v11->field_18->field_18 == 124))
goto LABEL_4040c1;
if (pipe(&v13) >= 0) {
if (*(&v13) >= a4->field_0)
v18 = *(&v13) + 8;
else
v18 = a4->field_0;
v8 = v18;
v12 = new_fd_bitmap(v8);
xbcopy(a4->field_8, v12->field_8, a4->field_0);
*((*(&v13) + v12->field_8)) = 1;
begin_unwind_frame("pipe-file-descriptors");
add_unwind_protect(dispose_fd_bitmap, v12);
add_unwind_protect(close_fd_bitmap, v12);
if (v0 >= 0)
add_unwind_protect(got.close, v0);
v9 = *(&v14);
add_unwind_protect(got.close, v9);
add_unwind_protect(restore_signal_mask, &v16);
if (v6 && v11->field_18->field_8)
*((v11->field_18->field_8 + 4)) = *((v11->field_18->field_8 + 4)) | 8;
execute_command_internal(v11->field_18->field_8, a1, v0, *(&v14), v12, a5);
if (v0 >= 0)
close(v0);
v0 = *(&v13);
close(*(&v14));
dispose_fd_bitmap(v12);
discard_unwind_frame("pipe-file-descriptors");
v11 = v11->field_18->field_10;
} else {
sys_error(gettext("pipe error"));
terminate_current_pipeline(a0, a1, a2, a3, v12, a5);
kill_current_pipeline(a0, a1, a2, a3, a4, a5);
sigprocmask(0x2, &v16, NULL);
line_number_for_err_trap = 1;
throw_to_top_level();
v19 = 1;
break;
}
}
}
return v19;
}
|
int
history_expand(char *str, char **output)
{
int ret = 0;
size_t idx, i, size;
char *tmp, *result;
if (h ==
((void *)0)
|| e ==
((void *)0)
)
rl_initialize();
if (history_expansion_char == 0) {
*output = strdup(str);
return 0;
}
*output =
((void *)0)
;
if (str[0] == history_subst_char) {
*output = calloc(strlen(str) + 4 + 1, sizeof(**output));
if (*output ==
((void *)0)
)
return 0;
(*output)[0] = (*output)[1] = history_expansion_char;
(*output)[2] = ':';
(*output)[3] = 's';
(void)strcpy((*output) + 4, str);
str = *output;
} else {
*output = strdup(str);
if (*output ==
((void *)0)
)
return 0;
}
result =
((void *)0)
;
size = idx = 0;
tmp =
((void *)0)
;
for (i = 0; str[i];) {
int qchar, loop_again;
size_t len, start, j;
qchar = 0;
loop_again = 1;
start = j = i;
loop:
for (; str[j]; j++) {
if (str[j] == '\\' &&
str[j + 1] == history_expansion_char) {
len = strlen(&str[j + 1]) + 1;
memmove(&str[j], &str[j + 1], len);
continue;
}
if (!loop_again) {
if (
((*__ctype_b_loc ())[(int) ((
(unsigned char) str[j]
))] & (unsigned short int) _ISspace)
|| str[j] == qchar)
break;
}
if (str[j] == history_expansion_char
&& !strchr(history_no_expand_chars, str[j + 1])
&& (!history_inhibit_expansion_function ||
(*history_inhibit_expansion_function)(str,
(int)j) == 0))
break;
}
if (str[j] && loop_again) {
i = j;
qchar = (j > 0 && str[j - 1] == '"' )? '"':0;
j++;
if (str[j] == history_expansion_char)
j++;
loop_again = 0;
goto loop;
}
len = i - start;
{ if (idx + len + 1 > size) { char *nresult = realloc(result, (size += len + 1) * sizeof(*nresult)); if (nresult ==
((void *)0)
) { free(*output); free(
((void *)0)
); return 0; } result = nresult; } (void)strlcpy(&result[idx], &str[start], len + 1); idx += len; };
if (str[i] == '\0' || str[i] != history_expansion_char) {
len = j - i;
{ if (idx + len + 1 > size) { char *nresult = realloc(result, (size += len + 1) * sizeof(*nresult)); if (nresult ==
((void *)0)
) { free(*output); free(
((void *)0)
); return 0; } result = nresult; } (void)strlcpy(&result[idx], &str[i], len + 1); idx += len; };
if (start == 0)
ret = 0;
else
ret = 1;
break;
}
ret = _history_expand_command (str, i, (j - i), &tmp);
if (ret > 0 && tmp) {
len = strlen(tmp);
{ if (idx + len + 1 > size) { char *nresult = realloc(result, (size += len + 1) * sizeof(*nresult)); if (nresult ==
((void *)0)
) { free(*output); free(tmp); return 0; } result = nresult; } (void)strlcpy(&result[idx], tmp, len + 1); idx += len; };
}
if (tmp) {
free(tmp);
tmp =
((void *)0)
;
}
i = j;
}
if (ret == 2) {
add_history(result);
}
free(*output);
*output = result;
return ret;
}
| long long history_expand(unsigned long a0, void* *a1) {
unsigned long long *v0;
int tmp_2;
void* v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
void* v5;
unsigned long v6;
void* v7;
unsigned int v8;
void* v9;
void* v10;
void* v11;
unsigned long v12;
void* v13;
void* v14;
void* v15;
void* v17;
unsigned int v20;
unsigned int v21;
v1 = a0;
v0 = a1;
v2 = 0;
if (h && !(!e))
goto LABEL_402060;
rl_initialize();
LABEL_402060:
if (!*(got.history_expansion_char)) {
*(a1) = strdup(v1);
v17 = 0;
} else {
*(a1) = 0;
if (*(v1) == *(got.history_subst_char)) {
*(a1) = calloc(strlen(v1) + 5, 0x1);
if (!*(a1)) {
v17 = 0;
goto LABEL_4026b2;
} else {
tmp_2 = *(a1) + 1;
*(&(*(a1))[1]) = *(got.history_expansion_char);
*(*(a1)) = *(tmp_2);
*(&(*(a1))[2]) = 58;
*(&(*(a1))[3]) = 115;
strcpy(*(a1) + 4, v1);
v1 = *(a1);
}
} else {
*(a1) = strdup(v1);
if (!*(a1)) {
v17 = 0;
goto LABEL_4026b2;
}
}
v9 = 0;
v6 = 0;
v8 = v6;
v5 = 0;
v7 = 0;
while (true) {
if (!*((v7 + v1))) {
LABEL_402683:
if (v2 == 2)
add_history(v9);
free(*(a1));
*(a1) = v9;
v17 = v2;
break;
}
v3 = 0;
v4 = 1;
v10 = v7;
v11 = v10;
while (true) {
while (true) {
if (!*((v10 + v1)))
break;
if (*((v10 + v1)) == 92 && *((v1 + v10 + 1)) == *(got.history_expansion_char)) {
*(&v12) = strlen(v1 + v10 + 1) + 1;
memmove(v1 + v10, v10 + 1 + v1, *(&v12));
goto LABEL_40231c;
}
if (!v4) {
v20 = *((*(__ctype_b_loc()) + *((v10 + v1)) * 2)) & 0x2000;
if (v20)
break;
if (v3 == *((v10 + v1)))
break;
}
if (*((v10 + v1)) == *(got.history_expansion_char) && !strchr(*(got.history_no_expand_chars), *((v1 + v10 + 1)))) {
if (!*(got.history_inhibit_expansion_function))
break;
if (!*(got.history_inhibit_expansion_function)(v1, v10, *(got.history_inhibit_expansion_function), v10))
break;
}
LABEL_40231c:
v10 += 1;
}
if (!*((v10 + v1)))
break;
if (!v4)
break;
v7 = v10;
if (v10 && *((v1 + v10 - 1)) == 34) {
v21 = 34;
goto LABEL_402380;
}
v21 = 0;
LABEL_402380:
v3 = v21;
v10 += 1;
if (*((v10 + v1)) == *(got.history_expansion_char))
v10 += 1;
v4 = 0;
}
v12 = v7 - v11;
if (v8 < v12 + v6 + 1) {
v8 = v8 + v12 + 1;
v13 = realloc(v9, v8);
if (v13) {
v9 = v13;
} else {
free(*(a1));
free(NULL);
v17 = 0;
break;
}
}
strlcpy(v6 + v9, v1 + v11, v12 + 1, v1 + v11);
v6 += v12;
if (!*((v7 + v1))) {
LABEL_402495:
v12 = v10 - v7;
if (v8 < v12 + v6 + 1) {
v8 = v8 + v12 + 1;
v15 = realloc(v9, *(&v8));
if (v15) {
v9 = v15;
} else {
free(*(a1));
free(NULL);
v17 = 0;
break;
}
}
strlcpy(v6 + v9, v1 + v7, v12 + 1, v1 + v7);
v6 += v12;
if (!v11) {
v2 = 0;
goto LABEL_402683;
} else {
v2 = 1;
goto LABEL_402683;
}
} else {
if (!(*((v7 + v1)) == *(got.history_expansion_char)))
goto LABEL_402495;
v2 = _history_expand_command(v1, v7, v10 - v7, &v5);
if (v2 > 0 && v5) {
v12 = strlen(v5);
if (v8 < v12 + v6 + 1) {
v8 = v8 + v12 + 1;
v14 = realloc(v9, *(&v8));
if (v14) {
v9 = v14;
} else {
free(*(a1));
free(v5);
v17 = 0;
break;
}
}
strlcpy(v6 + v9, v5, v12 + 1, v6 + v9);
v6 += v12;
}
if (v5) {
free(v5);
v5 = 0;
}
v7 = v10;
}
}
}
LABEL_4026b2:
return v17;
}
|
static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
{
struct hlist_node *first = h->first;
n->next = first;
if (first)
first->pprev = &n->next;
h->first = n;
n->pprev = &h->first;
}
| long * hlist_add_head(long *a1, long *a2)
{
long *result;
long v3;
v3 = *a2;
*a1 = *a2;
if ( v3 )
*(_QWORD *)(v3 + 8) = a1;
*a2 = (long)a1;
result = a1;
a1[1] = (long)a2;
return result;
}
|
void
sink_sftp(int argc, char *dst, const char *src, struct sftp_conn *conn)
{
char *abs_src =
((void *)0)
;
char *abs_dst =
((void *)0)
;
_ssh_compat_glob_t g;
char *filename, *tmp =
((void *)0)
;
int i, r, err = 0, dst_is_dir;
struct stat st;
memset(&g, 0, sizeof(g));
if ((abs_src = prepare_remote_path(conn, src)) ==
((void *)0)
) {
err = -1;
goto out;
}
sshlog("scp.c", __func__, 1507, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "copying remote %s to local %s", abs_src, dst);
if ((r = remote_glob(conn, abs_src, 0x0008,
((void *)0)
, &g)) != 0) {
if (r == (-1))
sshlog("scp.c", __func__, 1510, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "%s: too many glob matches", src);
else
sshlog("scp.c", __func__, 1512, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "%s: %s", src, strerror(
2
));
err = -1;
goto out;
}
if ((r = stat(dst, &st)) != 0)
sshlog("scp.c", __func__, 1518, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "stat local \"%s\": %s", dst, strerror(
(*__errno_location ())
));
dst_is_dir = r == 0 &&
((((
st.st_mode
)) & 0170000) == (0040000))
;
if (g.gl_matchc > 1 && !dst_is_dir) {
if (r == 0) {
sshlog("scp.c", __func__, 1523, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Multiple files match pattern, but destination " "\"%s\" is not a directory", dst)
;
err = -1;
goto out;
}
sshlog("scp.c", __func__, 1528, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "creating destination \"%s\"", dst);
if (mkdir(dst, 0777) != 0) {
sshlog("scp.c", __func__, 1530, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "local mkdir \"%s\": %s", dst, strerror(
(*__errno_location ())
));
err = -1;
goto out;
}
dst_is_dir = 1;
}
for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
tmp = xstrdup(g.gl_pathv[i]);
if ((filename =
__xpg_basename
(tmp)) ==
((void *)0)
) {
sshlog("scp.c", __func__, 1540, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "basename %s: %s", tmp, strerror(
(*__errno_location ())
));
err = -1;
goto out;
}
if (dst_is_dir)
abs_dst = path_append(dst, filename);
else
abs_dst = xstrdup(dst);
sshlog("scp.c", __func__, 1550, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Fetching %s to %s\n", g.gl_pathv[i], abs_dst);
if (globpath_is_dir(g.gl_pathv[i]) && iamrecursive) {
if (download_dir(conn, g.gl_pathv[i], abs_dst,
((void *)0)
,
pflag, 2, 0, 0, 1, 1) == -1)
err = -1;
} else {
if (do_download(conn, g.gl_pathv[i], abs_dst,
((void *)0)
,
pflag, 0, 0, 1) == -1)
err = -1;
}
free(abs_dst);
abs_dst =
((void *)0)
;
free(tmp);
tmp =
((void *)0)
;
}
out:
free(abs_src);
free(tmp);
_ssh__compat_globfree(&g);
if (err == -1)
errs = 1;
}
| void sink_sftp(unsigned long a0, char *a1, unsigned long long a2, unsigned long long a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
void* v5;
void* v6;
void* v7;
unsigned long long v8;
char v9;
char v10;
char v11;
char v12;
char v13;
char v14;
unsigned int v16;
unsigned long long v17;
unsigned long long *v21;
unsigned long long v22;
v0 = a0;
v7 = 0;
v5 = 0;
v6 = 0;
v2 = 0;
memset(&v9, 0x0, 0x60);
v7 = prepare_remote_path(a3, a2);
if (!v7) {
v2 = -1;
} else {
sshlog("scp.c", "sink_sftp", 0x5e3, 0x1, 0x7, 0x0, "copying remote %s to local %s", v7, a1);
v4 = remote_glob(a3, v7, 0x8, 0x0, &v9);
if (v4) {
if (v4 == -1)
sshlog("scp.c", "sink_sftp", 0x5e6, 0x0, 0x2, 0x0, "%s: too many glob matches", a2, a3);
else
sshlog("scp.c", "sink_sftp", 0x5e8, 0x0, 0x2, 0x0, "%s: %s", a2, strerror(0x2));
v2 = -1;
} else {
v4 = stat(a1, &v12);
if (v4)
sshlog("scp.c", "sink_sftp", 0x5ee, 0x1, 0x6, 0x0, "stat local \"%s\": %s", a1, strerror(*(__errno_location())));
if (!v4 && (*(&v13) & 0xf000) == 0x4000)
v16 = 1;
if (v4 || (*(&v13) & 0xf000) != 0x4000)
v16 = 0;
v3 = v16;
if (*(&v10) > 1 && !v3) {
if (!v4) {
sshlog("scp.c", "sink_sftp", 0x5f3, 0x0, 0x2, 0x0, "Multiple files match pattern, but destination \"%s\" is not a directory", a1, a3);
v2 = -1;
} else {
sshlog("scp.c", "sink_sftp", 0x5f8, 0x1, 0x6, 0x0, "creating destination \"%s\"", a1, a3);
v17 = mkdir(a1, 0x1ff);
if (v17) {
sshlog("scp.c", "sink_sftp", 0x5fa, 0x0, 0x2, 0x0, "local mkdir \"%s\": %s", a1, strerror(*(__errno_location())));
v2 = -1;
} else {
v3 = 1;
}
}
}
if (*(&v10) <= 1 || v3 || !v17 && v4) {
v1 = 0;
while (true) {
if (*((*(&v11) + (v1 << 3))) && !interrupted) {
v6 = xstrdup(*((*(&v11) + v1 * 8)));
v8 = __xpg_basename(v6);
if (!v8) {
sshlog("scp.c", "sink_sftp", 0x604, 0x0, 0x2, 0x0, "basename %s: %s", v6, strerror(*(__errno_location())));
v2 = -1;
break;
} else {
if (v3)
v5 = path_append(a1, v8, v8);
else
v5 = xstrdup(a1);
sshlog("scp.c", "sink_sftp", 0x60e, 0x0, 0x5, 0x0, "Fetching %s to %s\n", *((*(&v11) + v1 * 8)), v5);
if (globpath_is_dir(*((*(&v11) + v1 * 8)))) {
if (download_dir(a3, *((*(&v11) + v1 * 8)), v5, 0x0, 0x10ec8348e5894855, 0x2, 0x0, 0x0, 0x1) == -1)
v2 = -1;
} else {
if (do_download(a3, *((*(&v11) + v1 * 8)), v5, 0x0, 0x10ec8348e5894855, 0x0, 0x0) == -1)
v2 = -1;
}
free(v5);
v5 = 0;
free(v6);
v6 = 0;
v1 = __addvsi3(v1, 0x1);
continue;
}
}
if (!*((*(&v11) + (v1 << 3))) || interrupted)
break;
}
}
}
}
free(v7);
free(v6);
_ssh__compat_globfree(&v9);
if (v2 == -1)
targetshouldbedirectory = 1;
v22 = *(&v14) ^ v21[5];
return;
}
|
static void
give_help (void)
{
fprintf (
stderr
, "%s", gettext ("ed:\tEdit then use both versions, each decorated with a header.\neb:\tEdit then use both versions.\nel or e1:\tEdit then use the left version.\ner or e2:\tEdit then use the right version.\ne:\tDiscard both versions then edit a new one.\nl or 1:\tUse the left version.\nr or 2:\tUse the right version.\ns:\tSilently include common lines.\nv:\tVerbosely include common lines.\nq:\tQuit.\n")
);
}
| void give_help(void)
{
undefined8 uVar1;
uVar1 = gettext(
"ed:\tEdit then use both versions, each decorated with a header.\neb:\tEdit then use both versions.\nel or e1:\tEdit then use the left version.\ner or e2:\tEdit then use the right version.\ne:\tDiscard both versions then edit a new one.\nl or 1:\tUse the left version.\nr or 2:\tUse the right version.\ns:\tSilently include common lines.\nv:\tVerbosely include common lines.\nq:\tQuit.\n"
);
fprintf(stderr,"%s",uVar1);
return;
}
|
static void
ctime_decoder (struct tar_stat_info *st,
char const *keyword,
char const *arg,
size_t size __attribute__((unused)))
{
struct timespec ts;
if (decode_time (&ts, arg, keyword))
st->ctime = ts;
}
| long long ctime_decoder(unsigned long long a0[35], unsigned long a1, unsigned int a2, unsigned long a3) {
unsigned long v0;
char v1;
char v2;
v0 = a3;
if (decode_time(&v1, a2, a1)) {
a0[33] = *(&v1);
a0[34] = *(&v2);
}
return 0;
}
|
int
login_login(struct logininfo *li)
{
li->type = 7;
return (login_write(li));
}
| long login_login(long a1)
{
*(_WORD *)(a1 + 68) = 7;
return login_write(a1);
}
|
void
ssh_packet_set_server(struct ssh *ssh)
{
ssh->state->server_side = 1;
ssh->kex->server = 1;
}
| void ssh_packet_set_server(long *param_1)
{
*(undefined4 *)(*param_1 + 0x144) = 1;
*(undefined4 *)(param_1[1] + 0x18) = 1;
return;
}
|
gzFile gzopen64(path, mode)
const char *path;
const char *mode;
{
return gz_open(path, -1, mode);
}
| long long gzopen64(char *a0, unsigned int a1) {
return gz_open(a0, 0xffffffff, a1);
}
|
time_t get_crl_next_update(void)
{
return get_int_date(cfg.next_update_date, cfg.crl_next_update, "The next CRL will be issued in (days): ");
}
| long get_crl_next_update()
{
return get_int_date(*(const char **)&cfg[128], cfg[154], "The next CRL will be issued in (days): ");
}
|
keymacro_get(EditLine *el, wchar_t *ch, keymacro_value_t *val)
{
return node_trav(el, el->el_keymacro.map, ch, val);
}
| long keymacro_get(long a1, _DWORD *a2, _QWORD *a3)
{
return node_trav(a1, *(_QWORD *)(a1 + 1096), a2, a3);
}
|
static int
confirm_sk_overwrite(const char *application, const char *user)
{
char yesno[3];
printf("A resident key scoped to '%s' with user id '%s' already "
"exists.\n", application ==
((void *)0)
? "ssh:" : application,
user ==
((void *)0)
? "null" : user);
printf("Overwrite key in token (y/n)? ");
fflush(
stdout
);
if (fgets(yesno, sizeof(yesno),
stdin
) ==
((void *)0)
)
return 0;
if (yesno[0] != 'y' && yesno[0] != 'Y')
return 0;
return 1;
}
| _BOOL8 confirm_sk_overwrite(const char *a1, const char *a2)
{
const char *v2;
const char *v3;
char s[3];
unsigned long v6;
v6 = __readfsqword(0x28u);
if ( a2 )
v2 = a2;
else
v2 = "null";
if ( a1 )
v3 = a1;
else
v3 = "ssh:";
printf("A resident key scoped to '%s' with user id '%s' already exists.\n", v3, v2);
printf("Overwrite key in token (y/n)? ");
fflush(stdout);
if ( !fgets(s, 3, stdin) )
return 0LL;
return s[0] == 121 || s[0] == 89;
}
|
static void usage(void)
{
fprintf(
stderr
,
"Usage: ip vrf show [NAME] ...\n"
" ip vrf exec [NAME] cmd ...\n"
" ip vrf identify [PID]\n"
" ip vrf pids [NAME]\n");
exit(-1);
}
| void usage()
{
fprintf(
stderr,
"Usage:\tip vrf show [NAME] ...\n\tip vrf exec [NAME] cmd ...\n\tip vrf identify [PID]\n\tip vrf pids [NAME]\n");
exit(-1);
}
|
static void
process_write(u_int32_t id)
{
u_int64_t off;
size_t len;
int r, handle, fd, ret, status;
u_char *data;
if ((r = get_handle(iqueue, &handle)) != 0 ||
(r = sshbuf_get_u64(iqueue, &off)) != 0 ||
(r = sshbuf_get_string(iqueue, &data, &len)) != 0)
sshfatal("sftp-server.c", __func__, 864, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse");
sshlog("sftp-server.c", __func__, 866, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "request %u: write \"%s\" (handle %d) off %llu len %zu", id, handle_to_name(handle), handle, (unsigned long long)off, len)
;
fd = handle_to_fd(handle);
if (fd < 0)
status = 4;
else {
if (!(handle_to_flags(handle) &
02000
) &&
lseek(fd, off,
0
) == -1) {
status = errno_to_portable(
(*__errno_location ())
);
sshlog("sftp-server.c", __func__, 876, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "seek \"%.100s\": %s", handle_to_name(handle), strerror(
(*__errno_location ())
))
;
} else {
ret = write(fd, data, len);
if (ret == -1) {
status = errno_to_portable(
(*__errno_location ())
);
sshlog("sftp-server.c", __func__, 883, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "write \"%.100s\": %s", handle_to_name(handle), strerror(
(*__errno_location ())
))
;
} else if ((size_t)ret == len) {
status = 0;
handle_update_write(handle, ret);
} else {
sshlog("sftp-server.c", __func__, 889, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "nothing at all written");
status = 4;
}
}
}
send_status(id, status);
free(data);
}
| void process_write(uint param_1)
{
int iVar1;
size_t sVar2;
uint uVar3;
undefined8 uVar4;
__off_t _Var5;
int *piVar6;
char *pcVar7;
ssize_t sVar8;
ulong uVar9;
char **ppcVar10;
long in_FS_OFFSET;
char *pcStack136;
undefined8 uStack128;
undefined auStack120 [12];
uint local_6c;
uint local_5c;
int local_58;
undefined4 local_54;
int local_50;
int local_4c;
__off_t local_48;
size_t local_40;
void *local_38;
long local_30;
ppcVar10 = (char **)auStack120;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
uStack128 = 0x102658;
local_6c = param_1;
local_58 = get_handle(iqueue,&local_5c);
if (local_58 == 0) {
uStack128 = 0x102677;
local_58 = sshbuf_get_u64(iqueue,&local_48);
if (local_58 != 0) goto LAB_001026a3;
uStack128 = 0x10269a;
local_58 = sshbuf_get_string(iqueue,&local_38,&local_40);
if (local_58 != 0) goto LAB_001026a3;
}
else {
LAB_001026a3:
uStack128 = 0x1026ad;
uVar4 = ssh_err(local_58);
ppcVar10 = &pcStack136;
pcStack136 = "parse";
sshfatal("sftp-server.c","process_write",0x360,1,1,uVar4);
}
sVar2 = local_40;
_Var5 = local_48;
uVar9 = (ulong)local_5c;
*(undefined8 *)((long)ppcVar10 + -8) = 0x1026f9;
uVar4 = handle_to_name(local_5c);
*(size_t *)((long)ppcVar10 + -8) = sVar2;
*(__off_t *)((long)ppcVar10 + -0x10) = _Var5;
*(ulong *)((long)ppcVar10 + -0x18) = uVar9;
*(undefined8 *)((long)ppcVar10 + -0x20) = uVar4;
*(ulong *)((long)ppcVar10 + -0x28) = (ulong)local_6c;
*(char **)((long)ppcVar10 + -0x30) = "request %u: write \"%s\" (handle %d) off %llu len %zu";
*(undefined8 *)((long)ppcVar10 + -0x38) = 0x102739;
sshlog("sftp-server.c","process_write",0x362,0,5,0);
*(undefined8 *)((long)ppcVar10 + -8) = 0x102747;
local_50 = handle_to_fd();
if (local_50 < 0) {
local_54 = 4;
}
else {
*(undefined8 *)((long)ppcVar10 + -8) = 0x102766;
uVar3 = handle_to_flags();
if ((uVar3 & 0x400) == 0) {
*(undefined8 *)((long)ppcVar10 + -8) = 0x10278c;
_Var5 = lseek(local_50,local_48,0);
if (_Var5 == -1) {
*(undefined8 *)((long)ppcVar10 + -8) = 0x102797;
__errno_location();
*(undefined8 *)((long)ppcVar10 + -8) = 0x1027a0;
local_54 = errno_to_portable();
*(undefined8 *)((long)ppcVar10 + -8) = 0x1027a8;
piVar6 = __errno_location();
iVar1 = *piVar6;
*(undefined8 *)((long)ppcVar10 + -8) = 0x1027b1;
pcVar7 = strerror(iVar1);
*(undefined8 *)((long)ppcVar10 + -8) = 0x1027be;
uVar4 = handle_to_name(local_5c);
*(char **)((long)ppcVar10 + -0x10) = pcVar7;
*(undefined8 *)((long)ppcVar10 + -0x18) = uVar4;
*(char **)((long)ppcVar10 + -0x20) = "seek \"%.100s\": %s";
*(undefined8 *)((long)ppcVar10 + -0x28) = 0x1027fa;
sshlog("sftp-server.c","process_write",0x36c,1,2,0);
goto LAB_001028ff;
}
}
*(undefined8 *)((long)ppcVar10 + -8) = 0x102818;
sVar8 = write(local_50,local_38,local_40);
local_4c = (int)sVar8;
if (local_4c == -1) {
*(undefined8 *)((long)ppcVar10 + -8) = 0x102826;
__errno_location();
*(undefined8 *)((long)ppcVar10 + -8) = 0x10282f;
local_54 = errno_to_portable();
*(undefined8 *)((long)ppcVar10 + -8) = 0x102837;
piVar6 = __errno_location();
iVar1 = *piVar6;
*(undefined8 *)((long)ppcVar10 + -8) = 0x102840;
pcVar7 = strerror(iVar1);
*(undefined8 *)((long)ppcVar10 + -8) = 0x10284d;
uVar4 = handle_to_name(local_5c);
*(char **)((long)ppcVar10 + -0x10) = pcVar7;
*(undefined8 *)((long)ppcVar10 + -0x18) = uVar4;
*(char **)((long)ppcVar10 + -0x20) = "write \"%.100s\": %s";
*(undefined8 *)((long)ppcVar10 + -0x28) = 0x102889;
sshlog("sftp-server.c","process_write",0x373,1,2,0);
}
else if ((long)local_4c == local_40) {
local_54 = 0;
*(undefined8 *)((long)ppcVar10 + -8) = 0x1028b8;
handle_update_write(local_5c,(long)local_4c);
}
else {
*(char **)((long)ppcVar10 + -0x10) = "nothing at all written";
*(undefined8 *)((long)ppcVar10 + -0x18) = 0x1028f4;
sshlog("sftp-server.c","process_write",0x379,1,6,0);
local_54 = 4;
}
}
LAB_001028ff:
*(undefined8 *)((long)ppcVar10 + -8) = 0x10290e;
send_status(local_6c,local_54);
*(undefined8 *)((long)ppcVar10 + -8) = 0x10291a;
free(local_38);
if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)((long)ppcVar10 + -8) = 0x10292f;
__stack_chk_fail();
}
return;
}
|
int
sshkey_drop_cert(struct sshkey *k)
{
if (!sshkey_type_is_cert(k->type))
return -14;
cert_free(k->cert);
k->cert =
((void *)0)
;
k->type = sshkey_type_plain(k->type);
return 0;
}
| long long sshkey_drop_cert(struct_0 *a0) {
struct_0 *v0;
unsigned long long v3;
v0 = a0;
if (!sshkey_type_is_cert(a0->field_0)) {
v3 = 4294967282;
} else {
cert_free(a0->field_80);
a0->field_80 = 0;
a0->field_0 = sshkey_type_plain(a0->field_0);
v3 = 0;
}
return v3;
}
|
static void
alloc_table_row (void)
{
nrows++;
table = xnrealloc (table, nrows, sizeof (char **));
table[nrows - 1] = xnmalloc (ncolumns, sizeof (char *));
}
| void alloc_table_row() {
nrows = nrows + 1;
table = xnrealloc(table, nrows, 0x8, nrows);
*((table + nrows * 8 - 8)) = xnmalloc(ncolumns, 0x8, table, nrows * 8 - 8);
return;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.