input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
(r = sshbuf_get_string_direct(b,
((void *)0)
, &elen)) != 0) {
sshlog("ssh-agent.c", __func__, 967, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse");
goto out;
}
| void sshbuf_get_string_direct(void)
{
halt_baddata();
}
|
static int
can_optimize_assignment (entry, value, aflags)
SHELL_VAR *entry;
char *value;
int aflags;
{
if ((aflags & 0x0001) == 0)
return 0;
if (((((entry)->attributes) & (0x0000004))) || ((((entry)->attributes) & (0x0000040))))
return 0;
if (((((entry)->attributes) & (0x0000010))) || ((((entry)->attributes) & (0x0000100))) || ((((entry)->attributes) & (0x0000200))) || ((((entry)->attributes) & (0x0000400))))
return 0;
if (((((entry)->attributes) & (0x0000002))) || ((((entry)->attributes) & (0x0004000))))
return 0;
return 1;
}
| _BOOL8 can_optimize_assignment(long a1, long a2, char a3)
{
if ( (a3 & 1) == 0 )
return 0LL;
if ( (*(_DWORD *)(a1 + 40) & 4) != 0 || (*(_DWORD *)(a1 + 40) & 0x40) != 0 )
return 0LL;
if ( (*(_DWORD *)(a1 + 40) & 0x10) != 0
|| (*(_DWORD *)(a1 + 40) & 0x100) != 0
|| (*(_DWORD *)(a1 + 40) & 0x200) != 0
|| (*(_DWORD *)(a1 + 40) & 0x400) != 0 )
{
return 0LL;
}
return (*(_DWORD *)(a1 + 40) & 2) == 0 && (*(_DWORD *)(a1 + 40) & 0x4000) == 0;
}
|
static SHELL_VAR *
assign_seconds (self, value, unused, key)
SHELL_VAR *self;
char *value;
arrayind_t unused;
char *key;
{
intmax_t nval;
int expok;
if (((((self)->attributes) & (0x0000010))))
nval = evalexp (value, 0, &expok);
else
expok = legal_number (value, &nval);
seconds_value_assigned = expok ? nval : 0;
gettimeofday (&shellstart,
((void *)0)
);
shell_start_time = shellstart.tv_sec;
return (set_int_value (self, nval, ((((self)->attributes) & (0x0000010))) != 0));
}
| void assign_seconds(long param_1,undefined8 param_2)
{
long in_FS_OFFSET;
int local_1c;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if ((*(uint *)(param_1 + 0x28) & 0x10) == 0) {
local_1c = legal_number(param_2,&local_18);
}
else {
local_18 = evalexp(param_2,0,&local_1c);
}
seconds_value_assigned = local_18;
if (local_1c == 0) {
seconds_value_assigned = 0;
}
gettimeofday((timeval *)&shellstart,(__timezone_ptr_t)0x0);
shell_start_time = shellstart;
set_int_value(param_1,local_18,(*(uint *)(param_1 + 0x28) & 0x10) != 0);
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
}
|
void
_rl_pop_executing_macro (void)
{
struct saved_macro *macro;
if (rl_executing_macro) free (rl_executing_macro);
rl_executing_macro = (char *)
((void *)0)
;
executing_macro_index = 0;
if (macro_list)
{
macro = macro_list;
rl_executing_macro = macro_list->string;
executing_macro_index = macro_list->sindex;
macro_list = macro_list->next;
xfree (macro);
}
macro_level--;
if (rl_executing_macro == 0)
(rl_readline_state &= ~(0x0000800));
}
| void _rl_pop_executing_macro() {
struct_0 *v0;
int tmp_7;
struct_0 *v2;
struct_0 *v3;
if (rl_executing_macro)
free(rl_executing_macro);
rl_executing_macro = 0;
executing_macro_index = 0;
if (macro_list) {
v0 = macro_list;
rl_executing_macro = *((macro_list + 8));
executing_macro_index = *((macro_list + 16));
macro_list = *(macro_list);
xfree(v0);
}
macro_level = macro_level - 1;
v2 = rl_executing_macro;
if (!rl_executing_macro) {
v3 = rl_readline_state;
*(&v3) = (rl_readline_state >> 8) & 247;
tmp_7 = v3;
rl_readline_state = tmp_7;
}
return;
}
|
int
sshkey_check_revoked(struct sshkey *key, const char *revoked_keys_file)
{
int r;
r = ssh_krl_file_contains_key(revoked_keys_file, key);
if (r != -50)
return r;
switch ((r = sshkey_in_file(key, revoked_keys_file, 0, 1))) {
case 0:
return -51;
case -46:
return 0;
default:
return r;
}
}
| long sshkey_check_revoked(long a1, const char *a2)
{
unsigned int v3;
unsigned int v4;
v3 = ssh_krl_file_contains_key(a2, a1);
if ( v3 != -50 )
return v3;
v4 = sshkey_in_file(a1, a2, 0, 1);
if ( v4 == -46 )
return 0LL;
if ( v4 )
return v4;
return 4294967245LL;
}
|
static int
known_hosts_find_delete(struct hostkey_foreach_line *l, void *_ctx)
{
struct known_hosts_ctx *ctx = (struct known_hosts_ctx *)_ctx;
enum sshkey_fp_rep rep;
int fptype;
char *fp =
((void *)0)
, *ra =
((void *)0)
;
fptype = print_bubblebabble ? 1 : fingerprint_hash;
rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_DEFAULT;
if (l->status == 3) {
if (ctx->delete_host) {
if (l->marker != MRK_NONE) {
fprintf(ctx->out, "%s\n", l->line);
} else {
ctx->found_key = 1;
if (!quiet)
printf("# Host %s found: line %lu\n",
ctx->host, l->linenum);
}
return 0;
} else if (ctx->find_host) {
ctx->found_key = 1;
if (!quiet) {
printf("# Host %s found: line %lu %s\n",
ctx->host,
l->linenum, l->marker == MRK_CA ? "CA" :
(l->marker == MRK_REVOKE ? "REVOKED" : ""));
}
if (ctx->hash_hosts)
known_hosts_hash(l, ctx);
else if (print_fingerprint) {
fp = sshkey_fingerprint(l->key, fptype, rep);
ra = sshkey_fingerprint(l->key,
fingerprint_hash, SSH_FP_RANDOMART);
if (fp ==
((void *)0)
|| ra ==
((void *)0)
)
sshfatal("ssh-keygen.c", __func__, 1270, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshkey_fingerprint failed");
mprintf("%s %s %s%s%s\n", ctx->host,
sshkey_type(l->key), fp,
l->comment[0] ? " " : "",
l->comment);
if (log_level_get() >= SYSLOG_LEVEL_VERBOSE)
printf("%s\n", ra);
free(ra);
free(fp);
} else
fprintf(ctx->out, "%s\n", l->line);
return 0;
}
} else if (ctx->delete_host) {
if (l->status == 1) {
ctx->invalid = 1;
sshlog("ssh-keygen.c", __func__, 1287, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "%s:%lu: invalid line", l->path, l->linenum);
}
fprintf(ctx->out, "%s\n", l->line);
}
return 0;
}
| long long known_hosts_find_delete(struct_0 *a0, struct_2 *a1) {
unsigned int v0;
unsigned int v1;
void* v2;
void* v3;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
v2 = 0;
v3 = 0;
if (!print_bubblebabble)
v5 = fingerprint_hash;
else
v5 = 1;
v0 = v5;
if (print_bubblebabble)
v6 = 3;
else
v6 = 0;
v1 = v6;
if (a0->field_10 == 3) {
if (a1->field_24) {
if (a0->field_20 != 1) {
fprintf(a1->field_8, "%s\n", a0->field_18);
} else {
a1->field_14 = 1;
if (!*(&quiet))
printf("# Host %s found: line %lu\n", a1->field_0, a0->field_8);
}
} else {
if (a1->field_20) {
a1->field_14 = 1;
if (!*(&quiet)) {
if (a0->field_20 == 3) {
v7 = &g_4115ea;
} else if (a0->field_20 == 2) {
v7 = "REVOKED";
} else {
v7 = &g_410d75;
}
printf("# Host %s found: line %lu %s\n", a1->field_0, a0->field_8, v7);
}
if (a1->field_1c) {
known_hosts_hash(a0, a1);
} else if (print_fingerprint) {
v2 = sshkey_fingerprint(a0->field_40, v0, v1, v0);
v3 = sshkey_fingerprint(a0->field_40, fingerprint_hash, 0x4, fingerprint_hash);
if (!v2 || !v3)
sshfatal("ssh-keygen.c", "known_hosts_find_delete", 0x4f6, 0x1, 0x1, 0x0, "sshkey_fingerprint failed");
if (a0->field_48->field_0)
v8 = " ";
else
v8 = &g_410d75;
mprintf("%s %s %s%s%s\n", a1->field_0, sshkey_type(a0->field_40), v2, v8);
if (log_level_get("%s %s %s%s%s\n", a1, v9, v10, v11, 0x0) > 3)
printf("%s\n", v3);
free(v3);
free(v2);
} else {
fprintf(a1->field_8, "%s\n", a0->field_18);
}
}
}
} else {
if (a1->field_24) {
if (a0->field_10 == 1) {
*(&a1->padding_18[0]) = 1;
sshlog("ssh-keygen.c", "known_hosts_find_delete", 0x507, 0x0, 0x3, 0x0, "%s:%lu: invalid line", a0->field_0);
}
fprintf(a1->field_8, "%s\n", a0->field_18);
}
}
return 0;
}
|
static char *
string_extract_verbatim (string, slen, sindex, charlist, flags)
char *string;
size_t slen;
int *sindex;
char *charlist;
int flags;
{
register int i;
wchar_t *wcharlist;
int c;
char *temp;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
if ((flags & 0x0010) && charlist[0] == '\'' && charlist[1] == '\0')
{
temp = string_extract_single_quoted (string, sindex, 0);
--*sindex;
return temp;
}
if (*charlist == 0)
{
temp = string + *sindex;
c = (*sindex == 0) ? slen : (((temp) && (temp)[0]) ? ((temp)[1] ? ((temp)[2] ? strlen(temp) : 2) : 1) : 0);
temp = (char *)strcpy (sh_xmalloc((1 + strlen (temp)), "subst.c", 1195), (temp));
*sindex += c;
return temp;
}
i = *sindex;
wcharlist = 0;
while (c = string[i])
{
size_t mblength;
if ((flags & 0x0010) == 0 && c == '\001')
{
i += 2;
if (i >= slen) { i = slen; c = 0; break; } else;
continue;
}
else if ((flags & 0x0020) == 0 && c == '\001' && string[i+1] == '\177')
{
i += 2;
if (i >= slen) { i = slen; c = 0; break; } else;
continue;
}
if (locale_utf8locale && slen > i && (((string[i]) & 0x80) == 0))
mblength = (string[i] != 0) ? 1 : 0;
else
mblength = ((
(__ctype_get_mb_cur_max ())
> 1) ? mblen ((string + i), (slen - i)) : 1);
if (mblength > 1)
{
wchar_t wc;
mblength = mbtowc (&wc, string + i, slen - i);
if (((mblength) == (size_t)-1 || (mblength) == (size_t)-2))
{
if ((((c) && c == (charlist)[0] && !(charlist)[1]) || (((c) ? ((char *)mbschr ((charlist), (c)) != (char *)
((void *)0)
) : 0))))
break;
}
else
{
if (wcharlist == 0)
{
size_t len;
len = mbstowcs (wcharlist, charlist, 0);
if (len == -1)
len = 0;
wcharlist = (wchar_t *)sh_xmalloc((sizeof (wchar_t) * (len + 1)), "subst.c", 1247);
mbstowcs (wcharlist, charlist, len + 1);
}
if (wcschr (wcharlist, wc))
break;
}
}
else
if ((((c) && c == (charlist)[0] && !(charlist)[1]) || (((c) ? ((char *)mbschr ((charlist), (c)) != (char *)
((void *)0)
) : 0))))
break;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
}
do { if (wcharlist) sh_xfree((wcharlist), "subst.c", 1264); } while (0);
temp = substring (string, *sindex, i);
*sindex = i;
return (temp);
}
| char * string_extract_verbatim(long param_1,ulong param_2,int *param_3,char *param_4,uint param_5)
{
int iVar1;
int iVar2;
char *__dest;
wchar_t *pwVar4;
int iVar5;
long in_FS_OFFSET;
wchar_t local_64;
int local_60;
int local_5c;
wchar_t *local_58;
ulong local_50;
size_t local_48;
ulong local_40;
char *local_38;
mbstate_t local_30;
mbstate_t local_28;
long local_20;
size_t sVar3;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
memset(&local_30,0,8);
if ((((param_5 & 0x10) == 0) || (*param_4 != '\'')) || (param_4[1] != '\0')) {
iVar1 = (int)param_2;
if (*param_4 == '\0') {
local_38 = (char *)(param_1 + *param_3);
if (*param_3 != 0) {
if ((local_38 == (char *)0x0) || (*local_38 == '\0')) {
iVar1 = 0;
}
else if (local_38[1] == '\0') {
iVar1 = 1;
}
else if (local_38[2] == '\0') {
iVar1 = 2;
}
else {
sVar3 = strlen(local_38);
iVar1 = (int)sVar3;
}
}
local_60 = iVar1;
sVar3 = strlen(local_38);
__dest = (char *)sh_xmalloc(sVar3 + 1,"subst.c",0x4ab);
local_38 = strcpy(__dest,local_38);
*param_3 = *param_3 + local_60;
}
else {
iVar5 = *param_3;
local_58 = (wchar_t *)0x0;
do {
while( true ) {
while( true ) {
local_60 = (int)*(char *)(param_1 + iVar5);
if (local_60 == 0) goto LAB_001018bc;
if (((param_5 & 0x10) != 0) || (local_60 != 1)) break;
iVar5 = iVar5 + 2;
if (param_2 <= (ulong)(long)iVar5) {
local_60 = 0;
iVar5 = iVar1;
goto LAB_001018bc;
}
}
if (((param_5 & 0x20) == 0) &&
((local_60 == 1 && (*(char *)(param_1 + (long)iVar5 + 1) == '\x7f')))) break;
if (((locale_utf8locale == 0) || (param_2 <= (ulong)(long)iVar5)) ||
(*(char *)(param_1 + iVar5) < '\0')) {
sVar3 = __ctype_get_mb_cur_max();
if (sVar3 < 2) {
local_50 = 1;
}
else {
iVar2 = mblen((char *)(param_1 + iVar5),param_2 - (long)iVar5);
local_50 = (ulong)iVar2;
}
}
else {
local_50 = (ulong)(*(char *)(param_1 + iVar5) != '\0');
}
if (local_50 < 2) {
if (((local_60 != 0) && (local_60 == *param_4)) && (param_4[1] == '\0'))
goto LAB_001018bc;
if (local_60 != 0) {
pwVar4 = (wchar_t *)mbschr(param_4,local_60);
goto joined_r0x001016e3;
}
}
else {
iVar2 = mbtowc(&local_64,(char *)(iVar5 + param_1),param_2 - (long)iVar5);
local_50 = (ulong)iVar2;
if ((local_50 == 0xffffffffffffffff) || (local_50 == 0xfffffffffffffffe)) {
if ((local_60 != 0) && ((local_60 == *param_4 && (param_4[1] == '\0'))))
goto LAB_001018bc;
if (local_60 == 0) goto LAB_001017c5;
pwVar4 = (wchar_t *)mbschr(param_4,local_60);
}
else {
if (local_58 == (wchar_t *)0x0) {
local_48 = mbstowcs((wchar_t *)0x0,param_4,0);
if (local_48 == 0xffffffffffffffff) {
local_48 = 0;
}
local_58 = (wchar_t *)sh_xmalloc((local_48 + 1) * 4,"subst.c",0x4df);
mbstowcs(local_58,param_4,local_48 + 1);
}
pwVar4 = wcschr(local_58,local_64);
}
joined_r0x001016e3:
if (pwVar4 != (wchar_t *)0x0) goto LAB_001018bc;
}
LAB_001017c5:
if (locale_mb_cur_max < 2) {
iVar5 = iVar5 + 1;
}
else {
local_5c = is_basic((int)*(char *)(param_1 + iVar5));
if (local_5c == 0) {
if ((locale_utf8locale == 0) || (*(char *)(param_1 + iVar5) < '\0')) {
local_28 = local_30;
local_40 = mbrlen((char *)(iVar5 + param_1),param_2 - (long)iVar5,&local_30);
}
else {
local_40 = (ulong)(*(char *)(param_1 + iVar5) != '\0');
}
}
else {
local_40 = 1;
}
if ((local_40 == 0xfffffffffffffffe) || (local_40 == 0xffffffffffffffff)) {
local_30 = local_28;
iVar5 = iVar5 + 1;
}
else if (local_40 == 0) {
iVar5 = iVar5 + 1;
}
else {
iVar5 = iVar5 + (int)local_40;
}
}
}
iVar5 = iVar5 + 2;
} while ((ulong)(long)iVar5 < param_2);
local_60 = 0;
iVar5 = iVar1;
LAB_001018bc:
if (local_58 != (wchar_t *)0x0) {
sh_xfree(local_58,"subst.c",0x4f0);
}
local_38 = (char *)substring(param_1,*param_3,iVar5);
*param_3 = iVar5;
}
}
else {
local_38 = (char *)string_extract_single_quoted(param_1,param_3,0);
*param_3 = *param_3 + -1;
}
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_38;
}
|
static int
wscompare (p, pe, s, se)
wchar_t *p, *pe, *s, *se;
{
int ret;
wchar_t c1, c2;
int l1, l2;
l1 = pe - p;
l2 = se - s;
if (l1 != l2)
return (1);
c1 = *pe;
c2 = *se;
if (c1 != 0)
*pe = '\0';
if (c2 != 0)
*se = '\0';
ret = wcscoll(((wchar_t *)p), ((wchar_t *)s));
if (c1 != 0)
*pe = c1;
if (c2 != 0)
*se = c2;
return (ret == 0 ? ret : 1);
}
| void wscompare(unsigned short *a0, unsigned int *a1, unsigned short *a2, unsigned int *a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned long long v6;
unsigned long v7;
v0 = a1 - a0 >> 2;
v1 = a3 - a2 >> 2;
if (v0 != v1) {
v6 = 1;
} else {
v2 = *(a1);
v3 = *(a3);
if (v2)
*(a1) = 0;
if (v3)
*(a3) = 0;
v4 = wcscoll(a0, a2);
if (v2)
*(a1) = v2;
if (v3)
*(a3) = v3;
v7 = v4;
}
return;
}
|
int
nextopt(const char *optstring)
{
char *p;
const char *q;
char c;
if ((p = optptr) ==
((void *)0)
|| *p == '\0') {
p = *argptr;
if (p ==
((void *)0)
|| *p != '-' || *++p == '\0')
return '\0';
argptr++;
if (p[0] == '-' && p[1] == '\0')
return '\0';
}
c = *p++;
for (q = optstring ; *q != c ; ) {
if (*q == '\0')
sh_error("Illegal option -%c", c);
if (*++q == ':')
q++;
}
if (*++q == ':') {
if (*p == '\0' && (p = *argptr++) ==
((void *)0)
)
sh_error("No arg for -%c option", c);
optionarg = p;
p =
((void *)0)
;
}
optptr = p;
return c;
}
| long long nextopt(unsigned long a0) {
int tmp_9;
char v0;
void* v1;
char *v2;
void* v4;
v1 = 5250209293791953736;
if (!v1 || !*(v1)) {
v1 = *(5250209293791953736);
if (!v1) {
v4 = 0;
return v4;
} else if (*(v1) != 45) {
v4 = 0;
return v4;
} else {
v1 += 1;
if (!*(v1)) {
v4 = 0;
return v4;
}
minusc = 5250209293791953744;
if (*(v1) == 45 && !*((v1 + 1))) {
v4 = 0;
return v4;
}
}
}
tmp_9 = v1;
v1 += 1;
v0 = *(tmp_9);
v2 = a0;
while (true) {
if (v0 == *(v2))
break;
if (!*(v2))
sh_error("Illegal option -%c");
v2 += 1;
if (!(*(v2) == 58))
continue;
v2 += 1;
}
v2 += 1;
if (*(v2) == 58) {
if (!*(v1)) {
minusc = 5250209293791953744;
v1 = *(5250209293791953736);
if (!v1)
sh_error("No arg for -%c option");
}
minusc = v1;
v1 = 0;
}
minusc = v1;
v4 = v0;
return v4;
}
|
int
diff_2_files (struct comparison *cmp)
{
int f;
struct change *e, *p;
struct change *script;
int changes;
if (read_files (cmp->file, files_can_be_treated_as_binary))
{
if (cmp->file[0].stat.st_size != cmp->file[1].stat.st_size
&& 0 < cmp->file[0].stat.st_size
&& 0 < cmp->file[1].stat.st_size
&& (cmp->file[0].desc < 0 ||
((((
cmp->file[0].stat.st_mode
)) & 0170000) == (0100000))
)
&& (cmp->file[1].desc < 0 ||
((((
cmp->file[1].stat.st_mode
)) & 0170000) == (0100000))
))
changes = 1;
else if (cmp->file[0].desc == cmp->file[1].desc)
changes = 0;
else
{
size_t lcm_max =
(9223372036854775807L)
- 1;
size_t buffer_size =
buffer_lcm (sizeof (size_t),
buffer_lcm (((cmp->file[0].stat).st_blksize),
((cmp->file[1].stat).st_blksize),
lcm_max),
lcm_max);
for (f = 0; f < 2; f++)
cmp->file[f].buffer = xrealloc (cmp->file[f].buffer, buffer_size);
for (;; cmp->file[0].buffered = cmp->file[1].buffered = 0)
{
for (f = 0; f < 2; f++)
if (0 <= cmp->file[f].desc)
file_block_read (&cmp->file[f],
buffer_size - cmp->file[f].buffered);
if (cmp->file[0].buffered != cmp->file[1].buffered
|| memcmp (cmp->file[0].buffer,
cmp->file[1].buffer,
cmp->file[0].buffered))
{
changes = 1;
break;
}
if (cmp->file[0].buffered != buffer_size)
{
changes = 0;
break;
}
}
}
briefly_report (changes, cmp->file);
}
else
{
struct context ctxt;
lin diags;
lin too_expensive;
size_t s = cmp->file[0].buffered_lines + cmp->file[1].buffered_lines + 4;
char *flag_space = zalloc (s);
cmp->file[0].changed = flag_space + 1;
cmp->file[1].changed = flag_space + cmp->file[0].buffered_lines + 3;
discard_confusing_lines (cmp->file);
ctxt.xvec = cmp->file[0].undiscarded;
ctxt.yvec = cmp->file[1].undiscarded;
diags = (cmp->file[0].nondiscarded_lines
+ cmp->file[1].nondiscarded_lines + 3);
ctxt.fdiag = xmalloc (diags * (2 * sizeof *ctxt.fdiag));
ctxt.bdiag = ctxt.fdiag + diags;
ctxt.fdiag += cmp->file[1].nondiscarded_lines + 1;
ctxt.bdiag += cmp->file[1].nondiscarded_lines + 1;
ctxt.heuristic = speed_large_files;
too_expensive = 1;
for (; diags != 0; diags >>= 2)
too_expensive <<= 1;
ctxt.too_expensive = ((4096) >= (too_expensive) ? (4096) : (too_expensive));
files[0] = cmp->file[0];
files[1] = cmp->file[1];
compareseq (0, cmp->file[0].nondiscarded_lines,
0, cmp->file[1].nondiscarded_lines, minimal, &ctxt);
free (ctxt.fdiag - (cmp->file[1].nondiscarded_lines + 1));
shift_boundaries (cmp->file);
if (output_style == OUTPUT_ED)
script = build_reverse_script (cmp->file);
else
script = build_script (cmp->file);
if (ignore_blank_lines || ignore_regexp.fastmap)
{
struct change *next = script;
changes = 0;
while (next && changes == 0)
{
struct change *this, *end;
lin first0, last0, first1, last1;
this = next;
end = find_change (next);
next = end->link;
end->link = 0;
if (analyze_hunk (this, &first0, &last0, &first1, &last1))
changes = 1;
end->link = next;
}
}
else
changes = (script != 0);
if (brief)
briefly_report (changes, cmp->file);
else
{
if (changes || !no_diff_means_no_output)
{
setup_output (file_label[0] ? file_label[0] : cmp->file[0].name,
file_label[1] ? file_label[1] : cmp->file[1].name,
cmp->parent != 0);
switch (output_style)
{
case OUTPUT_CONTEXT:
print_context_script (script,
0
);
break;
case OUTPUT_UNIFIED:
print_context_script (script,
1
);
break;
case OUTPUT_ED:
print_ed_script (script);
break;
case OUTPUT_FORWARD_ED:
pr_forward_ed_script (script);
break;
case OUTPUT_RCS:
print_rcs_script (script);
break;
case OUTPUT_NORMAL:
print_normal_script (script);
break;
case OUTPUT_IFDEF:
print_ifdef_script (script);
break;
case OUTPUT_SDIFF:
print_sdiff_script (script);
break;
default:
abort ();
}
finish_output ();
}
}
free (cmp->file[0].undiscarded);
free (flag_space);
for (f = 0; f < 2; f++)
{
free (cmp->file[f].equivs);
free (cmp->file[f].linbuf + cmp->file[f].linbuf_base);
}
for (e = script; e; e = p)
{
p = e->link;
free (e);
}
if (! ((output_style) != OUTPUT_ED && (output_style) != OUTPUT_FORWARD_ED))
for (f = 0; f < 2; ++f)
if (cmp->file[f].missing_newline)
{
error (0, 0, "%s: %s\n",
file_label[f] ? file_label[f] : cmp->file[f].name,
gettext ("No newline at end of file"));
changes = 2;
}
}
if (cmp->file[0].buffer != cmp->file[1].buffer)
free (cmp->file[0].buffer);
free (cmp->file[1].buffer);
return changes;
}
| long long diff_2_files(unsigned long a0) {
struct_6 *v0;
unsigned int v1;
unsigned int v2;
char v3;
char v4;
char v5;
char v6;
unsigned long long *v7;
void* v8;
unsigned long long v9;
unsigned long long v10;
void* v11;
unsigned long long v12;
void* v13;
unsigned long long v14;
unsigned long long *v15;
void* v16;
unsigned long long v17;
unsigned long long v18;
unsigned long v19;
unsigned long v20;
unsigned long v21;
unsigned long v22;
char v23;
unsigned long long v24;
unsigned long long v27;
unsigned long long v28;
unsigned long v29;
unsigned long long v30;
struct_6 *v31;
unsigned long long v32;
unsigned long long v33;
unsigned long long v34;
unsigned long long *v35;
unsigned long long v36;
unsigned long long v38;
unsigned long long v39;
unsigned long long v40;
v0 = a0;
if (read_files(v0, files_can_be_treated_as_binary, files_can_be_treated_as_binary)) {
if (v0->field_40 != v0->field_170 && v0->field_40 > 0 && v0->field_170 > 0 && (*(&v0->field_0) < 0 || (v0->field_28 & 0xf000) == 0x8000) && (v0->field_130 < 0 || (v0->field_158 & 0xf000) == 0x8000))
v2 = 1;
if (v0->field_40 == v0->field_170 || v0->field_170 <= 0 || v0->field_40 <= 0 || v0->field_130 >= 0 && (v0->field_158 & 0xf000) != 0x8000 || *(&v0->field_0) >= 0 && (v0->field_28 & 0xf000) != 0x8000) {
if (*(&v0->field_0) == v0->field_130) {
v2 = 0;
} else {
v17 = 9223372036854775806;
v28 = buffer_lcm(v0->field_48, v0->field_178, v17, v0->field_48);
v18 = buffer_lcm(0x8, v28, v17, v28);
for (v1 = 0; v1 <= 1; v1 += 1) {
(&v0->field_a0)[38 * v1] = xrealloc((&v0->field_a0)[38 * v1], v18, v18, v0);
}
while (true) {
for (v1 = 0; v1 <= 1; v1 += 1) {
if (*(&(&v0->field_0)[0x100 * v1 + 32 * v1 + 16 * v1]) >= 0)
file_block_read(&(&v0->field_0)[304 * v1], v18 - (&v0->field_b0)[38 * v1], v0, v18 - (&v0->field_b0)[38 * v1]);
}
if (v0->field_b0 == v0->field_1e0) {
v36 = memcmp(v0->field_a0, v0->field_1d0, v0->field_b0);
if (!v36) {
if (v18 != v0->field_b0) {
v2 = 0;
break;
} else {
v0->field_1e0 = 0;
v0->field_b0 = v0->field_1e0;
continue;
}
}
}
if (v0->field_b0 != v0->field_1e0 || v36) {
v2 = 1;
break;
}
}
}
}
briefly_report(v2, v0);
} else {
v12 = v0->field_1f8 + v0->field_c8 + 4;
v13 = zalloc(v12);
v0->field_118 = v13 + 1;
v0->field_248 = v0->field_c8 + 3 + v13;
discard_confusing_lines(v0);
v19 = v0->field_100;
v20 = v0->field_230;
v9 = v0->field_240 + v0->field_110 + 3;
v21 = xmalloc(v9 * 16);
v22 = v21 + v9 * 8;
v21 = (v0->field_240 + 1) * 8 + v21;
v22 = (v0->field_240 + 1) * 8 + v22;
v23 = speed_large_files;
for (v10 = 1; v9; v9 >>= 2) {
v10 *= 2;
}
if (0x1000 <= v10)
v27 = v10;
else
v27 = 0x1000;
v24 = v27;
v31 = v0;
v30 = &files;
for (v32 = 38; v32; v31 = &(&v31->field_0)[8 * v29]) {
v32 -= 1;
*(v30) = *(&v31->field_0);
v30 += v29 * 8;
}
v33 = 38;
v34 = &g_500130;
for (v35 = &v0->field_130; v33; v35 = &v35[v29]) {
v33 -= 1;
*(v34) = *(v35);
v34 += v29 * 8;
}
compareseq(0x0, v0->field_110, 0x0, v0->field_240, minimal, &v19);
free(-8 - v0->field_240 * 8 + v21);
shift_boundaries(v0);
if (output_style == 4)
v8 = build_reverse_script(v0);
else
v8 = build_script(v0);
if (!ignore_blank_lines && !setup_output)
v2 = v8;
if (ignore_blank_lines || setup_output) {
v11 = v8;
for (v2 = 0; v11; *(v15) = v11) {
if (v2)
break;
if (!v2) {
v14 = v11;
v15 = find_change(v11);
v11 = *(v15);
*(v15) = 0;
if (analyze_hunk(v14, &v3, &v4, &v5, &v6))
v2 = 1;
}
}
}
if (brief) {
briefly_report(v2, v0);
} else if (v2 || (no_diff_means_no_output ^ 1)) {
if (brief)
v38 = brief;
else
v38 = v0->field_138;
if (file_label)
v39 = file_label;
else
v39 = v0->field_8;
setup_output(v39, v38);
switch (output_style) {
case 1:
print_normal_script(v8);
break;
case 2:
print_context_script(v8, 0x0);
break;
case 3:
print_context_script(v8, 0x1);
break;
case 4:
print_ed_script(v8);
break;
case 5:
pr_forward_ed_script(v8);
break;
case 6:
print_rcs_script(v8);
break;
case 7:
print_ifdef_script(v8);
break;
case 8:
print_sdiff_script(v8);
break;
finish_output();
default:
abort();
}
}
}
free(v0->field_100);
free(v13);
for (v1 = 0; v1 <= 1; v1 += 1) {
free(*(&(&v0->field_0)[304 * v1 + 248]));
free(*(&(&v0->padding_b8)[19 * v1 + 8]) * 8 + *(&(&v0->padding_b8)[19 * v1]));
}
for (v7 = v8; v7; v7 = v16) {
v16 = *(v7);
free(v7);
}
if (output_style == 5 || output_style == 4) {
for (v1 = 0; v1 <= 1; v1 += 1) {
if ((&v0->padding_120)[16 * v1 + 32 * v1 + 16 * v1]) {
v40 = gettext("No newline at end of file");
error(0x0, 0x0, "%s: %s\n");
v2 = 2;
}
}
}
if (v0->field_a0 != v0->field_1d0)
free(v0->field_a0);
free(v0->field_1d0);
return v2;
}
|
void removal_bulk(struct pkginfo *pkg) {
_Bool
foundpostrm;
debug(dbg_general, "removal_bulk package %s", pkg_name(pkg, pnaw_always));
if (pkg->status == PKG_STAT_HALFINSTALLED ||
pkg->status == PKG_STAT_UNPACKED) {
removal_bulk_remove_files(pkg);
}
foundpostrm = pkg_infodb_has_file(pkg, &pkg->installed, "postrm");
debug(dbg_general, "removal_bulk purging? foundpostrm=%d",foundpostrm);
if (!foundpostrm && !pkg->installed.conffiles) {
debug(dbg_general, "removal_bulk no postrm, no conffiles, purging");
pkg_set_want(pkg, PKG_WANT_PURGE);
dpkg_version_blank(&pkg->configversion);
} else if (pkg->want == PKG_WANT_PURGE) {
removal_bulk_remove_configfiles(pkg);
}
if (pkg->want == PKG_WANT_PURGE) {
const char *filename;
removal_bulk_remove_leftover_dirs(pkg);
filename = pkg_infodb_get_file(pkg, &pkg->installed, "list");
debug(dbg_general, "removal_bulk purge done, removing list '%s'",
filename);
if (unlink(filename) &&
(*__errno_location ())
!=
2
)
ohshite(gettext("cannot remove old files list"));
filename = pkg_infodb_get_file(pkg, &pkg->installed, "postrm");
debug(dbg_general, "removal_bulk purge done, removing postrm '%s'",
filename);
if (unlink(filename) &&
(*__errno_location ())
!=
2
)
ohshite(gettext("can't remove old postrm script"));
pkg_set_status(pkg, PKG_STAT_NOTINSTALLED);
pkg_set_want(pkg, PKG_WANT_UNKNOWN);
pkgbin_blank(&pkg->installed);
}
pkg_reset_eflags(pkg);
modstatdb_note(pkg);
debug(dbg_general, "removal done");
}
| long removal_bulk(long a1)
{
const char *v1;
char *v2;
const char *v3;
char *v4;
const char *v5;
unsigned char has_file;
char *name;
char *namea;
v1 = (const char *)pkg_name(a1, 3LL);
debug(1LL, "removal_bulk package %s", v1);
if ( *(_DWORD *)(a1 + 24) == 2 || *(_DWORD *)(a1 + 24) == 3 )
removal_bulk_remove_files(a1);
has_file = pkg_infodb_has_file(a1, a1 + 72, "postrm");
debug(1LL, "removal_bulk purging? foundpostrm=%d", has_file);
if ( has_file == 1 || *(_QWORD *)(a1 + 176) )
{
if ( *(_DWORD *)(a1 + 16) == 4 )
removal_bulk_remove_configfiles((_QWORD *)a1);
}
else
{
debug(1LL, "removal_bulk no postrm, no conffiles, purging");
pkg_set_want(a1, 4LL);
dpkg_version_blank(a1 + 48);
}
if ( *(_DWORD *)(a1 + 16) == 4 )
{
removal_bulk_remove_leftover_dirs(a1);
name = (char *)pkg_infodb_get_file(a1, a1 + 72, "list");
debug(1LL, "removal_bulk purge done, removing list '%s'", name);
if ( unlink(name) && *_errno_location() != 2 )
{
v2 = gettext("cannot remove old files list");
ohshite(v2, "removal_bulk purge done, removing list '%s'", v3);
}
namea = (char *)pkg_infodb_get_file(a1, a1 + 72, "postrm");
debug(1LL, "removal_bulk purge done, removing postrm '%s'", namea);
if ( unlink(namea) && *_errno_location() != 2 )
{
v4 = gettext("can't remove old postrm script");
ohshite(v4, "removal_bulk purge done, removing postrm '%s'", v5);
}
pkg_set_status(a1, 0LL);
pkg_set_want(a1, 0LL);
pkgbin_blank(a1 + 72);
}
pkg_reset_eflags(a1);
modstatdb_note(a1);
return debug(1LL, "removal done");
}
|
int main(int argc, char **argv)
{
char proc_dir_name[32];
char *target_str;
pid_t target;
int proc_dir_fd;
int ranges;
struct map_range *mappings;
struct stat st;
struct passwd *pw;
int written;
_Bool
allow_setgroups =
0
;
Prog = Basename (argv[0]);
log_set_progname(Prog);
log_set_logfd(
stderr
);
if (argc < 2)
usage();
target_str = argv[1];
if (!get_pid(target_str, &target))
usage();
written = snprintf(proc_dir_name, sizeof(proc_dir_name), "/proc/%u/",
target);
if ((written <= 0) || (written >= sizeof(proc_dir_name))) {
fprintf(
stderr
, "%s: snprintf of proc path failed: %s\n",
Prog, strerror(
(*__errno_location ())
));
}
proc_dir_fd = open(proc_dir_name,
0200000
);
if (proc_dir_fd < 0) {
fprintf(
stderr
, gettext ("%s: Could not open proc directory for target %u\n"),
Prog, target);
return
1
;
}
pw = get_my_pwent ();
if (
((void *)0)
== pw) {
fprintf (
stderr
,
gettext ("%s: Cannot determine your user name.\n"),
Prog);
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
4
, "Cannot determine the user name of the caller (UID %lu)", (unsigned long) getuid ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
)
;
return
1
;
}
if (fstat(proc_dir_fd, &st) < 0) {
fprintf(
stderr
, gettext ("%s: Could not stat directory for target %u\n"),
Prog, target);
return
1
;
}
if ((getuid() != pw->pw_uid) ||
(!getdef_bool("GRANT_AUX_GROUP_SUBIDS") && (getgid() != pw->pw_gid)) ||
(pw->pw_uid != st.st_uid) ||
(getgid() != st.st_gid)) {
fprintf(
stderr
, gettext ("%s: Target %u is owned by a different user: uid:%lu pw_uid:%lu st_uid:%lu, gid:%lu pw_gid:%lu st_gid:%lu\n"),
Prog, target,
(unsigned long int)getuid(), (unsigned long int)pw->pw_uid, (unsigned long int)st.st_uid,
(unsigned long int)getgid(), (unsigned long int)pw->pw_gid, (unsigned long int)st.st_gid);
return
1
;
}
if (!sub_gid_open(
00
)) {
return
1
;
}
ranges = ((argc - 2) + 2) / 3;
mappings = get_map_ranges(ranges, argc - 2, argv + 2);
if (!mappings)
usage();
verify_ranges(pw, ranges, mappings, &allow_setgroups);
write_setgroups(proc_dir_fd, allow_setgroups);
write_mapping(proc_dir_fd, ranges, mappings, "gid_map", pw->pw_uid);
sub_gid_close();
return
0
;
}
| undefined8 main(int param_1,undefined8 *param_2)
{
uint uVar1;
uint uVar2;
char cVar3;
int iVar4;
__uid_t _Var5;
__gid_t _Var6;
int *piVar7;
char *pcVar8;
undefined8 uVar9;
long in_FS_OFFSET;
undefined local_131;
uint local_130;
uint local_12c;
int local_128;
int local_124;
char *local_120;
undefined8 local_118;
long local_110;
long local_108;
char *local_100;
stat local_f8;
char local_68 [40];
long local_40;
local_40 = *(long *)(in_FS_OFFSET + 0x28);
local_131 = 0;
Prog = Basename(*param_2);
log_set_progname(Prog);
log_set_logfd(stderr);
if (param_1 < 2) {
usage();
}
local_118 = param_2[1];
iVar4 = get_pid(local_118,&local_130);
if (iVar4 == 0) {
usage();
}
local_12c = snprintf(local_68,0x20,"/proc/%u/");
if (((int)local_12c < 1) || (0x1f < local_12c)) {
piVar7 = __errno_location();
strerror(*piVar7);
fprintf(stderr,"%s: snprintf of proc path failed: %s\n",Prog);
}
local_128 = open(local_68,0x10000);
uVar9 = Prog;
if (local_128 < 0) {
pcVar8 = (char *)gettext("%s: Could not open proc directory for target %u\n");
fprintf(stderr,pcVar8,uVar9,(ulong)local_130);
uVar9 = 1;
goto LAB_00100975;
}
local_110 = get_my_pwent();
uVar9 = Prog;
if (local_110 == 0) {
pcVar8 = (char *)gettext("%s: Cannot determine your user name.\n");
fprintf(stderr,pcVar8,uVar9);
local_100 = setlocale(6,(char *)0x0);
local_120 = (char *)0x0;
if (local_100 != (char *)0x0) {
local_120 = strdup(local_100);
}
if (local_120 != (char *)0x0) {
setlocale(6,"C");
}
_Var5 = getuid();
syslog(4,"Cannot determine the user name of the caller (UID %lu)",(ulong)_Var5);
if (local_120 != (char *)0x0) {
setlocale(6,local_120);
free(local_120);
}
uVar9 = 1;
goto LAB_00100975;
}
iVar4 = fstat(local_128,&local_f8);
uVar9 = Prog;
if (iVar4 < 0) {
pcVar8 = (char *)gettext("%s: Could not stat directory for target %u\n");
fprintf(stderr,pcVar8,uVar9,(ulong)local_130);
uVar9 = 1;
goto LAB_00100975;
}
_Var5 = getuid();
if (_Var5 == *(__uid_t *)(local_110 + 0x10)) {
cVar3 = getdef_bool("GRANT_AUX_GROUP_SUBIDS");
if (cVar3 != '\x01') {
_Var6 = getgid();
if (_Var6 != *(__gid_t *)(local_110 + 0x14)) goto LAB_001007e0;
}
if (*(uint *)(local_110 + 0x10) == local_f8.st_uid) {
_Var6 = getgid();
if (_Var6 == local_f8.st_gid) {
iVar4 = sub_gid_open(0);
if (iVar4 == 0) {
uVar9 = 1;
}
else {
local_124 = param_1 / 3;
local_108 = get_map_ranges(local_124,param_1 + -2,param_2 + 2);
if (local_108 == 0) {
usage();
}
verify_ranges(local_110,local_124,local_108,&local_131);
write_setgroups(local_128,local_131);
write_mapping(local_128,local_124,local_108,"gid_map",*(undefined4 *)(local_110 + 0x10));
sub_gid_close();
uVar9 = 0;
}
goto LAB_00100975;
}
}
}
LAB_001007e0:
uVar1 = *(uint *)(local_110 + 0x14);
_Var6 = getgid();
uVar2 = *(uint *)(local_110 + 0x10);
_Var5 = getuid();
uVar9 = Prog;
pcVar8 = (char *)gettext(
"%s: Target %u is owned by a different user: uid:%lu pw_uid:%lu st_uid:%lu, gid:%lu pw_gid:%lu st_gid:%lu\n"
);
fprintf(stderr,pcVar8,uVar9,(ulong)local_130,(ulong)_Var5,(ulong)uVar2,(ulong)local_f8.st_uid,
(ulong)_Var6,(ulong)uVar1,(ulong)local_f8.st_gid);
uVar9 = 1;
LAB_00100975:
if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar9;
}
|
ed_next_char(EditLine *el, wint_t c __attribute__((__unused__)))
{
wchar_t *lim = el->el_line.lastchar;
if (el->el_line.cursor >= lim ||
(el->el_line.cursor == lim - 1 &&
el->el_map.type == 1 &&
el->el_chared.c_vcmd.action == 0x00))
return 6;
el->el_line.cursor += el->el_state.argument;
if (el->el_line.cursor > lim)
el->el_line.cursor = lim;
if (el->el_map.type == 1)
if (el->el_chared.c_vcmd.action != 0x00) {
cv_delfini(el);
return 4;
}
return 5;
}
| undefined8 ed_next_char(long param_1)
{
ulong uVar1;
undefined8 uVar2;
uVar1 = *(ulong *)(param_1 + 0x60);
if ((*(ulong *)(param_1 + 0x58) < uVar1) &&
(((*(long *)(param_1 + 0x58) != uVar1 - 4 || (*(int *)(param_1 + 0x420) != 1)) ||
(*(int *)(param_1 + 0x3c0) != 0)))) {
*(long *)(param_1 + 0x58) = *(long *)(param_1 + 0x58) + (long)*(int *)(param_1 + 0x78) * 4;
if (uVar1 < *(ulong *)(param_1 + 0x58)) {
*(ulong *)(param_1 + 0x58) = uVar1;
}
if ((*(int *)(param_1 + 0x420) == 1) && (*(int *)(param_1 + 0x3c0) != 0)) {
cv_delfini(param_1);
uVar2 = 4;
}
else {
uVar2 = 5;
}
}
else {
uVar2 = 6;
}
return uVar2;
}
|
int main(int argc, char **argv)
{
FILE *fp;
struct timeval tv;
fd_set fds;
char buf[1024];
char *p;
char *logfile;
char *pidfile;
int rotate;
int dontfork;
int ptm, pts;
int n, m, i;
int todo;
int considx;
struct real_cons cons[16];
int num_consoles, consoles_left;
int print_escape_sequence = 0;
fp =
((void *)0)
;
logfile = "/var/log/boot";
pidfile =
((void *)0)
;
rotate = 0;
dontfork = 0;
while ((i = getopt(argc, argv, "cdesl:p:rv")) !=
(-1)
) switch(i) {
case 'l':
logfile = optarg;
break;
case 'r':
rotate = 1;
break;
case 'v':
printf("bootlogd - %s\n", "3.05");
exit(0);
break;
case 'p':
pidfile = optarg;
break;
case 'c':
createlogfile = 1;
break;
case 'd':
dontfork = 1;
break;
case 'e':
print_escape_sequence = 1;
break;
case 's':
syncalot = 1;
break;
default:
usage();
break;
}
if (optind < argc) usage();
signal(
15
, handler);
signal(
3
, handler);
signal(
2
, handler);
signal(
21
,
((__sighandler_t) 1)
);
signal(
22
,
((__sighandler_t) 1)
);
signal(
20
,
((__sighandler_t) 1)
);
if ((num_consoles = consolenames(cons, 16)) <= 0)
return 1;
consoles_left = num_consoles;
for (considx = 0; considx < num_consoles; considx++) {
if (strcmp(cons[considx].name, "/dev/tty0") == 0)
strcpy(cons[considx].name, "/dev/tty1");
if (strcmp(cons[considx].name, "/dev/vc/0") == 0)
strcpy(cons[considx].name, "/dev/vc/1");
if ((cons[considx].fd = open_nb(cons[considx].name)) < 0) {
fprintf(
stderr
, "bootlogd: %s: %s\n",
cons[considx].name, strerror(
(*__errno_location ())
));
consoles_left--;
}
}
if (!consoles_left)
return 1;
ptm = -1;
pts = -1;
buf[0] = 0;
if (findpty(&ptm, &pts, buf) < 0) {
fprintf(
stderr
,
"bootlogd: cannot allocate pseudo tty: %s\n",
strerror(
(*__errno_location ())
));
return 1;
}
(void)ioctl(0,
0x541D
,
((void *)0)
);
if ((n = open("/dev/tty0",
02
)) >= 0) {
(void)ioctl(n,
0x541D
,
((void *)0)
);
close(n);
}
if (ioctl(pts,
0x541D
,
((void *)0)
) < 0)
{
fprintf(
stderr
, "bootlogd: ioctl(%s, TIOCCONS): %s\n",
buf, strerror(
(*__errno_location ())
));
return 1;
}
if (!dontfork) {
pid_t child_pid = fork();
switch (child_pid) {
case -1:
fprintf(
stderr
, "bootlogd: fork failed: %s\n",
strerror(
(*__errno_location ())
));
exit(1);
break;
case 0:
break;
default:
exit(0);
break;
}
setsid();
}
if (pidfile) {
unlink(pidfile);
if ((fp = fopen(pidfile, "w")) !=
((void *)0)
) {
fprintf(fp, "%d\n", (int)getpid());
fclose(fp);
}
fp =
((void *)0)
;
}
while (!got_signal) {
tv.tv_sec = 0;
tv.tv_usec = 500000;
do { unsigned int __i; fd_set *__arr = (
&fds
); for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) ((__arr)->fds_bits)[__i] = 0; } while (0)
;
((void) (((
&fds
)->fds_bits)[((
ptm
) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((
ptm
) % (8 * (int) sizeof (__fd_mask)))))))
;
if (select(ptm + 1, &fds,
((void *)0)
,
((void *)0)
, &tv) == 1) {
if ((n = read(ptm, inptr, endptr - inptr)) >= 0) {
for (considx = 0; considx < num_consoles; considx++) {
if (cons[considx].fd < 0) continue;
m = n;
p = inptr;
while (m > 0) {
i = write(cons[considx].fd, p, m);
if (i >= 0) {
m -= i;
p += i;
continue;
}
cons[considx].fd = write_err(pts,
cons[considx].fd,
cons[considx].name,
(*__errno_location ())
);
if (cons[considx].fd >= 0) continue;
if (--consoles_left <= 0) got_signal = 1;
break;
}
}
inptr += n;
if (inptr - n < outptr && inptr > outptr)
outptr = inptr;
if (inptr >= endptr)
inptr = ringbuf;
if (outptr >= endptr)
outptr = ringbuf;
}
}
if (fp ==
((void *)0)
&& access(logfile,
0
) == 0) {
if (rotate) {
snprintf(buf, sizeof(buf), "%s~", logfile);
rename(logfile, buf);
}
fp = fopen(logfile, "a");
}
if (fp ==
((void *)0)
&& createlogfile)
fp = fopen(logfile, "a");
if (inptr >= outptr)
todo = inptr - outptr;
else
todo = endptr - outptr;
if (fp && todo)
writelog(fp, (unsigned char *)outptr, todo, print_escape_sequence);
}
if (fp) {
if (!didnl) fputc('\n', fp);
fclose(fp);
}
close(pts);
close(ptm);
for (considx = 0; considx < num_consoles; considx++) {
close(cons[considx].fd);
}
return 0;
}
| int main() {
char v0;
unsigned long long v1;
unsigned long v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
void* v7;
unsigned long long v8;
void* v9;
char v10;
unsigned long v11;
unsigned int v12;
unsigned int v13;
unsigned int v14;
unsigned int v15;
unsigned int v16;
unsigned int v17;
unsigned int v18;
unsigned int v19;
unsigned int v20;
unsigned int v21;
unsigned int v22;
unsigned int v23;
unsigned int v24;
unsigned int v25;
void* v26;
void* v27;
char *v28;
char *v29;
unsigned long long *v30;
void* v31;
unsigned long long v32;
char v33;
char v34;
char v35;
unsigned long v36;
char v37;
char v38;
unsigned int v39;
unsigned int v40;
unsigned long long *v41;
do {
v1 = v1;
} while (&v1 != &v0);
v3 = v39;
*(&v2) = v40;
v36 = v41[5];
v6 = 0;
v7 = 0;
v8 = "/var/log/boot";
v9 = 0;
v4 = 0;
v5 = 0;
while (true) {
v22 = getopt(*((&v11 + 4)), *(&v10), "cdesl:p:rv");
if (v22 == -1)
break;
switch (v22) {
case 99:
createlogfile = 1;
break;
case 100:
v15 = 1;
break;
case 101:
v20 = 1;
break;
case 108:
v28 = *(&optarg);
break;
case 112:
v29 = *(&optarg);
break;
case 114:
v14 = 1;
break;
case 115:
syncalot = 1;
break;
case 118:
printf("bootlogd - %s\n", &g_401dd8);
exit(0x0);
default:
usage();
}
}
if (*((&v11 + 4)) > optind)
usage();
signal(0xf, handler);
signal(0x3, handler);
signal(0x2, handler);
signal(0x15, 0x1);
signal(0x16, 0x1);
signal(0x14, 0x1);
v23 = consolenames(&v34, 0x10);
if (v23 > 0) {
v19 = v23;
for (v18 = 0; v18 < v23; v18 += 1) {
if (!strcmp(&(&v34)[0x400 * v18 + 4 * v18], "/dev/tty0"))
strcpy(&(&v34)[1028 * v18], "/dev/tty1");
if (!strcmp(&(&v34)[0x400 * v18 + 4 * v18], "/dev/vc/0"))
strcpy(&(&v34)[1028 * v18], "/dev/vc/1");
*(&(&v35)[1028 * v18]) = open_nb(&(&v34)[1028 * v18], v40, v18);
if (*(&(&v35)[0x400 * v18 + 4 * v18]) < 0) {
fprintf(stderr, "bootlogd: %s: %s\n", &(&v34)[1028 * v18], strerror(*(__errno_location())));
v19 -= 1;
}
}
if (v19) {
v12 = -1;
v13 = -1;
v37 = 0;
if (findpty(&v12, &v13, &v37) < 0) {
fprintf(stderr, "bootlogd: cannot allocate pseudo tty: %s\n", strerror(*(__errno_location())));
} else {
ioctl(0x0, 0x541d);
v24 = open("/dev/tty0", 0x2, 0x0);
if (v24 >= 0) {
ioctl(v24, 0x541d);
close(v24);
}
if (ioctl(v13, 0x541d) < 0) {
fprintf(stderr, "bootlogd: ioctl(%s, TIOCCONS): %s\n", &v37, strerror(*(__errno_location())));
} else {
if (!v15) {
v25 = fork();
if (v25 == -1) {
fprintf(stderr, "bootlogd: fork failed: %s\n", strerror(*(__errno_location())));
exit(0x1);
}
if (v25)
exit(0x0);
setsid();
}
if (v29) {
unlink(v29);
v26 = fopen(v29, "w");
if (v26) {
fprintf(v26, "%d\n", getpid());
fclose(v26);
}
v26 = 0;
}
while (!got_signal) {
v31 = 0;
v32 = 500000;
v30 = &v33;
for (v21 = 0; v21 <= 15; v21 += 1) {
v30[v21] = 0;
}
*(&(&v33)[8 * ((v12 < 0 ? v12 + 63 : v12) >> 6)]) = *(&(&v33)[8 * ((v12 < 0 ? v12 + 63 : v12) >> 6)]) | 1 << (((v12 + (v12 >> 31 >> 26) & 63) - (v12 >> 31 >> 26)) & 63);
if (select(v12 + 1, &v33, NULL, NULL, &v31) == 1) {
v24 = read(v12, inptr, endptr - inptr);
if (v24 >= 0) {
v18 = 0;
while (true) {
if (v18 >= v23)
break;
if (*(&(&v35)[0x400 * v18 + 4 * v18]) >= 0) {
v16 = v24;
v27 = inptr;
do {
if (v16 <= 0)
v18 += 1;
v22 = write(*(&(&v35)[1028 * v18]), v27, v16);
if (v22 >= 0) {
v16 -= v22;
v27 += v22;
continue;
}
*(&(&v35)[1028 * v18]) = write_err(v13, *(&(&v35)[1028 * v18]), &(&v34)[1028 * v18], *(__errno_location()));
} while (*(&(&v35)[0x400 * v18 + 4 * v18]) >= 0);
v19 -= 1;
if (v19 <= 0)
got_signal = 1;
continue;
}
v18 += 1;
}
inptr = v24 + inptr;
if (!(v24) + inptr < outptr && inptr > outptr)
outptr = inptr;
if (inptr >= endptr)
inptr = &ringbuf;
if (outptr >= endptr)
outptr = &ringbuf;
}
}
if (!v26 && !access(v28, 0x0)) {
if (v14) {
snprintf(&v37, 0x400, "%s~", v28);
rename(v28, &v37);
}
v26 = fopen(v28, "a");
}
if (!v26 && createlogfile)
v26 = fopen(v28, "a");
if (inptr >= outptr)
v17 = inptr - outptr;
else
v17 = endptr - outptr;
if (v26 && v17)
writelog(v26, outptr, v17, v20);
}
if (v26) {
if (!didnl)
fputc(0xa, v26);
fclose(v26);
}
close(v13);
close(v12);
for (v18 = 0; v18 < v23; v18 += 1) {
close(*(&(&v35)[1028 * v18]));
}
}
}
}
}
if ((*(&v38) ^ v41[5]))
__stack_chk_fail();
return;
}
|
static
_Bool
from_match (const char *tok, const char *string)
{
size_t tok_len;
if (tok[0] == '@') {
return (netgroup_match (tok + 1, string, (char *) 0));
} else
if (string_match (tok, string)) {
return
1
;
} else if (tok[0] == '.') {
size_t str_len;
str_len = strlen (string);
tok_len = strlen (tok);
if ( (str_len > tok_len)
&& (strcasecmp (tok, string + str_len - tok_len) == 0)) {
return
1
;
}
} else if (strcasecmp (tok, "LOCAL") == 0) {
if (strchr (string, '.') ==
((void *)0)
) {
return
1
;
}
} else if ( (tok[(tok_len = strlen (tok)) - 1] == '.')
&& (strncmp (tok, resolve_hostname (string), tok_len) == 0)) {
return
1
;
}
return
0
;
}
| bool from_match(const char *a1, const char *a2)
{
char *v3;
size_t n;
size_t na;
size_t v6;
if ( *a1 == 64 )
return netgroup_match(a1 + 1, a2, 0LL);
if ( string_match(a1, a2) )
return 1;
if ( *a1 == 46 )
{
v6 = strlen(a2);
n = strlen(a1);
if ( v6 > n && !strcasecmp(a1, &a2[v6 - n]) )
return 1;
}
else if ( !strcasecmp(a1, "LOCAL") )
{
if ( !strchr(a2, 46) )
return 1;
}
else
{
na = strlen(a1);
if ( a1[na - 1] == 46 )
{
v3 = resolve_hostname(a2);
if ( !strncmp(a1, v3, na) )
return 1;
}
}
return 0;
}
|
int
sshpkt_get_ec(struct ssh *ssh, EC_POINT *v, const EC_GROUP *g)
{
return sshbuf_get_ec(ssh->state->incoming_packet, v, g);
}
| long long sshpkt_get_ec(struct struct_0 **a0, unsigned long long a1, unsigned long long a2) {
return sshbuf_get_ec(*(a0)->field_38, a1, a2, a1);
}
|
void
usage(int result)
{
printf("Usage: utmpdump [ -froh ] [ filename ]\n");
exit(result);
}
| void usage(int a1)
{
printf("Usage: utmpdump [ -froh ] [ filename ]\n");
exit(a1);
}
|
static void
reset_status (void)
{
int i = columns;
COLUMN *p;
for (p = column_vector; i; --i, ++p)
if (p->status == ON_HOLD)
{
p->status = OPEN;
files_ready_to_read++;
}
if (storing_columns)
{
if (column_vector->status == CLOSED)
files_ready_to_read = 0;
else
files_ready_to_read = 1;
}
}
| void reset_status(void)
{
int local_14;
long local_10;
local_10 = column_vector;
for (local_14 = columns; local_14 != 0; local_14 = local_14 + -1) {
if (*(int *)(local_10 + 0x10) == 2) {
*(undefined4 *)(local_10 + 0x10) = 0;
files_ready_to_read = files_ready_to_read + 1;
}
local_10 = local_10 + 0x40;
}
if (storing_columns != '\0') {
if (*(int *)(column_vector + 0x10) == 3) {
files_ready_to_read = 0;
}
else {
files_ready_to_read = 1;
}
}
return;
}
|
static
void my_re_exec(void)
{
CHILD *ch;
sigset_t mask, oldset;
pid_t pid;
char **env;
int fd;
if (strchr("S0123456",runlevel) ==
((void *)0)
)
return;
alarm(0);
sigfillset(&mask);
sigprocmask(
0
, &mask, &oldset);
if ((fd = make_pipe(11)) < 0) {
sigprocmask(
2
, &oldset,
((void *)0)
);
initlog(1, "Attempt to re-exec failed");
}
fail_cancel();
if (pipe_fd >= 0)
close(pipe_fd);
pipe_fd = -1;
((got_signals) &= ~(1 << (
17
)));
((got_signals) &= ~(1 << (
1
)));
((got_signals) &= ~(1 << (
10
)));
((got_signals) &= ~(1 << (
12
)));
for(ch = family; ch; ch = ch->next)
if (ch->flags & 64) {
;
ch->flags &= ~(2|64|32);
if (ch->process[0] != '+')
write_utmp_wtmp("", ch->id, ch->pid,
8
,
((void *)0)
);
}
if ((pid = fork()) == 0) {
send_state(fd);
exit(0);
}
env = init_buildenv(0);
execle(myname, myname, "--init",
((void *)0)
, env);
init_freeenv(env);
close(fd);
close(11);
sigprocmask(
2
, &oldset,
((void *)0)
);
initlog(1, "Attempt to re-exec failed");
}
| unsigned long my_re_exec()
{
int v0;
int v1;
int fd;
long i;
void **inited;
sigset_t set;
sigset_t oset;
unsigned long v8;
v8 = __readfsqword(0x28u);
if ( strchr("S0123456", runlevel) )
{
alarm(0);
sigfillset(&set);
sigprocmask(0, &set, &oset);
fd = make_pipe(11);
if ( fd < 0 )
{
sigprocmask(2, &oset, 0LL);
initlog(1, "Attempt to re-exec failed");
}
fail_cancel();
if ( pipe_fd >= 0 )
close(pipe_fd);
pipe_fd = -1;
got_signals &= ~0x20000u;
got_signals &= ~2u;
v0 = got_signals;
BYTE1(v0) = BYTE1(got_signals) & 0xFB;
got_signals = v0;
v1 = got_signals;
BYTE1(v1) = BYTE1(got_signals) & 0xEF;
got_signals = v1;
for ( i = family; i; i = *(_QWORD *)(i + 192) )
{
if ( (*(_DWORD *)i & 0x40) != 0 )
{
*(_DWORD *)i &= 0xFFFFFF9D;
if ( *(_BYTE *)(i + 52) != 43 )
write_utmp_wtmp(&unk_7481, i + 28, *(unsigned int *)(i + 8), 8LL, 0LL);
}
}
if ( !fork() )
{
send_state(fd);
exit(0);
}
inited = (void **)init_buildenv(0);
execle(myname, myname, "--init", 0LL, inited);
init_freeenv(inited);
close(fd);
close(11);
sigprocmask(2, &oset, 0LL);
initlog(1, "Attempt to re-exec failed");
}
return __readfsqword(0x28u) ^ v8;
}
|
inline static int is_ip(const char *hostname)
{
int len = strlen(hostname);
if (strchr(hostname, ':') != 0)
return 1;
else if (len > 2 && c_isdigit(hostname[0]) && c_isdigit(hostname[len-1]))
return 1;
return 0;
}
| _BOOL8 is_ip(const char *a1)
{
int v2;
v2 = strlen(a1);
if ( strchr(a1, 58) )
return 1LL;
return v2 > 2 && (unsigned char)c_isdigit((unsigned int)*a1) && (unsigned char)c_isdigit((unsigned int)a1[v2 - 1]);
}
|
int
acl_add_perm(acl_permset_t permset_d, acl_perm_t perm)
{
acl_permset_obj *acl_permset_obj_p = ((acl_permset_obj *)__ext2int_and_check(permset_d, (0x1ED5)));
if (!acl_permset_obj_p || (perm & ~((0x04)|(0x02)|(0x01))))
return -1;
acl_permset_obj_p->i.s_perm |= perm;
return 0;
}
| long long acl_add_perm(unsigned long long a0, unsigned long a1) {
struct_0 *v0;
unsigned long long v2;
v0 = __ext2int_and_check(a0, 0x1ed5);
if (v0 && !(a1 & -8)) {
v0->field_8 = v0->field_8 | a1;
v2 = 0;
}
if (!v0 || (a1 & -8))
v2 = 4294967295;
return v2;
}
|
static void
dump_cfg_fmtint(ServerOpCodes code, int val)
{
printf("%s %s\n", lookup_opcode_name(code), fmt_intarg(code, val));
}
| int dump_cfg_fmtint(unsigned int a1, int a2)
{
const char *v2;
const char *v3;
v2 = fmt_intarg(a1, a2);
v3 = lookup_opcode_name(a1);
return printf("%s %s\n", v3, v2);
}
|
static void print_fp_stats(const char *prefix,
const char *names[], unsigned int num,
struct rtattr *stats[])
{
unsigned int i;
int pad;
printf("%sstats:", prefix);
for (i = 1; i < num; i++) {
if (!names[i])
continue;
printf(" %s", names[i]);
}
printf("\n%s ", prefix);
for (i = 1; i < num; i++) {
if (!names[i])
continue;
pad = strlen(names[i]) + 1;
if (stats[i])
printf("%*llu", pad, getattr_u64(stats[i]));
else
printf("%*c", pad, '-');
}
printf("\n");
}
| void print_fp_stats(unsigned long a0, unsigned long long *a1, unsigned long a2, unsigned long long *a3) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
printf("%sstats:", a0);
for (v0 = 1; v0 < a2; v0 += 1) {
if (a1[v0])
printf(" %s", a1[v0]);
}
printf("\n%s ", a0);
for (v0 = 1; v0 < a2; v0 += 1) {
if (a1[v0]) {
v1 = strlen(a1[v0]) + 1;
if (a3[v0]) {
getattr_u64(a3[v0]);
printf("%*llu");
} else {
printf("%*c");
}
}
}
v3 = printf("\n");
return;
}
|
void *
ssh_get_app_data(struct ssh *ssh)
{
return ssh->app_data;
}
| undefined8 ssh_get_app_data(long param_1)
{
return *(undefined8 *)(param_1 + 0x870);
}
|
static
void uInt64_from_UInt32s ( UInt64* n, UInt32 lo32, UInt32 hi32 )
{
n->b[7] = (UChar)((hi32 >> 24) & 0xFF);
n->b[6] = (UChar)((hi32 >> 16) & 0xFF);
n->b[5] = (UChar)((hi32 >> 8) & 0xFF);
n->b[4] = (UChar) (hi32 & 0xFF);
n->b[3] = (UChar)((lo32 >> 24) & 0xFF);
n->b[2] = (UChar)((lo32 >> 16) & 0xFF);
n->b[1] = (UChar)((lo32 >> 8) & 0xFF);
n->b[0] = (UChar) (lo32 & 0xFF);
}
| void uInt64_from_UInt32s(undefined *param_1,undefined4 param_2,undefined4 param_3)
{
param_1[7] = (char)((uint)param_3 >> 0x18);
param_1[6] = (char)((uint)param_3 >> 0x10);
param_1[5] = (char)((uint)param_3 >> 8);
param_1[4] = (char)param_3;
param_1[3] = (char)((uint)param_2 >> 0x18);
param_1[2] = (char)((uint)param_2 >> 0x10);
param_1[1] = (char)((uint)param_2 >> 8);
*param_1 = (char)param_2;
return;
}
|
em_inc_search_next(EditLine *el, wint_t c __attribute__((__unused__)))
{
el->el_search.patlen = 0;
return ce_inc_search(el, 23);
}
| long long em_inc_search_next(struct_0 *a0, unsigned long a1) {
unsigned int v0;
v0 = a1;
a0->field_4a0 = 0;
return ce_inc_search(a0, 0x17);
}
|
struct sshkey *
get_hostkey_public_by_index(int ind, struct ssh *ssh)
{
if (ind < 0 || (u_int)ind >= options.num_host_key_files)
return (
((void *)0)
);
return (sensitive_data.host_pubkeys[ind]);
}
| undefined8 get_hostkey_public_by_index(uint param_1)
{
undefined8 uVar1;
if (((int)param_1 < 0) || (options._1088_4_ <= param_1)) {
uVar1 = 0;
}
else {
uVar1 = *(undefined8 *)(sensitive_data._8_8_ + (long)(int)param_1 * 8);
}
return uVar1;
}
|
_Bool
in_force(int flags)
{
return (flags & force_flags) == flags;
}
| bool in_force(int a1)
{
return a1 == (a1 & force_flags);
}
|
static void ZKeyGen(unsigned char *pk,unsigned char *sk)
{
Fq h[761];
small f[761],v[761];
KeyGen(h,f,v);
Rq_encode(pk,h);
Small_encode(sk,f); sk += ((761 +3)/4);
Small_encode(sk,v);
}
| void ZKeyGen(unsigned long long a0, unsigned long long a1) {
unsigned long long v0;
char v1;
char v2;
char v3;
char v4;
unsigned long long *v6;
unsigned long long v7;
v0 = a1;
KeyGen(&v1, &v2, &v3);
Rq_encode(a0, &v1);
Small_encode(v0, &v2);
v0 += 191;
Small_encode(v0, &v3);
v7 = *(&v4) ^ v6[5];
return;
}
|
int
parse_ipqos(const char *cp)
{
u_int i;
char *ep;
long val;
if (cp ==
((void *)0)
)
return -1;
for (i = 0; ipqos[i].name !=
((void *)0)
; i++) {
if (strcasecmp(cp, ipqos[i].name) == 0)
return ipqos[i].value;
}
val = strtol(cp, &ep, 0);
if (*cp == '\0' || *ep != '\0' || val < 0 || val > 255)
return -1;
return val;
}
| ulong parse_ipqos(char *param_1)
{
int iVar1;
ulong uVar2;
long in_FS_OFFSET;
uint local_24;
char *local_20;
ulong local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (param_1 == (char *)0x0) {
uVar2 = 0xffffffff;
}
else {
local_24 = 0;
while (*(long *)(ipqos + (ulong)local_24 * 0x10) != 0) {
iVar1 = strcasecmp(param_1,*(char **)(ipqos + (ulong)local_24 * 0x10));
if (iVar1 == 0) {
uVar2 = (ulong)*(uint *)(ipqos + (ulong)local_24 * 0x10 + 8);
goto LAB_00104b1f;
}
local_24 = local_24 + 1;
}
local_18 = strtol(param_1,&local_20,0);
if ((((*param_1 == '\0') || (*local_20 != '\0')) || ((long)local_18 < 0)) ||
(uVar2 = local_18, 0xff < (long)local_18)) {
uVar2 = 0xffffffff;
}
}
LAB_00104b1f:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar2;
}
__stack_chk_fail();
}
|
static inline const char *rta_getattr_str(const struct rtattr *rta)
{
return (const char *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| int rta_getattr_str(unsigned long a0) {
return a0 + 4;
}
|
static inline void
emit_mandatory_arg_note (void)
{
fputs_unlocked (gettext ("\nMandatory arguments to long options are mandatory for short options too.\n"),
stdout
)
;
}
| void emit_mandatory_arg_note() {
unsigned long long v1;
v1 = fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory for short options too.\n"), stdout);
return;
}
|
int ssh_digest_final(struct ssh_digest_ctx *ctx, u_char *d, size_t dlen)
__attribute__(());
void ssh_digest_free(struct ssh_digest_ctx *ctx);
const char *ssh_err(int n);
struct ssh_digest_ctx {
int alg;
EVP_MD_CTX *mdctx;
};
| undefined8 ssh_digest_final(undefined4 *param_1,uchar *param_2,ulong param_3)
{
int iVar1;
undefined8 uVar2;
long in_FS_OFFSET;
uint local_1c;
long local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = ssh_digest_by_alg(*param_1);
local_1c = (uint)param_3;
if ((local_18 == 0) || (0xffffffff < param_3)) {
uVar2 = 0xfffffff6;
}
else if (param_3 < *(ulong *)(local_18 + 0x10)) {
uVar2 = 0xfffffff6;
}
else {
iVar1 = EVP_DigestFinal_ex(*(EVP_MD_CTX **)(param_1 + 2),param_2,&local_1c);
if (iVar1 == 1) {
if ((ulong)local_1c == *(ulong *)(local_18 + 0x10)) {
uVar2 = 0;
}
else {
uVar2 = 0xffffffff;
}
}
else {
uVar2 = 0xffffffea;
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
}
|
int
rl_stop_output (int count, int key)
{
int fildes = fileno (rl_instream);
tcflow (fildes,
0
);
return 0;
}
| long long rl_stop_output(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
v1 = a0;
v0 = a1;
v2 = fileno(rl_instream);
tcflow(v2, 0x0);
return 0;
}
|
static char *
format_key(const struct sshkey *key)
{
char *ret, *fp = sshkey_fingerprint(key,
options.fingerprint_hash, SSH_FP_DEFAULT);
xasprintf(&ret, "%s %s", sshkey_type(key), fp);
free(fp);
return ret;
}
| int format_key(unsigned long long a0) {
char v0;
void* v1;
v1 = sshkey_fingerprint(a0, *(5250728), 0x0, *(5250728));
xasprintf(&v0, "%s %s", sshkey_type(a0), v1);
free(v1);
return *(&v0);
}
|
inline void ext2fs_mark_bb_dirty(ext2_filsys fs)
{
fs->flags |= 0x20 | 0x02;
}
| void ext2fs_mark_bb_dirty(void)
{
halt_baddata();
}
|
static int filecopy(const char *src, const char *dst)
{
FILE *fp, *fp2;
char line[5 * 1024];
char *p;
fp = fopen(dst, "w");
if (fp ==
((void *)0)
) {
fprintf(
stderr
, "Cannot open '%s' for write\n", dst);
return -1;
}
fp2 = fopen(src, "r");
if (fp2 ==
((void *)0)
) {
fclose(fp);
return 0;
}
line[sizeof(line) - 1] = 0;
do {
p = fgets(line, sizeof(line) - 1, fp2);
if (p ==
((void *)0)
)
break;
fputs(line, fp);
}
while (1);
fclose(fp);
fclose(fp2);
return 0;
}
| int filecopy(char *a0, char *a1) {
void* v0;
void* v1;
unsigned long v2;
char v3;
unsigned long long v4;
char v5;
unsigned int v7;
v4 = *(&v4);
v0 = fopen(a1, "w");
if (!v0) {
fprintf(stderr, "Cannot open '%s' for write\n", a1);
v7 = -1;
return v7;
}
v1 = fopen(a0, "r");
if (!v1) {
fclose(v0);
v7 = 0;
return v7;
}
v5 = 0;
while (true) {
v2 = fgets(&v3, 0x13ff, v1);
if (!v2)
break;
fputs(&v3, v0);
}
fclose(v0);
fclose(v1);
v7 = 0;
return v7;
}
|
pointer
ckrealloc(pointer p, size_t nbytes)
{
p = realloc(p, nbytes);
if (p ==
((void *)0)
)
sh_error("Out of space");
return p;
}
| void * ckrealloc(void *a1, size_t a2)
{
void *ptr;
ptr = realloc(a1, a2);
if ( !ptr )
sh_error("Out of space");
return ptr;
}
|
static
void signal_handler(int sig)
{
((got_signals) |= (1 << (sig)));
}
| long long signal_handler(unsigned long a0) {
oops_error = 874961156424106824 | (1 << (a0 & 31));
return 874961156424106824 | (1 << (a0 & 31));
}
|
int
sh_mbsnlen(src, srclen, maxlen)
const char *src;
size_t srclen;
int maxlen;
{
int count;
int sind;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
for (sind = count = 0; src[sind]; )
{
count++;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((src)[sind]); if (_f) mblength = 1; else if (locale_utf8locale && (((src)[sind] & 0x80) == 0)) mblength = (src)[sind] != 0; else { state_bak = state; mblength = mbrlen ((src) + (sind), (srclen) - (sind), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (sind)++; } else if (mblength == 0) (sind)++; else (sind) += mblength; } else (sind)++; } while (0);
if (sind > maxlen)
break;
}
return count;
}
| int sh_mbsnlen(long param_1,long param_2,int param_3)
{
int iVar1;
long in_FS_OFFSET;
int local_34;
int local_30;
ulong local_28;
mbstate_t local_20;
mbstate_t local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
memset(&local_20,0,8);
local_34 = 0;
local_30 = 0;
do {
if (*(char *)(param_1 + local_30) == '\0') break;
local_34 = local_34 + 1;
if (locale_mb_cur_max < 2) {
local_30 = local_30 + 1;
}
else {
iVar1 = is_basic((int)*(char *)(param_1 + local_30));
if (iVar1 == 0) {
if ((locale_utf8locale == 0) || (*(char *)(param_1 + local_30) < '\0')) {
local_18 = local_20;
local_28 = mbrlen((char *)(local_30 + param_1),param_2 - local_30,&local_20);
}
else {
local_28 = (ulong)(*(char *)(param_1 + local_30) != '\0');
}
}
else {
local_28 = 1;
}
if ((local_28 == 0xfffffffffffffffe) || (local_28 == 0xffffffffffffffff)) {
local_20 = local_18;
local_30 = local_30 + 1;
}
else if (local_28 == 0) {
local_30 = local_30 + 1;
}
else {
local_30 = local_30 + (int)local_28;
}
}
} while (local_30 <= param_3);
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_34;
}
__stack_chk_fail();
}
|
_Bool
xheader_string_end (struct xheader *xhdr, char const *keyword)
{
uintmax_t len;
uintmax_t p;
uintmax_t n = 0;
size_t size;
char nbuf[((((((sizeof (uintmax_t) * 8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)];
char const *np;
char *cp;
if (xhdr->buffer)
return
0
;
xheader_init (xhdr);
len = strlen (keyword) + xhdr->string_length + 3;
do
{
p = n;
np = umaxtostr (len + p, nbuf);
n = nbuf + sizeof nbuf - 1 - np;
}
while (n != p);
p = strlen (keyword) + n + 2;
size = p;
if (size != p)
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Generated keyword/value pair is too long (keyword=%s, length=%s)"), keyword, nbuf); exit_status = 2; } while (0)
;
__extension__ ({ struct obstack *__o = (xhdr->stk); void *__obj = (void *) (__extension__ ({ struct obstack *__o1 = (xhdr->stk); void *__value = (void *) __o1->object_base; if (__o1->next_free == __value) __o1->maybe_empty_object = 1; __o1->next_free = ((sizeof (ptrdiff_t) < sizeof (void *) ? (__o1->object_base) : (char *) 0) + (((__o1->next_free) - (sizeof (ptrdiff_t) < sizeof (void *) ? (__o1->object_base) : (char *) 0) + (__o1->alignment_mask)) & ~(__o1->alignment_mask))); if ((size_t) (__o1->next_free - (char *) __o1->chunk) > (size_t) (__o1->chunk_limit - (char *) __o1->chunk)) __o1->next_free = __o1->chunk_limit; __o1->object_base = __o1->next_free; __value; })); if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) __o->next_free = __o->object_base = (char *) __obj; else _obstack_free (__o, __obj); });
return
0
;
}
x_obstack_blank (xhdr, p);
x_obstack_1grow (xhdr, '\n');
cp = (char*) ((void *) (xhdr->stk)->next_free) - xhdr->string_length - p - 1;
memmove (cp + p, cp, xhdr->string_length);
cp = stpcpy (cp, np);
*cp++ = ' ';
cp = stpcpy (cp, keyword);
*cp++ = '=';
return
1
;
}
| long xheader_string_end(long a1, const char *a2)
{
char *v3;
_BYTE *v4;
size_t v5;
_BYTE *v6;
unsigned long v7;
char *v8;
void *src;
char v10[20];
_BYTE v11[12];
*(_QWORD *)&v11[4] = __readfsqword(0x28u);
v4 = 0LL;
if ( *(_QWORD *)(a1 + 16) )
return 0LL;
xheader_init((struct obstack **)a1);
v5 = *(_QWORD *)(a1 + 24) + strlen(a2) + 3;
do
{
v6 = v4;
v8 = (char *)umaxtostr(&v4[v5], v10);
v4 = (_BYTE *)(v11 - v8);
}
while ( (_BYTE *)(v11 - v8) != v6 );
v7 = (unsigned long)&v4[strlen(a2) + 2];
x_obstack_blank(a1, v7);
x_obstack_1grow(a1, 10);
src = (void *)(*(_QWORD *)(*(_QWORD *)a1 + 24LL) + -*(_QWORD *)(a1 + 24) - v7 - 1);
memmove((void *)(*(_QWORD *)(*(_QWORD *)a1 + 24LL) + -*(_QWORD *)(a1 + 24) - 1LL), src, *(_QWORD *)(a1 + 24));
v3 = stpcpy((char *)src, v8);
*v3 = 32;
*stpcpy(v3 + 1, a2) = 61;
return 1LL;
}
|
static int ipntable_show(int argc, char **argv)
{
ipntable_reset_filter();
filter.family = preferred_family;
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (strcmp("none", *argv) == 0)
filter.index = (-1);
else if ((filter.index = ll_name_to_index(*argv)) == 0)
invarg("\"DEV\" is invalid", *argv);
} else if (strcmp(*argv, "name") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
filter.name = *argv;
} else
invarg("unknown", *argv);
argc--; argv++;
}
if (rtnl_neightbldump_req(&rth, preferred_family) < 0) {
perror("Cannot send dump request");
exit(1);
}
new_json_obj(json);
if (rtnl_dump_filter_nc(&rth, print_ntable,
stdout
, 0) < 0) {
fprintf(
stderr
, "Dump terminated\n");
exit(1);
}
delete_json_obj();
return 0;
}
| undefined8 ipntable_show(int param_1,char **param_2)
{
int iVar1;
char **local_18;
int local_c;
ipntable_reset_filter();
filter._0_4_ = preferred_family;
local_18 = param_2;
local_c = param_1;
do {
if (local_c < 1) {
iVar1 = rtnl_neightbldump_req(&rth,preferred_family);
if (iVar1 < 0) {
perror("Cannot send dump request");
exit(1);
}
new_json_obj(json);
iVar1 = rtnl_dump_filter_nc(&rth,print_ntable,stdout,0);
if (iVar1 < 0) {
fprintf(stderr,"Dump terminated\n");
exit(1);
}
delete_json_obj();
return 0;
}
iVar1 = strcmp(*local_18,"dev");
if (iVar1 == 0) {
local_18 = local_18 + 1;
local_c = local_c + -1;
if (local_c < 1) {
incomplete_command();
}
iVar1 = strcmp("none",*local_18);
if (iVar1 == 0) {
filter._4_4_ = -1;
}
else {
filter._4_4_ = ll_name_to_index(*local_18);
if (filter._4_4_ == 0) {
invarg("\"DEV\" is invalid",*local_18);
goto LAB_00101f35;
}
}
}
else {
LAB_00101f35:
iVar1 = strcmp(*local_18,"name");
if (iVar1 == 0) {
local_18 = local_18 + 1;
local_c = local_c + -1;
if (local_c < 1) {
incomplete_command();
}
filter._8_8_ = *local_18;
}
else {
invarg("unknown",*local_18);
}
}
local_c = local_c + -1;
local_18 = local_18 + 1;
} while( true );
}
|
static void
channel_pre_connecting(struct ssh *ssh, Channel *c)
{
sshlog("channels.c", __func__, 1108, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "channel %d: waiting for connection", c->self);
c->io_want = 0x20;
}
| long long channel_pre_connecting(unsigned long a0, unsigned int a1[12]) {
unsigned long v0;
unsigned long v1;
v1 = a0;
v0 = a1[1];
sshlog("channels.c", "channel_pre_connecting", 0x454, 0x0, 0x7, 0x0, "channel %d: waiting for connection");
a1[11] = 32;
return a1;
}
|
char *
extract_process_subst (string, starter, sindex, xflags)
char *string;
char *starter;
int *sindex;
int xflags;
{
xflags |= (no_longjmp_on_fatal_error ? 0x0040 : 0);
return (xparse_dolparen (string, string+*sindex, sindex, xflags));
}
| long extract_process_subst(long a1, long a2, int *a3, unsigned int a4)
{
int v4;
if ( no_longjmp_on_fatal_error )
v4 = 64;
else
v4 = 0;
return xparse_dolparen(a1, *a3 + a1, a3, v4 | a4);
}
|
size_t
xmbsrtowcs (dest, src, len, pstate)
wchar_t *dest;
const char **src;
size_t len;
mbstate_t *pstate;
{
mbstate_t *ps;
size_t mblength, wclength, n;
ps = pstate;
if (pstate ==
((void *)0)
)
{
if (!local_state_use)
{
memset (&local_state, '\0', sizeof(mbstate_t));
local_state_use = 1;
}
ps = &local_state;
}
n = strlen (*src);
if (dest ==
((void *)0)
)
{
wchar_t *wsbuf;
const char *mbs;
mbstate_t psbuf;
wsbuf = (wchar_t *) malloc ((n + 1) * sizeof(wchar_t));
mbs = *src;
psbuf = *ps;
wclength = mbsrtowcs (wsbuf, &mbs, n, &psbuf);
if (wsbuf)
free (wsbuf);
return wclength;
}
for (wclength = 0; wclength < len; wclength++, dest++)
{
if (mbsinit(ps))
{
if (**src == '\0')
{
*dest = L'\0';
*src =
((void *)0)
;
return (wclength);
}
else if (**src == '\\')
{
*dest = L'\\';
mblength = 1;
}
else
mblength = mbrtowc(dest, *src, n, ps);
}
else
mblength = mbrtowc(dest, *src, n, ps);
if (mblength == (size_t)-1 || mblength == (size_t)-2)
return (size_t)-1;
*src += mblength;
n -= mblength;
if (*dest == L'\0')
{
*src =
((void *)0)
;
break;
}
}
return (wclength);
}
| long long xmbsrtowcs(unsigned long long a0, char **a1, unsigned long a2, unsigned long long a3) {
unsigned long long *v0;
unsigned int *v1;
char *v2;
unsigned long long v3;
unsigned long long v4;
void* v5;
unsigned long long v6;
void* v7;
unsigned long v8;
unsigned long long v10;
v1 = a0;
v0 = a1;
v3 = a3;
if (!a3) {
if (!local_state_use) {
memset(&local_state, 0x0, 0x8);
local_state_use = 1;
}
v3 = &local_state;
}
v6 = strlen(*(a1));
if (!v1) {
v7 = malloc((v6 + 1) * 4);
v2 = *(a1);
v8 = *(v3);
v5 = mbsrtowcs(v7, &v2, v6, &v8);
if (v7)
free(v7);
v10 = v5;
return v10;
} else {
v5 = 0;
while (true) {
if (v5 >= a2)
break;
if (!mbsinit(v3)) {
v4 = mbrtowc(v1, *(a1), v6, v3);
} else {
switch (*(*(a1))) {
case 0:
*(v1) = 0;
*(a1) = 0;
v10 = v5;
return v10;
case 92:
*(v1) = 92;
v4 = 1;
break;
default:
v4 = mbrtowc(v1, *(a1), v6, v3);
break;
}
}
if (v4 == -1) {
v10 = -1;
return v10;
}
if (v4 == -2) {
v10 = -1;
return v10;
}
*(a1) = &(*(a1))[v4];
v6 -= v4;
if (*(v1)) {
v5 += 1;
v1 += 1;
} else {
*(a1) = 0;
break;
}
}
v10 = v5;
return v10;
}
}
|
int
sshkey_load_private(const char *filename, const char *passphrase,
struct sshkey **keyp, char **commentp)
{
return sshkey_load_private_type(KEY_UNSPEC, filename, passphrase,
keyp, commentp);
}
| long long sshkey_load_private(unsigned int a0, unsigned long long a1, unsigned long long *a2, unsigned long long *a3) {
return sshkey_load_private_type(0xe, a0, a1, a2, a3);
}
|
static void
process_del(void)
{
char *name, *pin;
struct sshbuf *msg;
int r;
if ((msg = sshbuf_new()) ==
((void *)0)
)
sshfatal("ssh-pkcs11-helper.c", __func__, 170, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
if ((r = sshbuf_get_cstring(iqueue, &name,
((void *)0)
)) != 0 ||
(r = sshbuf_get_cstring(iqueue, &pin,
((void *)0)
)) != 0)
sshfatal("ssh-pkcs11-helper.c", __func__, 173, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse");
del_keys_by_name(name);
if ((r = sshbuf_put_u8(msg, pkcs11_del_provider(name) == 0 ?
6 : 5)) != 0)
sshfatal("ssh-pkcs11-helper.c", __func__, 177, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose");
free(pin);
free(name);
send_msg(msg);
sshbuf_free(msg);
}
| void process_del() {
unsigned long long v0;
unsigned int v1;
char v2;
char v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v8;
unsigned long long *v9;
unsigned long long v10;
v4 = sshbuf_new();
if (!v4) {
v0 = "sshbuf_new failed";
sshfatal("ssh-pkcs11-helper.c", "process_del", 0xaa, 0x1, 0x1, 0x0);
}
v1 = sshbuf_get_cstring(0xe87d894830ec8348, &v2, 0x0, &v2);
if (!v1)
v1 = sshbuf_get_cstring(0xe87d894830ec8348, &v3, 0x0, &v3);
if (v1 || v1) {
v5 = "parse";
sshfatal("ssh-pkcs11-helper.c", "process_del", 0xad, 0x1, 0x1, ssh_err(v1));
}
del_keys_by_name(*(&v2));
if (!pkcs11_del_provider(*(&v2)))
v8 = 6;
else
v8 = 5;
v1 = sshbuf_put_u8(v4, v8);
if (v1) {
v5 = "compose";
sshfatal("ssh-pkcs11-helper.c", "process_del", 0xb1, 0x1, 0x1, ssh_err(v1));
}
free(*(&v3));
free(*(&v2));
send_msg(v4);
sshbuf_free(v4);
v10 = v5 ^ v9[5];
return;
}
|
struct sshkey *
get_hostkey_by_index(int ind)
{
if (ind < 0 || (u_int)ind >= options.num_host_key_files)
return (
((void *)0)
);
return (sensitive_data.host_keys[ind]);
}
| long long get_hostkey_by_index(unsigned long a0) {
void* v1;
if (a0 < 0) {
v1 = 0;
return v1;
} else if (1221591368 <= a0) {
v1 = 0;
return v1;
} else {
v1 = *((0x7097058d480000 + a0 * 8));
return v1;
}
}
|
int
dehumanize_number(const char *buf, int64_t *num)
{
uint64_t rval, rmax;
int sign = +1;
int rc;
while (
((*__ctype_b_loc ())[(int) ((
*buf
))] & (unsigned short int) _ISspace)
)
buf++;
if (*buf == '-') {
sign = -1;
buf++;
}
rc = expand_number(buf, &rval);
if (rc < 0)
return rc;
rmax =
(9223372036854775807L)
+ 1ULL;
if (rval > rmax || (rval == rmax && sign == +1)) {
(*__errno_location ())
=
34
;
return -1;
}
*num = rval * sign;
return 0;
}
| long long dehumanize_number(unsigned long long a0, unsigned long long *a1) {
char *v0;
unsigned int v1;
unsigned int v2;
char v3;
unsigned long long v4;
unsigned int v7;
unsigned long long v8;
v0 = a0;
v1 = 1;
while (true) {
v7 = *((*(v0) * 2 + *(__ctype_b_loc()))) & 0x2000;
if (!v7)
break;
v0 += 1;
}
if (*(v0) == 45) {
v1 = -1;
v0 += 1;
}
v2 = expand_number(v0, &v3, &v3);
if (v2 < 0) {
v8 = v2;
} else {
v4 = 0x8000000000000000;
if (v4 > *(&v3) || v4 == *(&v3) && v1 != 1 && v4 >= *(&v3)) {
*(a1) = v1 * *(&v3);
v8 = 0;
}
if (v4 < *(&v3) || v4 == *(&v3) && v1 == 1) {
*(__errno_location()) = 34;
v8 = 4294967295;
}
}
return v8;
}
|
int
rl_rubout (int count, int key)
{
if (count < 0)
return (rl_delete (-count, key));
if (!rl_point)
{
rl_ding ();
return 1;
}
if (rl_insert_mode == 0)
return (_rl_overwrite_rubout (count, key));
return (_rl_rubout_char (count, key));
}
| undefined8 rl_rubout(int param_1,undefined4 param_2)
{
undefined8 uVar1;
if (param_1 < 0) {
uVar1 = rl_delete(-param_1,param_2);
}
else if (rl_point == 0) {
rl_ding();
uVar1 = 1;
}
else if (rl_insert_mode == 0) {
uVar1 = _rl_overwrite_rubout(param_1,param_2);
}
else {
uVar1 = _rl_rubout_char(param_1,param_2);
}
return uVar1;
}
|
static void
help(void)
{
printf("Available commands:\n"
"bye Quit sftp\n"
"cd path Change remote directory to 'path'\n"
"chgrp [-h] grp path Change group of file 'path' to 'grp'\n"
"chmod [-h] mode path Change permissions of file 'path' to 'mode'\n"
"chown [-h] own path Change owner of file 'path' to 'own'\n"
"copy oldpath newpath Copy remote file\n"
"cp oldpath newpath Copy remote file\n"
"df [-hi] [path] Display statistics for current directory or\n"
" filesystem containing 'path'\n"
"exit Quit sftp\n"
"get [-afpR] remote [local] Download file\n"
"help Display this help text\n"
"lcd path Change local directory to 'path'\n"
"lls [ls-options [path]] Display local directory listing\n"
"lmkdir path Create local directory\n"
"ln [-s] oldpath newpath Link remote file (-s for symlink)\n"
"lpwd Print local working directory\n"
"ls [-1afhlnrSt] [path] Display remote directory listing\n"
"lumask umask Set local umask to 'umask'\n"
"mkdir path Create remote directory\n"
"progress Toggle display of progress meter\n"
"put [-afpR] local [remote] Upload file\n"
"pwd Display remote working directory\n"
"quit Quit sftp\n"
"reget [-fpR] remote [local] Resume download file\n"
"rename oldpath newpath Rename remote file\n"
"reput [-fpR] local [remote] Resume upload file\n"
"rm path Delete remote file\n"
"rmdir path Remove remote directory\n"
"symlink oldpath newpath Symlink remote file\n"
"version Show SFTP version\n"
"!command Execute 'command' in local shell\n"
"! Escape to local shell\n"
"? Synonym for help\n");
}
| int help()
{
return printf(
"Available commands:\n"
"bye Quit sftp\n"
"cd path Change remote directory to 'path'\n"
"chgrp [-h] grp path Change group of file 'path' to 'grp'\n"
"chmod [-h] mode path Change permissions of file 'path' to 'mode'\n"
"chown [-h] own path Change owner of file 'path' to 'own'\n"
"copy oldpath newpath Copy remote file\n"
"cp oldpath newpath Copy remote file\n"
"df [-hi] [path] Display statistics for current directory or\n"
" filesystem containing 'path'\n"
"exit Quit sftp\n"
"get [-afpR] remote [local] Download file\n"
"help Display this help text\n"
"lcd path Change local directory to 'path'\n"
"lls [ls-options [path]] Display local directory listing\n"
"lmkdir path Create local directory\n"
"ln [-s] oldpath newpath Link remote file (-s for symlink)\n"
"lpwd Print local working directory\n"
"ls [-1afhlnrSt] [path] Display remote directory listing\n"
"lumask umask Set local umask to 'umask'\n"
"mkdir path Create remote directory\n"
"progress Toggle display of progress meter\n"
"put [-afpR] local [remote] Upload file\n"
"pwd Display remote working directory\n"
"quit Quit sftp\n"
"reget [-fpR] remote [local] Resume download file\n"
"rename oldpath newpath Rename remote file\n"
"reput [-fpR] local [remote] Resume upload file\n"
"rm path Delete remote file\n"
"rmdir path Remove remote directory\n"
"symlink oldpath newpath Symlink remote file\n"
"version Show SFTP version\n"
"!command Execute 'command' in local shell\n"
"! Escape to local shell\n"
"? Synonym for help\n");
}
|
static size_t
count_newlines (char *buf, size_t bufsize)
{
size_t count = 0;
char *p;
char *lim = buf + bufsize;
char ch = *lim;
*lim = '\n';
for (p = buf; (p = rawmemchr (p, '\n')) != lim; p++)
count++;
*lim = ch;
return count;
}
| int count_newlines(void* a0, unsigned long a1) {
char v0;
void* v1;
void* v2;
char *v3;
v1 = 0;
v3 = a1 + a0;
v0 = *(v3);
*(v3) = 10;
v2 = a0;
while (true) {
v2 = rawmemchr(v2, 0xa);
if (v2 == v3)
break;
v1 += 1;
v2 += 1;
}
*(v3) = v0;
return v1;
}
|
static int
parse_xform_flags (int *pflags, int c)
{
switch (c)
{
case 'r':
*pflags |= 0x01;
break;
case 'R':
*pflags &= ~0x01;
break;
case 'h':
*pflags |= 0x02;
break;
case 'H':
*pflags &= ~0x02;
break;
case 's':
*pflags |= 0x04;
break;
case 'S':
*pflags &= ~0x04;
break;
default:
return 1;
}
return 0;
}
| int parse_xform_flags(unsigned int *a0, unsigned long a1) {
unsigned int *v0;
unsigned int v2;
v0 = a0;
switch (a1) {
case 72:
*(a0) = *(a0) & -3;
break;
case 82:
*(a0) = *(a0) & -2;
break;
case 83:
*(a0) = *(a0) & -5;
break;
case 104:
*(a0) = *(a0) | 2;
break;
case 114:
*(a0) = *(a0) | 1;
break;
case 115:
*(a0) = *(a0) | 4;
break;
default:
v2 = 1;
goto LABEL_4002d3;
}
v2 = 0;
LABEL_4002d3:
return v2;
}
|
void
ipv64_normalise_mapped(struct sockaddr_storage *addr, socklen_t *len)
{
struct sockaddr_in6 *a6 = (struct sockaddr_in6 *)addr;
struct sockaddr_in *a4 = (struct sockaddr_in *)addr;
struct in_addr inaddr;
u_int16_t port;
if (addr->ss_family !=
10
||
!
(__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) (
&a6->sin6_addr
); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == htonl (0xffff); }))
)
return;
sshlog("canohost.c", __func__, 50, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "Normalising mapped IPv4 in IPv6 address");
memcpy(&inaddr, ((char *)&a6->sin6_addr) + 12, sizeof(inaddr));
port = a6->sin6_port;
memset(a4, 0, sizeof(*a4));
a4->sin_family =
2
;
*len = sizeof(*a4);
memcpy(&a4->sin_addr, &inaddr, sizeof(inaddr));
a4->sin_port = port;
}
| void ipv64_normalise_mapped(unsigned short a0[2], unsigned int *a1) {
unsigned long long v0;
unsigned short v1;
char v2;
unsigned short v3[2];
unsigned short v4[2];
unsigned int v5[3];
char v6;
unsigned int v8;
unsigned long long *v9;
unsigned long long v10;
*(&v3) = a0;
*(&v4) = a0;
if (a0[0] == 10) {
*(&v5[0]) = v3 + 2;
if (v5[0] || v5[1] || v5[2] != htonl(0xffff))
v8 = 0;
else
v8 = 1;
if (v8) {
v0 = "Normalising mapped IPv4 in IPv6 address";
sshlog("canohost.c", "ipv64_normalise_mapped", 0x32, 0x0, 0x7, 0x0);
memcpy(&v2, v3 + 5, 0x4);
v1 = v3[1];
memset(v4, 0x0, 0x10);
v4[0] = 2;
*(a1) = 16;
memcpy(v4 + 1, &v2, 0x4);
v4[1] = v1;
}
}
v10 = *(&v6) ^ v9[5];
return;
}
|
static int
spt_copyargs(int argc, char *argv[])
{
char *tmp;
int i;
for (i = 1; i < argc || (i >= argc && argv[i]); i++) {
if (argv[i] ==
((void *)0)
)
continue;
tmp = strdup(argv[i]);
if (tmp ==
((void *)0)
)
return
(*__errno_location ())
;
argv[i] = tmp;
}
return 0;
}
| int spt_copyargs(int param_1,long param_2)
{
char *pcVar1;
int *piVar2;
int local_14;
local_14 = 1;
while ((local_14 < param_1 ||
((param_1 <= local_14 && (*(long *)(param_2 + (long)local_14 * 8) != 0))))) {
if (*(long *)(param_2 + (long)local_14 * 8) != 0) {
pcVar1 = strdup(*(char **)(param_2 + (long)local_14 * 8));
if (pcVar1 == (char *)0x0) {
piVar2 = __errno_location();
return *piVar2;
}
*(char **)((long)local_14 * 8 + param_2) = pcVar1;
}
local_14 = local_14 + 1;
}
return 0;
}
|
int Clean_Line(char *source_line, char *output_line)
{
int source_index = 0, target_index = 0;
int source_max_index;
char a_letter;
int done;
char *garbage;
if (! source_line) return 0;
if (! output_line) return 0;
source_max_index = strlen(source_line);
while (source_index < source_max_index)
{
a_letter = source_line[source_index];
if (a_letter == '^')
{
done = 0;
while (! done)
{
source_index++;
if (source_index >= source_max_index)
done = 1;
else
{
a_letter = source_line[source_index];
if ( (a_letter == '.') || (a_letter == ' ') ||
(a_letter == '(') || (a_letter == 'd') ||
(a_letter == '\n') )
done = 1;
}
}
}
else if ( (a_letter == '?') && (source_line[source_index + 1] == '?') &&
(source_line[source_index + 2] == '7') )
{
source_index += 3;
output_line[target_index] = ' ';
target_index++;
}
else if ( (a_letter == '8') && (source_line[source_index + 1] == '?') &&
(source_line[source_index + 2] == '?') )
{
source_index += 3;
output_line[target_index] = ']';
target_index++;
}
else
{
output_line[target_index] = a_letter;
target_index++;
source_index++;
}
}
garbage = strstr(output_line, " .\n");
if (garbage)
{
garbage[0] = '\n';
garbage[1] = '\0';
}
return 1;
}
| int Clean_Line(char *a0, char *a1) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
char v5[2];
unsigned int v7;
v1 = 0;
v2 = 0;
if (!a0) {
v7 = 0;
} else if (!a1) {
v7 = 0;
} else {
v4 = strlen(a0);
while (v1 < v4) {
v0 = a0[v1];
if (v0 == 94) {
v3 = 0;
while (!v3) {
v1 += 1;
if (v1 >= v4) {
v3 = 1;
} else {
v0 = a0[v1];
if (v0 != 46 && v0 != 32 && v0 != 40 && v0 == 100)
continue;
v3 = 1;
}
}
} else {
if (v0 == 63 && a0[1 + v1] == 63 && a0[2 + v1] == 55) {
v1 += 3;
a1[v2] = 32;
v2 += 1;
continue;
}
if (a0[2 + v1] != 55 || v0 != 63 || a0[1 + v1] != 63) {
if (v0 == 56 && a0[1 + v1] == 63 && a0[2 + v1] == 63) {
v1 += 3;
a1[v2] = 93;
v2 += 1;
continue;
}
if (a0[2 + v1] != 63 || a0[1 + v1] != 63 || v0 != 56) {
a1[v2] = v0;
v2 += 1;
v1 += 1;
}
}
}
}
*(&v5) = strstr(a1, " .\n");
if (v5) {
v5[0] = 10;
v5[1] = 0;
}
v7 = 1;
}
return v7;
}
|
static struct keyfield *
key_init (struct keyfield *key)
{
memset (key, 0, sizeof *key);
key->eword =
(18446744073709551615UL)
;
return key;
}
| int key_init(struct_0 *a0) {
memset(a0, 0x0, 0x48);
a0->field_10 = -1;
return a0;
}
|
_Bool
pred_nogroup (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) pathname;
(void) pred_ptr;
return getgrgid (stat_buf->st_gid) ==
((void *)0)
;
}
| long long pred_nogroup(unsigned long a0, struct_0 *a1, unsigned long a2) {
unsigned long v0;
unsigned long v1;
unsigned long long v3;
v1 = a0;
v0 = a2;
v3 = getgrgid(a1->field_20);
*(&v3) = !v3;
return v3;
}
|
void
dpkg_selabel_load(void)
{
static int selinux_enabled = -1;
if (selinux_enabled < 0) {
int rc;
selinux_enabled = (in_force(FORCE_SECURITY_MAC) &&
is_selinux_enabled() > 0);
if (!selinux_enabled)
return;
rc = selinux_status_open(1);
if (rc < 0)
ohshit(gettext("cannot open security status notification channel"));
} else if (selinux_enabled && selinux_status_updated()) {
selabel_close(sehandle);
} else {
return;
}
sehandle = selabel_open(
0
,
((void *)0)
, 0);
if (sehandle ==
((void *)0)
&& security_getenforce() == 1)
ohshite(gettext("cannot get security labeling handle"));
}
| void dpkg_selabel_load(void)
{
char cVar1;
int iVar2;
undefined8 uVar3;
if (selinux_enabled_5706 < 0) {
cVar1 = in_force(0x4000000);
if ((cVar1 == '\0') || (iVar2 = is_selinux_enabled(), iVar2 < 1)) {
selinux_enabled_5706 = 0;
}
else {
selinux_enabled_5706 = 1;
}
if (selinux_enabled_5706 == 0) {
return;
}
iVar2 = selinux_status_open(1);
if (-1 < iVar2) goto LAB_0010009b;
uVar3 = gettext("cannot open security status notification channel");
ohshit(uVar3);
}
if (selinux_enabled_5706 == 0) {
return;
}
iVar2 = selinux_status_updated();
if (iVar2 == 0) {
return;
}
selabel_close(sehandle);
LAB_0010009b:
sehandle = selabel_open(0,0,0);
if ((sehandle == 0) && (iVar2 = security_getenforce(), iVar2 == 1)) {
uVar3 = gettext("cannot get security labeling handle");
ohshite(uVar3);
}
return;
}
|
const char *get_confirmed_pass(
_Bool
ign)
{
return getpass("Enter password: ");
}
| void get_confirmed_pass(void)
{
getpass("Enter password: ");
return;
}
|
static struct diff3_block *
using_to_diff3_block (struct diff_block *using[2],
struct diff_block *last_using[2],
int low_thread, int high_thread,
struct diff3_block const *last_diff3)
{
lin low[2], high[2];
struct diff3_block *result;
struct diff_block *ptr;
int d;
lin i;
lin lowc = ((using[low_thread])->ranges[1][0]);
lin highc = ((last_using[high_thread])->ranges[1][1]);
for (d = 0; d < 2; d++)
if (using[d])
{
low[d] = ((lowc) - (((using[d]))->ranges[(1)][0]) + (((using[d]))->ranges[(0)][0]));
high[d] = ((highc) - (((last_using[d]))->ranges[(1)][1]) + (((last_using[d]))->ranges[(0)][1]));
}
else
{
low[d] = ((lowc) - (((last_diff3))->ranges[(2)][1]) + (((last_diff3))->ranges[(0 + d)][1]));
high[d] = ((highc) - (((last_diff3))->ranges[(2)][1]) + (((last_diff3))->ranges[(0 + d)][1]));
}
result = create_diff3_block (low[0], high[0], low[1], high[1], lowc, highc);
for (d = 0; d < 2; d++)
for (ptr = using[d]; ptr; ptr = ((ptr)->next))
{
lin result_offset = ((ptr)->ranges[1][0]) - lowc;
if (!copy_stringlist (((ptr)->lines[1]),
((ptr)->lengths[1]),
((result)->lines[2]) + result_offset,
((result)->lengths[2]) + result_offset,
(((ptr)->ranges[1][1]) - ((ptr)->ranges[1][0]) + 1)))
return 0;
}
for (d = 0; d < 2; d++)
{
struct diff_block *u = using[d];
lin lo = low[d], hi = high[d];
for (i = 0;
i + lo < (u ? ((u)->ranges[0][0]) : hi + 1);
i++)
{
((result)->lines[0 + d][i]) = ((result)->lines[2][i]);
((result)->lengths[0 + d][i]) = ((result)->lengths[2][i]);
}
for (ptr = u; ptr; ptr = ((ptr)->next))
{
lin result_offset = ((ptr)->ranges[0][0]) - lo;
lin linec;
if (!copy_stringlist (((ptr)->lines[0]),
((ptr)->lengths[0]),
((result)->lines[0 + d]) + result_offset,
((result)->lengths[0 + d]) + result_offset,
(((ptr)->ranges[0][1]) - ((ptr)->ranges[0][0]) + 1)))
return 0;
linec = ((ptr)->ranges[1][1]) + 1 - lowc;
for (i = ((ptr)->ranges[0][1]) + 1 - lo;
i < (((ptr)->next) ? ((((ptr)->next))->ranges[0][0]) : hi + 1) - lo;
i++)
{
((result)->lines[0 + d][i]) = ((result)->lines[2][linec]);
((result)->lengths[0 + d][i]) = ((result)->lengths[2][linec]);
linec++;
}
}
}
if (!using[0])
((result)->correspond) = DIFF_2ND;
else if (!using[1])
((result)->correspond) = DIFF_1ST;
else
{
lin nl0 = (((result)->ranges[0][1]) - ((result)->ranges[0][0]) + 1);
lin nl1 = (((result)->ranges[1][1]) - ((result)->ranges[1][0]) + 1);
if (nl0 != nl1
|| !compare_line_list (((result)->lines[0]),
((result)->lengths[0]),
((result)->lines[1]),
((result)->lengths[1]),
nl0))
((result)->correspond) = DIFF_ALL;
else
((result)->correspond) = DIFF_3RD;
}
return result;
}
| int using_to_diff3_block(struct_3 *a0, unsigned long long *a1[4], unsigned long a2, unsigned long a3, struct_5 *a4) {
unsigned int v0;
struct_7 *v1;
unsigned long long *v2;
unsigned long long *v3;
unsigned long long v4;
unsigned long long v5;
struct_6 *v6;
unsigned long long v7;
unsigned long v8;
unsigned long long v9[9];
unsigned long v10;
unsigned long v11;
unsigned long v12;
unsigned long v13;
char v14;
char v15;
char v16;
char v17;
unsigned int v19;
unsigned long long v20;
v4 = (&a0->field_0)[a2]->field_10;
v5 = a1[a3 + 3];
for (v0 = 0; v0 <= 1; v0 += 1) {
if (!(&a0->field_0)[v0]) {
*(&(&v14)[8 * v0]) = v4 - a4->field_30 + *(&a4->padding_0[16 + 16 * v0]);
*(&(&v16)[8 * v0]) = v5 - a4->field_30 + *(&a4->padding_0[16 + 16 * v0]);
} else {
*(&(&v14)[8 * v0]) = v4 - (&a0->field_0)[v0]->field_10 + (&a0->field_0)[v0]->field_0;
*(&(&v16)[8 * v0]) = v5 - a1[v0 + 3] + a1[v0 + 1];
}
}
v6 = create_diff3_block(*(&v14), *(&v16), *(&v15), *(&v17), v4, v5);
v0 = 0;
while (true) {
if (v0 <= 1) {
v1[0] = (&a0->field_0)[v0];
while (true) {
if (!v1) {
v0 += 1;
break;
} else {
v13 = v1[2] - v4;
v19 = (copy_stringlist(v1[5], v1[7], v13 * 8 + v6->field_48, v6->field_60 + v13 * 8, v1[3] - v1[2] + 1) ^ 1);
if (v19) {
v19 = 0;
goto LABEL_4014ac;
} else {
v1[0] = v1[8];
}
}
}
} else {
v0 = 0;
while (v0 <= 1) {
v9[0] = (&a0->field_0)[v0];
v10 = *(&(&v14)[8 * v0]);
v11 = *(&(&v16)[8 * v0]);
v2 = 0;
while (true) {
if (v9)
v19 = v9[0];
else
v19 = v11 + 1;
if (v19 <= v2 + v10)
break;
*((v2 * 8 + (&v6->field_38)[v0])) = *((v6->field_48 + v2 * 8));
*((v2 * 8 + (&v6->field_50)[v0])) = *((v6->field_60 + v2 * 8));
v2 += 1;
}
v1 = &v9[0];
while (true) {
if (!v1) {
v0 += 1;
break;
} else {
v12 = v1->field_0 - v10;
*(&v19) = copy_stringlist(v1->field_20, v1->field_30, v12 * 8 + (&v6->field_38)[v0], (&v6->field_50)[v0] + v12 * 8, v1->field_8 - v1->field_0 + 1) ^ 1;
if (v19) {
v19 = 0;
goto LABEL_4014ac;
} else {
v3 = v1->field_18 + 1 - v4;
v2 = v1->field_8 + 1 - v10;
while (true) {
if (!v1->field_40)
v20 = v11 + 1;
else
v20 = v1->field_40->field_0;
v19 = v20 - v10;
if (v2 >= v19)
break;
*((v2 * 8 + (&v6->field_38)[v0])) = *((v6->field_48 + v3 * 8));
*((v2 * 8 + (&v6->field_50)[v0])) = *((v6->field_60 + v3 * 8));
v3 = v3 + 1;
v2 += 1;
}
v1 = &v1->field_40->field_0;
}
}
}
}
if (!a0->field_0) {
*(&v6->field_0) = 6;
goto LABEL_4014a8;
}
if (!a0->field_8) {
*(&v6->field_0) = 5;
goto LABEL_4014a8;
}
v7 = v6->field_10 - v6->field_8 + 1;
v8 = v6->field_20 - v6->field_18 + 1;
if (v7 == v8) {
*(&v19) = compare_line_list(v6->field_38, v6->field_50, v6->field_40, v6->field_58, v7) ^ 1;
if (!v19) {
*(&v6->field_0) = 7;
LABEL_4014a8:
v19 = v6;
break;
}
}
*(&v6->field_0) = 4;
goto LABEL_4014a8;
}
}
LABEL_4014ac:
return v19;
}
|
) {
parse_server_config_depth(options,
item->filename, item->contents,
includes, connectinfo,
(*inc_flags & 0x08
? 0x08 : (oactive
? 0 : 0x04)),
activep, depth + 1);
}
| void parse_server_config_depth
(undefined8 param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4,
undefined8 param_5,uint param_6,undefined8 param_7,uint param_8)
{
undefined4 uVar1;
int iVar2;
undefined8 uVar3;
char *pcVar4;
char **ppcVar5;
undefined *puVar6;
undefined *puVar7;
long in_FS_OFFSET;
uint *apuStack208 [2];
ulong auStack192 [5];
char *apcStack152 [2];
undefined auStack136 [8];
undefined8 local_80;
uint local_74;
undefined8 local_70;
undefined8 local_68;
undefined8 local_60;
undefined8 local_58;
undefined8 local_50;
undefined4 local_40;
uint local_3c;
char *local_38;
char *local_30;
char *local_28;
long local_20;
ppcVar5 = (char **)auStack136;
local_80 = param_7;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_3c = 0;
local_74 = param_6;
local_70 = param_5;
local_68 = param_4;
local_60 = param_3;
local_58 = param_2;
local_50 = param_1;
if (((int)param_8 < 0) || (0x10 < (int)param_8)) {
ppcVar5 = apcStack152;
apcStack152[0] = "Too many recursive configuration includes";
sshfatal("servconf.c","parse_server_config_depth",0xa86,0,1,0);
}
if ((local_74 & 4) == 0) {
pcVar4 = "";
}
else {
pcVar4 = " [checking syntax only]";
}
*(undefined8 *)((long)ppcVar5 + -8) = 0x109d84;
uVar3 = sshbuf_len(local_60);
*(char **)((long)ppcVar5 + -8) = pcVar4;
*(undefined8 *)((long)ppcVar5 + -0x10) = uVar3;
*(undefined8 *)((long)ppcVar5 + -0x18) = local_58;
*(char **)((long)ppcVar5 + -0x20) = "config %s len %zu%s";
*(undefined8 *)((long)ppcVar5 + -0x28) = 0x109dbf;
sshlog("servconf.c","parse_server_config_depth",0xa88,1,6,0);
*(undefined8 *)((long)ppcVar5 + -8) = 0x109dcf;
local_38 = (char *)sshbuf_dup_string(local_60);
puVar6 = (undefined *)ppcVar5;
local_30 = local_38;
if (local_38 == (char *)0x0) {
puVar6 = (undefined *)((long)ppcVar5 + -0x10);
*(char **)((long)ppcVar5 + -0x10) = "sshbuf_dup_string failed";
*(undefined8 *)((long)ppcVar5 + -0x18) = 0x109e1c;
sshfatal("servconf.c","parse_server_config_depth",0xa8c,1,1,0);
}
local_40 = 1;
while( true ) {
*(undefined8 *)(puVar6 + -8) = 0x109e96;
local_28 = strsep(&local_38,"\n");
uVar1 = local_40;
if (local_28 == (char *)0x0) break;
*(undefined8 *)(puVar6 + -8) = 0x109e34;
local_40 = __addvsi3(local_40,1);
*(undefined8 *)(puVar6 + -0x10) = local_68;
*(ulong *)(puVar6 + -0x18) = (ulong)param_8;
*(uint **)(puVar6 + -0x20) = &local_74;
*(undefined8 *)(puVar6 + -0x28) = 0x109e6b;
iVar2 = process_server_config_line_depth(local_50,local_28,local_58,uVar1,local_80,local_70);
if (iVar2 != 0) {
*(undefined8 *)(puVar6 + -8) = 0x109e80;
local_3c = __addvsi3(local_3c,1);
}
}
*(undefined8 *)(puVar6 + -8) = 0x109ead;
free(local_30);
puVar7 = puVar6;
if (0 < (int)local_3c) {
*(ulong *)(puVar6 + -0x10) = (ulong)local_3c;
*(undefined8 *)(puVar6 + -0x18) = local_58;
puVar7 = puVar6 + -0x20;
*(char **)(puVar6 + -0x20) = "%s: terminating, %d bad configuration options";
*(undefined8 *)(puVar6 + -0x28) = 0x109ef4;
sshfatal("servconf.c","parse_server_config_depth",0xa96,0,1,0);
}
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)(puVar7 + -8) = 0x109f09;
__stack_chk_fail();
}
return;
}
|
static Authmethod *
authmethod_get(char *authlist)
{
char *name =
((void *)0)
;
u_int next;
if (authlist ==
((void *)0)
|| strlen(authlist) == 0)
authlist = options.preferred_authentications;
if (supported ==
((void *)0)
|| strcmp(authlist, supported) != 0) {
sshlog("sshconnect2.c", __func__, 2346, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "start over, passed a different list %s", authlist);
free(supported);
supported = xstrdup(authlist);
preferred = options.preferred_authentications;
sshlog("sshconnect2.c", __func__, 2350, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "preferred %s", preferred);
current =
((void *)0)
;
} else if (current !=
((void *)0)
&& authmethod_is_enabled(current))
return current;
for (;;) {
if ((name = match_list(preferred, supported, &next)) ==
((void *)0)
) {
sshlog("sshconnect2.c", __func__, 2357, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "No more authentication methods to try.");
current =
((void *)0)
;
return
((void *)0)
;
}
preferred += next;
sshlog("sshconnect2.c", __func__, 2362, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "authmethod_lookup %s", name);
sshlog("sshconnect2.c", __func__, 2363, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "remaining preferred: %s", preferred);
if ((current = authmethod_lookup(name)) !=
((void *)0)
&&
authmethod_is_enabled(current)) {
sshlog("sshconnect2.c", __func__, 2366, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "authmethod_is_enabled %s", name);
sshlog("sshconnect2.c", __func__, 2367, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Next authentication method: %s", name);
free(name);
return current;
}
free(name);
}
}
| long authmethod_get(char *param_1)
{
int iVar1;
size_t sVar2;
long in_FS_OFFSET;
undefined8 uVar3;
char *local_30;
uint local_1c;
void *local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = (void *)0x0;
if ((param_1 == (char *)0x0) || (sVar2 = strlen(param_1), local_30 = param_1, sVar2 == 0)) {
local_30 = _sshkey_to_blob;
}
if ((supported == (char *)0x0) || (iVar1 = strcmp(local_30,supported), iVar1 != 0)) {
sshlog("sshconnect2.c","authmethod_get",0x92a,0,7,0,"start over, passed a different list %s",
local_30);
free(supported);
supported = (char *)xstrdup(local_30);
preferred = _sshkey_to_blob;
sshlog("sshconnect2.c","authmethod_get",0x92e,0,7,0,"preferred %s",_sshkey_to_blob);
current = 0;
}
else if ((current != 0) && (iVar1 = authmethod_is_enabled(current), iVar1 != 0))
goto LAB_001074c0;
while( true ) {
uVar3 = 0x1072f3;
local_18 = (void *)match_list(preferred,supported,&local_1c);
if (local_18 == (void *)0x0) break;
preferred = preferred + local_1c;
sshlog("sshconnect2.c","authmethod_get",0x93a,0,7,0,"authmethod_lookup %s",local_18);
sshlog("sshconnect2.c","authmethod_get",0x93b,0,7,0,"remaining preferred: %s",preferred);
current = authmethod_lookup(local_18);
if ((current != 0) && (iVar1 = authmethod_is_enabled(current), iVar1 != 0)) {
sshlog("sshconnect2.c","authmethod_get",0x93e,0,7,0,"authmethod_is_enabled %s",local_18);
sshlog("sshconnect2.c","authmethod_get",0x93f,0,5,0,"Next authentication method: %s",local_18)
;
free(local_18);
goto LAB_001074c0;
}
free(local_18);
}
sshlog("sshconnect2.c","authmethod_get",0x935,0,5,0,"No more authentication methods to try.",uVar3
);
current = 0;
LAB_001074c0:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return current;
}
__stack_chk_fail();
}
|
static int netns_get_name(int nsid, char *name)
{
struct dirent *entry;
DIR *dir;
int id;
if (nsid < 0)
return -
22
;
dir = opendir("/var/run/netns");
if (!dir)
return -
2
;
while ((entry = readdir(dir)) !=
((void *)0)
) {
if (strcmp(entry->d_name, ".") == 0)
continue;
if (strcmp(entry->d_name, "..") == 0)
continue;
id = get_netnsid_from_name(entry->d_name);
if (id >= 0 && nsid == id) {
strcpy(name, entry->d_name);
closedir(dir);
return 0;
}
}
closedir(dir);
return -
2
;
}
| int netns_get_name(unsigned long a0, char *a1) {
unsigned int v0;
unsigned long long v1;
unsigned long v2;
unsigned int v4;
if (a0 < 0) {
v4 = -22;
} else {
v1 = opendir("/var/run/netns");
if (!v1) {
v4 = -2;
} else {
do {
v2 = readdir64(v1);
if (!v2) {
closedir(v1);
v4 = -2;
goto LABEL_40094e;
}
if (!strcmp(v2 + 19, "."))
continue;
if (!strcmp(v2 + 19, ".."))
continue;
v0 = get_netnsid_from_name(v2 + 19);
if (v0 < 0)
continue;
} while (a0 != v0);
strcpy(a1, v2 + 19);
closedir(v1);
v4 = 0;
}
}
LABEL_40094e:
return v4;
}
|
static void
get_all_entries (void)
{
struct mount_entry *me;
filter_mount_list (show_all_fs);
for (me = mount_list; me; me = me->me_next)
get_dev (me->me_devname, me->me_mountdir,
((void *)0)
,
((void *)0)
, me->me_type,
me->me_dummy, me->me_remote,
((void *)0)
,
1
);
}
| void get_all_entries() {
struct_0 *v0;
unsigned long long v2;
unsigned long long v3;
filter_mount_list(show_all_fs);
v2 = mount_list;
for (v0 = mount_list; v0; v0 = v0->field_30) {
get_dev(v0->field_0, v0->field_8, 0x0, NULL, v0->field_18, (v0->field_28 & 1), (v0->field_28 & 2), 0x0, 0x1);
v3 = v0->field_30;
}
return;
}
|
static void
append_unset_var (char const *var)
{
if (usvars_used == usvars_alloc)
usvars = x2nrealloc (usvars, &usvars_alloc, sizeof *usvars);
usvars[usvars_used++] = var;
}
| void append_unset_var(unsigned long long a0) {
int tmp_20;
unsigned long long v1;
if (usvars_used == usvars_alloc)
usvars = x2nrealloc(usvars, &usvars_alloc, 0x8);
tmp_20 = usvars_used;
usvars_used = usvars_used + 1;
v1 = a0;
*((usvars + tmp_20 * 8)) = a0;
return;
}
|
static int
evalsubshell(union node *n, int flags)
{
struct job *jp;
int backgnd = (n->type == 3);
int status;
errlinno = lineno = n->nredir.linno;
if (funcline)
lineno -= funcline - 1;
expredir(n->nredir.redirect);
({ suppressint++; ({ __asm__ __volatile__ ("": : :"memory"); }); 0; });
if (!backgnd && flags & 01 && !have_traps()) {
forkreset();
goto nofork;
}
jp = makejob(n, 1);
if (forkshell(jp, n, backgnd) == 0) {
flags |= 01;
if (backgnd)
flags &=~ 02;
nofork:
({ ({ __asm__ __volatile__ ("": : :"memory"); }); if (--suppressint == 0 && intpending) onint(); 0; });
redirect(n->nredir.redirect, 0);
evaltreenr(n->nredir.n, flags);
}
status = 0;
if (! backgnd)
status = waitforjob(jp);
({ ({ __asm__ __volatile__ ("": : :"memory"); }); if (--suppressint == 0 && intpending) onint(); 0; });
return status;
}
| undefined4 evalsubshell(int *param_1,uint param_2)
{
int iVar1;
bool bVar2;
uint local_24;
undefined4 local_18;
undefined8 local_10;
bVar2 = *param_1 == 3;
_errlinno = param_1[1];
lineno = _errlinno;
if (funcline != 0) {
lineno = _errlinno - (funcline + -1);
}
expredir(*(undefined8 *)(param_1 + 4));
suppressint = suppressint + 1;
if ((bVar2) || ((param_2 & 1) == 0)) {
LAB_00100a1f:
local_10 = makejob(param_1,1);
iVar1 = forkshell(local_10,param_1,bVar2);
if (iVar1 != 0) goto LAB_00100ab1;
local_24 = param_2 | 1;
if (bVar2) {
local_24 = param_2 & 0xfffffffd | 1;
}
}
else {
iVar1 = have_traps();
if (iVar1 != 0) goto LAB_00100a1f;
forkreset();
local_24 = param_2;
}
suppressint = suppressint + -1;
if ((suppressint == 0) && (intpending != 0)) {
onint();
}
redirect(*(undefined8 *)(param_1 + 4),0);
evaltreenr(*(undefined8 *)(param_1 + 2),local_24);
LAB_00100ab1:
local_18 = 0;
if (!bVar2) {
local_18 = waitforjob(local_10);
}
suppressint = suppressint + -1;
if ((suppressint == 0) && (intpending != 0)) {
onint();
}
return local_18;
}
|
BN_div(((void *)0),(
rsa_dmp1
),(
d_consttime
),(
aux
),(
ctx
))
== 0)) {
r = -22;
goto out;
}
| int BN_div(BIGNUM *dv,BIGNUM *rem,BIGNUM *m,BIGNUM *d,BN_CTX *ctx)
{
halt_baddata();
}
|
static char **
make_env_array_from_var_list (vars)
SHELL_VAR **vars;
{
register int i, list_index;
register SHELL_VAR *var;
char **list, *value;
list = strvec_create ((1 + strvec_len ((char **)vars)));
for (i = 0, list_index = 0; var = vars[i]; i++)
{
if (((((var)->attributes) & (0x0040000))) && var->dynamic_value)
{
var = (*(var->dynamic_value)) (var);
do { if ((var)->exportstr) { sh_xfree(((var)->exportstr), "variables.c", 4907); (var)->exportstr = (char *)
((void *)0)
; } } while (0);
}
if (var->exportstr)
value = var->exportstr;
else if (((((var)->attributes) & (0x0000008))))
value = named_function_string ((char *)
((void *)0)
, (COMMAND *)((var)->value), 0);
else if (((((var)->attributes) & (0x0000004))))
continue;
else if (((((var)->attributes) & (0x0000040))))
continue;
else
value = ((var)->value);
if (value)
{
list[list_index] = (value == var->exportstr && ((((var)->attributes) & (0x0000004))) == 0 && ((((var)->attributes) & (0x0000040))) == 0) ? (char *)strcpy (sh_xmalloc((1 + strlen (value)), "variables.c", 4935), (value))
: mk_env_string (var->name, value, var->attributes);
if ((value == var->exportstr && ((((var)->attributes) & (0x0000004))) == 0 && ((((var)->attributes) & (0x0000040))) == 0) == 0)
(var)->exportstr = (list[list_index]) ? (char *)strcpy (sh_xmalloc((1 + strlen (list[list_index])), "variables.c", 4939), (list[list_index])) : (char *)
((void *)0)
;
list_index++;
}
}
list[list_index] = (char *)
((void *)0)
;
return (list);
}
| long make_env_array_from_var_list(long param_1)
{
bool bVar1;
int iVar2;
long lVar3;
undefined8 *puVar4;
size_t sVar5;
char *pcVar6;
char *__dest;
int iVar7;
char *local_38;
iVar2 = strvec_len(param_1);
lVar3 = strvec_create(iVar2 + 1);
iVar7 = 0;
iVar2 = 0;
do {
puVar4 = *(undefined8 **)(param_1 + (long)iVar7 * 8);
if (puVar4 == (undefined8 *)0x0) {
*(undefined8 *)(lVar3 + (long)iVar2 * 8) = 0;
return lVar3;
}
if ((((*(uint *)(puVar4 + 5) & 0x40000) != 0) && (puVar4[3] != 0)) &&
(puVar4 = (undefined8 *)(*(code *)puVar4[3])(puVar4), puVar4[2] != 0)) {
sh_xfree(puVar4[2],"variables.c",0x132b);
puVar4[2] = 0;
}
if (puVar4[2] == 0) {
if ((*(uint *)(puVar4 + 5) & 8) != 0) {
local_38 = (char *)named_function_string(0,puVar4[1],0);
goto LAB_00108ace;
}
if (((*(uint *)(puVar4 + 5) & 4) == 0) && ((*(uint *)(puVar4 + 5) & 0x40) == 0)) {
local_38 = (char *)puVar4[1];
goto LAB_00108ace;
}
}
else {
local_38 = (char *)puVar4[2];
LAB_00108ace:
if (local_38 != (char *)0x0) {
if (((local_38 == (char *)puVar4[2]) && ((*(uint *)(puVar4 + 5) & 4) == 0)) &&
((*(uint *)(puVar4 + 5) & 0x40) == 0)) {
sVar5 = strlen(local_38);
pcVar6 = (char *)sh_xmalloc(sVar5 + 1,"variables.c",0x1347);
pcVar6 = strcpy(pcVar6,local_38);
}
else {
pcVar6 = (char *)mk_env_string(*puVar4,local_38,*(undefined4 *)(puVar4 + 5));
}
*(char **)(lVar3 + (long)iVar2 * 8) = pcVar6;
if (((local_38 == (char *)puVar4[2]) && ((*(uint *)(puVar4 + 5) & 4) == 0)) &&
((*(uint *)(puVar4 + 5) & 0x40) == 0)) {
bVar1 = true;
}
else {
bVar1 = false;
}
if (!bVar1) {
if (*(long *)(lVar3 + (long)iVar2 * 8) == 0) {
pcVar6 = (char *)0x0;
}
else {
pcVar6 = *(char **)(lVar3 + (long)iVar2 * 8);
sVar5 = strlen(*(char **)(lVar3 + (long)iVar2 * 8));
__dest = (char *)sh_xmalloc(sVar5 + 1,"variables.c",0x134b);
pcVar6 = strcpy(__dest,pcVar6);
}
puVar4[2] = pcVar6;
}
iVar2 = iVar2 + 1;
}
}
iVar7 = iVar7 + 1;
} while( true );
}
|
static int
hack_braces_completion (names)
char **names;
{
register int i;
char *temp;
i = strvec_len (names);
if (
(__ctype_get_mb_cur_max ())
> 1 && i > 2)
qsort (names+1, i-1, sizeof (char *), (QSFUNC *)_strcompare);
temp = really_munge_braces (names, 1, i, 0);
for (i = 0; names[i]; ++i)
{
sh_xfree((names[i]), "bracecomp.c", 180);
names[i] =
((void *)0)
;
}
names[0] = temp;
return 0;
}
| long hack_braces_completion(char **a1)
{
int v1;
int i;
char *v4;
v1 = strvec_len(a1);
if ( _ctype_get_mb_cur_max() > 1 && v1 > 2 )
qsort(a1 + 1, v1 - 1, 8uLL, (__compar_fn_t)strcompare);
v4 = really_munge_braces(a1, 1, v1, 0);
for ( i = 0; a1[i]; ++i )
{
sh_xfree(a1[i], "bracecomp.c", 180LL);
a1[i] = 0LL;
}
*a1 = v4;
return 0LL;
}
|
static void bsPutUInt32 ( BitStream* bs, UInt32 c )
{
Int32 i;
for (i = 31; i >= 0; i--)
bsPutBit ( bs, (c >> i) & 0x1 );
}
| void bsPutUInt32(void* a0, unsigned long a1) {
unsigned int v0;
unsigned long long v2;
for (v0 = 31; v0 >= 0; v0 -= 1) {
v2 = bsPutBit(a0, (a1 >> (v0 & 31)) & 1);
}
return;
}
|
test_code_t test_dhe(gnutls_session_t session)
{
int ret;
sprintf(prio_str, "NONE:"
"+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT"
":+DHE-RSA:+DHE-DSS:%s", protocol_str, rest);
{ int _ret; if ((_ret=__gnutls_priority_set_direct(session, prio_str, 220)) != TEST_SUCCEED) { return _ret; } };
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
gnutls_dh_get_pubkey(session, &pubkey);
return ret;
return TEST_IGNORE;
}
| int test_dhe(undefined8 param_1)
{
int iVar1;
sprintf(prio_str,
"NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+DHE-RSA:+DHE-DSS:%s"
,protocol_str,rest);
iVar1 = __gnutls_priority_set_direct(param_1,prio_str,0xdc);
if (iVar1 == 0) {
gnutls_credentials_set(param_1,1,xcred);
iVar1 = test_do_handshake(param_1);
gnutls_dh_get_pubkey(param_1,pubkey);
}
return iVar1;
}
|
static int xfrm_policy_flush(int argc, char **argv)
{
struct rtnl_handle rth;
struct {
struct nlmsghdr n;
char buf[2048];
} req = {
.n.nlmsg_len = ((0) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))),
.n.nlmsg_flags = 0x01,
.n.nlmsg_type = XFRM_MSG_FLUSHPOLICY,
};
char *ptypep =
((void *)0)
;
struct xfrm_userpolicy_type upt = {};
while (argc > 0) {
if (strcmp(*argv, "ptype") == 0) {
if (ptypep)
duparg("ptype", *argv);
ptypep = *argv;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
xfrm_policy_ptype_parse(&upt.type, &argc, &argv);
} else
invarg("unknown", *argv);
argc--; argv++;
}
if (ptypep) {
addattr_l(&req.n, sizeof(req), XFRMA_POLICY_TYPE,
(void *)&upt, sizeof(upt));
}
if (rtnl_open_byproto(&rth, 0, 6) < 0)
exit(1);
if (show_stats > 1)
fprintf(
stderr
, "Flush policy\n");
if (rtnl_talk(&rth, &req.n,
((void *)0)
) < 0)
exit(2);
rtnl_close(&rth);
return 0;
}
| long xfrm_policy_flush(int a1, const char **a2)
{
const char **v3;
int v4;
int v5;
short v6;
long v7;
char v8[64];
int v9[518];
unsigned long v10;
v4 = a1;
v3 = a2;
v10 = __readfsqword(0x28u);
memset(v9, 0, 0x810uLL);
v9[0] = 16;
v9[1] = 65565;
v7 = 0LL;
v5 = 0;
v6 = 0;
while ( v4 > 0 )
{
if ( !strcmp(*v3, "ptype") )
{
if ( v7 )
duparg("ptype", *v3);
v7 = (long)*v3++;
if ( --v4 <= 0 )
incomplete_command();
xfrm_policy_ptype_parse(&v5, &v4, &v3);
}
else
{
invarg("unknown", *v3);
}
--v4;
++v3;
}
if ( v7 )
addattr_l(v9, 2064LL, 16LL, &v5, 6LL);
if ( (int)rtnl_open_byproto(v8, 0LL, 6LL) < 0 )
exit(1);
if ( show_stats > 1 )
fprintf(stderr, "Flush policy\n");
if ( (int)rtnl_talk(v8, v9, 0LL) < 0 )
exit(2);
rtnl_close(v8);
return 0LL;
}
|
static int nh_dump_filter(struct nlmsghdr *nlh, int reqlen)
{
int err;
if (filter.ifindex) {
err = addattr32(nlh, reqlen, NHA_OIF, filter.ifindex);
if (err)
return err;
}
if (filter.groups) {
err = addattr_l(nlh, reqlen, NHA_GROUPS,
((void *)0)
, 0);
if (err)
return err;
}
if (filter.master) {
err = addattr32(nlh, reqlen, NHA_MASTER, filter.master);
if (err)
return err;
}
if (filter.fdb) {
err = addattr_l(nlh, reqlen, NHA_FDB,
((void *)0)
, 0);
if (err)
return err;
}
return 0;
}
| int nh_dump_filter(undefined8 param_1,undefined4 param_2)
{
int iVar1;
if (((((filter._8_4_ == 0) || (iVar1 = addattr32(param_1,param_2,5,filter._8_4_), iVar1 == 0)) &&
((filter._4_4_ == 0 || (iVar1 = addattr_l(param_1,param_2,9,0,0), iVar1 == 0)))) &&
((filter._12_4_ == 0 || (iVar1 = addattr32(param_1,param_2,10,filter._12_4_), iVar1 == 0))))
&& ((filter._20_4_ == 0 || (iVar1 = addattr_l(param_1,param_2,0xb,0,0), iVar1 == 0)))) {
iVar1 = 0;
}
return iVar1;
}
|
static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
char s2[64];
if (!tb)
return;
tnl_print_endpoint("remote", tb[IFLA_VTI_REMOTE],
2
);
tnl_print_endpoint("local", tb[IFLA_VTI_LOCAL],
2
);
if (tb[IFLA_VTI_LINK]) {
__u32 link = rta_getattr_u32(tb[IFLA_VTI_LINK]);
if (link) {
print_string(PRINT_ANY, "link", "dev %s ",
ll_index_to_name(link));
}
}
if (tb[IFLA_VTI_IKEY]) {
struct rtattr *rta = tb[IFLA_VTI_IKEY];
__u32 key = rta_getattr_u32(rta);
if (key && inet_ntop(
2
, ((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), s2, sizeof(s2)))
print_string(PRINT_ANY, "ikey", "ikey %s ", s2);
}
if (tb[IFLA_VTI_OKEY]) {
struct rtattr *rta = tb[IFLA_VTI_OKEY];
__u32 key = rta_getattr_u32(rta);
if (key && inet_ntop(
2
, ((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), s2, sizeof(s2)))
print_string(PRINT_ANY, "okey", "okey %s ", s2);
}
if (tb[IFLA_VTI_FWMARK]) {
__u32 fwmark = rta_getattr_u32(tb[IFLA_VTI_FWMARK]);
if (fwmark) {
print_0xhex(PRINT_ANY,
"fwmark", "fwmark %#llx ", fwmark);
}
}
}
| void vti_print_opt(undefined8 param_1,undefined8 param_2,long param_3)
{
long lVar1;
int iVar2;
undefined8 uVar3;
char *pcVar4;
long in_FS_OFFSET;
char local_58 [72];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (param_3 != 0) {
tnl_print_endpoint("remote",*(undefined8 *)(param_3 + 0x28),2);
tnl_print_endpoint("local",*(undefined8 *)(param_3 + 0x20),2);
if (*(long *)(param_3 + 8) != 0) {
iVar2 = rta_getattr_u32(*(undefined8 *)(param_3 + 8));
if (iVar2 != 0) {
uVar3 = ll_index_to_name(iVar2);
print_string(4,&DAT_00100c23,"dev %s ",uVar3);
}
}
if (*(long *)(param_3 + 0x10) != 0) {
lVar1 = *(long *)(param_3 + 0x10);
iVar2 = rta_getattr_u32(lVar1);
if (iVar2 != 0) {
pcVar4 = inet_ntop(2,(void *)(lVar1 + 4),local_58,0x40);
if (pcVar4 != (char *)0x0) {
print_string(4,&DAT_00100be9,"ikey %s ",local_58);
}
}
}
if (*(long *)(param_3 + 0x18) != 0) {
lVar1 = *(long *)(param_3 + 0x18);
iVar2 = rta_getattr_u32(lVar1);
if (iVar2 != 0) {
pcVar4 = inet_ntop(2,(void *)(lVar1 + 4),local_58,0x40);
if (pcVar4 != (char *)0x0) {
print_string(4,&DAT_00100bee,"okey %s ",local_58);
}
}
}
if (*(long *)(param_3 + 0x30) != 0) {
iVar2 = rta_getattr_u32(*(undefined8 *)(param_3 + 0x30));
if (iVar2 != 0) {
print_0xhex(4,"fwmark","fwmark %#llx ",iVar2);
}
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
static int
parse_args(const char **cpp, int *ignore_errors, int *disable_echo, int *aflag,
int *fflag, int *hflag, int *iflag, int *lflag, int *pflag,
int *rflag, int *sflag,
unsigned long *n_arg, char **path1, char **path2)
{
const char *cmd, *cp = *cpp;
char *cp2, **argv;
int base = 0;
long long ll;
int path1_mandatory = 0, i, cmdnum, optidx, argc;
cp = cp + strspn(cp, " \t\r\n");
*ignore_errors = 0;
*disable_echo = 0;
for (;*cp != '\0'; cp++) {
if (*cp == '-') {
*ignore_errors = 1;
} else if (*cp == '@') {
*disable_echo = 1;
} else {
break;
}
}
cp = cp + strspn(cp, " \t\r\n");
if (*cp == '\0' || *cp == '#')
return (0);
if ((argv = makeargv(cp, &argc, 0,
((void *)0)
,
((void *)0)
)) ==
((void *)0)
)
return -1;
for (i = 0; cmds[i].c !=
((void *)0)
; i++) {
if (argv[0] !=
((void *)0)
&& strcasecmp(cmds[i].c, argv[0]) == 0)
break;
}
cmdnum = cmds[i].n;
cmd = cmds[i].c;
if (*cp == '!') {
cp++;
cmdnum = I_SHELL;
} else if (cmdnum == -1) {
sshlog("sftp.c", __func__, 1378, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Invalid command.");
return -1;
}
*aflag = *fflag = *hflag = *iflag = *lflag = *pflag = 0;
*rflag = *sflag = 0;
*path1 = *path2 =
((void *)0)
;
optidx = 1;
switch (cmdnum) {
case I_GET:
case I_REGET:
case I_REPUT:
case I_PUT:
if ((optidx = parse_getput_flags(cmd, argv, argc,
aflag, fflag, pflag, rflag)) == -1)
return -1;
if (argc - optidx < 1) {
sshlog("sftp.c", __func__, 1397, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "You must specify at least one path after a " "%s command.", cmd)
;
return -1;
}
*path1 = xstrdup(argv[optidx]);
if (argc - optidx > 1) {
*path2 = xstrdup(argv[optidx + 1]);
undo_glob_escape(*path2);
}
break;
case I_LINK:
if ((optidx = parse_link_flags(cmd, argv, argc, sflag)) == -1)
return -1;
goto parse_two_paths;
case I_COPY:
if ((optidx = parse_no_flags(cmd, argv, argc)) == -1)
return -1;
goto parse_two_paths;
case I_RENAME:
if ((optidx = parse_rename_flags(cmd, argv, argc, lflag)) == -1)
return -1;
goto parse_two_paths;
case I_SYMLINK:
if ((optidx = parse_no_flags(cmd, argv, argc)) == -1)
return -1;
parse_two_paths:
if (argc - optidx < 2) {
sshlog("sftp.c", __func__, 1426, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "You must specify two paths after a %s " "command.", cmd)
;
return -1;
}
*path1 = xstrdup(argv[optidx]);
*path2 = xstrdup(argv[optidx + 1]);
undo_glob_escape(*path1);
undo_glob_escape(*path2);
break;
case I_RM:
case I_MKDIR:
case I_RMDIR:
case I_LMKDIR:
path1_mandatory = 1;
case I_CHDIR:
case I_LCHDIR:
if ((optidx = parse_no_flags(cmd, argv, argc)) == -1)
return -1;
if (argc - optidx < 1) {
if (!path1_mandatory)
break;
sshlog("sftp.c", __func__, 1450, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "You must specify a path after a %s command.", cmd)
;
return -1;
}
*path1 = xstrdup(argv[optidx]);
if (cmdnum != I_RM)
undo_glob_escape(*path1);
break;
case I_DF:
if ((optidx = parse_df_flags(cmd, argv, argc, hflag,
iflag)) == -1)
return -1;
if (argc - optidx < 1)
*path1 =
((void *)0)
;
else {
*path1 = xstrdup(argv[optidx]);
undo_glob_escape(*path1);
}
break;
case I_LS:
if ((optidx = parse_ls_flags(argv, argc, lflag)) == -1)
return(-1);
if (argc - optidx > 0)
*path1 = xstrdup(argv[optidx]);
break;
case I_LLS:
cp = cp + strlen(cmd) + strspn(cp, " \t\r\n");
case I_SHELL:
break;
case I_LUMASK:
case I_CHMOD:
base = 8;
case I_CHOWN:
case I_CHGRP:
if ((optidx = parse_ch_flags(cmd, argv, argc, hflag)) == -1)
return -1;
if (argc - optidx < 1)
goto need_num_arg;
(*__errno_location ())
= 0;
ll = strtoll(argv[optidx], &cp2, base);
if (cp2 == argv[optidx] || *cp2 != '\0' ||
((ll ==
(-0x7fffffffffffffffLL - 1LL)
|| ll == 0x7fffffffffffffffLL) &&
(*__errno_location ())
==
34
) ||
ll < 0 || ll >
(4294967295U)
) {
need_num_arg:
sshlog("sftp.c", __func__, 1501, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "You must supply a numeric argument " "to the %s command.", cmd)
;
return -1;
}
*n_arg = ll;
if (cmdnum == I_LUMASK)
break;
if (argc - optidx < 2) {
sshlog("sftp.c", __func__, 1510, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "You must specify a path after a %s command.", cmd)
;
return -1;
}
*path1 = xstrdup(argv[optidx + 1]);
break;
case I_QUIT:
case I_PWD:
case I_LPWD:
case I_HELP:
case I_VERSION:
case I_PROGRESS:
if ((optidx = parse_no_flags(cmd, argv, argc)) == -1)
return -1;
break;
default:
sshfatal("sftp.c", __func__, 1526, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Command not implemented");
}
*cpp = cp;
return(cmdnum);
}
| int parse_args(unsigned long long *a0, unsigned int *a1, unsigned int *a2, unsigned int *a3, unsigned int *a4, unsigned int *a5, unsigned int *v20, unsigned int *a6, unsigned int *a7, unsigned int *a8, unsigned int *a9, unsigned long a10, unsigned long a11, unsigned long a12) {
char v0;
unsigned long long *v1;
unsigned long long *v2;
unsigned long long *v3;
unsigned int *v4;
unsigned int *v5;
unsigned int *v6;
unsigned int *v7;
unsigned int *v8;
char v9;
unsigned int v10;
unsigned int v11;
unsigned int v12;
unsigned int v13;
unsigned int v14;
char v15;
char *v16;
unsigned long long *v17;
char *v18;
unsigned long v19;
unsigned int v21;
v8 = v20;
v7 = a6;
v6 = a7;
v5 = a8;
v4 = a9;
v3 = a10;
v2 = a11;
v1 = a12;
v16 = *(a0);
v10 = 0;
v11 = 0;
v16 = &v16[strspn(v16, " \t\r\n")];
*(a1) = 0;
for (*(a2) = 0; *(v16); v16 += 1) {
if (*(v16) == 45) {
*(a1) = 1;
} else {
if (*(v16) != 64)
break;
if (*(v16) == 64)
*(a2) = 1;
}
}
v16 = &v16[strspn(v16, " \t\r\n")];
if (*(v16) && *(v16) != 35) {
v17 = makeargv(v16, &v9, 0x0, NULL, NULL);
if (!v17) {
v21 = -1;
} else {
for (v12 = 0; cmds[2 * v12 + v12]; v12 = __addvsi3(v12, 0x1)) {
if (*(v17)) {
v21 = strcasecmp(cmds[3 * v12], *(v17));
if (!v21)
break;
}
}
v13 = (&g_40a7a8)[3 * v12];
v18 = cmds[3 * v12];
if (*(v16) == 33) {
v16 += 1;
v13 = 25;
} else if (v13 == -1) {
sshlog("sftp.c", "parse_args", 0x562, 0x0, 0x2, 0x0, "Invalid command.", *(&v0));
v21 = -1;
}
if (*(v16) == 33 || v13 != -1) {
*(v6) = 0;
*(v7) = *(v6);
*(v8) = *(v7);
*(a5) = *(v8);
*(a4) = *(a5);
*(a3) = *(a4);
*(v4) = 0;
*(v5) = *(v4);
*(v1) = 0;
*(v2) = *(v1);
v14 = 1;
switch (v13) {
case 5:
v14 = parse_no_flags(v18, v17, *(&v9));
if (v14 == -1) {
v21 = -1;
break;
} else {
v21 = __subvsi3(*(&v9), v14);
if (v21 <= 1) {
sshlog("sftp.c", "parse_args", 0x592, 0x0, 0x2, 0x0, "You must specify two paths after a %s command.", v18);
v21 = -1;
break;
} else {
*(v2) = xstrdup(v17[v14]);
*(v1) = xstrdup(v17[__addvsi3(v14, 0x1)]);
undo_glob_escape(*(v2));
undo_glob_escape(*(v1));
*(a0) = v16;
v21 = v13;
break;
}
}
case 6:
v14 = parse_df_flags(v18, v17, *(&v9), a5, v8);
if (v14 == -1) {
v21 = -1;
break;
} else {
v21 = __subvsi3(*(&v9), v14);
if (v21 <= 0) {
*(v2) = 0;
} else {
*(v2) = xstrdup(v17[v14]);
undo_glob_escape(*(v2));
}
}
case 7: case 17: case 20: case 22:
v14 = parse_getput_flags(v18, v17, *(&v9), a3, a4, v6, v5);
if (v14 == -1) {
v21 = -1;
break;
} else {
v21 = __subvsi3(*(&v9), v14);
if (v21 <= 0) {
sshlog("sftp.c", "parse_args", 0x575, 0x0, 0x2, 0x0, "You must specify at least one path after a %s command.", v18);
v21 = -1;
break;
} else {
*(v2) = xstrdup(v17[v14]);
v21 = __subvsi3(*(&v9), v14);
if (v21 > 1) {
*(v1) = xstrdup(v17[__addvsi3(v14, 0x1)]);
undo_glob_escape(*(v1));
}
}
}
case 8: case 13: case 18: case 19: case 27: case 28:
v14 = parse_no_flags(v18, v17, *(&v9));
if (v14 == -1) {
v21 = -1;
break;
}
case 10:
v14 = parse_link_flags(v18, v17, *(&v9), v4);
if (v14 == -1) {
v21 = -1;
break;
}
case 14:
v14 = parse_ls_flags(v17, *(&v9), v7);
if (v14 == -1) {
v21 = -1;
break;
} else {
v21 = __subvsi3(*(&v9), v14);
if (v21 > 0)
*(v2) = xstrdup(v17[v14]);
}
case 21:
v14 = parse_rename_flags(v18, v17, *(&v9), v7);
if (v14 == -1) {
v21 = -1;
break;
}
case 26:
v14 = parse_no_flags(v18, v17, *(&v9));
if (v14 == -1) {
v21 = -1;
break;
}
case 3: case 15:
v10 = 8;
case 2: case 4:
v14 = parse_ch_flags(v18, v17, *(&v9), a5);
if (v14 == -1) {
v21 = -1;
break;
} else {
v21 = __subvsi3(*(&v9), v14);
if (v21 > 0) {
*(__errno_location()) = 0;
v19 = strtoll(v17[v14], &v15, v10);
if (v17[v14] != *(&v15) && !*(*(&v15))) {
if (v19 != 0x8000000000000000 && v19 != 9223372036854775807 && !((v19 - 0 >> 63)) && v19 <= 4294967295) {
*(v3) = v19;
if (v13 != 15) {
v21 = __subvsi3(*(&v9), v14);
if (v21 <= 1) {
sshlog("sftp.c", "parse_args", 0x5e6, 0x0, 0x2, 0x0, "You must specify a path after a %s command.", v18);
v21 = -1;
break;
} else {
*(v2) = xstrdup(v17[__addvsi3(v14, 0x1)]);
}
}
}
if (v19 == 0x8000000000000000 || v19 == 9223372036854775807)
v21 = *(__errno_location());
}
} else {
sshlog("sftp.c", "parse_args", 0x5dd, 0x0, 0x2, 0x0, "You must supply a numeric argument to the %s command.", v18);
v21 = -1;
break;
}
}
case 11:
v21 = strspn(v16, " \t\r\n") + strlen(v18);
v16 = &v16[v21];
case 12: case 16: case 23: case 24:
v11 = 1;
case 1: case 9:
v14 = parse_no_flags(v18, v17, *(&v9));
if (v14 == -1) {
v21 = -1;
break;
} else {
v21 = __subvsi3(*(&v9), v14);
if (v21 > 0) {
*(v2) = xstrdup(v17[v14]);
if (v13 != 23)
undo_glob_escape(*(v2));
} else if (v11) {
sshlog("sftp.c", "parse_args", 0x5aa, 0x0, 0x2, 0x0, "You must specify a path after a %s command.", v18);
v21 = -1;
break;
}
}
default:
sshfatal("sftp.c", "parse_args", 0x5f6, 0x0, 0x1, 0x0, "Command not implemented");
}
}
}
}
if (*(v16) == 35 || !*(v16))
v21 = 0;
return v21;
}
|
static void
code_time (struct timespec t, char const *keyword, struct xheader *xhdr)
{
char buf[TIMESPEC_STRSIZE_BOUND];
xheader_print (xhdr, keyword, code_timespec (t, buf));
}
| unsigned long code_time(long a1, long a2, char *a3, long a4)
{
const char *v4;
char v8[40];
unsigned long v9;
v9 = __readfsqword(0x28u);
v4 = (const char *)code_timespec(a1, a2, v8);
xheader_print(a4, a3, v4);
return __readfsqword(0x28u) ^ v9;
}
|
static void process_flags (int argc, char **argv)
{
int c;
static struct option long_options[] = {
{"help",
0
,
((void *)0)
, 'h'},
{"root",
1
,
((void *)0)
, 'R'},
{
((void *)0)
, 0,
((void *)0)
, '\0'}
};
while ((c = getopt_long (argc, argv, "hR:",
long_options,
((void *)0)
)) != -1) {
switch (c) {
case 'h':
usage (
0
);
break;
case 'R':
break;
default:
usage (2);
}
}
if (optind != argc) {
usage (2);
}
}
| long process_flags(int a1, char *const *a2)
{
int v2;
long result;
while ( 1 )
{
v2 = getopt_long(a1, a2, "hR:", &long_options_5649, 0LL);
if ( v2 == -1 )
break;
if ( v2 != 82 )
{
if ( v2 == 104 )
usage(0);
usage(2);
}
}
result = (unsigned int)optind;
if ( a1 != optind )
usage(2);
return result;
}
|
static void
socket_starttls(socket_st * socket)
{
char buf[512];
if (socket->secure)
return;
if (socket->app_proto ==
((void *)0)
|| strcasecmp(socket->app_proto, "https") == 0)
return;
if (strcasecmp(socket->app_proto, "smtp") == 0 || strcasecmp(socket->app_proto, "submission") == 0) {
if (socket->verbose)
log_msg(
stdout
, "Negotiating SMTP STARTTLS\n");
wait_for_text(socket, "220 ", 4);
snprintf(buf, sizeof(buf), "EHLO %s\r\n", socket->hostname);
send_line(socket, buf);
wait_for_text(socket, "250 ", 4);
send_line(socket, "STARTTLS\r\n");
wait_for_text(socket, "220 ", 4);
} else if (strcasecmp(socket->app_proto, "imap") == 0 || strcasecmp(socket->app_proto, "imap2") == 0) {
if (socket->verbose)
log_msg(
stdout
, "Negotiating IMAP STARTTLS\n");
send_line(socket, "a CAPABILITY\r\n");
wait_for_text(socket, "a OK", 4);
send_line(socket, "a STARTTLS\r\n");
wait_for_text(socket, "a OK", 4);
} else if (strcasecmp(socket->app_proto, "xmpp") == 0) {
if (socket->verbose)
log_msg(
stdout
, "Negotiating XMPP STARTTLS\n");
snprintf(buf, sizeof(buf), "<stream:stream xmlns:stream='http:
send_line(socket, buf);
wait_for_text(socket, "<?", 2);
send_line(socket, "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
wait_for_text(socket, "<proceed", 8);
} else if (strcasecmp(socket->app_proto, "ldap") == 0) {
if (socket->verbose)
log_msg(
stdout
, "Negotiating LDAP STARTTLS\n");
send(socket->fd, "\x30\x1d\x02\x01\x01\x77\x18\x80\x16\x31\x2e\x33\x2e\x36\x2e\x31\x2e\x34\x2e\x31\x2e\x31\x34\x36\x36\x2e\x32\x30\x30\x33\x37", sizeof("\x30\x1d\x02\x01\x01\x77\x18\x80\x16\x31\x2e\x33\x2e\x36\x2e\x31\x2e\x34\x2e\x31\x2e\x31\x34\x36\x36\x2e\x32\x30\x30\x33\x37")-1, 0);
wait_for_text(socket,
((void *)0)
, 0);
} else if (strcasecmp(socket->app_proto, "ftp") == 0 || strcasecmp(socket->app_proto, "ftps") == 0) {
if (socket->verbose)
log_msg(
stdout
, "Negotiating FTP STARTTLS\n");
send_line(socket, "FEAT\r\n");
wait_for_text(socket, "211 ", 4);
send_line(socket, "AUTH TLS\r\n");
wait_for_text(socket, "234", 3);
} else if (strcasecmp(socket->app_proto, "lmtp") == 0) {
if (socket->verbose)
log_msg(
stdout
, "Negotiating LMTP STARTTLS\n");
wait_for_text(socket, "220 ", 4);
snprintf(buf, sizeof(buf), "LHLO %s\r\n", socket->hostname);
send_line(socket, buf);
wait_for_text(socket, "250 ", 4);
send_line(socket, "STARTTLS\r\n");
wait_for_text(socket, "220 ", 4);
} else if (strcasecmp(socket->app_proto, "pop3") == 0) {
if (socket->verbose)
log_msg(
stdout
, "Negotiating POP3 STARTTLS\n");
wait_for_text(socket, "+OK", 3);
send_line(socket, "STLS\r\n");
wait_for_text(socket, "+OK", 3);
} else if (strcasecmp(socket->app_proto, "nntp") == 0) {
if (socket->verbose)
log_msg(
stdout
, "Negotiating NNTP STARTTLS\n");
wait_for_text(socket, "200 ", 4);
send_line(socket, "STARTTLS\r\n");
wait_for_text(socket, "382 ", 4);
} else if (strcasecmp(socket->app_proto, "sieve") == 0) {
if (socket->verbose)
log_msg(
stdout
, "Negotiating Sieve STARTTLS\n");
wait_for_text(socket, "OK ", 3);
send_line(socket, "STARTTLS\r\n");
wait_for_text(socket, "OK ", 3);
} else if (strcasecmp(socket->app_proto, "postgres") == 0 || strcasecmp(socket->app_proto, "postgresql") == 0) {
if (socket->verbose)
log_msg(
stdout
, "Negotiating PostgreSQL STARTTLS\n");
send(socket->fd, "\x00\x00\x00\x08\x04\xD2\x16\x2F", sizeof("\x00\x00\x00\x08\x04\xD2\x16\x2F")-1, 0);
wait_for_text(socket,
((void *)0)
, 0);
} else {
if (!c_isdigit(socket->app_proto[0])) {
static int warned = 0;
if (warned == 0) {
fprintf(
stderr
, "unknown protocol '%s'\n", socket->app_proto);
warned = 1;
}
}
}
return;
}
| void socket_starttls(struct_0 *a0) {
char v0;
char v1;
unsigned long long *v4;
unsigned long long v5;
if (!a0->field_10 && a0->field_20 && strcasecmp(a0->field_20, "https")) {
if (!strcasecmp(a0->field_20, "smtp")) {
LABEL_400736:
if (a0->field_48)
log_msg(*(&stdout), "Negotiating SMTP STARTTLS\n");
wait_for_text(a0, "220 ", 0x4);
snprintf(&v0, 0x200, "EHLO %s\r\n", a0->field_18);
send_line(a0, &v0);
wait_for_text(a0, "250 ", 0x4);
send_line(a0, "STARTTLS\r\n");
wait_for_text(a0, "220 ", 0x4);
goto LABEL_400edd;
} else {
if (!strcasecmp(a0->field_20, "submission"))
goto LABEL_400736;
if (!strcasecmp(a0->field_20, "imap")) {
LABEL_400852:
if (a0->field_48)
log_msg(*(&stdout), "Negotiating IMAP STARTTLS\n");
send_line(a0, "a CAPABILITY\r\n");
wait_for_text(a0, "a OK", 0x4);
send_line(a0, "a STARTTLS\r\n");
wait_for_text(a0, "a OK", 0x4);
goto LABEL_400edd;
} else {
if (!strcasecmp(a0->field_20, "imap2"))
goto LABEL_400852;
if (!strcasecmp(a0->field_20, "xmpp")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating XMPP STARTTLS\n");
snprintf(&v0, 0x200, "<stream:stream xmlns:stream='http:
send_line(a0, &v0);
wait_for_text(a0, "<?", 0x2);
send_line(a0, "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
wait_for_text(a0, "<proceed", 0x8);
goto LABEL_400ee5;
}
if (!strcasecmp(a0->field_20, "ldap")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating LDAP STARTTLS\n");
send(a0->field_0, &g_4021e8, 0x1f, 0x0);
wait_for_text(a0, NULL, 0x0);
goto LABEL_400ee5;
}
if (!strcasecmp(a0->field_20, "ftp")) {
LABEL_400a8b:
if (a0->field_48)
log_msg(*(&stdout), "Negotiating FTP STARTTLS\n");
send_line(a0, "FEAT\r\n");
wait_for_text(a0, "211 ", 0x4);
send_line(a0, "AUTH TLS\r\n");
wait_for_text(a0, "234", 0x3);
goto LABEL_400edd;
} else {
if (!strcasecmp(a0->field_20, "ftps"))
goto LABEL_400a8b;
if (!strcasecmp(a0->field_20, "lmtp")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating LMTP STARTTLS\n");
wait_for_text(a0, "220 ", 0x4);
snprintf(&v0, 0x200, "LHLO %s\r\n", a0->field_18);
send_line(a0, &v0);
wait_for_text(a0, "250 ", 0x4);
send_line(a0, "STARTTLS\r\n");
wait_for_text(a0, "220 ", 0x4);
goto LABEL_400ee5;
}
if (!strcasecmp(a0->field_20, "pop3")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating POP3 STARTTLS\n");
wait_for_text(a0, "+OK", 0x3);
send_line(a0, "STLS\r\n");
wait_for_text(a0, "+OK", 0x3);
goto LABEL_400ee5;
}
if (!strcasecmp(a0->field_20, "nntp")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating NNTP STARTTLS\n");
wait_for_text(a0, "200 ", 0x4);
send_line(a0, "STARTTLS\r\n");
wait_for_text(a0, "382 ", 0x4);
goto LABEL_400ee5;
}
if (!strcasecmp(a0->field_20, "sieve")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating Sieve STARTTLS\n");
wait_for_text(a0, "OK ", 0x3);
send_line(a0, "STARTTLS\r\n");
wait_for_text(a0, "OK ", 0x3);
goto LABEL_400ee5;
}
if (strcasecmp(a0->field_20, "postgres") && strcasecmp(a0->field_20, "postgresql") && (c_isdigit(a0->field_20->field_0) ^ 1) && !warned.11693) {
fprintf(stderr, "unknown protocol '%s'\n", a0->field_20);
warned.11693 = 1;
goto LABEL_400ee5;
}
if (a0->field_48)
log_msg(*(&stdout), "Negotiating PostgreSQL STARTTLS\n");
send(a0->field_0, &g_402321, 0x8, 0x0);
wait_for_text(a0, NULL, 0x0);
LABEL_400edd:
}
}
}
LABEL_400ee5:
goto LABEL_400ee6;
}
LABEL_400ee6:
v5 = *(&v1) ^ v4[5];
return;
}
|
void e2fsck_intercept_block_allocations(e2fsck_t ctx)
{
ext2fs_set_alloc_block_callback(ctx->fs, e2fsck_get_alloc_block, 0);
ext2fs_set_block_alloc_stats_callback(ctx->fs,
e2fsck_block_alloc_stats, 0);
ext2fs_set_new_range_callback(ctx->fs, e2fsck_new_range,
((void *)0)
);
ext2fs_set_block_alloc_stats_range_callback(ctx->fs,
e2fsck_block_alloc_stats_range,
((void *)0)
);
}
| void e2fsck_intercept_block_allocations(unsigned long long *a0) {
unsigned long long v1;
ext2fs_set_alloc_block_callback(*(a0), e2fsck_get_alloc_block, 0x0);
ext2fs_set_block_alloc_stats_callback(*(a0), e2fsck_block_alloc_stats, 0x0);
ext2fs_set_new_range_callback(*(a0), e2fsck_new_range, 0x0);
v1 = ext2fs_set_block_alloc_stats_range_callback(*(a0), e2fsck_block_alloc_stats_range, 0x0);
return;
}
|
static void fail_exit (int status)
{
if (pw_locked) {
if (pw_unlock () == 0) {
fprintf (
stderr
, gettext ("%s: failed to unlock %s\n"), Prog, pw_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failed to unlock %s", pw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
}
if (spw_locked) {
if (spw_unlock () == 0) {
fprintf (
stderr
, gettext ("%s: failed to unlock %s\n"), Prog, spw_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failed to unlock %s", spw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
}
exit (status);
}
| void fail_exit(int a1)
{
long v1;
long v2;
char *v3;
const char *v4;
long v5;
long v6;
char *v7;
const char *v8;
char *locale;
char *v10;
const char *s;
const char *v12;
if ( pw_locked && !(unsigned int)pw_unlock() )
{
v1 = pw_dbname();
v2 = Prog;
v3 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v3, v2, v1);
s = setlocale(6, 0LL);
locale = 0LL;
if ( s )
locale = strdup(s);
if ( locale )
setlocale(6, "C");
v4 = (const char *)pw_dbname();
syslog(3, "failed to unlock %s", v4);
if ( locale )
{
setlocale(6, locale);
free(locale);
}
}
if ( spw_locked && !(unsigned int)spw_unlock() )
{
v5 = spw_dbname();
v6 = Prog;
v7 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v7, v6, v5);
v12 = setlocale(6, 0LL);
v10 = 0LL;
if ( v12 )
v10 = strdup(v12);
if ( v10 )
setlocale(6, "C");
v8 = (const char *)spw_dbname();
syslog(3, "failed to unlock %s", v8);
if ( v10 )
{
setlocale(6, v10);
free(v10);
}
}
exit(a1);
}
|
static void
wrapf (char const *message,...)
{
va_list args;
char *buf;
int buflen;
__builtin_va_start(
args
,
message
)
;
buflen = vasprintf (&buf, message, args);
__builtin_va_end(
args
)
;
if (buflen < 0)
xalloc_die ();
if (0 < current_col)
{
if (max_col - current_col < buflen)
{
putchar_unlocked ('\n');
current_col = 0;
}
else
{
putchar_unlocked (' ');
current_col++;
}
}
fputs_unlocked (buf,
stdout
);
free (buf);
current_col += buflen;
}
| void wrapf() {
unsigned int v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned long v4;
unsigned long v5;
unsigned long long v6;
char v7;
unsigned long v8;
unsigned long v9;
unsigned long v10;
unsigned long v11;
unsigned long v12;
int v13;
int v14;
int v15;
int v16;
int v17;
int v18;
int v19;
int v20;
unsigned long v21;
unsigned long v22;
unsigned long v23;
unsigned long v24;
unsigned long v25;
unsigned long v26;
char v27;
int v28;
int v29;
int v30;
int v31;
int v32;
int v33;
int v34;
int v35;
unsigned long long *v36;
char *v37;
unsigned long long v38;
v8 = v22;
v9 = v23;
v10 = v24;
v11 = v25;
v12 = v26;
if (v27) {
v13 = v28;
v14 = v29;
v15 = v30;
v16 = v31;
v17 = v32;
v18 = v33;
v19 = v34;
v20 = v35;
}
v6 = v36[5];
v2 = 8;
v3 = 48;
v4 = &v21;
v5 = &v7;
v0 = vasprintf(&v1, v37, &v2);
if (v0 < 0)
xalloc_die();
if (current_col > 0) {
if (v0 > max_col - current_col) {
putchar_unlocked(0xa);
current_col = 0;
} else {
putchar_unlocked(0x20);
current_col = current_col + 1;
}
}
fputs_unlocked(*(&v1), stdout);
free(*(&v1));
current_col = v0 + current_col;
v38 = v6 ^ v36[5];
if ((v6 ^ v36[5]))
__stack_chk_fail();
return;
}
|
test_code_t test_bye(gnutls_session_t session)
{
int ret;
char data[20];
int secs = 6;
struct sigaction sa, old_sa;
signal(
14
, got_alarm);
sprintf(prio_str, "NONE:"
"+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT"
":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%s", protocol_str, rest);
{ int _ret; if ((_ret=__gnutls_priority_set_direct(session, prio_str, 698)) != TEST_SUCCEED) { return _ret; } };
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret == TEST_FAILED)
return ret;
ret = gnutls_bye(session, GNUTLS_SHUT_WR);
if (ret < 0)
return TEST_FAILED;
(void) sigaction (
14
,
((void *)0)
, &sa);
sa.sa_flags &= ~
0x10000000
;
sigaction(
14
, &sa, &old_sa);
alarm(secs);
do {
ret = gnutls_record_recv(session, data, sizeof(data));
}
while (ret > 0);
sigaction(
14
, &old_sa,
((void *)0)
);
if (ret == 0)
return TEST_SUCCEED;
if (alrm == 0)
return TEST_UNSURE;
return TEST_FAILED;
}
| int test_bye(undefined8 param_1)
{
int iVar1;
long in_FS_OFFSET;
sigaction local_168;
sigaction local_c8;
undefined local_28 [24];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
signal(0xe,got_alarm);
sprintf(prio_str,
"NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s"
,protocol_str,rest);
iVar1 = __gnutls_priority_set_direct(param_1,prio_str,0x2ba);
if (iVar1 == 0) {
gnutls_credentials_set(param_1,1,xcred);
iVar1 = test_do_handshake(param_1);
if (iVar1 != 1) {
iVar1 = gnutls_bye(param_1,1);
if (iVar1 < 0) {
iVar1 = 1;
}
else {
sigaction(0xe,(sigaction *)0x0,&local_168);
local_168.sa_flags = local_168.sa_flags & 0xefffffff;
sigaction(0xe,&local_168,&local_c8);
alarm(6);
do {
iVar1 = gnutls_record_recv(param_1,local_28,0x14);
} while (0 < iVar1);
sigaction(0xe,&local_c8,(sigaction *)0x0);
if (iVar1 == 0) {
iVar1 = 0;
}
else if (alrm == 0) {
iVar1 = 2;
}
else {
iVar1 = 1;
}
}
}
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return iVar1;
}
__stack_chk_fail();
}
|
void test_dict_inflate(compr, comprLen, uncompr, uncomprLen)
Byte *compr, *uncompr;
uLong comprLen, uncomprLen;
{
int err;
z_stream d_stream;
strcpy((char*)uncompr, "garbage");
d_stream.zalloc = zalloc;
d_stream.zfree = zfree;
d_stream.opaque = (voidpf)0;
d_stream.next_in = compr;
d_stream.avail_in = (uInt)comprLen;
err = inflateInit_((&d_stream), "1.2.13", (int)sizeof(z_stream));
{ if (err != 0) { fprintf(
stderr
, "%s error: %d\n", "inflateInit", err); exit(1); } };
d_stream.next_out = uncompr;
d_stream.avail_out = (uInt)uncomprLen;
for (;;) {
err = inflate(&d_stream, 0);
if (err == 1) break;
if (err == 2) {
if (d_stream.adler != dictId) {
fprintf(
stderr
, "unexpected dictionary");
exit(1);
}
err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,
(int)sizeof(dictionary));
}
{ if (err != 0) { fprintf(
stderr
, "%s error: %d\n", "inflate with dict", err); exit(1); } };
}
err = inflateEnd(&d_stream);
{ if (err != 0) { fprintf(
stderr
, "%s error: %d\n", "inflateEnd", err); exit(1); } };
if (strcmp((char*)uncompr, hello)) {
fprintf(
stderr
, "bad inflate with dict\n");
exit(1);
} else {
printf("inflate with dictionary: %s\n", (char *)uncompr);
}
}
| unsigned long test_dict_inflate(long a1, int a2, char *a3, int a4)
{
unsigned int v7;
unsigned int v8;
unsigned int v9;
long v10;
int v11;
char *v12;
int v13;
long v14;
long v15;
long v16;
long v17;
unsigned long v18;
v18 = __readfsqword(0x28u);
strcpy(a3, "garbage");
v14 = zalloc;
v15 = zfree;
v16 = 0LL;
v10 = a1;
v11 = a2;
v7 = inflateInit_(&v10, "1.2.13", 112LL);
if ( v7 )
{
fprintf(stderr, "%s error: %d\n", "inflateInit", v7);
exit(1);
}
v12 = a3;
v13 = a4;
while ( 1 )
{
v8 = inflate(&v10, 0LL);
if ( v8 == 1 )
break;
if ( v8 == 2 )
{
if ( v17 != dictId )
{
fprintf(stderr, "unexpected dictionary");
exit(1);
}
v8 = inflateSetDictionary(&v10, "hello", 6LL);
}
if ( v8 )
{
fprintf(stderr, "%s error: %d\n", "inflate with dict", v8);
exit(1);
}
}
v9 = inflateEnd(&v10);
if ( v9 )
{
fprintf(stderr, "%s error: %d\n", "inflateEnd", v9);
exit(1);
}
if ( strcmp(a3, hello) )
{
fprintf(stderr, "bad inflate with dict\n");
exit(1);
}
printf("inflate with dictionary: %s\n", a3);
return __readfsqword(0x28u) ^ v18;
}
|
static int print_linkinfo_brief(FILE *fp, const char *name,
const struct ifinfomsg *ifi,
struct rtattr *tb[])
{
unsigned int m_flag = 0;
m_flag = print_name_and_link("%-16s ", name, tb);
if (tb[IFLA_OPERSTATE])
print_operstate(fp, rta_getattr_u8(tb[IFLA_OPERSTATE]));
if (filter.family ==
17
) {
char b1[64];
if (tb[IFLA_ADDRESS]) {
print_color_string(PRINT_ANY, COLOR_MAC,
"address", "%s ",
ll_addr_n2a(
((void*)(((char*)(tb[IFLA_ADDRESS])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
((int)((tb[IFLA_ADDRESS])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))),
ifi->ifi_type,
b1, sizeof(b1)));
}
}
if (filter.family ==
17
) {
print_link_flags(fp, ifi->ifi_flags, m_flag);
print_string(PRINT_FP,
((void *)0)
, "%s", "\n");
}
fflush(fp);
return 0;
}
| long print_linkinfo_brief(FILE *a1, const char *a2, long a3, long a4)
{
unsigned char v4;
const char *v5;
int v9;
char v10[72];
unsigned long v11;
v11 = __readfsqword(0x28u);
v9 = print_name_and_link("%-16s ", a2);
if ( *(_QWORD *)(a4 + 128) )
{
v4 = rta_getattr_u8(*(_QWORD *)(a4 + 128));
print_operstate(a1, v4);
}
if ( dword_8504 == 17 && *(_QWORD *)(a4 + 8) )
{
v5 = (const char *)ll_addr_n2a(
*(_QWORD *)(a4 + 8) + 4LL,
(unsigned int)**(unsigned short **)(a4 + 8) - 4,
*(unsigned short *)(a3 + 2),
v10,
64LL);
print_color_string(4LL, 1LL, "address", "%s ", v5);
}
if ( dword_8504 == 17 )
{
print_link_flags((long)a1, *(_DWORD *)(a3 + 8), v9);
print_string(1u, 0LL, "%s", (long)"\n");
}
fflush(a1);
return 0LL;
}
|
static void
add_ignore_pattern (char const *pattern)
{
struct ignore_pattern *ignore;
ignore = xmalloc (sizeof *ignore);
ignore->pattern = pattern;
ignore->next = ignore_patterns;
ignore_patterns = ignore;
}
| void add_ignore_pattern(unsigned long a0) {
unsigned long long v0[2];
unsigned long long v3[2];
*(&v0[0]) = xmalloc(0x10);
v0[0] = a0;
v0[1] = ignore_patterns;
v3 = v0;
ignore_patterns[0] = v0;
return;
}
|
static __u64 getattr_u64(const struct rtattr *stat)
{
size_t len = ((int)((stat)->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)));
switch (len) {
case sizeof(__u64):
return rta_getattr_u64(stat);
case sizeof(__u32):
return rta_getattr_u32(stat);
case sizeof(__u16):
return rta_getattr_u16(stat);
case sizeof(__u8):
return rta_getattr_u8(stat);
default:
fprintf(
stderr
, "invalid attribute length %zu\n",
len);
exit(-1);
}
}
| long getattr_u64(_WORD *a1)
{
unsigned long v2;
v2 = (unsigned short)*a1 - 4LL;
if ( *a1 == 12LL )
return rta_getattr_u64((long)a1);
if ( v2 > 8 )
goto LABEL_12;
if ( *a1 == 8LL )
return (unsigned int)rta_getattr_u32((long)a1);
if ( v2 > 4 )
goto LABEL_12;
if ( *a1 == 5LL )
return (unsigned char)rta_getattr_u8((long)a1);
if ( *a1 != 6LL )
{
LABEL_12:
fprintf(stderr, "invalid attribute length %zu\n", v2);
exit(-1);
}
return (unsigned short)rta_getattr_u16((long)a1);
}
|
int
rl_show_char (int c)
{
int n = 1;
if (((c) > 0x07f && (c) <= 255) && (_rl_output_meta_chars == 0))
{
fprintf (rl_outstream, "M-");
n += 2;
c = ((c) & (~0x080));
}
if ((((c) < 0x020 && (((c) & 0x80) == 0)) && c != '\t') || c == 0x7f)
{
fprintf (rl_outstream, "C-");
n += 2;
c = ((c) < 0x020 && (((c) & 0x80) == 0)) ? ((1 && (1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)((c)|0x40)
))] & (unsigned short int) _ISlower)
)) ? toupper((unsigned char)(((c)|0x40))) : (((c)|0x40))) : '?';
}
putc (c, rl_outstream);
fflush (rl_outstream);
return n;
}
| long long rl_show_char(unsigned long a0) {
unsigned int v0;
unsigned int v1;
unsigned int v4;
unsigned int v6;
v0 = a0;
v1 = 1;
if (v0 > 127 && v0 <= 255 && !_rl_output_meta_chars) {
fprintf(rl_outstream, "M-");
v1 += 2;
v0 &= -129;
}
if (v0 <= 31 && !(v0 & 128) && !(v0 == 9))
goto LABEL_4068c7;
if (!(v0 == 127))
goto LABEL_406940;
LABEL_4068c7:
fprintf(rl_outstream, "C-");
v1 += 2;
if (v0 <= 31 && !(v0 & 128)) {
v6 = *((*(__ctype_b_loc()) + (v0 | 64) * 2)) & 0x200;
if (!v6) {
v4 = v0 | 64;
goto LABEL_40693d;
} else {
v4 = toupper(v0 | 64);
goto LABEL_40693d;
}
}
v4 = 63;
LABEL_40693d:
v0 = v4;
LABEL_406940:
putc(v0, rl_outstream);
fflush(rl_outstream);
return v1;
}
|
static int jread(struct buffer_head **bhp, journal_t *journal,
unsigned int offset)
{
int err;
unsigned long long blocknr;
struct buffer_head *bh;
*bhp =
((void *)0)
;
if (offset >= journal->j_total_len) {
printf("" "JBD2: corrupted journal superblock\n");
return -(2133571502L);
}
err = jbd2_journal_bmap(journal, offset, &blocknr);
if (err) {
printf("" "JBD2: bad block at offset %u\n",
offset);
return err;
}
bh = getblk(journal->j_dev, blocknr, journal->j_blocksize);
if (!bh)
return -
12
;
if (!buffer_uptodate(bh)) {
if (!1)
do {} while (0);
wait_on_buffer(bh);
}
if (!buffer_uptodate(bh)) {
printf("" "JBD2: Failed to read block at offset %u\n",
offset);
brelse(bh);
return -
5
;
}
*bhp = bh;
return 0;
}
| long jread(_QWORD *a1, long a2, unsigned int a3)
{
unsigned int v5;
long v6;
long v7;
unsigned long v8;
v8 = __readfsqword(0x28u);
*a1 = 0LL;
if ( a3 < *(_DWORD *)(a2 + 128) )
{
v5 = jbd2_journal_bmap(a2, a3, &v6);
if ( v5 )
{
printf("JBD2: bad block at offset %u\n", a3);
return v5;
}
else
{
v7 = getblk(*(_QWORD *)(a2 + 104), v6, *(unsigned int *)(a2 + 120));
if ( v7 )
{
if ( !(unsigned int)buffer_uptodate(v7) )
wait_on_buffer(v7);
if ( (unsigned int)buffer_uptodate(v7) )
{
*a1 = v7;
return 0LL;
}
else
{
printf("JBD2: Failed to read block at offset %u\n", a3);
brelse(v7);
return 4294967291LL;
}
}
else
{
return 4294967284LL;
}
}
}
else
{
printf("JBD2: corrupted journal superblock\n");
return 2161395794LL;
}
}
|
static
void usage(char *s)
{
fprintf(
stderr
, "Usage: %s {-e VAR[=VAL] | [-t SECONDS] {0|1|2|3|4|5|6|S|s|Q|q|A|a|B|b|C|c|U|u}}\n", s);
exit(1);
}
| void usage(undefined8 param_1)
{
fprintf(stderr,"Usage: %s {-e VAR[=VAL] | [-t SECONDS] {0|1|2|3|4|5|6|S|s|Q|q|A|a|B|b|C|c|U|u}}\n"
,param_1);
exit(1);
}
|
time_t get_crl_this_update_date(void)
{
if (batch && cfg.this_update_date !=
((void *)0)
) {
return get_date(cfg.this_update_date);
}
return time(
((void *)0)
);
}
| long long get_crl_this_update_date() {
unsigned long long v1;
if (*(got.batch) && *((got.cfg + 504))) {
v1 = get_date(*((got.cfg + 504)));
return v1;
}
v1 = time(NULL);
return v1;
}
|
static void
dumpdir_coder (struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr, void const *data)
{
xheader_print_n (xhdr, keyword, data, dumpdir_size (data));
}
| void dumpdir_coder(undefined8 param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4)
{
undefined8 uVar1;
uVar1 = dumpdir_size(param_4);
xheader_print_n(param_3,param_2,param_4,uVar1);
return;
}
|
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";
}
}
}
| const char * fmt_intarg(int a1, int a2)
{
const char *result;
if ( a2 == -1 )
return "unset";
switch ( a1 )
{
case 19:
result = fmt_multistate_int(a2, (long)&multistate_yesnoaskconfirm);
break;
case 29:
result = fmt_multistate_int(a2, (long)&multistate_strict_hostkey);
break;
case 38:
result = fmt_multistate_int(a2, (long)&multistate_pubkey_auth);
break;
case 53:
case 90:
result = fmt_multistate_int(a2, (long)&multistate_yesnoask);
break;
case 55:
result = fmt_multistate_int(a2, (long)&multistate_addressfamily);
break;
case 64:
result = fmt_multistate_int(a2, (long)&multistate_controlmaster);
break;
case 67:
result = fmt_multistate_int(a2, (long)&multistate_tunnel);
break;
case 75:
result = fmt_multistate_int(a2, (long)&multistate_requesttty);
break;
case 76:
result = fmt_multistate_int(a2, (long)&multistate_sessiontype);
break;
case 82:
result = fmt_multistate_int(a2, (long)&multistate_canonicalizehostname);
break;
case 89:
result = (const char *)ssh_digest_alg_name((unsigned int)a2);
break;
default:
if ( a2 )
{
if ( a2 == 1 )
result = "yes";
else
result = "UNKNOWN";
}
else
{
result = "no";
}
break;
}
return result;
}
|
_Bool
sys_get_archive_stat (void)
{
return fstat (archive, &archive_stat) == 0;
}
| long long sys_get_archive_stat() {
unsigned long long v1;
v1 = fstat(archive, &archive_stat);
*(&v1) = !v1;
return v1;
}
|
void
usage (FILE *out, int status)
{
const char str[] =
"gnutls-cli - GnuTLS client\n"
"Usage: gnutls-cli [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostname]\n"
"\n"
"None:\n"
"\n"
" -d, --debug=num Enable debugging\n"
" - it must be in the range:\n"
" 0 to 9999\n"
" -V, --verbose More verbose output\n"
" --tofu Enable trust on first use authentication\n"
" --strict-tofu Fail to connect if a certificate is unknown or a known certificate has changed\n"
" --dane Enable DANE certificate verification (DNSSEC)\n"
" --local-dns Use the local DNS server for DNSSEC resolving\n"
" --ca-verification Enable CA certificate verification\n"
" - enabled by default\n"
" - disabled as '--no-ca-verification'\n"
" --ocsp Enable OCSP certificate verification\n"
" -r, --resume Establish a session and resume\n"
" --earlydata=str Send early data on resumption from the specified file\n"
" -e, --rehandshake Establish a session and rehandshake\n"
" --sni-hostname=str Server's hostname for server name indication extension\n"
" --verify-hostname=str Server's hostname to use for validation\n"
" -s, --starttls Connect, establish a plain session and start TLS\n"
" --app-proto an alias for the 'starttls-proto' option\n"
" --starttls-proto=str The application protocol to be used to obtain the server's certificate (https, ftp, smtp, imap, ldap, xmpp, lmtp, pop3, nntp, sieve, postgres)\n"
" - prohibits the option 'starttls'\n"
" -u, --udp Use DTLS (datagram TLS) over UDP\n"
" --mtu=num Set MTU for datagram TLS\n"
" - it must be in the range:\n"
" 0 to 17000\n"
" --crlf Send CR LF instead of LF\n"
" --fastopen Enable TCP Fast Open\n"
" --x509fmtder Use DER format for certificates to read from\n"
" --print-cert Print peer's certificate in PEM format\n"
" --save-cert=str Save the peer's certificate chain in the specified file in PEM format\n"
" --save-ocsp=str Save the peer's OCSP status response in the provided file\n"
" - prohibits the option 'save-ocsp-multi'\n"
" --save-ocsp-multi=str Save all OCSP responses provided by the peer in this file\n"
" - prohibits the option 'save-ocsp'\n"
" --save-server-trace=str Save the server-side TLS message trace in the provided file\n"
" --save-client-trace=str Save the client-side TLS message trace in the provided file\n"
" --dh-bits=num The minimum number of bits allowed for DH\n"
" --priority=str Priorities string\n"
" --x509cafile=str Certificate file or PKCS #11 URL to use\n"
" --x509crlfile=file CRL file to use\n"
" - file must pre-exist\n"
" --x509keyfile=str X.509 key file or PKCS #11 URL to use\n"
" --x509certfile=str X.509 Certificate file or PKCS #11 URL to use\n"
" - requires the option 'x509keyfile'\n"
" --rawpkkeyfile=str Private key file (PKCS #8 or PKCS #12) or PKCS #11 URL to use\n"
" --rawpkfile=str Raw public-key file to use\n"
" - requires the option 'rawpkkeyfile'\n"
" --srpusername=str SRP username to use\n"
" --srppasswd=str SRP password to use\n"
" --pskusername=str PSK username to use\n"
" --pskkey=str PSK key (in hex) to use\n"
" -p, --port=str The port or service to connect to\n"
" --insecure Don't abort program if server certificate can't be validated\n"
" --verify-allow-broken Allow broken algorithms, such as MD5 for certificate verification\n"
" --benchmark-ciphers Benchmark individual ciphers\n"
" --benchmark-tls-kx Benchmark TLS key exchange methods\n"
" --benchmark-tls-ciphers Benchmark TLS ciphers\n"
" -l, --list Print a list of the supported algorithms and modes\n"
" - prohibits the option 'port'\n"
" --priority-list Print a list of the supported priority strings\n"
" --noticket Don't allow session tickets\n"
" --srtp-profiles=str Offer SRTP profiles\n"
" --alpn=str Application layer protocol\n"
" --compress-cert=str Compress certificate\n"
" -b, --heartbeat Activate heartbeat support\n"
" --recordsize=num The maximum record size to advertise\n"
" - it must be in the range:\n"
" 0 to 4096\n"
" --disable-sni Do not send a Server Name Indication (SNI)\n"
" --single-key-share Send a single key share under TLS1.3\n"
" --post-handshake-auth Enable post-handshake authentication under TLS1.3\n"
" --inline-commands Inline commands of the form ^<cmd>^\n"
" --inline-commands-prefix=str Change the default delimiter for inline commands\n"
" --provider=file Specify the PKCS #11 provider library\n"
" - file must pre-exist\n"
" --fips140-mode Reports the status of the FIPS140-2 mode in gnutls library\n"
" --list-config Reports the configuration of the library\n"
" --logfile=str Redirect informational messages to a specific file\n"
" --keymatexport=str Label used for exporting keying material\n"
" --keymatexportsize=num Size of the exported keying material\n"
" --waitresumption Block waiting for the resumption data under TLS1.3\n"
" --ca-auto-retrieve Enable automatic retrieval of missing CA certificates\n"
"\n"
"Version, usage and configuration options:\n"
"\n"
" -v, --version[=arg] output version information and exit\n"
" -h, --help display extended usage information and exit\n"
" -!, --more-help extended usage information passed thru pager\n"
"\n"
"Options are specified by doubled hyphens and their name or by a single\n"
"hyphen and the flag character.\n"
"Operands and options may be intermixed. They will be reordered.\n"
"\n"
"Simple client program to set up a TLS connection to some other computer. \n"
"It sets up a TLS connection and forwards data from the standard input to the secured socket and vice versa.\n"
"\n"
"Please send bug reports to: <bugs@gnutls.org>\n"
"\n";
fprintf (out, "%s", str);
exit (status);
}
| void usage(FILE *a1, int a2)
{
long v2[750];
v2[749] = __readfsqword(0x28u);
qmemcpy(v2, aGnutlsCliGnutl, 0x1763uLL);
fprintf(a1, "%s", (const char *)v2);
exit(a2);
}
|
terminal_overwrite(EditLine *el, const wchar_t *cp, size_t n)
{
if (n == 0)
return;
if (n > (size_t)el->el_terminal.t_size.h) {
return;
}
do {
terminal__putc(el, *cp++);
el->el_cursor.h++;
} while (--n);
if (el->el_cursor.h >= el->el_terminal.t_size.h) {
if (((el)->el_terminal.t_flags & 0x080)) {
el->el_cursor.h = 0;
if (el->el_cursor.v + 1 < el->el_terminal.t_size.v)
el->el_cursor.v++;
if (((el)->el_terminal.t_flags & 0x100)) {
wchar_t c;
if ((c = el->el_display[el->el_cursor.v]
[el->el_cursor.h]) != '\0') {
terminal_overwrite(el, &c, (size_t)1);
while (el->el_display[el->el_cursor.v]
[el->el_cursor.h] == ((wint_t)-1))
el->el_cursor.h++;
} else {
terminal__putc(el, ' ');
el->el_cursor.h = 1;
}
}
} else
el->el_cursor.h = el->el_terminal.t_size.h - 1;
}
}
| void terminal_overwrite(struct_0 *a0, unsigned long a1, unsigned long a2) {
unsigned long v0;
int tmp_9;
unsigned int *v1;
unsigned int v2;
char v3;
unsigned long long *v6;
unsigned long long v7;
v1 = a1;
v0 = a2;
if (v0 && v0 <= a0->field_90) {
while (true) {
tmp_9 = v1;
v1 += 1;
terminal__putc(a0, *(tmp_9));
a0->field_30 = a0->field_30 + 1;
v0 -= 1;
if (!v0)
break;
}
if (a0->field_30 >= a0->field_90) {
if ((a0->field_98 & 128)) {
a0->field_30 = 0;
if (a0->field_34 + 1 < a0->field_94)
a0->field_34 = a0->field_34 + 1;
if ((a0->field_98 & 0x100)) {
v2 = *((a0->field_30 * 4 + *((a0->field_34 * 8 + a0->field_38))));
if (v2) {
terminal_overwrite(a0, &v2, 0x1);
for (; *(((a0->field_30 << 2) + *(((a0->field_34 << 3) + a0->field_38)))) == -1; a0->field_30 = a0->field_30 + 1);
} else {
terminal__putc(a0, 0x20);
a0->field_30 = 1;
}
}
} else {
a0->field_30 = a0->field_90 - 1;
}
}
}
v7 = *(&v3) ^ v6[5];
return;
}
|
static void zero_pad(UINT8 *p, int nbytes)
{
if (nbytes >= (int)sizeof(UWORD)) {
while ((ptrdiff_t)p % sizeof(UWORD)) {
*p = 0;
nbytes--;
p++;
}
while (nbytes >= (int)sizeof(UWORD)) {
*(UWORD *)p = 0;
nbytes -= sizeof(UWORD);
p += sizeof(UWORD);
}
}
while (nbytes) {
*p = 0;
nbytes--;
p++;
}
}
| void zero_pad(undefined4 *param_1,int param_2)
{
int local_14;
undefined4 *local_10;
local_14 = param_2;
local_10 = param_1;
if (3 < param_2) {
for (; ((ulong)local_10 & 3) != 0; local_10 = (undefined4 *)((long)local_10 + 1)) {
*(undefined *)local_10 = 0;
local_14 = __addvsi3(local_14,0xffffffff);
}
for (; 3 < local_14; local_14 = local_14 + -4) {
*local_10 = 0;
local_10 = local_10 + 1;
}
}
while (local_14 != 0) {
*(undefined *)local_10 = 0;
local_14 = __addvsi3(local_14,0xffffffff);
local_10 = (undefined4 *)((long)local_10 + 1);
}
return;
}
|
static void
chacha_encrypt_bytes(chacha_ctx *x,const u8 *m,u8 *c,u32 bytes)
{
u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
u8 *ctarget =
((void *)0)
;
u8 tmp[64];
unsigned int i;
if (!bytes) return;
j0 = x->input[0];
j1 = x->input[1];
j2 = x->input[2];
j3 = x->input[3];
j4 = x->input[4];
j5 = x->input[5];
j6 = x->input[6];
j7 = x->input[7];
j8 = x->input[8];
j9 = x->input[9];
j10 = x->input[10];
j11 = x->input[11];
j12 = x->input[12];
j13 = x->input[13];
j14 = x->input[14];
j15 = x->input[15];
for (;;) {
if (bytes < 64) {
for (i = 0;i < bytes;++i) tmp[i] = m[i];
m = tmp;
ctarget = c;
c = tmp;
}
x0 = j0;
x1 = j1;
x2 = j2;
x3 = j3;
x4 = j4;
x5 = j5;
x6 = j6;
x7 = j7;
x8 = j8;
x9 = j9;
x10 = j10;
x11 = j11;
x12 = j12;
x13 = j13;
x14 = j14;
x15 = j15;
for (i = 20;i > 0;i -= 2) {
x0 = (((u32)((x0) + (x4)) & (0xFFFFFFFFU))); x12 = ((((u32)((((x12) ^ (x0))) << (16)) & (0xFFFFFFFFU)) | ((((x12) ^ (x0))) >> (32 - (16))))); x8 = (((u32)((x8) + (x12)) & (0xFFFFFFFFU))); x4 = ((((u32)((((x4) ^ (x8))) << (12)) & (0xFFFFFFFFU)) | ((((x4) ^ (x8))) >> (32 - (12))))); x0 = (((u32)((x0) + (x4)) & (0xFFFFFFFFU))); x12 = ((((u32)((((x12) ^ (x0))) << (8)) & (0xFFFFFFFFU)) | ((((x12) ^ (x0))) >> (32 - (8))))); x8 = (((u32)((x8) + (x12)) & (0xFFFFFFFFU))); x4 = ((((u32)((((x4) ^ (x8))) << (7)) & (0xFFFFFFFFU)) | ((((x4) ^ (x8))) >> (32 - (7)))));
x1 = (((u32)((x1) + (x5)) & (0xFFFFFFFFU))); x13 = ((((u32)((((x13) ^ (x1))) << (16)) & (0xFFFFFFFFU)) | ((((x13) ^ (x1))) >> (32 - (16))))); x9 = (((u32)((x9) + (x13)) & (0xFFFFFFFFU))); x5 = ((((u32)((((x5) ^ (x9))) << (12)) & (0xFFFFFFFFU)) | ((((x5) ^ (x9))) >> (32 - (12))))); x1 = (((u32)((x1) + (x5)) & (0xFFFFFFFFU))); x13 = ((((u32)((((x13) ^ (x1))) << (8)) & (0xFFFFFFFFU)) | ((((x13) ^ (x1))) >> (32 - (8))))); x9 = (((u32)((x9) + (x13)) & (0xFFFFFFFFU))); x5 = ((((u32)((((x5) ^ (x9))) << (7)) & (0xFFFFFFFFU)) | ((((x5) ^ (x9))) >> (32 - (7)))));
x2 = (((u32)((x2) + (x6)) & (0xFFFFFFFFU))); x14 = ((((u32)((((x14) ^ (x2))) << (16)) & (0xFFFFFFFFU)) | ((((x14) ^ (x2))) >> (32 - (16))))); x10 = (((u32)((x10) + (x14)) & (0xFFFFFFFFU))); x6 = ((((u32)((((x6) ^ (x10))) << (12)) & (0xFFFFFFFFU)) | ((((x6) ^ (x10))) >> (32 - (12))))); x2 = (((u32)((x2) + (x6)) & (0xFFFFFFFFU))); x14 = ((((u32)((((x14) ^ (x2))) << (8)) & (0xFFFFFFFFU)) | ((((x14) ^ (x2))) >> (32 - (8))))); x10 = (((u32)((x10) + (x14)) & (0xFFFFFFFFU))); x6 = ((((u32)((((x6) ^ (x10))) << (7)) & (0xFFFFFFFFU)) | ((((x6) ^ (x10))) >> (32 - (7)))));
x3 = (((u32)((x3) + (x7)) & (0xFFFFFFFFU))); x15 = ((((u32)((((x15) ^ (x3))) << (16)) & (0xFFFFFFFFU)) | ((((x15) ^ (x3))) >> (32 - (16))))); x11 = (((u32)((x11) + (x15)) & (0xFFFFFFFFU))); x7 = ((((u32)((((x7) ^ (x11))) << (12)) & (0xFFFFFFFFU)) | ((((x7) ^ (x11))) >> (32 - (12))))); x3 = (((u32)((x3) + (x7)) & (0xFFFFFFFFU))); x15 = ((((u32)((((x15) ^ (x3))) << (8)) & (0xFFFFFFFFU)) | ((((x15) ^ (x3))) >> (32 - (8))))); x11 = (((u32)((x11) + (x15)) & (0xFFFFFFFFU))); x7 = ((((u32)((((x7) ^ (x11))) << (7)) & (0xFFFFFFFFU)) | ((((x7) ^ (x11))) >> (32 - (7)))));
x0 = (((u32)((x0) + (x5)) & (0xFFFFFFFFU))); x15 = ((((u32)((((x15) ^ (x0))) << (16)) & (0xFFFFFFFFU)) | ((((x15) ^ (x0))) >> (32 - (16))))); x10 = (((u32)((x10) + (x15)) & (0xFFFFFFFFU))); x5 = ((((u32)((((x5) ^ (x10))) << (12)) & (0xFFFFFFFFU)) | ((((x5) ^ (x10))) >> (32 - (12))))); x0 = (((u32)((x0) + (x5)) & (0xFFFFFFFFU))); x15 = ((((u32)((((x15) ^ (x0))) << (8)) & (0xFFFFFFFFU)) | ((((x15) ^ (x0))) >> (32 - (8))))); x10 = (((u32)((x10) + (x15)) & (0xFFFFFFFFU))); x5 = ((((u32)((((x5) ^ (x10))) << (7)) & (0xFFFFFFFFU)) | ((((x5) ^ (x10))) >> (32 - (7)))));
x1 = (((u32)((x1) + (x6)) & (0xFFFFFFFFU))); x12 = ((((u32)((((x12) ^ (x1))) << (16)) & (0xFFFFFFFFU)) | ((((x12) ^ (x1))) >> (32 - (16))))); x11 = (((u32)((x11) + (x12)) & (0xFFFFFFFFU))); x6 = ((((u32)((((x6) ^ (x11))) << (12)) & (0xFFFFFFFFU)) | ((((x6) ^ (x11))) >> (32 - (12))))); x1 = (((u32)((x1) + (x6)) & (0xFFFFFFFFU))); x12 = ((((u32)((((x12) ^ (x1))) << (8)) & (0xFFFFFFFFU)) | ((((x12) ^ (x1))) >> (32 - (8))))); x11 = (((u32)((x11) + (x12)) & (0xFFFFFFFFU))); x6 = ((((u32)((((x6) ^ (x11))) << (7)) & (0xFFFFFFFFU)) | ((((x6) ^ (x11))) >> (32 - (7)))));
x2 = (((u32)((x2) + (x7)) & (0xFFFFFFFFU))); x13 = ((((u32)((((x13) ^ (x2))) << (16)) & (0xFFFFFFFFU)) | ((((x13) ^ (x2))) >> (32 - (16))))); x8 = (((u32)((x8) + (x13)) & (0xFFFFFFFFU))); x7 = ((((u32)((((x7) ^ (x8))) << (12)) & (0xFFFFFFFFU)) | ((((x7) ^ (x8))) >> (32 - (12))))); x2 = (((u32)((x2) + (x7)) & (0xFFFFFFFFU))); x13 = ((((u32)((((x13) ^ (x2))) << (8)) & (0xFFFFFFFFU)) | ((((x13) ^ (x2))) >> (32 - (8))))); x8 = (((u32)((x8) + (x13)) & (0xFFFFFFFFU))); x7 = ((((u32)((((x7) ^ (x8))) << (7)) & (0xFFFFFFFFU)) | ((((x7) ^ (x8))) >> (32 - (7)))));
x3 = (((u32)((x3) + (x4)) & (0xFFFFFFFFU))); x14 = ((((u32)((((x14) ^ (x3))) << (16)) & (0xFFFFFFFFU)) | ((((x14) ^ (x3))) >> (32 - (16))))); x9 = (((u32)((x9) + (x14)) & (0xFFFFFFFFU))); x4 = ((((u32)((((x4) ^ (x9))) << (12)) & (0xFFFFFFFFU)) | ((((x4) ^ (x9))) >> (32 - (12))))); x3 = (((u32)((x3) + (x4)) & (0xFFFFFFFFU))); x14 = ((((u32)((((x14) ^ (x3))) << (8)) & (0xFFFFFFFFU)) | ((((x14) ^ (x3))) >> (32 - (8))))); x9 = (((u32)((x9) + (x14)) & (0xFFFFFFFFU))); x4 = ((((u32)((((x4) ^ (x9))) << (7)) & (0xFFFFFFFFU)) | ((((x4) ^ (x9))) >> (32 - (7)))));
}
x0 = (((u32)((x0) + (j0)) & (0xFFFFFFFFU)));
x1 = (((u32)((x1) + (j1)) & (0xFFFFFFFFU)));
x2 = (((u32)((x2) + (j2)) & (0xFFFFFFFFU)));
x3 = (((u32)((x3) + (j3)) & (0xFFFFFFFFU)));
x4 = (((u32)((x4) + (j4)) & (0xFFFFFFFFU)));
x5 = (((u32)((x5) + (j5)) & (0xFFFFFFFFU)));
x6 = (((u32)((x6) + (j6)) & (0xFFFFFFFFU)));
x7 = (((u32)((x7) + (j7)) & (0xFFFFFFFFU)));
x8 = (((u32)((x8) + (j8)) & (0xFFFFFFFFU)));
x9 = (((u32)((x9) + (j9)) & (0xFFFFFFFFU)));
x10 = (((u32)((x10) + (j10)) & (0xFFFFFFFFU)));
x11 = (((u32)((x11) + (j11)) & (0xFFFFFFFFU)));
x12 = (((u32)((x12) + (j12)) & (0xFFFFFFFFU)));
x13 = (((u32)((x13) + (j13)) & (0xFFFFFFFFU)));
x14 = (((u32)((x14) + (j14)) & (0xFFFFFFFFU)));
x15 = (((u32)((x15) + (j15)) & (0xFFFFFFFFU)));
j12 = ((((u32)(((j12)) + (1)) & (0xFFFFFFFFU))));
if (!j12) {
j13 = ((((u32)(((j13)) + (1)) & (0xFFFFFFFFU))));
}
do { (c + 0)[0] = ((u8)((x0)) & (0xFFU)); (c + 0)[1] = ((u8)((x0) >> 8) & (0xFFU)); (c + 0)[2] = ((u8)((x0) >> 16) & (0xFFU)); (c + 0)[3] = ((u8)((x0) >> 24) & (0xFFU)); } while (0);
do { (c + 4)[0] = ((u8)((x1)) & (0xFFU)); (c + 4)[1] = ((u8)((x1) >> 8) & (0xFFU)); (c + 4)[2] = ((u8)((x1) >> 16) & (0xFFU)); (c + 4)[3] = ((u8)((x1) >> 24) & (0xFFU)); } while (0);
do { (c + 8)[0] = ((u8)((x2)) & (0xFFU)); (c + 8)[1] = ((u8)((x2) >> 8) & (0xFFU)); (c + 8)[2] = ((u8)((x2) >> 16) & (0xFFU)); (c + 8)[3] = ((u8)((x2) >> 24) & (0xFFU)); } while (0);
do { (c + 12)[0] = ((u8)((x3)) & (0xFFU)); (c + 12)[1] = ((u8)((x3) >> 8) & (0xFFU)); (c + 12)[2] = ((u8)((x3) >> 16) & (0xFFU)); (c + 12)[3] = ((u8)((x3) >> 24) & (0xFFU)); } while (0);
do { (c + 16)[0] = ((u8)((x4)) & (0xFFU)); (c + 16)[1] = ((u8)((x4) >> 8) & (0xFFU)); (c + 16)[2] = ((u8)((x4) >> 16) & (0xFFU)); (c + 16)[3] = ((u8)((x4) >> 24) & (0xFFU)); } while (0);
do { (c + 20)[0] = ((u8)((x5)) & (0xFFU)); (c + 20)[1] = ((u8)((x5) >> 8) & (0xFFU)); (c + 20)[2] = ((u8)((x5) >> 16) & (0xFFU)); (c + 20)[3] = ((u8)((x5) >> 24) & (0xFFU)); } while (0);
do { (c + 24)[0] = ((u8)((x6)) & (0xFFU)); (c + 24)[1] = ((u8)((x6) >> 8) & (0xFFU)); (c + 24)[2] = ((u8)((x6) >> 16) & (0xFFU)); (c + 24)[3] = ((u8)((x6) >> 24) & (0xFFU)); } while (0);
do { (c + 28)[0] = ((u8)((x7)) & (0xFFU)); (c + 28)[1] = ((u8)((x7) >> 8) & (0xFFU)); (c + 28)[2] = ((u8)((x7) >> 16) & (0xFFU)); (c + 28)[3] = ((u8)((x7) >> 24) & (0xFFU)); } while (0);
do { (c + 32)[0] = ((u8)((x8)) & (0xFFU)); (c + 32)[1] = ((u8)((x8) >> 8) & (0xFFU)); (c + 32)[2] = ((u8)((x8) >> 16) & (0xFFU)); (c + 32)[3] = ((u8)((x8) >> 24) & (0xFFU)); } while (0);
do { (c + 36)[0] = ((u8)((x9)) & (0xFFU)); (c + 36)[1] = ((u8)((x9) >> 8) & (0xFFU)); (c + 36)[2] = ((u8)((x9) >> 16) & (0xFFU)); (c + 36)[3] = ((u8)((x9) >> 24) & (0xFFU)); } while (0);
do { (c + 40)[0] = ((u8)((x10)) & (0xFFU)); (c + 40)[1] = ((u8)((x10) >> 8) & (0xFFU)); (c + 40)[2] = ((u8)((x10) >> 16) & (0xFFU)); (c + 40)[3] = ((u8)((x10) >> 24) & (0xFFU)); } while (0);
do { (c + 44)[0] = ((u8)((x11)) & (0xFFU)); (c + 44)[1] = ((u8)((x11) >> 8) & (0xFFU)); (c + 44)[2] = ((u8)((x11) >> 16) & (0xFFU)); (c + 44)[3] = ((u8)((x11) >> 24) & (0xFFU)); } while (0);
do { (c + 48)[0] = ((u8)((x12)) & (0xFFU)); (c + 48)[1] = ((u8)((x12) >> 8) & (0xFFU)); (c + 48)[2] = ((u8)((x12) >> 16) & (0xFFU)); (c + 48)[3] = ((u8)((x12) >> 24) & (0xFFU)); } while (0);
do { (c + 52)[0] = ((u8)((x13)) & (0xFFU)); (c + 52)[1] = ((u8)((x13) >> 8) & (0xFFU)); (c + 52)[2] = ((u8)((x13) >> 16) & (0xFFU)); (c + 52)[3] = ((u8)((x13) >> 24) & (0xFFU)); } while (0);
do { (c + 56)[0] = ((u8)((x14)) & (0xFFU)); (c + 56)[1] = ((u8)((x14) >> 8) & (0xFFU)); (c + 56)[2] = ((u8)((x14) >> 16) & (0xFFU)); (c + 56)[3] = ((u8)((x14) >> 24) & (0xFFU)); } while (0);
do { (c + 60)[0] = ((u8)((x15)) & (0xFFU)); (c + 60)[1] = ((u8)((x15) >> 8) & (0xFFU)); (c + 60)[2] = ((u8)((x15) >> 16) & (0xFFU)); (c + 60)[3] = ((u8)((x15) >> 24) & (0xFFU)); } while (0);
if (bytes <= 64) {
if (bytes < 64) {
for (i = 0;i < bytes;++i) ctarget[i] = c[i];
}
x->input[12] = j12;
x->input[13] = j13;
return;
}
bytes -= 64;
c += 64;
}
}
| void chacha_encrypt_bytes(unsigned int a0[16], unsigned long a1, unsigned long a2, unsigned long a3) {
unsigned long v0;
int tmp_234;
int tmp_267;
int tmp_324;
int tmp_357;
int tmp_414;
int tmp_447;
int tmp_504;
int tmp_537;
int tmp_594;
int tmp_627;
int tmp_684;
int tmp_170;
int tmp_203;
int tmp_260;
int tmp_293;
int tmp_350;
int tmp_383;
int tmp_440;
void* v1;
void* v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
unsigned int v11;
unsigned int v12;
unsigned int v13;
unsigned int v14;
unsigned int v15;
unsigned int v16;
unsigned int v17;
unsigned int v18;
unsigned int v19;
unsigned int v20;
unsigned int v21;
unsigned int v22;
unsigned int v23;
unsigned int v24;
unsigned int v25;
unsigned int v26;
unsigned int v27;
unsigned int v28;
unsigned int v29;
unsigned int v30;
unsigned int v31;
unsigned int v32;
unsigned int v33;
unsigned int v34;
unsigned int v35;
void* v36;
char v37;
char v38;
unsigned long v40;
unsigned long v41;
unsigned long v42;
unsigned long long *v43;
unsigned long long v44;
v2 = a1;
v1 = a2;
v0 = a3;
v36 = 0;
if (v0) {
v22 = a0[0];
v23 = a0[1];
v24 = a0[2];
v25 = a0[3];
v26 = a0[4];
v27 = a0[5];
v28 = a0[6];
v29 = a0[7];
v30 = a0[8];
v31 = a0[9];
v32 = a0[10];
v33 = a0[11];
v19 = a0[12];
v20 = a0[13];
v34 = a0[14];
v35 = a0[15];
while (true) {
if (v0 <= 63) {
for (v21 = 0; v21 < v0; v21 += 1) {
(&v37)[v21] = v2[v21];
}
v2 = &v37;
v36 = v1;
v1 = &v37;
}
v3 = v22;
v4 = v23;
v5 = v24;
v6 = v25;
v7 = v26;
v8 = v27;
v9 = v28;
v10 = v29;
v11 = v30;
v12 = v31;
v13 = v32;
v14 = v33;
v15 = v19;
v16 = v20;
v17 = v34;
v18 = v35;
for (v21 = 20; v21; v21 -= 2) {
v3 += v7;
tmp_234 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-180, size=4, endness=Iend_LE) ^ Load(addr=stack_base-228, size=4, endness=Iend_LE))), 0x0<64>, cc_ndep<8>);
v15 = (v15 ^ v3) * 0x10000 | (v15 ^ v3) >> 16;
v11 += v15;
tmp_267 = v7 ^ v11;
v7 = (v7 ^ v11) * 0x1000 | (v7 ^ v11) >> 20;
v3 += v7;
tmp_324 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-180, size=4, endness=Iend_LE) ^ Load(addr=stack_base-228, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v15 = (v15 ^ v3) * 0x100 | (v15 ^ v3) >> 24;
v11 += v15;
tmp_357 = v7 ^ v11;
v7 = (v7 ^ v11) * 128 | (v7 ^ v11) >> 25;
v4 += v8;
tmp_414 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-176, size=4, endness=Iend_LE) ^ Load(addr=stack_base-224, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v16 = (v16 ^ v4) * 0x10000 | (v16 ^ v4) >> 16;
v12 += v16;
tmp_447 = v8 ^ v12;
v8 = (v8 ^ v12) * 0x1000 | (v8 ^ v12) >> 20;
v4 += v8;
tmp_504 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-176, size=4, endness=Iend_LE) ^ Load(addr=stack_base-224, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v16 = (v16 ^ v4) * 0x100 | (v16 ^ v4) >> 24;
v12 += v16;
tmp_537 = v8 ^ v12;
v8 = (v8 ^ v12) * 128 | (v8 ^ v12) >> 25;
v5 += v9;
tmp_594 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-172, size=4, endness=Iend_LE) ^ Load(addr=stack_base-220, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v17 = (v17 ^ v5) * 0x10000 | (v17 ^ v5) >> 16;
v13 += v17;
tmp_627 = v9 ^ v13;
v9 = (v9 ^ v13) * 0x1000 | (v9 ^ v13) >> 20;
v5 += v9;
tmp_684 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-172, size=4, endness=Iend_LE) ^ Load(addr=stack_base-220, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v17 = (v17 ^ v5) * 0x100 | (v17 ^ v5) >> 24;
v13 += v17;
v40 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-204, size=4, endness=Iend_LE) ^ Load(addr=stack_base-188, size=4, endness=Iend_LE))), 0x0<64>, t684);
v9 = (v9 ^ v13) * 128 | (v9 ^ v13) >> 25;
v6 += v10;
tmp_234 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-168, size=4, endness=Iend_LE) ^ Load(addr=stack_base-216, size=4, endness=Iend_LE))), 0x0<64>, cc_ndep<8>);
v18 = (v18 ^ v6) * 0x10000 | (v18 ^ v6) >> 16;
v14 += v18;
tmp_267 = v10 ^ v14;
v10 = (v10 ^ v14) * 0x1000 | (v10 ^ v14) >> 20;
v6 += v10;
tmp_324 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-168, size=4, endness=Iend_LE) ^ Load(addr=stack_base-216, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v18 = (v18 ^ v6) * 0x100 | (v18 ^ v6) >> 24;
v14 += v18;
tmp_357 = v10 ^ v14;
v10 = (v10 ^ v14) * 128 | (v10 ^ v14) >> 25;
v3 += v8;
tmp_414 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-168, size=4, endness=Iend_LE) ^ Load(addr=stack_base-228, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v18 = (v18 ^ v3) * 0x10000 | (v18 ^ v3) >> 16;
v13 += v18;
tmp_447 = v8 ^ v13;
v8 = (v8 ^ v13) * 0x1000 | (v8 ^ v13) >> 20;
v3 += v8;
tmp_504 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-168, size=4, endness=Iend_LE) ^ Load(addr=stack_base-228, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v18 = (v18 ^ v3) * 0x100 | (v18 ^ v3) >> 24;
v13 += v18;
tmp_537 = v8 ^ v13;
v8 = (v8 ^ v13) * 128 | (v8 ^ v13) >> 25;
v4 += v9;
tmp_594 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-180, size=4, endness=Iend_LE) ^ Load(addr=stack_base-224, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v15 = (v15 ^ v4) * 0x10000 | (v15 ^ v4) >> 16;
v14 += v15;
tmp_627 = v9 ^ v14;
v9 = (v9 ^ v14) * 0x1000 | (v9 ^ v14) >> 20;
v4 += v9;
tmp_684 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-180, size=4, endness=Iend_LE) ^ Load(addr=stack_base-224, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v15 = (v15 ^ v4) * 0x100 | (v15 ^ v4) >> 24;
v14 += v15;
v41 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-204, size=4, endness=Iend_LE) ^ Load(addr=stack_base-184, size=4, endness=Iend_LE))), 0x0<64>, t684);
v9 = (v9 ^ v14) * 128 | (v9 ^ v14) >> 25;
v5 += v10;
tmp_170 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-176, size=4, endness=Iend_LE) ^ Load(addr=stack_base-220, size=4, endness=Iend_LE))), 0x0<64>, cc_ndep<8>);
v16 = (v16 ^ v5) * 0x10000 | (v16 ^ v5) >> 16;
v11 += v16;
tmp_203 = v10 ^ v11;
v10 = (v10 ^ v11) * 0x1000 | (v10 ^ v11) >> 20;
v5 += v10;
tmp_260 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-176, size=4, endness=Iend_LE) ^ Load(addr=stack_base-220, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v16 = (v16 ^ v5) * 0x100 | (v16 ^ v5) >> 24;
v11 += v16;
tmp_293 = v10 ^ v11;
v10 = (v10 ^ v11) * 128 | (v10 ^ v11) >> 25;
v6 += v7;
tmp_350 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-172, size=4, endness=Iend_LE) ^ Load(addr=stack_base-216, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v17 = (v17 ^ v6) * 0x10000 | (v17 ^ v6) >> 16;
v12 += v17;
tmp_383 = v7 ^ v12;
v7 = (v7 ^ v12) * 0x1000 | (v7 ^ v12) >> 20;
v6 += v7;
tmp_440 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-172, size=4, endness=Iend_LE) ^ Load(addr=stack_base-216, size=4, endness=Iend_LE))), 0x0<64>, DirtyExpression (<class 'ailment.expression.VEXCCallExpression'>));
v17 = (v17 ^ v6) * 0x100 | (v17 ^ v6) >> 24;
v12 += v17;
v42 = [D] amd64g_calculate_rflags_all(0x13<64>, Conv(32->64, (Load(addr=stack_base-212, size=4, endness=Iend_LE) ^ Load(addr=stack_base-192, size=4, endness=Iend_LE))), 0x0<64>, t440);
v7 = (v7 ^ v12) * 128 | (v7 ^ v12) >> 25;
}
v3 += v22;
v4 += v23;
v5 += v24;
v6 += v25;
v7 += v26;
v8 += v27;
v9 += v28;
v10 += v29;
v11 += v30;
v12 += v31;
v13 += v32;
v14 += v33;
v15 += v19;
v16 += v20;
v17 += v34;
v18 += v35;
v19 += 1;
if (!v19)
v20 += 1;
*(v1) = v3;
*(&v1[1]) = v3 >> 8;
*(&v1[2]) = v3 >> 16;
*(&v1[3]) = v3 >> 24;
*(&v1[4]) = v4;
*(&v1[5]) = v4 >> 8;
*(&v1[6]) = v4 >> 16;
*(&v1[7]) = v4 >> 24;
*(&v1[8]) = v5;
*(&v1[9]) = v5 >> 8;
*(&v1[10]) = v5 >> 16;
*(&v1[11]) = v5 >> 24;
*(&v1[12]) = v6;
*(&v1[13]) = v6 >> 8;
*(&v1[14]) = v6 >> 16;
*(&v1[15]) = v6 >> 24;
*(&v1[16]) = v7;
*(&v1[17]) = v7 >> 8;
*(&v1[18]) = v7 >> 16;
*(&v1[19]) = v7 >> 24;
*(&v1[20]) = v8;
*(&v1[21]) = v8 >> 8;
*(&v1[22]) = v8 >> 16;
*(&v1[23]) = v8 >> 24;
*(&v1[24]) = v9;
*(&v1[25]) = v9 >> 8;
*(&v1[26]) = v9 >> 16;
*(&v1[27]) = v9 >> 24;
*(&v1[28]) = v10;
*(&v1[29]) = v10 >> 8;
*(&v1[30]) = v10 >> 16;
*(&v1[31]) = v10 >> 24;
*(&v1[32]) = v11;
*(&v1[33]) = v11 >> 8;
*(&v1[34]) = v11 >> 16;
*(&v1[35]) = v11 >> 24;
*(&v1[36]) = v12;
*(&v1[37]) = v12 >> 8;
*(&v1[38]) = v12 >> 16;
*(&v1[39]) = v12 >> 24;
*(&v1[40]) = v13;
*(&v1[41]) = v13 >> 8;
*(&v1[42]) = v13 >> 16;
*(&v1[43]) = v13 >> 24;
*(&v1[44]) = v14;
*(&v1[45]) = v14 >> 8;
*(&v1[46]) = v14 >> 16;
*(&v1[47]) = v14 >> 24;
*(&v1[48]) = v15;
*(&v1[49]) = v15 >> 8;
*(&v1[50]) = v15 >> 16;
*(&v1[51]) = v15 >> 24;
*(&v1[52]) = v16;
*(&v1[53]) = v16 >> 8;
*(&v1[54]) = v16 >> 16;
*(&v1[55]) = v16 >> 24;
*(&v1[56]) = v17;
*(&v1[57]) = v17 >> 8;
*(&v1[58]) = v17 >> 16;
*(&v1[59]) = v17 >> 24;
*(&v1[60]) = v18;
*(&v1[61]) = v18 >> 8;
*(&v1[62]) = v18 >> 16;
*(&v1[63]) = v18 >> 24;
if (v0 <= 64)
break;
v0 = v0 - 64;
v1 += 64;
}
if (v0 <= 63) {
for (v21 = 0; v21 < v0; v21 += 1) {
*(v36 + v21) = *(v1 + v21);
}
}
a0[12] = v19;
a0[13] = v20;
}
v44 = *(&v38) ^ v43[5];
return;
}
|
void
tolocal(int argc, char **argv, enum scp_mode_e mode, char *sftp_direct)
{
char *bp, *host =
((void *)0)
, *src =
((void *)0)
, *suser =
((void *)0)
;
arglist alist;
struct sftp_conn *conn =
((void *)0)
;
int i, r, sport = -1;
memset(&alist, '\0', sizeof(alist));
alist.list =
((void *)0)
;
for (i = 0; i < argc - 1; i++) {
free(suser);
free(host);
free(src);
r = parse_scp_uri(argv[i], &suser, &host, &sport, &src);
if (r == -1) {
fmprintf(
stderr
, "%s: invalid uri\n", argv[i]);
++errs;
continue;
}
if (r != 0)
parse_user_host_path(argv[i], &suser, &host, &src);
if (suser !=
((void *)0)
&& !okname(suser)) {
++errs;
continue;
}
if (!host) {
freeargs(&alist);
addargs(&alist, "%s", "cp");
if (iamrecursive)
addargs(&alist, "-r");
if (pflag)
addargs(&alist, "-p");
addargs(&alist, "--");
addargs(&alist, "%s", argv[i]);
addargs(&alist, "%s", argv[argc-1]);
if (do_local_cmd(&alist))
++errs;
continue;
}
if (mode == MODE_SFTP) {
conn = do_sftp_connect(host, suser, sport,
sftp_direct, &remin, &remout, &do_cmd_pid);
if (conn ==
((void *)0)
) {
sshlog("scp.c", __func__, 1215, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "sftp connection failed");
++errs;
continue;
}
sink_sftp(1, argv[argc - 1], src, conn);
free(conn);
(void) close(remin);
(void) close(remout);
remin = remout = -1;
continue;
}
xasprintf(&bp, "%s -f %s%s",
cmd, *src == '-' ? "-- " : "", src);
if (do_cmd(ssh_program, host, suser, sport, 0, bp,
&remin, &remout, &do_cmd_pid) < 0) {
free(bp);
++errs;
continue;
}
free(bp);
sink(1, argv + argc - 1, src);
(void) close(remin);
remin = remout = -1;
}
free(suser);
free(host);
free(src);
}
| void tolocal(unsigned long a0, unsigned long long *a1, unsigned long long a2, unsigned long long a3, unsigned long a4, unsigned long long a5) {
char v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
char v5;
void* v6;
void* v7;
void* v8;
void* v9;
char v10;
char v11;
unsigned long long v14;
unsigned long long v15;
unsigned long long *v18;
unsigned long long v19;
v6 = 0;
v7 = 0;
v8 = 0;
v9 = 0;
v2 = -1;
memset(&v10, 0x0, 0x10);
v10 = 0;
v3 = 0;
while (true) {
if (v3 >= __addvsi3(a0, 0xffffffff))
break;
free(v8);
free(v6);
free(v7);
v4 = parse_scp_uri(a1[v3], &v8, &v6, &v2, &v7);
if (v4 == -1) {
fmprintf(stderr, "%s: invalid uri\n", a1[v3]);
targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1);
} else {
if (v4)
parse_user_host_path(a1[v3], &v8, &v6, &v7);
if (v8) {
v14 = okname(v8, a1, a2, a3, &v7, a5);
if (!v14)
targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1);
}
if (!v8 || v14) {
if (!v6) {
freeargs(&v10);
addargs(&v10, "%s");
addargs(&v10, "-r");
addargs(&v10, "-p");
addargs(&v10, "--");
addargs(&v10, "%s");
__addvsi3(a0, 0xffffffff);
addargs(&v10, "%s");
if (do_local_cmd(&v10))
targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1);
} else if (a2 == 1) {
v9 = do_sftp_connect(v6, v8, v2, a3, &targetshouldbedirectory, &targetshouldbedirectory, &do_cmd_pid);
if (!v9) {
sshlog("scp.c", "tolocal", 0x4bf, 0x0, 0x2, 0x0, "sftp connection failed", *(&v0), *(&v1));
targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1);
} else {
sink_sftp(0x1, a1[__addvsi3(a0, 0xffffffff)], v7, v9);
free(v9);
close(0xe5894855);
close(0xe5894855);
targetshouldbedirectory = -1;
targetshouldbedirectory = 1219493948222425173;
}
} else {
if (*(v7) == 45)
v15 = "-- ";
else
v15 = &g_406e67;
xasprintf(&v5, "%s -f %s%s", &cmd, v15, v7);
if (do_cmd(ssh_program, v6, v8, v2, 0x0, *(&v5), &targetshouldbedirectory, &targetshouldbedirectory, &do_cmd_pid) < 0) {
free(*(&v5));
targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1);
} else {
free(*(&v5));
sink(0x1, &a1[1 + a0], v7);
close(0xe5894855);
targetshouldbedirectory = -1;
targetshouldbedirectory = 1219493948222425173;
}
}
}
}
v3 = __addvsi3(v3, 0x1);
}
free(v8);
free(v6);
free(v7);
v19 = *(&v11) ^ v18[5];
return;
}
|
static unsigned int
format_to_mask (char const *format)
{
unsigned int mask = 0;
char const *b;
for (b = format; *b; b++)
{
if (*b != '%')
continue;
b += format_code_offset (b);
if (*b == '\0')
break;
mask |= fmt_to_mask (*b);
}
return mask;
}
| int format_to_mask(unsigned int a0) {
unsigned int v0;
char *v1;
v0 = 0;
*(&v1) = a0;
while (true) {
if (!*(v1))
break;
if (*(v1) == 37) {
v1 = &v1[format_code_offset(v1)];
if (!*(v1))
break;
v0 |= fmt_to_mask(*(v1));
}
v1 += 1;
}
return v0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.