input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
int main (void)
{
const char *user, *tty;
uid_t uid;
tty = ttyname (0);
if (
((void *)0)
== tty) {
tty = "UNKNOWN";
}
user = getlogin ();
if (
((void *)0)
== user) {
user = "UNKNOWN";
}
char *ssh_origcmd = getenv("SSH_ORIGINAL_COMMAND");
uid = getuid ();
openlog ("nologin",
0x02
,
(4<<3)
);
syslog (
2
, "Attempted login by %s (UID: %d) on %s%s%s",
user, uid, tty,
(ssh_origcmd ? " SSH_ORIGINAL_COMMAND=" : ""),
(ssh_origcmd ? ssh_origcmd : ""));
closelog ();
printf ("%s", "This account is currently not available.\n");
return
1
;
}
| int main() {
unsigned long v0;
unsigned int v1;
unsigned long v2;
unsigned long long v3;
unsigned long v4;
v3 = ttyname(0x0);
if (!v3)
v3 = "UNKNOWN";
v2 = getlogin();
if (!v2)
v2 = "UNKNOWN";
v4 = getenv("SSH_ORIGINAL_COMMAND");
v1 = getuid();
openlog("nologin", 0x2, 0x20);
*(&v0) = (!v4 ? v4 : &g_40011d);
syslog(0x2, "Attempted login by %s (UID: %d) on %s%s%s");
closelog();
printf("%s", &g_400168);
return 1;
}
|
static STRINGLIST *
gen_shell_function_matches (cs, cmd, text, line, ind, lwords, nw, cw, foundp)
COMPSPEC *cs;
const char *cmd;
const char *text;
char *line;
int ind;
WORD_LIST *lwords;
int nw, cw;
int *foundp;
{
char *funcname;
STRINGLIST *sl;
SHELL_VAR *f, *v;
WORD_LIST *cmdlist;
int fval, found;
sh_parser_state_t ps;
sh_parser_state_t * __restrict__ pps;
ARRAY *a;
found = 0;
if (foundp)
*foundp = found;
funcname = cs->funcname;
f = find_function (funcname);
if (f == 0)
{
internal_error (gettext("completion: function `%s' not found"), funcname);
rl_ding ();
rl_on_new_line ();
return ((STRINGLIST *)
((void *)0)
);
}
bind_compfunc_variables (line, ind, lwords, cw - 1, 0);
cmdlist = build_arg_list (funcname, cmd, text, lwords, cw);
pps = &ps;
save_parser_state (pps);
begin_unwind_frame ("gen-shell-function-matches");
add_unwind_protect (restore_parser_state, (char *)pps);
add_unwind_protect (dispose_words, (char *)cmdlist);
add_unwind_protect (unbind_compfunc_variables, (char *)0);
fval = execute_shell_function (f, cmdlist);
discard_unwind_frame ("gen-shell-function-matches");
restore_parser_state (pps);
found = fval != 127;
if (fval == 124)
found |= ((1<<8) << 1);
if (foundp)
*foundp = found;
dispose_words (cmdlist);
unbind_compfunc_variables (0);
v = find_variable ("COMPREPLY");
if (v == 0)
return ((STRINGLIST *)
((void *)0)
);
if (((((v)->attributes) & (0x0000004))) == 0 && ((((v)->attributes) & (0x0000040))) == 0)
v = convert_var_to_array (v);
((v)->attributes &= ~(0x0001000));
a = (ARRAY *)((v)->value);
if (found == 0 || (found & ((1<<8) << 1)) || a == 0 || ((((v)->attributes) & (0x0000004))) == 0 || ((a)->num_elements == 0))
sl = (STRINGLIST *)
((void *)0)
;
else
{
sl = strlist_create (0);
sl->list = array_to_argv (a, 0);
sl->list_len = sl->list_size = ((a)->num_elements);
}
unbind_variable_noref ("COMPREPLY");
return (sl);
}
| int gen_shell_function_matches(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5, unsigned int v11, unsigned long a6) {
unsigned long long v0;
int tmp_24;
unsigned int v1;
unsigned int v2;
void* v3;
struct_1 *v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
struct_2 *v9;
char v10;
char v12;
unsigned int v13;
v0 = *(&v12);
v1 = 0;
if (v0)
*(v0) = v1;
v5 = a0->field_38;
v6 = find_function(v5);
if (!v6) {
v13 = gettext("completion: function `%s' not found");
internal_error(v13, v5, v13);
rl_ding(a0, a1, a2, a3, a4, a5);
rl_on_new_line(a0, a1, a2, a3, a4, a5);
v13 = 0;
} else {
bind_compfunc_variables(a3, a4, a5, a6 - 1, 0x0);
v7 = build_arg_list(v5, a1, a2, a5, a6);
v8 = &v10;
save_parser_state(v8);
begin_unwind_frame("gen-shell-function-matches");
add_unwind_protect(got.restore_parser_state, v8);
add_unwind_protect(got.dispose_words, v7);
add_unwind_protect(unbind_compfunc_variables, 0x0);
v2 = execute_shell_function(v6, v7, v7);
discard_unwind_frame("gen-shell-function-matches");
restore_parser_state(v8);
v1 = v2 != 127;
if (v2 == 124)
v1 |= 0x200;
if (v0)
*(v0) = v1;
dispose_words(v7);
unbind_compfunc_variables(0x0);
v4 = find_variable("COMPREPLY");
if (!v4) {
v13 = 0;
} else {
if (!(v4->field_28 & 4) && !(v4->field_28 & 64))
v4 = convert_var_to_array(v4);
v13 = v4->field_28;
*(&v13) = (v4->field_28 >> 8) & 239;
tmp_24 = v13;
v4->field_28 = tmp_24;
v9 = v4->field_8;
if (v1 && !(v1 & 0x200) && v9 && (v4->field_28 & 4) && v9->field_8) {
v3 = strlist_create(0x0);
*(v3) = array_to_argv(v9, 0x0);
*(&v3[8]) = v9->field_8;
*(&v3[12]) = v3[8];
}
if (!v9 || !(v4->field_28 & 4) || !v9->field_8 || !v1 || (v1 & 0x200))
v3 = 0;
unbind_variable_noref("COMPREPLY");
v13 = v3;
}
}
return v13;
}
|
namebuf_t
namebuf_create (const char *dir)
{
namebuf_t buf = xmalloc (sizeof (*buf));
buf->buffer_size = strlen (dir) + 2;
buf->buffer = xmalloc (buf->buffer_size);
strcpy (buf->buffer, dir);
buf->dir_length = strlen (buf->buffer);
if (!
((
buf->buffer[buf->dir_length - 1]
) == '/')
)
buf->buffer[buf->dir_length++] = '/';
return buf;
}
| long namebuf_create(const char *a1)
{
char *v1;
long v2;
long v4;
v4 = xmalloc(24LL);
*(_QWORD *)(v4 + 8) = strlen(a1) + 2;
*(_QWORD *)v4 = xmalloc(*(_QWORD *)(v4 + 8));
strcpy(*(char **)v4, a1);
*(_QWORD *)(v4 + 16) = strlen(*(const char **)v4);
if ( *(_BYTE *)(*(_QWORD *)v4 + *(_QWORD *)(v4 + 16) - 1LL) != 47 )
{
v1 = *(char **)v4;
v2 = *(_QWORD *)(v4 + 16);
*(_QWORD *)(v4 + 16) = v2 + 1;
v1[v2] = 47;
}
return v4;
}
|
static char *
get_socket_address(int sock, int remote, int flags)
{
struct sockaddr_storage addr;
socklen_t addrlen;
char ntop[
1025
];
int r;
addrlen = sizeof(addr);
memset(&addr, 0, sizeof(addr));
if (remote) {
if (getpeername(sock, (struct sockaddr *)&addr, &addrlen) != 0)
return
((void *)0)
;
} else {
if (getsockname(sock, (struct sockaddr *)&addr, &addrlen) != 0)
return
((void *)0)
;
}
if (addr.ss_family ==
10
) {
addrlen = sizeof(struct sockaddr_in6);
ipv64_normalise_mapped(&addr, &addrlen);
}
switch (addr.ss_family) {
case
2
:
case
10
:
if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop,
sizeof(ntop),
((void *)0)
, 0, flags)) != 0) {
sshlog("canohost.c", __func__, 99, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "getnameinfo %d failed: %s", flags, ssh_gai_strerror(r))
;
return
((void *)0)
;
}
return xstrdup(ntop);
case
1
:
return xstrdup(((struct sockaddr_un *)&addr)->sun_path);
default:
return
((void *)0)
;
}
}
| undefined8 get_socket_address(int param_1,int param_2,uint param_3)
{
int iVar1;
undefined8 uVar2;
long in_FS_OFFSET;
undefined8 uVar3;
socklen_t local_4a0;
int local_49c;
sockaddr local_498 [8];
char local_418 [1032];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_4a0 = 0x80;
memset(local_498,0,0x80);
if (param_2 == 0) {
iVar1 = getsockname(param_1,local_498,&local_4a0);
if (iVar1 != 0) {
uVar2 = 0;
goto LAB_0010034b;
}
}
else {
iVar1 = getpeername(param_1,local_498,&local_4a0);
if (iVar1 != 0) {
uVar2 = 0;
goto LAB_0010034b;
}
}
if (local_498[0].sa_family == 10) {
local_4a0 = 0x1c;
ipv64_normalise_mapped(local_498);
}
if (local_498[0].sa_family == 10) {
LAB_0010027b:
local_49c = getnameinfo(local_498,local_4a0,local_418,0x401,(char *)0x0,0,param_3);
if (local_49c == 0) {
uVar2 = xstrdup(local_418);
}
else {
uVar3 = 0x1002d3;
uVar2 = ssh_gai_strerror(local_49c);
sshlog("canohost.c","get_socket_address",99,1,2,0,"getnameinfo %d failed: %s",param_3,uVar2,
uVar3);
uVar2 = 0;
}
}
else {
if (local_498[0].sa_family < 0xb) {
if (local_498[0].sa_family == 1) {
uVar2 = xstrdup(local_498[0].sa_data);
goto LAB_0010034b;
}
if (local_498[0].sa_family == 2) goto LAB_0010027b;
}
uVar2 = 0;
}
LAB_0010034b:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
}
|
static int
pidfile_read(const char *path, pid_t *pidptr)
{
char buf[16], *endptr;
int error, fd, i;
fd = open(path,
00
);
if (fd == -1)
return (
(*__errno_location ())
);
i = read(fd, buf, sizeof(buf) - 1);
error =
(*__errno_location ())
;
close(fd);
if (i == -1)
return (error);
else if (i == 0)
return (
11
);
buf[i] = '\0';
*pidptr = strtol(buf, &endptr, 10);
if (endptr != &buf[i])
return (
22
);
return (0);
}
| long pidfile_read(const char *a1, _DWORD *a2)
{
int fd;
int v4;
unsigned int v5;
char *endptr;
char buf[24];
unsigned long v8;
v8 = __readfsqword(0x28u);
fd = open(a1, 0);
if ( fd == -1 )
return (unsigned int)*_errno_location();
v4 = read(fd, buf, 0xFuLL);
v5 = *_errno_location();
close(fd);
if ( v4 == -1 )
return v5;
if ( !v4 )
return 11LL;
buf[v4] = 0;
*a2 = strtol(buf, &endptr, 10);
if ( &buf[v4] == endptr )
return 0LL;
else
return 22LL;
}
|
static void Rq_decode(Fq *r,const unsigned char *s)
{
crypto_uint16 R[761],M[761];
int i;
for (i = 0;i < 761;++i) M[i] = 4591;
Decode(R,s,M,761);
for (i = 0;i < 761;++i) r[i] = ((Fq)R[i])-((4591 -1)/2);
}
| void Rq_decode(unsigned short *a0, unsigned long long a1, unsigned long long a2) {
unsigned int v0;
char v1;
char v2;
char v3;
unsigned long long *v5;
unsigned long long v6;
for (v0 = 0; v0 <= 760; v0 = __addvsi3(v0, 0x1, a2)) {
*(&(&v2)[2 * v0]) = 4591;
}
Decode(&v1, a1, &v2, 0x2f9);
for (v0 = 0; v0 <= 760; v0 = __addvsi3(v0, 0x1, *(&(&v1)[2 * v0]) - 2295)) {
a0[v0] = *(&(&v1)[2 * v0]) - 2295;
}
v6 = *(&v3) ^ v5[5];
return;
}
|
static int gz_load(state, buf, len, have)
gz_statep state;
unsigned char *buf;
unsigned len;
unsigned *have;
{
int ret;
unsigned get, max = ((unsigned)-1 >> 2) + 1;
*have = 0;
do {
get = len - *have;
if (get > max)
get = max;
ret = read(state->fd, buf + *have, get);
if (ret <= 0)
break;
*have += (unsigned)ret;
} while (*have < len);
if (ret < 0) {
gz_error(state, (-1), strerror(
(*__errno_location ())
));
return -1;
}
if (ret == 0)
state->eof = 1;
return 0;
}
| undefined8 gz_load(long param_1,long param_2,uint param_3,uint *param_4)
{
int iVar1;
ssize_t sVar2;
int *piVar3;
char *pcVar4;
undefined8 uVar5;
uint local_14;
*param_4 = 0;
do {
local_14 = param_3 - *param_4;
if (0x40000000 < local_14) {
local_14 = 0x40000000;
}
sVar2 = read(*(int *)(param_1 + 0x1c),(void *)((ulong)*param_4 + param_2),(ulong)local_14);
iVar1 = (int)sVar2;
} while ((0 < iVar1) && (*param_4 = *param_4 + iVar1, *param_4 < param_3));
if (iVar1 < 0) {
piVar3 = __errno_location();
pcVar4 = strerror(*piVar3);
gz_error(param_1,0xffffffff,pcVar4);
uVar5 = 0xffffffff;
}
else {
if (iVar1 == 0) {
*(undefined4 *)(param_1 + 0x50) = 1;
}
uVar5 = 0;
}
return uVar5;
}
|
static void
main_sigchld_handler(int sig)
{
int save_errno =
(*__errno_location ())
;
pid_t pid;
int status;
while ((pid = waitpid(-1, &status,
1
)) > 0 ||
(pid == -1 &&
(*__errno_location ())
==
4
))
;
(*__errno_location ())
= save_errno;
}
| unsigned long main_sigchld_handler()
{
int stat_loc;
int v2;
__pid_t v3;
unsigned long v4;
v4 = __readfsqword(0x28u);
v2 = *_errno_location();
do
{
do
v3 = waitpid(-1, &stat_loc, 1);
while ( v3 > 0 );
}
while ( v3 == -1 && *_errno_location() == 4 );
*_errno_location() = v2;
return __readfsqword(0x28u) ^ v4;
}
|
char *
xstrdup (char const *string)
{
return xmemdup (string, strlen (string) + 1);
}
| long long xstrdup(void* a0) {
return xmemdup(a0, strlen(a0) + 1);
}
|
static Channel *
rdynamic_connect_prepare(struct ssh *ssh, char *ctype, char *rname)
{
Channel *c;
int r;
c = channel_new(ssh, ctype, 21, -1, -1, -1,
(64*(32*1024)), (32*1024), 0, rname, 1);
c->host_port = 0;
c->path =
((void *)0)
;
if ((r = sshpkt_start(ssh, 91)) != 0 ||
(r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
(r = sshpkt_put_u32(ssh, c->self)) != 0 ||
(r = sshpkt_put_u32(ssh, c->local_window)) != 0 ||
(r = sshpkt_put_u32(ssh, c->local_maxpacket)) != 0)
sshfatal("channels.c", __func__, 4751, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i; confirm", c->self);
return c;
}
| void rdynamic_connect_prepare(void* a0, unsigned int a1, unsigned long long a2) {
unsigned long v0;
unsigned int v1;
struct_0 *v2;
struct_0 *v5;
*(&v2) = channel_new(a0, a1, 0x15, 0xffffffff, 0xffffffff, 0xffffffff, 0x200000, 0x8000, 0x0, a2, 0x1);
v2->field_98 = 0;
v2->field_80 = 0;
v1 = sshpkt_start(a0, 0x5b);
if (!v1) {
v1 = sshpkt_put_u32(a0, v2->field_8, v2->field_8);
if (!v1) {
v1 = sshpkt_put_u32(a0, v2->field_4, v2->field_4);
if (!v1) {
v1 = sshpkt_put_u32(a0, v2->field_b0, v2->field_b0);
if (!v1)
v1 = sshpkt_put_u32(a0, v2->field_bc, v2->field_bc);
}
}
}
if (v1 || v1 || v1 || v1 || v1) {
v0 = v2->field_4;
sshfatal("channels.c", "rdynamic_connect_prepare", 0x128f, 0x1, 0x1, ssh_err(v1));
}
v5 = v2;
return;
}
|
int
strnunvisx(char *dst, size_t dlen, const char *src, int flag)
{
char c;
char t = '\0', *start = dst;
int state = 0;
;
;
while ((c = *src++) != '\0') {
again:
switch (unvis(&t, c, &state, flag)) {
case 1:
do { if (dlen-- == 0) {
(*__errno_location ())
=
28
; return -1; } } while (0);
*dst++ = t;
break;
case 2:
do { if (dlen-- == 0) {
(*__errno_location ())
=
28
; return -1; } } while (0);
*dst++ = t;
goto again;
case 0:
case 3:
break;
case -1:
(*__errno_location ())
=
22
;
return -1;
default:
;
(*__errno_location ())
=
22
;
return -1;
}
}
if (unvis(&t, c, &state, 0x0800) == 1) {
do { if (dlen-- == 0) {
(*__errno_location ())
=
28
; return -1; } } while (0);
*dst++ = t;
}
do { if (dlen-- == 0) {
(*__errno_location ())
=
28
; return -1; } } while (0);
*dst = '\0';
return (int)(dst - start);
}
| void strnunvisx(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long a3) {
char *v0;
int tmp_11;
unsigned long long v1;
char *v2;
char v3;
char v4;
unsigned int v5;
char *v6;
struct_0 *v9;
unsigned long long v11;
char *v12;
unsigned long long v13;
char *v14;
unsigned long long v15;
unsigned long long v16;
unsigned long long v17;
unsigned long long v18;
unsigned long long v19;
char *v20;
unsigned long long v21;
unsigned long long v22;
unsigned long long v23;
unsigned long long v24;
v2 = a0;
v1 = a1;
v0 = a2;
v3 = 0;
v6 = v2;
v5 = 0;
while (true) {
tmp_11 = v0;
v0 += 1;
v4 = *(tmp_11);
if (!v4)
break;
while (true) {
v9 = unvis(&v3, v4, &v5, a3) + 1;
switch (v9) {
case 0:
*(__errno_location()) = 22;
v15 = 4294967295;
return;
case 1: case 4:
break;
case 2:
v13 = v1;
v1 -= 1;
if (!v13) {
*(__errno_location()) = 28;
v16 = 4294967295;
return;
}
v14 = v2;
v2 += 1;
*(v14) = v3;
break;
case 3:
v11 = v1;
v1 -= 1;
if (!v11) {
*(__errno_location()) = 28;
v17 = 4294967295;
return;
}
v12 = v2;
v2 += 1;
*(v12) = v3;
continue;
default:
*(__errno_location()) = 22;
v18 = 4294967295;
return;
}
}
}
if (unvis(&v3, v4, &v5, 0x800) == 1) {
v19 = v1;
v1 -= 1;
if (!v19) {
*(__errno_location()) = 28;
v22 = 4294967295;
return;
}
v20 = v2;
v2 += 1;
*(v20) = v3;
}
v21 = v1;
v1 -= 1;
if (v21) {
*(v2) = 0;
v23 = v2 - v6;
return;
}
*(__errno_location()) = 28;
v24 = 4294967295;
return;
}
|
int
_rl_set_mark_at_pos (int position)
{
if (position < 0 || position > rl_end)
return 1;
rl_mark = position;
return 0;
}
| void _rl_set_mark_at_pos(unsigned long a0) {
unsigned long long v1;
void* v2;
if (a0 < 0) {
LABEL_402c67:
v1 = 1;
} else {
if (!(a0 <= rl_end))
goto LABEL_402c67;
rl_mark = a0;
v2 = 0;
}
return;
}
|
static
_Bool
parse_time (const struct parser_table* entry, char *argv[], int *arg_ptr)
{
struct predicate *our_pred;
struct time_val tval;
enum comparison_type comp;
const char *timearg, *orig_timearg;
const char *errmsg = gettext ("arithmetic overflow while converting %s " "days to a number of seconds")
;
struct timespec origin;
const int saved_argc = *arg_ptr;
if (!collect_arg (argv, arg_ptr, &timearg))
return
0
;
orig_timearg = timearg;
origin = options.cur_day_start;
if (get_comp_type (&timearg, &comp))
{
if (COMP_LT == comp)
{
uintmax_t expected = origin.tv_sec + (86400 -1);
origin.tv_sec += (86400 -1);
if (expected != (uintmax_t)origin.tv_sec)
{
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"arithmetic overflow when trying to calculate the end of today\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("arithmetic overflow when trying to calculate the end of today")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("arithmetic overflow when trying to calculate the end of today")), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
}
}
timearg = orig_timearg;
if (!get_relative_timestamp (timearg, &tval, origin, 86400, errmsg))
{
*arg_ptr = saved_argc;
return
0
;
}
our_pred = insert_primary (entry, orig_timearg);
our_pred->args.reftime = tval;
our_pred->est_success_rate = estimate_timestamp_success_rate (tval.ts.tv_sec);
if (options.debug_options & DebugExpressionTree)
{
time_t t;
fprintf (
stderr
, "inserting %s\n", our_pred->p_name);
fprintf (
stderr
, " type: %s %s ",
(tval.kind == COMP_GT) ? "gt" :
((tval.kind == COMP_LT) ? "lt" : ((tval.kind == COMP_EQ) ? "eq" : "?")),
(tval.kind == COMP_GT) ? " >" :
((tval.kind == COMP_LT) ? " <" : ((tval.kind == COMP_EQ) ? ">=" : " ?")));
t = our_pred->args.reftime.ts.tv_sec;
fprintf (
stderr
, "%"
"l" "u"
" %s",
(uintmax_t) our_pred->args.reftime.ts.tv_sec,
ctime (&t));
if (tval.kind == COMP_EQ)
{
t = our_pred->args.reftime.ts.tv_sec + 86400;
fprintf (
stderr
, " < %"
"l" "u"
" %s",
(uintmax_t) t, ctime (&t));
}
}
return
1
;
}
| long long parse_time(unsigned long long a0, unsigned long long a1, unsigned int *a2) {
char v0;
unsigned int v1;
unsigned long long v2;
unsigned long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long v6;
struct_0 *v7;
unsigned long long v8;
unsigned long long v9;
char v10;
char v11;
char v12;
unsigned long long v15;
unsigned int v17;
unsigned int v18;
v4 = gettext("arithmetic overflow while converting %s days to a number of seconds");
v1 = *(a2);
if ((collect_arg(a1, a2, &v2) ^ 1)) {
v15 = 0;
} else {
v5 = *(&v2);
v8 = getfileconat;
v9 = pred_delete;
if (get_comp_type(&v2, &v0) && *(&v0) == 1) {
v6 = v8 + 86399;
v8 += 86399;
if (v8 != v6)
error(0x1, 0x0, gettext("arithmetic overflow when trying to calculate the end of today"));
}
v2 = v5;
if ((get_relative_timestamp(v2, &v10, v8, v9, v4) ^ 1)) {
*(a2) = v1;
v15 = 0;
} else {
v7 = insert_primary(a0, v5, v5);
v7->field_38 = *(&v10);
v7->field_40 = *(&v11);
v7->field_48 = *(&v12);
estimate_timestamp_success_rate(*(&v11));
v7->field_24 = 0;
if ((pred_prune & 1)) {
fprintf(stderr, "inserting %s\n", v7->field_8);
if (!*(&(&v10)[4])) {
v17 = &g_406d45;
} else if (*(&(&v10)[4]) == 1) {
v17 = " <";
} else if (*(&(&v10)[4]) == 2) {
v17 = ">=";
} else {
v17 = " ?";
}
if (!*(&(&v10)[4])) {
v18 = &g_406d50;
} else if (*(&(&v10)[4]) == 1) {
v18 = "lt";
} else if (*(&(&v10)[4]) == 2) {
v18 = "eq";
} else {
v18 = "?";
}
fprintf(stderr, " type: %s %s ", v18, v17);
v3 = v7->field_40;
fprintf(stderr, "%lu %s", v7->field_40, ctime(&v3));
if (*(&(&v10)[4]) == 2) {
v3 = v7->field_40 + 86400;
fprintf(stderr, " < %lu %s", v3, ctime(&v3));
}
}
v15 = 1;
}
}
return v15;
}
|
static
_Bool
parse_regextype (const struct parser_table* entry, char **argv, int *arg_ptr)
{
const char *type_name;
if (collect_arg (argv, arg_ptr, &type_name))
{
options.regex_options = get_regex_type (type_name);
return parse_noop (entry, argv, arg_ptr);
}
return
0
;
}
| long long parse_regextype(unsigned long long a0, unsigned long long a1, unsigned long long a2) {
char v0;
void* v2;
if (!collect_arg(a1, a2, &v0)) {
v2 = 0;
return v2;
}
g_500064 = get_regex_type(*(&v0));
v2 = parse_noop(a0, a1, a2);
return v2;
}
|
static void
terminal_init_arrow(EditLine *el)
{
funckey_t *arrow = el->el_terminal.t_fkey;
arrow[0].name = L"down";
arrow[0].key = 16;
arrow[0].fun.cmd = 15;
arrow[0].type = 0;
arrow[1].name = L"up";
arrow[1].key = 19;
arrow[1].fun.cmd = 18;
arrow[1].type = 0;
arrow[2].name = L"left";
arrow[2].key = 17;
arrow[2].fun.cmd = 17;
arrow[2].type = 0;
arrow[3].name = L"right";
arrow[3].key = 18;
arrow[3].fun.cmd = 14;
arrow[3].type = 0;
arrow[4].name = L"home";
arrow[4].key = 36;
arrow[4].fun.cmd = 11;
arrow[4].type = 0;
arrow[5].name = L"end";
arrow[5].key = 37;
arrow[5].fun.cmd = 12;
arrow[5].type = 0;
arrow[6].name = L"delete";
arrow[6].key = 38;
arrow[6].fun.cmd = 3;
arrow[6].type = 0;
}
| void terminal_init_arrow(struct_0 *a0) {
struct_1 *v0;
unsigned long long v2;
v0 = a0->field_c8;
v0->field_0 = "d";
v0->field_8 = 16;
v0->field_10 = 15;
v0->field_18 = 0;
v0->field_20 = "u";
v0->field_28 = 19;
v0->field_30 = 18;
v0->field_38 = 0;
v0->field_40 = "l";
v0->field_48 = 17;
v0->field_50 = 17;
v0->field_58 = 0;
v0->field_60 = "r";
v0->field_68 = 18;
v0->field_70 = 14;
v0->field_78 = 0;
*(&v0[83848836698679779].padding_6c) = "h";
*((&v0[83848836698679779].field_60 + 4)) = 36;
v0[83848836698679779].padding_5c[0] = 11;
*(&v0[83848836698679779].padding_51[3]) = 0;
v0->field_a0 = "e";
v0->field_a8 = 37;
v0->field_b0 = 12;
v0->field_b8 = 0;
v0->field_c0 = "d";
v0->field_c8 = 38;
v0->field_d0 = 3;
v2 = &v0->field_c0;
v0->field_d8 = 0;
return;
}
|
char *
filesystem_type (const struct stat *statp, const char *path)
{
static
_Bool
fstype_known =
0
;
static char *current_fstype =
((void *)0)
;
static dev_t current_dev;
if (current_fstype !=
((void *)0)
)
{
if (fstype_known && statp->st_dev == current_dev)
return current_fstype;
free (current_fstype);
}
current_dev = statp->st_dev;
current_fstype = file_system_type_uncached (statp, path, &fstype_known);
return current_fstype;
}
| void * filesystem_type(long *a1, long a2)
{
if ( current_fstype_5906 )
{
if ( fstype_known_5905 && *a1 == current_dev_5907 )
return current_fstype_5906;
free(current_fstype_5906);
}
current_dev_5907 = *a1;
current_fstype_5906 = (void *)file_system_type_uncached(a1, a2, (bool *)&fstype_known_5905);
return current_fstype_5906;
}
|
static
_Bool
ip_tunnel_parm_match(const struct tnl_print_nlmsg_info *info)
{
const struct ip_tunnel_parm *p1 = info->p1;
const struct ip_tunnel_parm *p2 = info->p2;
return ((!p1->link || p1->link == p2->link) &&
(!p1->name[0] || strcmp(p1->name, p2->name) == 0) &&
(!p1->iph.daddr || p1->iph.daddr == p2->iph.daddr) &&
(!p1->iph.saddr || p1->iph.saddr == p2->iph.saddr) &&
(!p1->i_key || p1->i_key == p2->i_key));
}
| _BOOL8 ip_tunnel_parm_match(long a1)
{
char *s1;
char *s2;
s1 = *(char **)(a1 + 8);
s2 = *(char **)(a1 + 16);
return (!*((_DWORD *)s1 + 4) || *((_DWORD *)s1 + 4) == *((_DWORD *)s2 + 4))
&& (!*s1 || !strcmp(s1, s2))
&& (!*((_DWORD *)s1 + 12) || *((_DWORD *)s1 + 12) == *((_DWORD *)s2 + 12))
&& (!*((_DWORD *)s1 + 11) || *((_DWORD *)s1 + 11) == *((_DWORD *)s2 + 11))
&& (!*((_DWORD *)s1 + 6) || *((_DWORD *)s1 + 6) == *((_DWORD *)s2 + 6));
}
|
static inline int
is_basic (char c)
{
return (is_basic_table [(unsigned char) c >> 5] >> ((unsigned char) c & 31))
& 1;
}
| int is_basic(unsigned long a0) {
return (*((4 * (a0 >> 5) + &is_basic_table)) >> (a0 & 31 & 31)) & 1;
}
|
int
strnvisx(char *mbdst, size_t dlen, const char *mbsrc, size_t len, int flags)
{
return istrsenvisxna(mbdst, &dlen, mbsrc, len, flags, "",
((void *)0)
);
}
| long long strnvisx(unsigned int a0, unsigned long a1, char *a2, unsigned long a3, unsigned long a4) {
unsigned long v0;
v0 = a1;
return istrsenvisxna(a0, &v0, a2, a3, a4, &g_4018dc, NULL);
}
|
int
rl_overwrite_mode (int count, int key)
{
if (rl_explicit_arg == 0)
_rl_set_insert_mode (rl_insert_mode ^ 1, 0);
else if (count > 0)
_rl_set_insert_mode (0, 0);
else
_rl_set_insert_mode (1, 0);
return 0;
}
| long long rl_overwrite_mode(unsigned long a0, unsigned long a1) {
unsigned int v0;
v0 = a1;
if (!rl_explicit_arg) {
_rl_set_insert_mode(rl_insert_mode ^ 1, 0x0);
} else if (a0 > 0) {
_rl_set_insert_mode(0x0, 0x0);
} else {
_rl_set_insert_mode(0x1, 0x0);
}
return 0;
}
|
inflateInit_((
&ssh->state->compression_in_stream
), "1.2.11", (int)sizeof(z_stream))
) {
case
0
:
ssh->state->compression_in_started = 1;
break;
case
(-4)
:
return -2;
default:
return -1;
}
| void inflateInit_(void)
{
halt_baddata();
}
|
static
void compressStream ( FILE *stream, FILE *zStream )
{
BZFILE* bzf =
((void *)0)
;
UChar ibuf[5000];
Int32 nIbuf;
UInt32 nbytes_in_lo32, nbytes_in_hi32;
UInt32 nbytes_out_lo32, nbytes_out_hi32;
Int32 bzerr, bzerr_dummy, ret;
;
;
if (ferror(stream)) goto errhandler_io;
if (ferror(zStream)) goto errhandler_io;
bzf = BZ2_bzWriteOpen ( &bzerr, zStream,
blockSize100k, verbosity, workFactor );
if (bzerr != 0) goto errhandler;
if (verbosity >= 2) fprintf (
stderr
, "\n" );
while (((Bool)1)) {
if (myfeof(stream)) break;
nIbuf = fread ( ibuf, sizeof(UChar), 5000, stream );
if (ferror(stream)) goto errhandler_io;
if (nIbuf > 0) BZ2_bzWrite ( &bzerr, bzf, (void*)ibuf, nIbuf );
if (bzerr != 0) goto errhandler;
}
BZ2_bzWriteClose64 ( &bzerr, bzf, 0,
&nbytes_in_lo32, &nbytes_in_hi32,
&nbytes_out_lo32, &nbytes_out_hi32 );
if (bzerr != 0) goto errhandler;
if (ferror(zStream)) goto errhandler_io;
ret = fflush ( zStream );
if (ret ==
(-1)
) goto errhandler_io;
if (zStream !=
stdout
) {
Int32 fd = fileno ( zStream );
if (fd < 0) goto errhandler_io;
applySavedFileAttrToOutputFile ( fd );
ret = fclose ( zStream );
outputHandleJustInCase =
((void *)0)
;
if (ret ==
(-1)
) goto errhandler_io;
}
outputHandleJustInCase =
((void *)0)
;
if (ferror(stream)) goto errhandler_io;
ret = fclose ( stream );
if (ret ==
(-1)
) goto errhandler_io;
if (verbosity >= 1) {
if (nbytes_in_lo32 == 0 && nbytes_in_hi32 == 0) {
fprintf (
stderr
, " no data compressed.\n");
} else {
Char buf_nin[32], buf_nout[32];
UInt64 nbytes_in, nbytes_out;
double nbytes_in_d, nbytes_out_d;
uInt64_from_UInt32s ( &nbytes_in,
nbytes_in_lo32, nbytes_in_hi32 );
uInt64_from_UInt32s ( &nbytes_out,
nbytes_out_lo32, nbytes_out_hi32 );
nbytes_in_d = uInt64_to_double ( &nbytes_in );
nbytes_out_d = uInt64_to_double ( &nbytes_out );
uInt64_toAscii ( buf_nin, &nbytes_in );
uInt64_toAscii ( buf_nout, &nbytes_out );
fprintf (
stderr
, "%6.3f:1, %6.3f bits/byte, "
"%5.2f%% saved, %s in, %s out.\n",
nbytes_in_d / nbytes_out_d,
(8.0 * nbytes_out_d) / nbytes_in_d,
100.0 * (1.0 - nbytes_out_d / nbytes_in_d),
buf_nin,
buf_nout
);
}
}
return;
errhandler:
BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1,
&nbytes_in_lo32, &nbytes_in_hi32,
&nbytes_out_lo32, &nbytes_out_hi32 );
switch (bzerr) {
case (-9):
configError(); break;
case (-3):
outOfMemory (); break;
case (-6):
errhandler_io:
ioError(); break;
default:
panic ( "compress:unexpected error" );
}
panic ( "compress:end" );
}
| void compressStream(void* a0, void* a1) {
unsigned long v0;
char v1;
char v2;
char v3;
char v4;
char v5;
char v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned long long v10;
unsigned long v11;
unsigned long v12;
char v13;
char v14;
char v15;
char v16;
char v17;
char v18;
char v19;
unsigned int v21;
unsigned long v22;
unsigned long long *v23;
unsigned long long v24;
v18 = *(&v18);
v10 = 0;
if (ferror(a0)) {
ioError();
} else if (ferror(a1)) {
ioError();
} else {
v10 = BZ2_bzWriteOpen(&v5, a1, blockSize100k, verbosity, workFactor);
if (!*(&v5)) {
if (verbosity > 1)
fprintf(stderr, "\n");
do {
if (!myfeof(a0)) {
v7 = fread(&v17, 0x1, 0x1388, a0);
if (!ferror(a0))
goto LABEL_40040e;
else
goto LABEL_4007a0;
} else {
v0 = &v4;
BZ2_bzWriteClose64(&v5, v10, 0x0, &v1, &v2, &v3);
if (!*(&v5)) {
if (ferror(a1))
ioError();
v8 = fflush(a1);
if (v8 == -1)
ioError();
if (a1 != stdout) {
v9 = fileno(a1);
if (v9 < 0)
ioError();
applySavedFileAttrToOutputFile(v9);
v8 = fclose(a1);
outputHandleJustInCase = 0;
if (v8 == -1)
ioError();
}
outputHandleJustInCase = 0;
if (ferror(a0))
ioError();
v8 = fclose(a0);
if (v8 == -1)
ioError();
if (verbosity > 0) {
if (*(&v1) || *(&v2)) {
uInt64_from_UInt32s(&v13, *(&v1), *(&v2));
uInt64_from_UInt32s(&v14, *(&v3), *(&v4));
uInt64_to_double(&v13);
v11 = v22;
uInt64_to_double(&v14);
v12 = v22;
uInt64_toAscii(&v15, &v13);
uInt64_toAscii(&v16, &v14);
fprintf(stderr, "%6.3f:1, %6.3f bits/byte, %5.2f%% saved, %s in, %s out.\n", &v15, &v16);
} else {
fprintf(stderr, " no data compressed.\n");
}
}
v24 = *(&v19) - v23[5];
return;
}
break;
}
LABEL_40040e:
if (v7 > 0)
BZ2_bzWrite(&v5, v10, &v17, v7);
} while (!*(&v5));
}
v0 = &v4;
BZ2_bzWriteClose64(&v6, v10, 0x1, &v1, &v2, &v3);
v21 = *(&v5);
switch (v21) {
case 4294967287:
configError();
case 4294967290:
LABEL_4007a0:
ioError();
default:
panic("compress:unexpected error");
}
}
}
|
static int gz_load(state, buf, len, have)
gz_statep state;
unsigned char *buf;
unsigned len;
unsigned *have;
{
int ret;
unsigned get, max = ((unsigned)-1 >> 2) + 1;
*have = 0;
do {
get = len - *have;
if (get > max)
get = max;
ret = read(state->fd, buf + *have, get);
if (ret <= 0)
break;
*have += (unsigned)ret;
} while (*have < len);
if (ret < 0) {
gz_error(state, (-1), strerror(
(*__errno_location ())
));
return -1;
}
if (ret == 0)
state->eof = 1;
return 0;
}
| int gz_load(unsigned int a0[21], unsigned long a1, unsigned long a2, unsigned int *a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v4;
v1 = 0x40000000;
*(a3) = 0;
do {
v0 = a2 - *(a3);
if (v0 > v1)
v0 = v1;
v2 = read(a0[7], *(a3) + a1, v0);
if (v2 <= 0)
break;
*(a3) = *(a3) + v2;
} while (a2 > *(a3));
if (v2 < 0) {
gz_error(a0, 0xffffffff, strerror(*(__errno_location())));
v4 = -1;
} else {
if (!v2)
a0[20] = 1;
v4 = 0;
}
return v4;
}
|
static SHELL_VAR *
assign_random (self, value, unused, key)
SHELL_VAR *self;
char *value;
arrayind_t unused;
char *key;
{
intmax_t seedval;
int expok;
if (((((self)->attributes) & (0x0000010))))
seedval = evalexp (value, 0, &expok);
else
expok = legal_number (value, &seedval);
if (expok == 0)
return (self);
sbrand (seedval);
if (subshell_environment)
seeded_subshell = getpid ();
return (set_int_value (self, seedval, ((((self)->attributes) & (0x0000010))) != 0));
}
| long assign_random(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);
}
if (local_1c != 0) {
sbrand(local_18);
if (subshell_environment != 0) {
seeded_subshell = getpid();
}
param_1 = set_int_value(param_1,local_18,(*(uint *)(param_1 + 0x28) & 0x10) != 0);
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return param_1;
}
__stack_chk_fail();
}
|
int
sshkey_to_certified(struct sshkey *k)
{
int newtype;
switch (k->type) {
case KEY_RSA:
newtype = KEY_RSA_CERT;
break;
case KEY_DSA:
newtype = KEY_DSA_CERT;
break;
case KEY_ECDSA:
newtype = KEY_ECDSA_CERT;
break;
case KEY_ECDSA_SK:
newtype = KEY_ECDSA_SK_CERT;
break;
case KEY_ED25519_SK:
newtype = KEY_ED25519_SK_CERT;
break;
case KEY_ED25519:
newtype = KEY_ED25519_CERT;
break;
default:
return -10;
}
if ((k->cert = cert_new()) ==
((void *)0)
)
return -2;
k->type = newtype;
return 0;
}
| long long sshkey_to_certified(struct_0 *a0) {
unsigned int v0;
unsigned long long v2;
switch (a0->field_0) {
case 0:
v0 = 4;
break;
case 1:
v0 = 5;
break;
case 2:
v0 = 6;
break;
case 3:
v0 = 7;
break;
case 10:
v0 = 11;
break;
case 12:
v0 = 13;
break;
default:
v2 = 4294967286;
goto LABEL_4068c7;
}
a0->field_80 = cert_new();
if (!a0->field_80) {
v2 = 4294967294;
} else {
a0->field_0 = v0;
v2 = 0;
}
LABEL_4068c7:
return v2;
}
|
void
compspec_dispose (cs)
COMPSPEC *cs;
{
cs->refcount--;
if (cs->refcount == 0)
{
do { if (cs->globpat) sh_xfree((cs->globpat), "pcomplib.c", 78); } while (0);
do { if (cs->words) sh_xfree((cs->words), "pcomplib.c", 79); } while (0);
do { if (cs->prefix) sh_xfree((cs->prefix), "pcomplib.c", 80); } while (0);
do { if (cs->suffix) sh_xfree((cs->suffix), "pcomplib.c", 81); } while (0);
do { if (cs->funcname) sh_xfree((cs->funcname), "pcomplib.c", 82); } while (0);
do { if (cs->command) sh_xfree((cs->command), "pcomplib.c", 83); } while (0);
do { if (cs->lcommand) sh_xfree((cs->lcommand), "pcomplib.c", 84); } while (0);
do { if (cs->filterpat) sh_xfree((cs->filterpat), "pcomplib.c", 85); } while (0);
sh_xfree((cs), "pcomplib.c", 87);
}
}
| void compspec_dispose(struct_0 *a0) {
unsigned long long v1;
unsigned long long v2;
a0->field_0 = a0->field_0 - 1;
v1 = a0->field_0;
if (!a0->field_0) {
if (a0->field_18)
sh_xfree(a0->field_18, "pcomplib.c", 0x4e);
if (a0->field_20)
sh_xfree(a0->field_20, "pcomplib.c", 0x4f);
if (a0->field_28)
sh_xfree(a0->field_28, "pcomplib.c", 0x50);
if (a0->field_30)
sh_xfree(a0->field_30, "pcomplib.c", 0x51);
if (a0->field_38)
sh_xfree(a0->field_38, "pcomplib.c", 0x52);
if (a0->field_40)
sh_xfree(a0->field_40, "pcomplib.c", 0x53);
if (a0->field_48)
sh_xfree(a0->field_48, "pcomplib.c", 0x54);
if (a0->field_50)
sh_xfree(a0->field_50, "pcomplib.c", 0x55);
v2 = sh_xfree(a0, "pcomplib.c", 0x57);
}
return;
}
|
static void
check_stdout (void)
{
if (ferror_unlocked (
stdout
))
((!!sizeof (struct { _Static_assert (2, "verify_expr (" "2" ", " "(error (2, 0, \"%s\", gettext (\"write failed\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (2, 0, "%s", gettext ("write failed")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (2, 0, "%s", gettext ("write failed")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
else if (fclose (
stdout
) != 0)
((!!sizeof (struct { _Static_assert (2, "verify_expr (" "2" ", " "(error (2, (*__errno_location ()), \"%s\", gettext (\"standard output\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (2,
(*__errno_location ())
, "%s", gettext ("standard output")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (2,
(*__errno_location ())
, "%s", gettext ("standard output")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
}
| void check_stdout(void)
{
int iVar1;
undefined8 uVar2;
int *piVar3;
iVar1 = ferror_unlocked(stdout);
if (iVar1 != 0) {
uVar2 = gettext("write failed");
error(2,0,&DAT_00101d40,uVar2);
}
iVar1 = fclose(stdout);
if (iVar1 != 0) {
uVar2 = gettext("standard output");
piVar3 = __errno_location();
error(2,*piVar3,&DAT_00101d40,uVar2);
}
return;
}
|
char **env_set(char **envp, const char *envstr) {
size_t count, found;
char **p, *envtmp;
found = (size_t)-1;
for (count = 0; envp[count] !=
((void *)0)
; count++) {
if (!strcmp_until(envp[count], envstr, '='))
found = count;
}
count++;
if (found != (size_t)-1) {
if ((envtmp = strdup(envstr)) ==
((void *)0)
)
return (
((void *)0)
);
free(envp[found]);
envp[found] = envtmp;
return (envp);
}
if ((envtmp = strdup(envstr)) ==
((void *)0)
)
return (
((void *)0)
);
p = (char **) realloc((void *) envp,
(count + 1) * sizeof (char *));
if (p ==
((void *)0)
) {
free(envtmp);
return (
((void *)0)
);
}
p[count] = p[count - 1];
p[count - 1] = envtmp;
return (p);
}
| int env_set(unsigned long long a0, char *a1) {
void* v0;
unsigned long long v1;
void* v2;
void* v3;
unsigned int v5;
v1 = -1;
for (v0 = 0; *((a0 + (v0 << 3))); v0 += 1) {
if (!strcmp_until(*((a0 + (v0 << 3))), a1, 0x3d, a1))
v1 = v0;
}
v0 += 1;
if (v1 != -1) {
v2 = strdup(a1);
if (!v2) {
v5 = 0;
} else {
free(*((a0 + v1 * 8)));
*((v1 * 8 + a0)) = v2;
v5 = a0;
}
} else {
v2 = strdup(a1);
if (!v2) {
v5 = 0;
} else {
v3 = realloc(a0, (v0 + 1) * 8);
if (v3) {
*((v3 + 0x8 * v0)) = *((-8 + v3 + 0x8 * v0));
*((-8 + 0x8 * v0 + v3)) = v2;
v5 = v3;
} else {
free(v2);
v5 = 0;
}
}
}
return v5;
}
|
static void
cmdlist(union node *np, int sep)
{
for (; np; np = np->narg.next) {
if (!sep)
cmdputs(spcstr);
cmdtxt(np);
if (sep && np->narg.next)
cmdputs(spcstr);
}
}
| void cmdlist(unsigned int a0, unsigned long a1) {
struct_0 *v0;
unsigned long long v2;
for (*(&v0) = a0; v0; v0 = v0->field_8) {
if (!a1)
cmdputs(&spcstr);
cmdtxt(v0);
if (a1 && v0->field_8)
cmdputs(&spcstr);
v2 = v0->field_8;
}
return;
}
|
static int build_bl_tree(s)
deflate_state *s;
{
int max_blindex;
scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
build_tree(s, (tree_desc *)(&(s->bl_desc)));
for (max_blindex = 19 -1; max_blindex >= 3; max_blindex--) {
if (s->bl_tree[bl_order[max_blindex]].dl.len != 0) break;
}
s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4;
;
return max_blindex;
}
| int build_bl_tree(struct_0 *a0) {
unsigned int v0;
scan_tree(a0, &a0->padding_0[212], a0->field_b60);
scan_tree(a0, &a0->padding_0[2504], a0->field_b78);
build_tree(a0, &a0->padding_b7c[12]);
for (v0 = 18; v0 > 2; v0 -= 1) {
if (*(&a0->padding_0[14 + 4 * (*(v0 + &bl_order) + 684)]))
break;
}
a0->field_1718 = (v0 + 1) * 3 + a0->field_1718 + 14;
return v0;
}
|
int
argv_split(const char *s, int *argcp, char ***argvp, int terminate_on_comment)
{
int r = -1;
int argc = 0, quote, i, j;
char *arg, **argv = xcalloc(1, sizeof(*argv));
*argvp =
((void *)0)
;
*argcp = 0;
for (i = 0; s[i] != '\0'; i++) {
if (s[i] == ' ' || s[i] == '\t')
continue;
if (terminate_on_comment && s[i] == '#')
break;
quote = 0;
argv = xreallocarray(argv, (argc + 2), sizeof(*argv));
arg = argv[argc++] = xcalloc(1, strlen(s + i) + 1);
argv[argc] =
((void *)0)
;
for (j = 0; s[i] != '\0'; i++) {
if (s[i] == '\\') {
if (s[i + 1] == '\'' ||
s[i + 1] == '\"' ||
s[i + 1] == '\\' ||
(quote == 0 && s[i + 1] == ' ')) {
i++;
arg[j++] = s[i];
} else {
arg[j++] = s[i];
}
} else if (quote == 0 && (s[i] == ' ' || s[i] == '\t'))
break;
else if (quote == 0 && (s[i] == '\"' || s[i] == '\''))
quote = s[i];
else if (quote != 0 && s[i] == quote)
quote = 0;
else
arg[j++] = s[i];
}
if (s[i] == '\0') {
if (quote != 0) {
r = -4;
goto out;
}
break;
}
}
*argcp = argc;
*argvp = argv;
argc = 0;
argv =
((void *)0)
;
r = 0;
out:
if (argc != 0 && argv !=
((void *)0)
) {
for (i = 0; i < argc; i++)
free(argv[i]);
free(argv);
}
return r;
}
| long long argv_split(char *a0, unsigned int *a1, unsigned long long *a2, unsigned long a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
void* v5;
char *v6;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long *v11;
char *v12;
char *v13;
char *v14;
v0 = -1;
v1 = 0;
v5 = xcalloc(0x1, 0x8);
*(a2) = 0;
*(a1) = 0;
v3 = 0;
while (true) {
if (a0[v3]) {
if (a0[v3] != 32 && a0[v3] != 9 && (!a3 || a0[v3] != 35)) {
v2 = 0;
v8 = __addvsi3(v1, 0x2);
v5 = xreallocarray(v5, v8, 0x8, v8);
v9 = strlen(&a0[v3]) + 1;
v10 = v1;
v1 = __addvsi3(v1, 0x1);
v11 = v10 * 8 + v5;
*(v11) = xcalloc(0x1, v9);
v6 = *(v11);
*((v5 + 8 * v1)) = 0;
for (v4 = 0; a0[v3]; v3 = __addvsi3(v3, 0x1)) {
if (a0[v3] == 92) {
*(&v8) = a0[__addvsi3(v3, 0x1)];
if (v8 != 39) {
*(&v8) = a0[__addvsi3(v3, 0x1)];
if (v8 != 34) {
*(&v8) = a0[__addvsi3(v3, 0x1)];
if (v8 != 92) {
if (!v2)
*(&v8) = a0[__addvsi3(v3, 0x1)];
if (v8 != 32 || v2) {
v13 = v4;
v4 = __addvsi3(v4, 0x1);
*((v13 + v6)) = a0[v3];
}
}
}
}
if (v8 == 92 || v8 == 39 || v8 == 34 || v8 == 32 && !v2) {
v3 = __addvsi3(v3, 0x1);
v14 = v4;
v4 = __addvsi3(v4, 0x1);
*((v14 + v6)) = a0[v3];
}
} else {
if (!v2) {
if (a0[v3] == 32)
break;
if (a0[v3] != 32) {
if (a0[v3] == 9)
break;
}
}
if (a0[v3] != 9) {
if (!v2 && (a0[v3] == 34 || a0[v3] == 39))
v2 = a0[v3];
if (v2 || a0[v3] != 34 && a0[v3] != 39) {
if (v2 && v2 == a0[v3])
v2 = 0;
if (!v2 || v2 != a0[v3]) {
v12 = v4;
v4 = __addvsi3(v4, 0x1);
*((v12 + v6)) = a0[v3];
}
}
}
}
}
if (!a0[v3] && v2) {
v0 = -0x4;
break;
}
}
if ((a0[v3] == 9 || a0[v3] == 32 || a0[v3]) && (a0[v3] == 9 || a0[v3] == 32 || !a3 || a0[v3] != 35)) {
v3 = __addvsi3(v3, 0x1);
continue;
}
}
if (!a0[v3] || !v2 && !a0[v3] && a0[v3] != 9 && a0[v3] != 32 || a0[v3] == 35 && a0[v3] != 9 && a0[v3] != 32 && a3) {
*(a1) = v1;
*(a2) = v5;
v1 = 0;
v5 = 0;
v0 = 0;
break;
}
}
if (v1 && v5) {
for (v3 = 0; v3 < v1; v3 = __addvsi3(v3, 0x1)) {
free(*((v5 + 8 * v3)));
}
free(v5);
}
return v0;
}
|
int xasprintf(char **sp, const char *f, ...)
{
va_list ap;
int ret;
__builtin_va_start(
ap
,
f
)
;
ret = xvasprintf(sp, 0, f, ap);
__builtin_va_end(
ap
)
;
return ret;
}
| long long xasprintf() {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
char v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
unsigned long v10;
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
int v17;
int v18;
unsigned long v19;
unsigned long v20;
unsigned long v21;
unsigned long v22;
unsigned long v23;
char v24;
int v25;
int v26;
int v27;
int v28;
int v29;
int v30;
int v31;
int v32;
unsigned long long *v33;
unsigned long long *v34;
char *v35;
v7 = v20;
v8 = v21;
v9 = v22;
v10 = v23;
if (v24) {
v11 = v25;
v12 = v26;
v13 = v27;
v14 = v28;
v15 = v29;
v16 = v30;
v17 = v31;
v18 = v32;
}
v5 = v33[5];
v1 = 16;
v2 = 48;
v3 = &v19;
v4 = &v6;
v0 = xvasprintf(v34, 0x0, v35, &v1);
if ((v5 ^ v33[5]))
__stack_chk_fail();
return v0;
}
|
static
_Bool
atdir_eq (char const *dir, ptrdiff_t dirlen)
{
if (dirlen == 0)
dir = &dot, dirlen = 1;
return memcmp (dfname, dir, dirlen) == 0 && !dfname[dirlen];
}
| undefined4 atdir_eq(undefined1 *param_1,size_t param_2)
{
int iVar1;
undefined4 uVar2;
size_t local_18;
undefined1 *local_10;
local_18 = param_2;
local_10 = param_1;
if (param_2 == 0) {
local_10 = ˙
local_18 = 1;
}
iVar1 = memcmp(dfname,local_10,local_18);
if ((iVar1 == 0) && (dfname[local_18] == '\0')) {
uVar2 = 1;
}
else {
uVar2 = 0;
}
return uVar2;
}
|
void
rl_forced_update_display(void)
{
el_set(e, 20);
}
| long rl_forced_update_display(long a1, long a2, long a3)
{
return el_set(e, 20LL, a3);
}
|
_Bool
pred_delete (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void) pred_ptr;
(void) stat_buf;
if (strcmp (state.rel_pathname, "."))
{
int flags=0;
if (state.have_stat &&
((((
stat_buf->st_mode
)) & 0170000) == (0040000))
)
flags |=
0x200
;
if (perform_delete (flags))
{
return
1
;
}
else
{
if (
2
==
(*__errno_location ())
&& options.ignore_readdir_race)
{
(*__errno_location ())
= 0;
return
1
;
}
if (
21
==
(*__errno_location ())
)
{
if ((flags &
0x200
) == 0)
{
flags |=
0x200
;
if (perform_delete (flags))
return
1
;
}
}
}
error (0,
(*__errno_location ())
, gettext ("cannot delete %s"),
safely_quote_err_filename (0, pathname));
state.exit_status =
1
;
return
0
;
}
else
{
return
1
;
}
}
| undefined8 pred_delete(undefined8 param_1,long param_2)
{
char cVar1;
int iVar2;
undefined8 uVar3;
int *piVar4;
undefined8 uVar5;
int local_1c;
iVar2 = strcmp(_strcmp,".");
if (iVar2 == 0) {
uVar3 = 1;
}
else {
local_1c = 0;
if ((DAT_0010402c != '\0') && ((*(uint *)(param_2 + 0x18) & 0xf000) == 0x4000)) {
local_1c = 0x200;
}
cVar1 = perform_delete(local_1c);
if (cVar1 == '\0') {
piVar4 = __errno_location();
if ((*piVar4 == 2) && (DAT_00104056 != '\0')) {
piVar4 = __errno_location();
*piVar4 = 0;
uVar3 = 1;
}
else {
piVar4 = __errno_location();
if ((*piVar4 == 0x15) && ((local_1c == 0 && (cVar1 = perform_delete(0x200), cVar1 != '\0')))
) {
return 1;
}
uVar3 = safely_quote_err_filename(0,param_1);
uVar5 = gettext("cannot delete %s");
piVar4 = __errno_location();
error(0,*piVar4,uVar5,uVar3);
DAT_0010404c = 1;
uVar3 = 0;
}
}
else {
uVar3 = 1;
}
}
return uVar3;
}
|
void
array_add (element, array)
char *element;
ARRAY *array;
{
if (array->sindex + 2 > array->size)
array->array = (char **)xrealloc
(array->array, (array->size += array->growth_rate) * array->width);
array->array[array->sindex++] = element;
array->array[array->sindex] = (char *)
((void *)0)
;
}
| void array_add(unsigned long a0, unsigned long a1) {
struct_0 *v0;
int tmp_48;
unsigned long long *v2;
unsigned long long v3;
v0 = a1;
if (v0->field_4 + 1 >= v0->field_0) {
v0->field_0 = v0->field_0 + v0->field_c;
v0->field_10 = xrealloc(v0->field_10, v0->field_8 * v0->field_0);
}
v2 = v0->field_10;
tmp_48 = v0->field_4;
v0->field_4 = v0->field_4 + 1;
v2[tmp_48] = a0;
v3 = v0->field_4 * 8 + v0->field_10;
*((v0->field_4 * 8 + v0->field_10)) = 0;
return;
}
|
static
void start_if_needed(void)
{
CHILD *ch;
int delete;
;
for(ch = family; ch; ch = ch->next) {
if (ch->flags & 32) break;
if (ch->flags & 2) continue;
delete = 1;
if (strchr(ch->rlevel, runlevel) ||
((ch->flags & 8) && !strchr("#*Ss", runlevel))) {
startup(ch);
delete = 0;
}
if (delete) {
ch->flags &= ~(2|32);
if (!((ch->action) == 7 || (ch->action) == 6 || (ch->action) == 8 || (ch->action) == 14 || (ch->action) == 9) && ch->action != 15)
ch->flags &= ~128;
ch->pid = 0;
} else
if (ch->flags & 32) break;
}
}
| void start_if_needed(unsigned long a0, unsigned long a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned int a5) {
unsigned int v0;
struct_0 *v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
v3 = family;
v1 = family;
while (true) {
if (!v1)
goto LABEL_4040f1;
v4 = v1->field_0 & 32;
if ((v1->field_0 & 32))
goto LABEL_4040f1;
if (!(v1->field_0 & 2))
break;
LABEL_4040ce:
v6 = v1->field_c0;
v1 = v1->field_c0;
}
v0 = 1;
*(&a1) = runlevel;
if (!strchr(&v1->padding_c[24], runlevel)) {
if (!(v1->field_0 & 8))
goto LABEL_404031;
*(&a1) = runlevel;
if (!(!strchr("#*Ss", runlevel)))
goto LABEL_404031;
}
startup(v1, a1, a2, a3, a4, a5);
v0 = 0;
LABEL_404031:
if (v0) {
v1->field_0 = v1->field_0 & -35;
if (v1->field_30 != 7 && v1->field_30 != 6 && v1->field_30 != 8 && v1->field_30 != 14 && v1->field_30 != 9 && v1->field_30 != 15) {
*(&v4) = v1->field_0;
*(&v4) = v1->field_0 & 127;
v1->field_0 = v4;
}
v1->field_8 = 0;
goto LABEL_4040ce;
} else {
v5 = v1->field_0 & 32;
}
LABEL_4040f1:
return;
}
|
static void
add_temp_dir (char const *dir)
{
if (temp_dir_count == temp_dir_alloc)
temp_dirs = ((!!sizeof (struct { _Static_assert (sizeof *(temp_dirs) != 1, "verify_expr (" "sizeof *(temp_dirs) != 1" ", " "x2nrealloc (temp_dirs, &temp_dir_alloc, sizeof *(temp_dirs))" ")"); int _gl_dummy; })) ? (x2nrealloc (temp_dirs, &temp_dir_alloc, sizeof *(temp_dirs))) : (x2nrealloc (temp_dirs, &temp_dir_alloc, sizeof *(temp_dirs))));
temp_dirs[temp_dir_count++] = dir;
}
| void add_temp_dir(unsigned long long a0) {
int tmp_20;
unsigned long long v1;
if (temp_dir_count == temp_dir_alloc)
temp_dirs = x2nrealloc(temp_dirs, &temp_dir_alloc, 0x8);
tmp_20 = temp_dir_count;
temp_dir_count = temp_dir_count + 1;
v1 = a0;
*((temp_dirs + tmp_20 * 8)) = a0;
return;
}
|
1
) == -1) {
sshfatal("readconf.c", __func__, 536, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Shell \"%s\" is not executable: %s", shell, strerror(
(*__errno_location ())
))
;
}
| void sshfatal(void)
{
halt_baddata();
}
|
static
_Bool
zero_block_p (char const *buffer, size_t size)
{
while (size--)
if (*buffer++)
return
0
;
return
1
;
}
| long zero_block_p(_BYTE *a1, long a2)
{
_BYTE *v2;
while ( a2-- )
{
v2 = a1++;
if ( *v2 )
return 0LL;
}
return 1LL;
}
|
int
_ssh_order_hostkeyalgs(struct ssh *ssh)
{
struct key_entry *k;
char *orig, *avail, *oavail =
((void *)0)
, *alg, *replace =
((void *)0)
;
char **proposal;
size_t maxlen;
int ktype, r;
if ((r = kex_buf2prop(ssh->kex->my,
((void *)0)
, &proposal)) != 0)
return r;
orig = proposal[PROPOSAL_SERVER_HOST_KEY_ALGS];
if ((oavail = avail = strdup(orig)) ==
((void *)0)
) {
r = -2;
goto out;
}
maxlen = strlen(avail) + 1;
if ((replace = calloc(1, maxlen)) ==
((void *)0)
) {
r = -2;
goto out;
}
*replace = '\0';
while ((alg = strsep(&avail, ",")) && *alg != '\0') {
if ((ktype = sshkey_type_from_name(alg)) == KEY_UNSPEC)
continue;
for((k) = ((&ssh->public_keys)->tqh_first); (k) !=
((void *)0)
; (k) = ((k)->next.tqe_next)) {
if (k->key->type == ktype ||
(sshkey_is_cert(k->key) && k->key->type ==
sshkey_type_plain(ktype))) {
if (*replace != '\0')
strlcat(replace, ",", maxlen);
strlcat(replace, alg, maxlen);
break;
}
}
}
if (*replace != '\0') {
sshlog("ssh_api.c", __func__, 549, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "orig/%d %s", ssh->kex->server, orig);
sshlog("ssh_api.c", __func__, 550, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "replace/%d %s", ssh->kex->server, replace);
free(orig);
proposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = replace;
replace =
((void *)0)
;
r = kex_prop2buf(ssh->kex->my, proposal);
}
out:
free(oavail);
free(replace);
kex_prop_free(proposal);
return r;
}
| int _ssh_order_hostkeyalgs(struct_0 *a0) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
void* v3;
char v4;
struct_2 *v5;
void* v6;
void* v7;
void* v8;
unsigned long v9;
char *v10;
unsigned int v12;
v7 = 0;
v6 = 0;
v1 = kex_buf2prop(a0->field_8->field_50, 0x0, &v4);
if (v1) {
v12 = v1;
} else {
v8 = *((*(&v4) + 8));
v3 = strdup(v8);
v7 = v3;
if (!v7) {
v1 = -2;
} else {
v9 = strlen(v3) + 1;
v6 = calloc(0x1, v9);
if (!v6) {
v1 = -2;
} else {
*(v6) = 0;
while (true) {
v10 = strsep(&v3, ",");
if (!v10)
break;
if (!*(v10))
break;
v2 = sshkey_type_from_name(v10);
if (v2 == 14)
continue;
v5 = a0->field_850;
while (true) {
if (!v5)
break;
if (v2 == v5->field_10->field_0) {
LABEL_40154b:
if (*(v6))
strlcat(v6, ",", v9);
strlcat(v6, v10, v9);
break;
} else {
if (sshkey_is_cert(v5->field_10) && v5->field_10->field_0 == sshkey_type_plain(v2))
goto LABEL_40154b;
v5 = v5->field_0;
}
}
}
if (*(v6)) {
v0 = v8;
sshlog("ssh_api.c", "_ssh_order_hostkeyalgs", 0x225, 0x1, 0x6, 0x0, "orig/%d %s", a0->field_8->field_18);
v0 = v6;
sshlog("ssh_api.c", "_ssh_order_hostkeyalgs", 0x226, 0x1, 0x6, 0x0, "replace/%d %s", a0->field_8->field_18);
free(v8);
*((*(&v4) + 8)) = v6;
v6 = 0;
v1 = kex_prop2buf(a0->field_8->field_50, *(&v4), *(&v4));
}
}
}
free(v7);
free(v6);
kex_prop_free(*(&v4));
v12 = v1;
}
return v12;
}
|
static void
volume_offset_coder (struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr, void const *data)
{
off_t const *v = data;
code_num (*v, keyword, xhdr);
}
| long long volume_offset_coder(unsigned long a0, unsigned int a1, void* a2, unsigned long long *a3) {
unsigned long v0;
v0 = a0;
return code_num(*(a3), a1, a2);
}
|
gl_linked_first_node (gl_list_t list)
{
if (list->count > 0)
return list->root.next;
else
return
((void *)0)
;
}
| long long gl_linked_first_node(unsigned long long a0[9]) {
void* v1;
if (!a0[8])
v1 = 0;
else
v1 = a0[5];
return v1;
}
|
void
extract_archive (void)
{
char typeflag;
tar_extractor_t fun;
_Bool
skip_dotdot_name;
fatal_exit_hook = extract_finish;
set_next_block_after (current_header);
skip_dotdot_name = (!absolute_names_option
&& contains_dot_dot (current_stat_info.orig_file_name));
if (skip_dotdot_name)
do { if (error_hook) error_hook (); error (0, 0, gettext ("%s: Member name contains '..'"), quotearg_colon (current_stat_info.orig_file_name)); exit_status = 2; } while (0)
;
if (!current_stat_info.file_name[0]
|| skip_dotdot_name
|| (interactive_option
&& !confirm ("extract", current_stat_info.file_name)))
{
skip_member ();
return;
}
if (verbose_option)
print_header (¤t_stat_info, current_header, -1);
if (!delay_directory_restore_option)
{
int dir = chdir_current;
apply_nonancestor_delayed_set_stat (current_stat_info.file_name, 0);
chdir_do (dir);
}
if (backup_option)
if (!maybe_backup_file (current_stat_info.file_name, 0))
{
int e =
(*__errno_location ())
;
do { if (error_hook) error_hook (); error (0, e, gettext ("%s: Was unable to backup this file"), quotearg_colon (current_stat_info.file_name)); exit_status = 2; } while (0)
;
skip_member ();
return;
}
typeflag = sparse_member_p (¤t_stat_info) ?
'S' : current_header->header.typeflag;
if (prepare_to_extract (current_stat_info.file_name, typeflag, &fun))
{
if (fun (current_stat_info.file_name, typeflag) == 0)
return;
}
else
skip_member ();
if (backup_option)
undo_last_backup ();
}
| long long extract_archive() {
char v0;
char v1;
unsigned int v2;
unsigned int v3;
char v4;
char v6;
unsigned long long v7;
char v9;
unsigned long long v10;
fatal_exit_hook = extract_finish;
set_next_block_after(current_header);
if ((absolute_names_option ^ 1) && contains_dot_dot(current_stat_info)) {
v6 = 1;
goto LABEL_40393a;
}
v6 = 0;
LABEL_40393a:
v0 = v6;
v0 &= 1;
if (v0) {
if (error_hook)
*(5243024)();
v7 = quotearg_colon(current_stat_info);
error(0x0, 0x0, gettext("%s: Member name contains '..'"));
exit_status = 2;
}
if (!*(quotearg_colon)) {
LABEL_4039d7:
skip_member();
} else {
if (!(!v0))
goto LABEL_4039d7;
if (!interactive_option) {
LABEL_4039e1:
if (verbose_option)
print_header(0x500170, current_header, 0xffffffffffffffff);
if ((delay_directory_restore_option ^ 1)) {
v2 = chdir_current;
apply_nonancestor_delayed_set_stat(quotearg_colon, 0x0);
chdir_do(v2);
}
if (backup_option && (maybe_backup_file(quotearg_colon, 0x0) ^ 1)) {
v3 = *(__errno_location());
if (error_hook)
*(5243024)();
v10 = quotearg_colon(quotearg_colon);
error(0x0, v3, gettext("%s: Was unable to backup this file"));
exit_status = 2;
skip_member();
goto LABEL_403b45;
}
if (sparse_member_p(0x500170))
v9 = 83;
else
v9 = *((current_header + 156));
v1 = v9;
if (!prepare_to_extract(quotearg_colon, v1, &v4)) {
skip_member();
} else if (!*(&v4)(quotearg_colon, v1, v1, *(&v4))) {
goto LABEL_403b45;
}
if (backup_option)
undo_last_backup();
} else {
if (!(!confirm("extract", quotearg_colon)))
goto LABEL_4039e1;
goto LABEL_4039d7;
}
}
LABEL_403b45:
return 0;
}
|
static struct sshkey *
pkcs11_fetch_ecdsa_pubkey(struct pkcs11_provider *p, CK_ULONG slotidx,
CK_OBJECT_HANDLE *obj)
{
CK_ATTRIBUTE key_attr[3];
CK_SESSION_HANDLE session;
CK_FUNCTION_LIST *f =
((void *)0)
;
CK_RV rv;
ASN1_OCTET_STRING *octet =
((void *)0)
;
EC_KEY *ec =
((void *)0)
;
EC_GROUP *group =
((void *)0)
;
struct sshkey *key =
((void *)0)
;
const unsigned char *attrp =
((void *)0)
;
int i;
int nid;
memset(&key_attr, 0, sizeof(key_attr));
key_attr[0].type = (0x102);
key_attr[1].type = (0x181);
key_attr[2].type = (0x180);
session = p->slotinfo[slotidx].session;
f = p->function_list;
rv = f->C_GetAttributeValue(session, *obj, key_attr, 3);
if (rv != (0)) {
sshlog("ssh-pkcs11.c", __func__, 726, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "C_GetAttributeValue failed: %lu", rv);
return (
((void *)0)
);
}
if (key_attr[1].ulValueLen == 0 ||
key_attr[2].ulValueLen == 0) {
sshlog("ssh-pkcs11.c", __func__, 737, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "invalid attribute length");
return (
((void *)0)
);
}
for (i = 0; i < 3; i++)
if (key_attr[i].ulValueLen > 0)
key_attr[i].pValue = xcalloc(1, key_attr[i].ulValueLen);
rv = f->C_GetAttributeValue(session, *obj, key_attr, 3);
if (rv != (0)) {
sshlog("ssh-pkcs11.c", __func__, 749, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "C_GetAttributeValue failed: %lu", rv);
goto fail;
}
ec = EC_KEY_new();
if (ec ==
((void *)0)
) {
sshlog("ssh-pkcs11.c", __func__, 755, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "EC_KEY_new failed");
goto fail;
}
attrp = key_attr[2].pValue;
group = d2i_ECPKParameters(
((void *)0)
, &attrp, key_attr[2].ulValueLen);
if (group ==
((void *)0)
) {
ossl_error("d2i_ECPKParameters failed");
goto fail;
}
if (EC_KEY_set_group(ec, group) == 0) {
ossl_error("EC_KEY_set_group failed");
goto fail;
}
if (key_attr[1].ulValueLen <= 2) {
sshlog("ssh-pkcs11.c", __func__, 772, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "CKA_EC_POINT too small");
goto fail;
}
attrp = key_attr[1].pValue;
octet = d2i_ASN1_OCTET_STRING(
((void *)0)
, &attrp, key_attr[1].ulValueLen);
if (octet ==
((void *)0)
) {
ossl_error("d2i_ASN1_OCTET_STRING failed");
goto fail;
}
attrp = octet->data;
if (o2i_ECPublicKey(&ec, &attrp, octet->length) ==
((void *)0)
) {
ossl_error("o2i_ECPublicKey failed");
goto fail;
}
nid = sshkey_ecdsa_key_to_nid(ec);
if (nid < 0) {
sshlog("ssh-pkcs11.c", __func__, 790, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "couldn't get curve nid");
goto fail;
}
if (pkcs11_ecdsa_wrap(p, slotidx, &key_attr[0], ec))
goto fail;
key = sshkey_new(KEY_UNSPEC);
if (key ==
((void *)0)
) {
sshlog("ssh-pkcs11.c", __func__, 799, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "sshkey_new failed");
goto fail;
}
key->ecdsa = ec;
key->ecdsa_nid = nid;
key->type = KEY_ECDSA;
key->flags |= 0x0001;
ec =
((void *)0)
;
fail:
for (i = 0; i < 3; i++)
free(key_attr[i].pValue);
if (ec)
EC_KEY_free(ec);
if (group)
EC_GROUP_free(group);
if (octet)
ASN1_OCTET_STRING_free(octet);
return (key);
}
| long pkcs11_fetch_ecdsa_pubkey(long a1, long a2, _QWORD *a3)
{
int i;
int j;
int v7;
long v8;
long v9;
int *v10;
long v11;
long v12;
long v13;
long v14;
long v15;
long s[10];
s[9] = __readfsqword(0x28u);
v13 = 0LL;
v10 = 0LL;
v8 = 0LL;
v11 = 0LL;
v12 = 0LL;
v9 = 0LL;
memset(s, 0, 0x48uLL);
s[0] = 258LL;
s[3] = 385LL;
s[6] = 384LL;
v14 = *(_QWORD *)(*(_QWORD *)(a1 + 128) + 224 * a2 + 208);
v13 = *(_QWORD *)(a1 + 16);
v15 = (*(long ( **)(long, _QWORD, long *, long))(v13 + 200))(v14, *a3, s, 3LL);
if ( v15 )
{
sshlog("ssh-pkcs11.c", "pkcs11_fetch_ecdsa_pubkey", 726LL, 0LL, 2LL, 0LL, "C_GetAttributeValue failed: %lu", v15);
return 0LL;
}
else if ( s[5] && s[8] )
{
for ( i = 0; i <= 2; ++i )
{
if ( s[3 * i + 2] )
s[3 * i + 1] = xcalloc(1LL, s[3 * i + 2]);
}
v15 = (*(long ( **)(long, _QWORD, long *, long))(v13 + 200))(v14, *a3, s, 3LL);
if ( v15 )
{
sshlog("ssh-pkcs11.c", "pkcs11_fetch_ecdsa_pubkey", 749LL, 0LL, 2LL, 0LL, "C_GetAttributeValue failed: %lu", v15);
}
else
{
v8 = EC_KEY_new();
if ( v8 )
{
v9 = s[7];
v11 = d2i_ECPKParameters(0LL, &v9, s[8]);
if ( v11 )
{
if ( (unsigned int)EC_KEY_set_group(v8, v11) )
{
if ( s[5] > 2uLL )
{
v9 = s[4];
v10 = (int *)d2i_ASN1_OCTET_STRING(0LL, &v9, s[5]);
if ( v10 )
{
v9 = *((_QWORD *)v10 + 1);
if ( o2i_ECPublicKey(&v8, &v9, *v10) )
{
v7 = sshkey_ecdsa_key_to_nid(v8);
if ( v7 >= 0 )
{
if ( !(unsigned int)pkcs11_ecdsa_wrap(a1, a2, (long)s, v8) )
{
v12 = sshkey_new(14LL);
if ( v12 )
{
*(_QWORD *)(v12 + 32) = v8;
*(_DWORD *)(v12 + 24) = v7;
*(_DWORD *)v12 = 2;
*(_DWORD *)(v12 + 4) |= 1u;
v8 = 0LL;
}
else
{
sshlog("ssh-pkcs11.c", "pkcs11_fetch_ecdsa_pubkey", 799LL, 0LL, 2LL, 0LL, "sshkey_new failed");
}
}
}
else
{
sshlog("ssh-pkcs11.c", "pkcs11_fetch_ecdsa_pubkey", 790LL, 0LL, 2LL, 0LL, "couldn't get curve nid");
}
}
else
{
ossl_error("o2i_ECPublicKey failed");
}
}
else
{
ossl_error("d2i_ASN1_OCTET_STRING failed");
}
}
else
{
sshlog("ssh-pkcs11.c", "pkcs11_fetch_ecdsa_pubkey", 772LL, 0LL, 2LL, 0LL, "CKA_EC_POINT too small");
}
}
else
{
ossl_error("EC_KEY_set_group failed");
}
}
else
{
ossl_error("d2i_ECPKParameters failed");
}
}
else
{
sshlog("ssh-pkcs11.c", "pkcs11_fetch_ecdsa_pubkey", 755LL, 0LL, 2LL, 0LL, "EC_KEY_new failed");
}
}
for ( j = 0; j <= 2; ++j )
free((void *)s[3 * j + 1]);
if ( v8 )
EC_KEY_free(v8);
if ( v11 )
EC_GROUP_free(v11);
if ( v10 )
ASN1_OCTET_STRING_free(v10);
return v12;
}
else
{
sshlog("ssh-pkcs11.c", "pkcs11_fetch_ecdsa_pubkey", 737LL, 0LL, 2LL, 0LL, "invalid attribute length");
return 0LL;
}
}
|
terminal_set(EditLine *el, const char *term)
{
int i;
char buf[((size_t)2048)];
char *area;
const struct termcapstr *t;
sigset_t oset, nset;
int lins, cols;
(void) sigemptyset(&nset);
(void) sigaddset(&nset,
28
);
(void) sigprocmask(
0
, &nset, &oset);
area = buf;
if (term ==
((void *)0)
)
term = getenv("TERM");
if (!term || !term[0])
term = "dumb";
if (strcmp(term, "emacs") == 0)
el->el_flags |= 0x004;
(void) memset(el->el_terminal.t_cap, 0, ((size_t)2048));
i = tgetent(el->el_terminal.t_cap, term);
if (i <= 0) {
if (i == -1)
(void) fprintf(el->el_errfile,
"Cannot read termcap database;\n");
else if (i == 0)
(void) fprintf(el->el_errfile,
"No entry for terminal type \"%s\";\n", term);
(void) fprintf(el->el_errfile,
"using dumb terminal settings.\n");
el->el_terminal.t_val[3] = 80;
el->el_terminal.t_val[1] = el->el_terminal.t_val[4] = el->el_terminal.t_val[2] = 0;
el->el_terminal.t_val[5] = el->el_terminal.t_val[7];
for (t = tstr; t->name !=
((void *)0)
; t++)
terminal_alloc(el, t,
((void *)0)
);
} else {
el->el_terminal.t_val[0] = tgetflag("am");
el->el_terminal.t_val[6] = tgetflag("xn");
el->el_terminal.t_val[1] = tgetflag("pt");
el->el_terminal.t_val[5] = tgetflag("xt");
el->el_terminal.t_val[4] = tgetflag("km");
el->el_terminal.t_val[7] = tgetflag("MT");
el->el_terminal.t_val[3] = tgetnum("co");
el->el_terminal.t_val[2] = tgetnum("li");
for (t = tstr; t->name !=
((void *)0)
; t++) {
terminal_alloc(el, t, tgetstr(strchr(t->name, *t->name),
&area));
}
}
if (el->el_terminal.t_val[3] < 2)
el->el_terminal.t_val[3] = 80;
if (el->el_terminal.t_val[2] < 1)
el->el_terminal.t_val[2] = 24;
el->el_terminal.t_size.v = el->el_terminal.t_val[3];
el->el_terminal.t_size.h = el->el_terminal.t_val[2];
terminal_setflags(el);
(void) terminal_get_size(el, &lins, &cols);
if (terminal_change_size(el, lins, cols) == -1)
return -1;
(void) sigprocmask(
2
, &oset,
((void *)0)
);
terminal_bind_arrow(el);
el->el_terminal.t_name = term;
return i <= 0 ? -1 : 0;
}
| undefined8 terminal_set(long param_1,char *param_2)
{
undefined4 *puVar1;
long lVar2;
int iVar3;
undefined4 uVar4;
undefined4 *puVar5;
char *pcVar6;
undefined8 uVar7;
long in_FS_OFFSET;
char *local_958;
undefined4 local_944;
undefined4 local_940;
int local_93c;
undefined *local_938;
undefined1 *local_930;
sigset_t local_928;
sigset_t local_8a8;
undefined local_828 [2056];
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
sigemptyset(&local_8a8);
sigaddset(&local_8a8,0x1c);
sigprocmask(0,&local_8a8,&local_928);
local_938 = local_828;
local_958 = param_2;
if (param_2 == (char *)0x0) {
local_958 = getenv("TERM");
}
if ((local_958 == (char *)0x0) || (*local_958 == '\0')) {
local_958 = "dumb";
}
iVar3 = strcmp(local_958,"emacs");
if (iVar3 == 0) {
*(uint *)(param_1 + 0x2c) = *(uint *)(param_1 + 0x2c) | 4;
}
memset(*(void **)(param_1 + 0xc0),0,0x800);
local_93c = tgetent(*(undefined8 *)(param_1 + 0xc0));
if (local_93c < 1) {
if (local_93c == -1) {
fprintf(*(FILE **)(param_1 + 0x18),"Cannot read termcap database;\n");
}
else if (local_93c == 0) {
fprintf(*(FILE **)(param_1 + 0x18),"No entry for terminal type \"%s\";\n",local_958);
}
fprintf(*(FILE **)(param_1 + 0x18),"using dumb terminal settings.\n");
*(undefined4 *)(*(long *)(param_1 + 0xb8) + 0xc) = 0x50;
puVar1 = (undefined4 *)(*(long *)(param_1 + 0xb8) + 8);
*puVar1 = 0;
puVar5 = (undefined4 *)(*(long *)(param_1 + 0xb8) + 0x10);
*puVar5 = *puVar1;
*(undefined4 *)(*(long *)(param_1 + 0xb8) + 4) = *puVar5;
*(undefined4 *)(*(long *)(param_1 + 0xb8) + 0x14) =
*(undefined4 *)(*(long *)(param_1 + 0xb8) + 0x1c);
for (local_930 = tstr; *(char **)local_930 != (char *)0x0;
local_930 = (undefined1 *)((long)local_930 + 0x10)) {
terminal_alloc(param_1,local_930,0);
}
}
else {
puVar1 = *(undefined4 **)(param_1 + 0xb8);
uVar4 = tgetflag(&DAT_001048a9);
*puVar1 = uVar4;
lVar2 = *(long *)(param_1 + 0xb8);
uVar4 = tgetflag(&DAT_00104928);
*(undefined4 *)(lVar2 + 0x18) = uVar4;
lVar2 = *(long *)(param_1 + 0xb8);
uVar4 = tgetflag(&DAT_001048c2);
*(undefined4 *)(lVar2 + 4) = uVar4;
lVar2 = *(long *)(param_1 + 0xb8);
uVar4 = tgetflag(&DAT_0010490f);
*(undefined4 *)(lVar2 + 0x14) = uVar4;
lVar2 = *(long *)(param_1 + 0xb8);
uVar4 = tgetflag(&DAT_001048ff);
*(undefined4 *)(lVar2 + 0x10) = uVar4;
lVar2 = *(long *)(param_1 + 0xb8);
uVar4 = tgetflag(&DAT_00104950);
*(undefined4 *)(lVar2 + 0x1c) = uVar4;
lVar2 = *(long *)(param_1 + 0xb8);
uVar4 = tgetnum(&DAT_001048ea);
*(undefined4 *)(lVar2 + 0xc) = uVar4;
lVar2 = *(long *)(param_1 + 0xb8);
uVar4 = tgetnum(&DAT_001048d7);
*(undefined4 *)(lVar2 + 8) = uVar4;
for (local_930 = tstr; *(char **)local_930 != (char *)0x0;
local_930 = (undefined1 *)((long)local_930 + 0x10)) {
pcVar6 = strchr(*(char **)local_930,(int)**(char **)local_930);
uVar7 = tgetstr(pcVar6,&local_938);
terminal_alloc(param_1,local_930,uVar7);
}
}
if (*(int *)(*(long *)(param_1 + 0xb8) + 0xc) < 2) {
*(undefined4 *)(*(long *)(param_1 + 0xb8) + 0xc) = 0x50;
}
if (*(int *)(*(long *)(param_1 + 0xb8) + 8) < 1) {
*(undefined4 *)(*(long *)(param_1 + 0xb8) + 8) = 0x18;
}
*(undefined4 *)(param_1 + 0x94) = *(undefined4 *)(*(long *)(param_1 + 0xb8) + 0xc);
*(undefined4 *)(param_1 + 0x90) = *(undefined4 *)(*(long *)(param_1 + 0xb8) + 8);
terminal_setflags(param_1);
terminal_get_size(param_1,&local_944,&local_940);
iVar3 = terminal_change_size(param_1,local_944,local_940);
if (iVar3 == -1) {
uVar7 = 0xffffffff;
}
else {
sigprocmask(2,&local_928,(sigset_t *)0x0);
terminal_bind_arrow(param_1);
*(char **)(param_1 + 0x88) = local_958;
if (local_93c < 1) {
uVar7 = 0xffffffff;
}
else {
uVar7 = 0;
}
}
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar7;
}
__stack_chk_fail();
}
|
static void
_ignore_completion_names (names, name_func)
char **names;
sh_ignore_func_t *name_func;
{
char **newnames;
int idx, nidx;
char **oldnames;
int oidx;
if (names[1] == (char *)0)
{
if (force_fignore)
if ((*name_func) (names[0]) == 0)
{
sh_xfree((names[0]), "bashline.c", 3002);
names[0] = (char *)
((void *)0)
;
}
return;
}
for (nidx = 1; names[nidx]; nidx++)
;
newnames = strvec_create (nidx + 1);
if (force_fignore == 0)
{
oldnames = strvec_create (nidx - 1);
oidx = 0;
}
newnames[0] = names[0];
for (idx = nidx = 1; names[idx]; idx++)
{
if ((*name_func) (names[idx]))
newnames[nidx++] = names[idx];
else if (force_fignore == 0)
oldnames[oidx++] = names[idx];
else
sh_xfree((names[idx]), "bashline.c", 3029);
}
newnames[nidx] = (char *)
((void *)0)
;
if (nidx == 1)
{
if (force_fignore)
{
sh_xfree((names[0]), "bashline.c", 3039);
names[0] = (char *)
((void *)0)
;
}
else
sh_xfree((oldnames), "bashline.c", 3043);
sh_xfree((newnames), "bashline.c", 3045);
return;
}
if (force_fignore == 0)
{
while (oidx)
sh_xfree((oldnames[--oidx]), "bashline.c", 3052);
sh_xfree((oldnames), "bashline.c", 3053);
}
if (nidx == 2)
{
sh_xfree((names[0]), "bashline.c", 3059);
names[0] = newnames[1];
names[1] = (char *)
((void *)0)
;
sh_xfree((newnames), "bashline.c", 3062);
return;
}
for (nidx = 1; newnames[nidx]; nidx++)
names[nidx] = newnames[nidx];
names[nidx] = (char *)
((void *)0)
;
sh_xfree((newnames), "bashline.c", 3071);
}
| void _ignore_completion_names(undefined8 *param_1,code *param_2)
{
int iVar1;
undefined8 *puVar2;
int local_24;
int local_20;
int local_1c;
long local_18;
if (param_1[1] == 0) {
if ((force_fignore != 0) && (iVar1 = (*param_2)(*param_1), iVar1 == 0)) {
sh_xfree(*param_1,"bashline.c",0xbba);
*param_1 = 0;
}
}
else {
for (local_20 = 1; param_1[local_20] != 0; local_20 = local_20 + 1) {
}
puVar2 = (undefined8 *)strvec_create(local_20 + 1);
if (force_fignore == 0) {
local_18 = strvec_create(local_20 + -1);
local_1c = 0;
}
*puVar2 = *param_1;
local_20 = 1;
for (local_24 = 1; param_1[local_24] != 0; local_24 = local_24 + 1) {
iVar1 = (*param_2)(param_1[local_24]);
if (iVar1 == 0) {
if (force_fignore == 0) {
*(undefined8 *)((long)local_1c * 8 + local_18) = param_1[local_24];
local_1c = local_1c + 1;
}
else {
sh_xfree(param_1[local_24],"bashline.c",0xbd5);
}
}
else {
puVar2[local_20] = param_1[local_24];
local_20 = local_20 + 1;
}
}
puVar2[local_20] = 0;
if (local_20 == 1) {
if (force_fignore == 0) {
sh_xfree(local_18,"bashline.c",0xbe3);
}
else {
sh_xfree(*param_1,"bashline.c",0xbdf);
*param_1 = 0;
}
sh_xfree(puVar2,"bashline.c",0xbe5);
}
else {
if (force_fignore == 0) {
while (local_1c != 0) {
local_1c = local_1c + -1;
sh_xfree(*(undefined8 *)(local_18 + (long)local_1c * 8),"bashline.c",0xbec);
}
sh_xfree(local_18,"bashline.c",0xbed);
}
if (local_20 == 2) {
sh_xfree(*param_1,"bashline.c",0xbf3);
*param_1 = puVar2[1];
param_1[1] = 0;
sh_xfree(puVar2,"bashline.c",0xbf6);
}
else {
for (local_20 = 1; puVar2[local_20] != 0; local_20 = local_20 + 1) {
param_1[local_20] = puVar2[local_20];
}
param_1[local_20] = 0;
sh_xfree(puVar2,"bashline.c",0xbff);
}
}
}
return;
}
|
static void update_gecos (const char *user, char *gecos)
{
const struct passwd *pw;
struct passwd pwent;
if (setuid (0) != 0) {
fputs (gettext ("Cannot change ID to root.\n"),
stderr
);
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
, "can't setuid(0)") ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
fail_exit (1);
}
pwd_init ();
if (pw_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, pw_dbname ());
fail_exit (1);
}
pw_locked =
1
;
if (pw_open (
0100
|
02
) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot open %s\n"), Prog, pw_dbname ());
fail_exit (1);
}
pw = pw_locate (user);
if (
((void *)0)
== pw) {
fprintf (
stderr
,
gettext ("%s: user '%s' does not exist in %s\n"),
Prog, user, pw_dbname ());
fail_exit (1);
}
pwent = *pw;
pwent.pw_gecos = gecos;
if (pw_update (&pwent) == 0) {
fprintf (
stderr
,
gettext ("%s: failed to prepare the new %s entry '%s'\n"),
Prog, pw_dbname (), pwent.pw_name);
fail_exit (1);
}
if (pw_close () == 0) {
fprintf (
stderr
, gettext ("%s: failure while writing changes to %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
, "failure while writing changes to %s", pw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
fail_exit (1);
}
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
);
}
pw_locked =
0
;
}
| void update_gecos(undefined8 param_1,undefined8 param_2)
{
FILE *__stream;
int iVar1;
char *pcVar2;
undefined8 uVar3;
undefined8 *puVar4;
undefined8 uVar5;
undefined8 uVar6;
long in_FS_OFFSET;
char *local_a0;
char *local_98;
char *local_90;
undefined8 local_68;
undefined8 local_60;
undefined8 local_58;
undefined8 local_50;
undefined8 local_48;
undefined8 local_40;
long local_30;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = setuid(0);
__stream = stderr;
if (iVar1 != 0) {
pcVar2 = (char *)gettext("Cannot change ID to root.\n");
fputs(pcVar2,__stream);
pcVar2 = setlocale(6,(char *)0x0);
local_a0 = (char *)0x0;
if (pcVar2 != (char *)0x0) {
local_a0 = strdup(pcVar2);
}
if (local_a0 != (char *)0x0) {
setlocale(6,"C");
}
syslog(3,"can\'t setuid(0)");
if (local_a0 != (char *)0x0) {
setlocale(6,local_a0);
free(local_a0);
}
fail_exit(1);
}
pwd_init();
iVar1 = pw_lock();
if (iVar1 == 0) {
uVar3 = pw_dbname();
uVar6 = Prog;
pcVar2 = (char *)gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr,pcVar2,uVar6,uVar3);
fail_exit(1);
}
pw_locked = 1;
iVar1 = pw_open(0x42);
if (iVar1 == 0) {
uVar3 = pw_dbname();
uVar6 = Prog;
pcVar2 = (char *)gettext("%s: cannot open %s\n");
fprintf(stderr,pcVar2,uVar6,uVar3);
fail_exit(1);
}
puVar4 = (undefined8 *)pw_locate(param_1);
if (puVar4 == (undefined8 *)0x0) {
uVar3 = pw_dbname();
uVar6 = Prog;
pcVar2 = (char *)gettext("%s: user \'%s\' does not exist in %s\n");
fprintf(stderr,pcVar2,uVar6,param_1,uVar3);
fail_exit(1);
}
local_68 = *puVar4;
local_60 = puVar4[1];
local_58 = puVar4[2];
local_40 = puVar4[5];
local_48 = puVar4[4];
local_50 = param_2;
iVar1 = pw_update(&local_68);
uVar6 = local_68;
if (iVar1 == 0) {
uVar5 = pw_dbname();
uVar3 = Prog;
pcVar2 = (char *)gettext("%s: failed to prepare the new %s entry \'%s\'\n");
fprintf(stderr,pcVar2,uVar3,uVar5,uVar6);
fail_exit(1);
}
iVar1 = pw_close();
if (iVar1 == 0) {
uVar3 = pw_dbname();
uVar6 = Prog;
pcVar2 = (char *)gettext("%s: failure while writing changes to %s\n");
fprintf(stderr,pcVar2,uVar6,uVar3);
pcVar2 = setlocale(6,(char *)0x0);
local_98 = (char *)0x0;
if (pcVar2 != (char *)0x0) {
local_98 = strdup(pcVar2);
}
if (local_98 != (char *)0x0) {
setlocale(6,"C");
}
uVar6 = pw_dbname();
syslog(3,"failure while writing changes to %s",uVar6);
if (local_98 != (char *)0x0) {
setlocale(6,local_98);
free(local_98);
}
fail_exit(1);
}
iVar1 = pw_unlock();
if (iVar1 == 0) {
uVar3 = pw_dbname();
uVar6 = Prog;
pcVar2 = (char *)gettext("%s: failed to unlock %s\n");
fprintf(stderr,pcVar2,uVar6,uVar3);
pcVar2 = setlocale(6,(char *)0x0);
local_90 = (char *)0x0;
if (pcVar2 != (char *)0x0) {
local_90 = strdup(pcVar2);
}
if (local_90 != (char *)0x0) {
setlocale(6,"C");
}
uVar6 = pw_dbname();
syslog(3,"failed to unlock %s",uVar6);
if (local_90 != (char *)0x0) {
setlocale(6,local_90);
free(local_90);
}
}
pw_locked = 0;
if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
pw_locked = 0;
return;
}
|
static z_word_t crc_word_big(data)
z_word_t data;
{
int k;
for (k = 0; k < 8; k++)
data = (data << 8) ^
crc_big_table[(data >> ((8 - 1) << 3)) & 0xff];
return data;
}
| ulong crc_word_big(ulong param_1)
{
ulong local_20;
int local_c;
local_20 = param_1;
for (local_c = 0; local_c < 8; local_c = local_c + 1) {
local_20 = *(ulong *)(crc_big_table + (local_20 >> 0x38) * 8) ^ local_20 << 8;
}
return local_20;
}
|
static int
compare (struct line const *a, struct line const *b)
{
int diff;
size_t alen, blen;
if (keylist)
{
diff = keycompare (a, b);
if (diff || unique || stable)
return diff;
}
alen = a->length - 1, blen = b->length - 1;
if (alen == 0)
diff = - ((blen) != 0);
else if (blen == 0)
diff = 1;
else if (hard_LC_COLLATE)
{
diff = xmemcoll0 (a->text, alen + 1, b->text, blen + 1);
}
else if (! (diff = memcmp (a->text, b->text,
(((
alen
)<(
blen
))?(
alen
):(
blen
))
)))
diff = alen < blen ? -1 : alen != blen;
return reverse ? -diff : diff;
}
| int compare(unsigned long long a0[2], unsigned long long a1[2]) {
unsigned int v0;
unsigned long v1;
unsigned long v2;
unsigned long v4;
if (!keylist) {
LABEL_405d50:
v1 = a0[1] - 1;
v2 = a1[1] - 1;
if (!v1) {
v0 = -(v2);
} else if (!v2) {
v0 = 1;
} else if (hard_LC_COLLATE) {
v0 = xmemcoll0(a0[0], v1 + 1, a1[0], v2 + 1);
} else {
v4 = v1;
if (v2 <= v1)
v4 = v2;
v0 = memcmp(v4, *(v4), v4);
if (!v0) {
if (v1 < v2)
*(&v4) = -1;
else
*(&v4) = v1 != v2;
v0 = v4;
}
}
if (!reverse)
*(&v4) = v0;
else
*(&v4) = -(v0);
} else {
v0 = keycompare(a0, a1);
if (!v0 && !unique && !stable)
goto LABEL_405d50;
v4 = v0;
}
return v4;
}
|
void
sh_getopt_restore_istate (state)
sh_getopt_state_t *state;
{
sh_optarg = state->gs_optarg;
sh_optind = state->gs_optind;
sh_curopt = state->gs_curopt;
nextchar = state->gs_nextchar;
sh_charindex = state->gs_charindex;
sh_getopt_dispose_istate (state);
}
| long long sh_getopt_restore_istate(struct_0 *a0) {
sh_optarg = a0->field_0;
sh_optind = a0->field_8;
sh_curopt = a0->field_c;
nextchar = a0->field_10;
sh_charindex = a0->field_18;
return sh_getopt_dispose_istate(a0);
}
|
int
do_fsync(struct sftp_conn *conn, u_char *handle, u_int handle_len)
{
struct sshbuf *msg;
u_int status, id;
int r;
if ((conn->exts & 0x00000010) == 0)
return -1;
sshlog("sftp-client.c", __func__, 1336, 0, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "Sending SSH2_FXP_EXTENDED(fsync@openssh.com)");
if ((msg = sshbuf_new()) ==
((void *)0)
)
sshfatal("sftp-client.c", __func__, 1340, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
id = conn->msg_id++;
if ((r = sshbuf_put_u8(msg, 200)) != 0 ||
(r = sshbuf_put_u32(msg, id)) != 0 ||
(r = sshbuf_put_cstring(msg, "fsync@openssh.com")) != 0 ||
(r = sshbuf_put_string(msg, handle, handle_len)) != 0)
sshfatal("sftp-client.c", __func__, 1346, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose");
send_msg(conn, msg);
sshlog("sftp-client.c", __func__, 1348, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "Sent message fsync@openssh.com I:%u", id);
sshbuf_free(msg);
status = get_status(conn, id);
if (status != 0)
sshlog("sftp-client.c", __func__, 1353, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "remote fsync: %s", fx2txt(status));
return status == 0 ? 0 : -1;
}
| void do_fsync(unsigned int a0[8], unsigned long long a1, unsigned long a2) {
unsigned int v0[8];
int tmp_14;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long long v4;
unsigned long v5;
char v6;
unsigned long long v8;
unsigned long v9;
*(&v0[0]) = a0;
if (!(a0[7] & 16)) {
v8 = 4294967295;
return;
}
sshlog("sftp-client.c", "do_fsync", 0x538, 0x0, 0x6, 0x0, "Sending SSH2_FXP_EXTENDED(fsync@openssh.com)");
v4 = sshbuf_new();
if (!v4)
sshfatal("sftp-client.c", "do_fsync", 0x53c, 0x1, 0x1, 0x0, "sshbuf_new failed");
tmp_14 = a0[6];
a0[6] = a0[6] + 1;
v2 = tmp_14;
v1 = sshbuf_put_u8(v4, 0xc8, a0);
if (!(!v1) || !((v1 = sshbuf_put_u32(v4, v2, v2), !v1))) {
LABEL_4053b6:
v4 = "compose";
sshfatal("sftp-client.c", "do_fsync", 0x542, 0x1, 0x1, ssh_err(v1), *(&v6));
} else {
v1 = sshbuf_put_cstring(v4, "fsync@openssh.com");
if (v1 || (v1 = sshbuf_put_string(v4, a1, a2, a1), v1))
goto LABEL_4053b6;
}
send_msg(a0, v4);
v5 = v2;
v4 = "Sent message fsync@openssh.com I:%u";
sshlog("sftp-client.c", "do_fsync", 0x544, 0x0, 0x7, 0x0, *(&v6));
sshbuf_free(v4);
v3 = get_status(a0, v2);
if (v3) {
v5 = fx2txt(v3);
v4 = "remote fsync: %s";
sshlog("sftp-client.c", "do_fsync", 0x549, 0x0, 0x2, 0x0, *(&v6));
}
v9 = (!v3 ? 4294967295 : 0);
return;
}
|
static int
compare_files (struct comparison const *parent,
char const *name0,
char const *name1)
{
struct comparison cmp;
register int f;
int status =
0
;
_Bool
same_files;
char *free0;
char *free1;
if (! ((name0 && name1)
|| (unidirectional_new_file && name1)
|| new_file))
{
char const *name = name0 ? name0 : name1;
char const *dir = parent->file[!name0].name;
message ("Only in %s: %s\n", dir, name);
return
1
;
}
memset (cmp.file, 0, sizeof cmp.file);
cmp.parent = parent;
cmp.file[0].desc = name0 ? (-2) : (-1);
cmp.file[1].desc = name1 ? (-2) : (-1);
if (!name0)
name0 = name1;
if (!name1)
name1 = name0;
if (!parent)
{
free0 =
((void *)0)
;
free1 =
((void *)0)
;
cmp.file[0].name = name0;
cmp.file[1].name = name1;
}
else
{
cmp.file[0].name = free0
= file_name_concat (parent->file[0].name, name0,
((void *)0)
);
cmp.file[1].name = free1
= file_name_concat (parent->file[1].name, name1,
((void *)0)
);
}
for (f = 0; f < 2; f++)
{
if (cmp.file[f].desc != (-1))
{
if (f && strcmp (cmp.file[f].name, cmp.file[0].name) == 0)
{
cmp.file[f].desc = cmp.file[0].desc;
cmp.file[f].stat = cmp.file[0].stat;
}
else if ((strcmp (cmp.file[f].name, "-") == 0))
{
cmp.file[f].desc =
0
;
if (binary && ! isatty (
0
))
set_binary_mode (
0
,
0
);
if (fstat (
0
, &cmp.file[f].stat) != 0)
cmp.file[f].desc = (-3 - (
(*__errno_location ())
));
else
{
if (
((((
cmp.file[f].stat.st_mode
)) & 0170000) == (0100000))
)
{
off_t pos = lseek (
0
, 0,
1
);
if (pos < 0)
cmp.file[f].desc = (-3 - (
(*__errno_location ())
));
else
cmp.file[f].stat.st_size =
((0) >= (cmp.file[f].stat.st_size - pos) ? (0) : (cmp.file[f].stat.st_size - pos));
}
set_mtime_to_now (&cmp.file[f].stat);
}
}
else if ((no_dereference_symlinks
? lstat (cmp.file[f].name, &cmp.file[f].stat)
: stat (cmp.file[f].name, &cmp.file[f].stat))
!= 0)
cmp.file[f].desc = (-3 - (
(*__errno_location ())
));
}
}
for (f = 0; f < 2; f++)
if ((new_file || (f == 0 && unidirectional_new_file))
&& (cmp.file[f].desc == (-2)
? (
((((
cmp.file[f].stat.st_mode
)) & 0170000) == (0100000))
&& ! (cmp.file[f].stat.st_mode & (
(0400|0200|0100)
|
((0400|0200|0100) >> 3)
|
(((0400|0200|0100) >> 3) >> 3)
))
&& cmp.file[f].stat.st_size == 0)
: ((cmp.file[f].desc == (-3 - (
2
))
|| cmp.file[f].desc == (-3 - (
9
)))
&& ! parent
&& (cmp.file[1 - f].desc == (-2)
|| cmp.file[1 - f].desc ==
0
))))
cmp.file[f].desc = (-1);
for (f = 0; f < 2; f++)
if (cmp.file[f].desc == (-1))
{
memset (&cmp.file[f].stat, 0, sizeof cmp.file[f].stat);
cmp.file[f].stat.st_mode = cmp.file[1 - f].stat.st_mode;
}
for (f = 0; f < 2; f++)
{
int e = (-3 - (cmp.file[f].desc));
if (0 <= e)
{
(*__errno_location ())
= e;
perror_with_name (cmp.file[f].name);
status = 2;
}
}
if (status ==
0
&& ! parent && (
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0040000))
!= 0) != (
((((
cmp.file[1].stat.st_mode
)) & 0170000) == (0040000))
!= 0))
{
int fnm_arg = (
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0040000))
!= 0);
int dir_arg = 1 - fnm_arg;
char const *fnm = cmp.file[fnm_arg].name;
char const *dir = cmp.file[dir_arg].name;
char const *filename = cmp.file[dir_arg].name = free0
= find_dir_file_pathname (dir, last_component (fnm));
if ((strcmp (fnm, "-") == 0))
fatal ("cannot compare '-' to a directory");
if ((no_dereference_symlinks
? lstat (filename, &cmp.file[dir_arg].stat)
: stat (filename, &cmp.file[dir_arg].stat))
!= 0)
{
perror_with_name (filename);
status = 2;
}
}
if (status !=
0
)
{
}
else if (cmp.file[0].desc == (-1)
&& cmp.file[1].desc == (-1))
{
}
else if ((same_files
= (cmp.file[0].desc != (-1)
&& cmp.file[1].desc != (-1)
&& 0 < ((((&cmp.file[0].stat)->st_ino == (&cmp.file[1].stat)->st_ino) && ((&cmp.file[0].stat)->st_dev == (&cmp.file[1].stat)->st_dev)) || (((
((((
(&cmp.file[0].stat)->st_mode
)) & 0170000) == (0060000))
&&
((((
(&cmp.file[1].stat)->st_mode
)) & 0170000) == (0060000))
) || (
((((
(&cmp.file[0].stat)->st_mode
)) & 0170000) == (0020000))
&&
((((
(&cmp.file[1].stat)->st_mode
)) & 0170000) == (0020000))
)) && (&cmp.file[0].stat)->st_rdev == (&cmp.file[1].stat)->st_rdev))
&& ((&cmp.file[0].stat)->st_mode == (&cmp.file[1].stat)->st_mode && (&cmp.file[0].stat)->st_nlink == (&cmp.file[1].stat)->st_nlink && (&cmp.file[0].stat)->st_uid == (&cmp.file[1].stat)->st_uid && (&cmp.file[0].stat)->st_gid == (&cmp.file[1].stat)->st_gid && (&cmp.file[0].stat)->st_size == (&cmp.file[1].stat)->st_size && (&cmp.file[0].stat)->
st_mtim.tv_sec
== (&cmp.file[1].stat)->
st_mtim.tv_sec
&& (&cmp.file[0].stat)->
st_ctim.tv_sec
== (&cmp.file[1].stat)->
st_ctim.tv_sec
)
))
&& no_diff_means_no_output)
{
}
else if ((
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0040000))
!= 0) & (
((((
cmp.file[1].stat.st_mode
)) & 0170000) == (0040000))
!= 0))
{
if (output_style == OUTPUT_IFDEF)
fatal ("-D option not supported with directories");
if (parent && !recursive)
{
message ("Common subdirectories: %s and %s\n",
cmp.file[0].name, cmp.file[1].name);
}
else
status = diff_dirs (&cmp, compare_files);
}
else if (((
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0040000))
!= 0) | (
((((
cmp.file[1].stat.st_mode
)) & 0170000) == (0040000))
!= 0))
|| (parent
&& !((
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0100000))
||
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0120000))
)
&& (
((((
cmp.file[1].stat.st_mode
)) & 0170000) == (0100000))
||
((((
cmp.file[1].stat.st_mode
)) & 0170000) == (0120000))
))))
{
if (cmp.file[0].desc == (-1) || cmp.file[1].desc == (-1))
{
if (((
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0040000))
!= 0) | (
((((
cmp.file[1].stat.st_mode
)) & 0170000) == (0040000))
!= 0))
&& recursive
&& (new_file
|| (unidirectional_new_file
&& cmp.file[0].desc == (-1))))
status = diff_dirs (&cmp, compare_files);
else
{
char const *dir;
((void) sizeof ((
parent
) ? 1 : 0), __extension__ ({ if (
parent
) ; else __assert_fail (
"parent"
, "diff.c", 1325, __extension__ __PRETTY_FUNCTION__); }))
;
dir = parent->file[cmp.file[0].desc == (-1)].name;
message ("Only in %s: %s\n", dir, name0);
status =
1
;
}
}
else
{
message5 ("File %s is a %s while file %s is a %s\n",
file_label[0] ? file_label[0] : cmp.file[0].name,
file_type (&cmp.file[0].stat),
file_label[1] ? file_label[1] : cmp.file[1].name,
file_type (&cmp.file[1].stat));
status =
1
;
}
}
else if (
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0120000))
||
((((
cmp.file[1].stat.st_mode
)) & 0170000) == (0120000))
)
{
((void) sizeof ((
no_dereference_symlinks
) ? 1 : 0), __extension__ ({ if (
no_dereference_symlinks
) ; else __assert_fail (
"no_dereference_symlinks"
, "diff.c", 1353, __extension__ __PRETTY_FUNCTION__); }))
;
if (
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0120000))
&&
((((
cmp.file[1].stat.st_mode
)) & 0170000) == (0120000))
)
{
char *link_value[2] = {
((void *)0)
,
((void *)0)
};
for (f = 0; f < 2; f++)
{
link_value[f] = xreadlink (cmp.file[f].name);
if (link_value[f] ==
((void *)0)
)
{
perror_with_name (cmp.file[f].name);
status = 2;
break;
}
}
if (status ==
0
)
{
if ( ! (strcmp (link_value[0], link_value[1]) == 0))
{
message ("Symbolic links %s and %s differ\n",
cmp.file[0].name, cmp.file[1].name);
status =
1
;
}
}
for (f = 0; f < 2; f++)
free (link_value[f]);
}
else
{
message5 ("File %s is a %s while file %s is a %s\n",
file_label[0] ? file_label[0] : cmp.file[0].name,
file_type (&cmp.file[0].stat),
file_label[1] ? file_label[1] : cmp.file[1].name,
file_type (&cmp.file[1].stat));
status =
1
;
}
}
else if (files_can_be_treated_as_binary
&&
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0100000))
&&
((((
cmp.file[1].stat.st_mode
)) & 0170000) == (0100000))
&& 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)
{
message ("Files %s and %s differ\n",
file_label[0] ? file_label[0] : cmp.file[0].name,
file_label[1] ? file_label[1] : cmp.file[1].name);
status =
1
;
}
else
{
int oflags =
00
| (binary ?
0
: 0);
if (cmp.file[0].desc == (-2))
if ((cmp.file[0].desc = open (cmp.file[0].name, oflags, 0)) < 0)
{
perror_with_name (cmp.file[0].name);
status = 2;
}
if (cmp.file[1].desc == (-2))
{
if (same_files)
cmp.file[1].desc = cmp.file[0].desc;
else if ((cmp.file[1].desc = open (cmp.file[1].name, oflags, 0)) < 0)
{
perror_with_name (cmp.file[1].name);
status = 2;
}
}
if (status ==
0
)
status = diff_2_files (&cmp);
if (0 <= cmp.file[0].desc && close (cmp.file[0].desc) != 0)
{
perror_with_name (cmp.file[0].name);
status = 2;
}
if (0 <= cmp.file[1].desc && cmp.file[0].desc != cmp.file[1].desc
&& close (cmp.file[1].desc) != 0)
{
perror_with_name (cmp.file[1].name);
status = 2;
}
}
if (status ==
0
)
{
if (report_identical_files && !(
((((
cmp.file[0].stat.st_mode
)) & 0170000) == (0040000))
!= 0))
message ("Files %s and %s are identical\n",
file_label[0] ? file_label[0] : cmp.file[0].name,
file_label[1] ? file_label[1] : cmp.file[1].name);
}
else
{
if (fflush_unlocked (
stdout
) != 0)
pfatal_with_name (gettext ("standard output"));
}
free (free0);
free (free1);
return status;
}
| int compare_files(long param_1,char *param_2,char *param_3)
{
bool bVar1;
uint uVar2;
int iVar3;
int iVar4;
long lVar5;
__off_t _Var6;
int *piVar7;
undefined8 uVar8;
undefined8 uVar9;
char *pcVar10;
char *pcVar11;
long lVar12;
long lVar13;
long in_FS_OFFSET;
char *local_310;
char *local_308;
int local_2f4;
char *local_2e0;
char *local_2d8;
char *local_298 [2];
int local_288 [2];
char *local_280;
undefined local_278 [24];
undefined8 local_260;
int local_258;
undefined4 uStack596;
long local_250 [31];
int local_158;
char *local_150;
long local_148;
long local_140;
long local_138;
uint local_130;
int local_12c;
int local_128;
long local_120;
long local_118;
long local_f0;
long local_e0;
long local_28;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_2f4 = 0;
if ((((param_2 == (char *)0x0) || (param_3 == (char *)0x0)) &&
((unidirectional_new_file != '\x01' || (param_3 == (char *)0x0)))) && (new_file != '\x01')) {
if (param_2 != (char *)0x0) {
param_3 = param_2;
}
message("Only in %s: %s\n",
*(undefined8 *)((long)(int)(uint)(param_2 == (char *)0x0) * 0x130 + param_1 + 8),param_3
);
local_2f4 = 1;
goto LAB_00102ea8;
}
memset(local_288,0,0x260);
local_28 = param_1;
if (param_2 == (char *)0x0) {
local_288[0] = -1;
}
else {
local_288[0] = -2;
}
if (param_3 == (char *)0x0) {
local_158 = -1;
}
else {
local_158 = -2;
}
local_308 = param_2;
if (param_2 == (char *)0x0) {
local_308 = param_3;
}
local_310 = param_3;
if (param_3 == (char *)0x0) {
local_310 = local_308;
}
if (param_1 == 0) {
local_2e0 = (char *)0x0;
local_2d8 = (char *)0x0;
local_280 = local_308;
local_150 = local_310;
}
else {
local_2e0 = (char *)file_name_concat(*(undefined8 *)(param_1 + 8),local_308,0);
local_280 = local_2e0;
local_2d8 = (char *)file_name_concat(*(undefined8 *)(param_1 + 0x138),local_310,0);
local_150 = local_2d8;
}
for (iVar3 = 0; iVar3 < 2; iVar3 = iVar3 + 1) {
if (local_288[(long)iVar3 * 0x4c] != -1) {
if ((iVar3 == 0) || (iVar4 = strcmp((&local_280)[(long)iVar3 * 0x26],local_280), iVar4 != 0))
{
iVar4 = strcmp((&local_280)[(long)iVar3 * 0x26],"-");
if (iVar4 == 0) {
local_288[(long)iVar3 * 0x4c] = 0;
iVar4 = isatty(0);
if (iVar4 == 0) {
set_binary_mode(0,0);
}
iVar4 = fstat(0,(stat *)(local_278 + (long)iVar3 * 0x130));
if (iVar4 == 0) {
if ((*(uint *)(&local_260 + (long)iVar3 * 0x26) & 0xf000) == 0x8000) {
_Var6 = lseek(0,0,1);
if (_Var6 < 0) {
piVar7 = __errno_location();
local_288[(long)iVar3 * 0x4c] = -3 - *piVar7;
}
else {
lVar12 = 0;
if (-1 < local_250[(long)iVar3 * 0x26 + 1] - _Var6) {
lVar12 = local_250[(long)iVar3 * 0x26 + 1] - _Var6;
}
local_250[(long)iVar3 * 0x26 + 1] = lVar12;
}
}
set_mtime_to_now();
}
else {
piVar7 = __errno_location();
local_288[(long)iVar3 * 0x4c] = -3 - *piVar7;
}
}
else {
if (no_dereference_symlinks == '\0') {
iVar4 = stat((&local_280)[(long)iVar3 * 0x26],(stat *)(local_278 + (long)iVar3 * 0x130))
;
}
else {
iVar4 = lstat((&local_280)[(long)iVar3 * 0x26],(stat *)(local_278 + (long)iVar3 * 0x130)
);
}
if (iVar4 != 0) {
piVar7 = __errno_location();
local_288[(long)iVar3 * 0x4c] = -3 - *piVar7;
}
}
}
else {
local_288[(long)iVar3 * 0x4c] = local_288[0];
lVar12 = local_278._8_8_;
lVar13 = (long)iVar3;
lVar5 = lVar13 * 0x130;
*(long *)(local_278 + lVar5) = local_278._0_8_;
*(long *)(local_278 + lVar5 + 8) = lVar12;
uVar8 = CONCAT44(local_260._4_4_,(uint)local_260);
*(long *)(local_278 + lVar5 + 0x10) = local_278._16_8_;
(&local_260)[lVar13 * 0x26] = uVar8;
lVar12 = local_250[0];
*(ulong *)(&local_258 + lVar13 * 0x4c) = CONCAT44(uStack596,local_258);
local_250[lVar13 * 0x26] = lVar12;
lVar12 = local_250[2];
local_250[lVar13 * 0x26 + 1] = local_250[1];
local_250[lVar13 * 0x26 + 2] = lVar12;
lVar12 = local_250[4];
local_250[lVar13 * 0x26 + 3] = local_250[3];
local_250[lVar13 * 0x26 + 4] = lVar12;
lVar12 = local_250[6];
local_250[lVar13 * 0x26 + 5] = local_250[5];
local_250[lVar13 * 0x26 + 6] = lVar12;
lVar12 = local_250[8];
local_250[lVar13 * 0x26 + 7] = local_250[7];
local_250[lVar13 * 0x26 + 8] = lVar12;
lVar12 = local_250[10];
local_250[lVar13 * 0x26 + 9] = local_250[9];
local_250[lVar13 * 0x26 + 10] = lVar12;
lVar12 = local_250[12];
local_250[lVar13 * 0x26 + 0xb] = local_250[11];
local_250[lVar13 * 0x26 + 0xc] = lVar12;
}
}
}
for (iVar3 = 0; iVar3 < 2; iVar3 = iVar3 + 1) {
if ((new_file != '\0') || ((iVar3 == 0 && (unidirectional_new_file != '\0')))) {
if (local_288[(long)iVar3 * 0x4c] == -2) {
if ((((*(uint *)(&local_260 + (long)iVar3 * 0x26) & 0xf000) == 0x8000) &&
((*(uint *)(&local_260 + (long)iVar3 * 0x26) & 0x1ff) == 0)) &&
(local_250[(long)iVar3 * 0x26 + 1] == 0)) {
bVar1 = true;
}
else {
bVar1 = false;
}
}
else if ((((local_288[(long)iVar3 * 0x4c] == -5) || (local_288[(long)iVar3 * 0x4c] == -0xc))
&& (param_1 == 0)) &&
((local_288[(long)(1 - iVar3) * 0x4c] == -2 ||
(local_288[(long)(1 - iVar3) * 0x4c] == 0)))) {
bVar1 = true;
}
else {
bVar1 = false;
}
if (bVar1) {
local_288[(long)iVar3 * 0x4c] = -1;
}
}
}
for (iVar3 = 0; iVar3 < 2; iVar3 = iVar3 + 1) {
if (local_288[(long)iVar3 * 0x4c] == -1) {
memset(local_278 + (long)iVar3 * 0x130,0,0x90);
*(undefined4 *)(&local_260 + (long)iVar3 * 0x26) =
*(undefined4 *)(&local_260 + (long)(1 - iVar3) * 0x26);
}
}
for (iVar3 = 0; iVar3 < 2; iVar3 = iVar3 + 1) {
iVar4 = local_288[(long)iVar3 * 0x4c];
if (-1 < -3 - iVar4) {
piVar7 = __errno_location();
*piVar7 = -3 - iVar4;
perror_with_name();
local_2f4 = 2;
}
}
if (((local_2f4 == 0) && (param_1 == 0)) &&
(((local_130 & 0xf000) == 0x4000) != (((uint)local_260 & 0xf000) == 0x4000))) {
uVar2 = (uint)(((uint)local_260 & 0xf000) == 0x4000);
iVar3 = 1 - uVar2;
pcVar10 = (&local_280)[(long)(int)uVar2 * 0x26];
pcVar11 = (&local_280)[(long)iVar3 * 0x26];
uVar8 = last_component(pcVar10);
local_2e0 = (char *)find_dir_file_pathname(pcVar11,uVar8);
(&local_280)[(long)iVar3 * 0x26] = local_2e0;
pcVar11 = (&local_280)[(long)iVar3 * 0x26];
iVar4 = strcmp(pcVar10,"-");
if (iVar4 == 0) {
fatal("cannot compare \'-\' to a directory");
}
if (no_dereference_symlinks == '\0') {
iVar3 = stat(pcVar11,(stat *)(local_278 + (long)iVar3 * 0x130));
}
else {
iVar3 = lstat(pcVar11,(stat *)(local_278 + (long)iVar3 * 0x130));
}
if (iVar3 != 0) {
perror_with_name();
local_2f4 = 2;
}
}
if ((local_2f4 == 0) && ((local_288[0] != -1 || (local_158 != -1)))) {
if ((local_288[0] == -1) || (local_158 == -1)) {
LAB_00102693:
bVar1 = false;
}
else {
if (((local_278._8_8_ == local_140) && (local_278._0_8_ == local_148)) ||
((((((uint)local_260 & 0xf000) == 0x6000 && ((local_130 & 0xf000) == 0x6000)) ||
((((uint)local_260 & 0xf000) == 0x2000 && ((local_130 & 0xf000) == 0x2000)))) &&
(local_250[0] == local_120)))) {
bVar1 = true;
}
else {
bVar1 = false;
}
if ((((!bVar1) || ((uint)local_260 != local_130)) || (local_278._16_8_ != local_138)) ||
(((local_260._4_4_ != local_12c || (local_258 != local_128)) ||
((local_250[1] != local_118 || ((local_250[6] != local_f0 || (local_250[8] != local_e0))))
)))) goto LAB_00102693;
bVar1 = true;
}
if ((!bVar1) || (no_diff_means_no_output == '\0')) {
if ((local_130 & 0xf000) == 0x4000 && ((uint)local_260 & 0xf000) == 0x4000) {
if (output_style == 7) {
fatal("-D option not supported with directories");
}
if ((param_1 == 0) || (recursive == '\x01')) {
local_2f4 = diff_dirs(local_288,compare_files);
}
else {
message("Common subdirectories: %s and %s\n",local_280,local_150);
}
}
else if (((local_130 & 0xf000) == 0x4000 || ((uint)local_260 & 0xf000) == 0x4000) ||
((param_1 != 0 &&
(((((uint)local_260 & 0xf000) != 0x8000 && (((uint)local_260 & 0xf000) != 0xa000)) ||
(((local_130 & 0xf000) != 0x8000 && ((local_130 & 0xf000) != 0xa000)))))))) {
if ((local_288[0] == -1) || (local_158 == -1)) {
if (((local_130 & 0xf000) == 0x4000 || ((uint)local_260 & 0xf000) == 0x4000) &&
((recursive != '\0' &&
((new_file != '\0' || ((unidirectional_new_file != '\0' && (local_288[0] == -1))))))))
{
local_2f4 = diff_dirs(local_288,compare_files);
}
else {
if (param_1 == 0) {
__assert_fail("parent","diff.c",0x52d,"compare_files");
}
message("Only in %s: %s\n",
*(undefined8 *)((long)(int)(uint)(local_288[0] == -1) * 0x130 + param_1 + 8),
local_308);
local_2f4 = 1;
}
}
else {
uVar8 = file_type(&local_148);
pcVar10 = local_150;
if (file_label._8_8_ != (char *)0x0) {
pcVar10 = file_label._8_8_;
}
uVar9 = file_type(local_278);
pcVar11 = local_280;
if (file_label._0_8_ != (char *)0x0) {
pcVar11 = file_label._0_8_;
}
message5("File %s is a %s while file %s is a %s\n",pcVar11,uVar9,pcVar10,uVar8);
local_2f4 = 1;
}
}
else if ((((uint)local_260 & 0xf000) == 0xa000) || ((local_130 & 0xf000) == 0xa000)) {
if (no_dereference_symlinks == '\0') {
__assert_fail("no_dereference_symlinks","diff.c",0x549,"compare_files");
}
if ((((uint)local_260 & 0xf000) == 0xa000) && ((local_130 & 0xf000) == 0xa000)) {
local_298[0] = (char *)0x0;
local_298[1] = (char *)0x0;
for (iVar3 = 0; iVar3 < 2; iVar3 = iVar3 + 1) {
pcVar10 = (char *)xreadlink((&local_280)[(long)iVar3 * 0x26]);
local_298[iVar3] = pcVar10;
if (local_298[iVar3] == (char *)0x0) {
perror_with_name((&local_280)[(long)iVar3 * 0x26]);
local_2f4 = 2;
break;
}
}
if ((local_2f4 == 0) && (iVar3 = strcmp(local_298[0],local_298[1]), iVar3 != 0)) {
message("Symbolic links %s and %s differ\n",local_280,local_150);
local_2f4 = 1;
}
for (iVar3 = 0; iVar3 < 2; iVar3 = iVar3 + 1) {
free(local_298[iVar3]);
}
}
else {
uVar8 = file_type(&local_148);
pcVar10 = local_150;
if (file_label._8_8_ != (char *)0x0) {
pcVar10 = file_label._8_8_;
}
uVar9 = file_type(local_278);
pcVar11 = local_280;
if (file_label._0_8_ != (char *)0x0) {
pcVar11 = file_label._0_8_;
}
message5("File %s is a %s while file %s is a %s\n",pcVar11,uVar9,pcVar10,uVar8);
local_2f4 = 1;
}
}
else if (((((files_can_be_treated_as_binary == '\0') || (((uint)local_260 & 0xf000) != 0x8000)
) || ((local_130 & 0xf000) != 0x8000)) ||
((local_250[1] == local_118 || (local_250[1] < 1)))) || (local_118 < 1)) {
if ((local_288[0] == -2) && (local_288[0] = open(local_280,0,0), local_288[0] < 0)) {
perror_with_name();
local_2f4 = 2;
}
if (local_158 == -2) {
if (bVar1) {
local_158 = local_288[0];
}
else {
local_158 = open(local_150,0,0);
if (local_158 < 0) {
perror_with_name();
local_2f4 = 2;
}
}
}
if (local_2f4 == 0) {
local_2f4 = diff_2_files();
}
if ((-1 < local_288[0]) && (iVar3 = close(local_288[0]), iVar3 != 0)) {
perror_with_name();
local_2f4 = 2;
}
if (((-1 < local_158) && (local_288[0] != local_158)) &&
(iVar3 = close(local_158), iVar3 != 0)) {
perror_with_name(local_150);
local_2f4 = 2;
}
}
else {
pcVar10 = local_150;
if (file_label._8_8_ != (char *)0x0) {
pcVar10 = file_label._8_8_;
}
pcVar11 = local_280;
if (file_label._0_8_ != (char *)0x0) {
pcVar11 = file_label._0_8_;
}
message("Files %s and %s differ\n",pcVar11,pcVar10);
local_2f4 = 1;
}
}
}
if (local_2f4 == 0) {
if ((report_identical_files != '\0') && (((uint)local_260 & 0xf000) != 0x4000)) {
pcVar10 = local_150;
if (file_label._8_8_ != (char *)0x0) {
pcVar10 = file_label._8_8_;
}
pcVar11 = local_280;
if (file_label._0_8_ != (char *)0x0) {
pcVar11 = file_label._0_8_;
}
message("Files %s and %s are identical\n",pcVar11,pcVar10);
}
}
else {
iVar3 = fflush_unlocked(stdout);
if (iVar3 != 0) {
uVar8 = gettext("standard output");
pfatal_with_name(uVar8);
}
}
free(local_2e0);
free(local_2d8);
LAB_00102ea8:
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_2f4;
}
__stack_chk_fail();
}
|
static int
it_init_arrayvars (itp)
ITEMLIST *itp;
{
init_itemlist_from_varlist (itp, all_array_variables);
return 1;
}
| long long it_init_arrayvars(unsigned long long a0) {
init_itemlist_from_varlist(a0, got.all_array_variables);
return 1;
}
|
static void
freewords (char **words, int start)
{
register int i;
for (i = start; words[i]; i++)
xfree (words[i]);
}
| long freewords(long a1, int a2)
{
long result;
while ( 1 )
{
result = *(_QWORD *)(8LL * a2 + a1);
if ( !result )
break;
xfree(*(_QWORD *)(8LL * a2++ + a1));
}
return result;
}
|
static void list_cmd(void) {
char n[
4096
];
FILE *f;
int ch;
const int colorize = isatty(1) && getenv("NO_COLOR") ==
((void *)0)
;
int new_line = 1;
int in_comment = 0;
log_it(RealUser, Pid, "LIST", User, 0);
if (!glue_strings(n, sizeof n, "/usr/local/var/spool/cron", User, '/')) {
fprintf(
stderr
, "path too long\n");
exit(1);
}
if (!(f = fopen(n, "r"))) {
if (
(*__errno_location ())
==
2
)
fprintf(
stderr
, "no crontab for %s\n", User);
else
perror(n);
exit(1);
}
{if ((DebugFlags & (0x0008|0x0001)) != 0) printf ("linenum=%d\n",1); LineNumber = 1; };
while (
(-1)
!= (ch = get_char(f))) {
if (colorize) {
if (!in_comment && new_line && ch == '#') {
in_comment = 1;
fputs("\x1B[34;1m",
stdout
);
}
if (in_comment && ch == '\n') {
in_comment = 0;
fputs("\x1B[0m",
stdout
);
}
}
putchar(ch);
new_line = ch == '\n';
}
if (colorize && !new_line) {
putchar('\n');
fputs("\x1B[31;1m" "No end-of-line character at the end of file"
"\x1B[0m",
stdout
);
putchar('\n');
}
fclose(f);
}
| void list_cmd() {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
void* v4;
char v5;
char v6;
char v7;
unsigned int v9;
unsigned long long v10;
unsigned long long *v11;
unsigned long long v12;
v6 = *(&v6);
v9 = isatty(0x1);
if (v9) {
v9 = getenv("NO_COLOR");
if (!v9)
v9 = 1;
}
if (!v9 || v9)
v9 = 0;
v2 = v9;
v0 = 1;
v1 = 0;
log_it(&RealUser, Pid, "LIST", &User, 0x0);
v10 = glue_strings(&v5, 0x1000, "/usr/local/var/spool/cron", &User, 0x2f);
if (!v10) {
fprintf(*(&stderr), "path too long\n");
exit(0x1);
}
v4 = fopen(&v5, "r");
if (!v4) {
*(&v10) = *(__errno_location());
if (v10 == 2)
fprintf(*(&stderr), "no crontab for %s\n", &User);
else
perror(&v5);
exit(0x1);
} else {
if ((DebugFlags & 9))
printf("linenum=%d\n", 1);
ChangePath = 1;
while (true) {
v3 = get_char(v4);
if (v3 == -1)
break;
if (v2) {
if (!v1 && v0 && v3 == 35) {
v1 = 1;
fputs(&g_40640e, stdout);
}
if (v1 && v3 == 10) {
v1 = 0;
fputs(&g_406416, stdout);
}
}
putchar(v3);
v0 = v3 == 10;
}
if (v2 && !v0) {
putchar(0xa);
fputs(&g_406420, stdout);
putchar(0xa);
}
fclose(v4);
v12 = *(&v7) ^ v11[5];
return;
}
}
|
static int iplink_filter_req(struct nlmsghdr *nlh, int reqlen)
{
int err;
err = addattr32(nlh, reqlen, IFLA_EXT_MASK, (1 << 0));
if (err)
return err;
if (filter.master) {
err = addattr32(nlh, reqlen, IFLA_MASTER, filter.master);
if (err)
return err;
}
if (filter.kind) {
struct rtattr *linkinfo;
linkinfo = addattr_nest(nlh, reqlen, IFLA_LINKINFO);
err = addattr_l(nlh, reqlen, IFLA_INFO_KIND, filter.kind,
strlen(filter.kind));
if (err)
return err;
addattr_nest_end(nlh, linkinfo);
}
return 0;
}
| long long iplink_filter_req(unsigned long long a0, unsigned long a1) {
unsigned int v0;
unsigned long long v1;
void* v3;
v0 = addattr32(a0, a1, 0x1d, 0x1);
if (v0) {
v3 = v0;
} else {
if (g_408654) {
v0 = addattr32(a0, a1, 0xa, g_408654);
if (v0)
v3 = v0;
}
if (!g_408654 || !v0) {
if (g_408658) {
v1 = addattr_nest(a0, a1, 0x12, a1);
v0 = addattr_l(a0, a1, 0x1, g_408658, strlen(g_408658));
if (v0)
v3 = v0;
else
addattr_nest_end(a0, v1, v1);
}
if (!v0 || !g_408658)
v3 = 0;
}
}
return v3;
}
|
static int
should_drop_connection(int startups)
{
int p, r;
if (startups < options.max_startups_begin)
return 0;
if (startups >= options.max_startups)
return 1;
if (options.max_startups_rate == 100)
return 1;
p = 100 - options.max_startups_rate;
p *= startups - options.max_startups_begin;
p /= options.max_startups - options.max_startups_begin;
p += options.max_startups_rate;
r = arc4random_uniform(100);
sshlog("sshd.c", __func__, 836, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "p %d, r %d", p, r);
return (r < p) ? 1 : 0;
}
| bool should_drop_connection(int param_1)
{
bool bVar1;
undefined4 uVar2;
undefined4 uVar3;
int iVar4;
int iVar5;
undefined8 uVar6;
if (param_1 < options._7632_4_) {
bVar1 = false;
}
else if (param_1 < options._7640_4_) {
if (options._7636_4_ == 100) {
bVar1 = true;
}
else {
uVar2 = __subvsi3(100,options._7636_4_);
uVar3 = __subvsi3(param_1,options._7632_4_);
iVar4 = __mulvsi3(uVar2,uVar3);
iVar5 = __subvsi3(options._7640_4_,options._7632_4_);
iVar4 = __addvsi3(iVar4 / iVar5,options._7636_4_,(long)iVar4 % (long)iVar5 & 0xffffffff);
uVar6 = 0x1017cb;
iVar5 = arc4random_uniform(100);
sshlog("sshd.c","should_drop_connection",0x344,1,5,0,"p %d, r %d",iVar4,iVar5,uVar6);
bVar1 = iVar5 < iVar4;
}
}
else {
bVar1 = true;
}
return bVar1;
}
|
static int
kex_ecdh_dec_key_group(struct kex *kex, const struct sshbuf *ec_blob,
EC_KEY *key, const EC_GROUP *group, struct sshbuf **shared_secretp)
{
struct sshbuf *buf =
((void *)0)
;
BIGNUM *shared_secret =
((void *)0)
;
EC_POINT *dh_pub =
((void *)0)
;
u_char *kbuf =
((void *)0)
;
size_t klen = 0;
int r;
*shared_secretp =
((void *)0)
;
if ((buf = sshbuf_new()) ==
((void *)0)
) {
r = -2;
goto out;
}
if ((r = sshbuf_put_stringb(buf, ec_blob)) != 0)
goto out;
if ((dh_pub = EC_POINT_new(group)) ==
((void *)0)
) {
r = -2;
goto out;
}
if ((r = sshbuf_get_ec(buf, dh_pub, group)) != 0) {
goto out;
}
sshbuf_reset(buf);
if (sshkey_ec_validate_public(group, dh_pub) != 0) {
r = -3;
goto out;
}
klen = (EC_GROUP_get_degree(group) + 7) / 8;
if ((kbuf = malloc(klen)) ==
((void *)0)
||
(shared_secret = BN_new()) ==
((void *)0)
) {
r = -2;
goto out;
}
if (ECDH_compute_key(kbuf, klen, dh_pub, key,
((void *)0)
) != (int)klen ||
BN_bin2bn(kbuf, klen, shared_secret) ==
((void *)0)
) {
r = -22;
goto out;
}
if ((r = sshbuf_put_bignum2(buf, shared_secret)) != 0)
goto out;
*shared_secretp = buf;
buf =
((void *)0)
;
out:
EC_POINT_clear_free(dh_pub);
BN_clear_free(shared_secret);
freezero(kbuf, klen);
sshbuf_free(buf);
return r;
}
| int kex_ecdh_dec_key_group
(undefined8 param_1,undefined8 param_2,EC_KEY *param_3,EC_GROUP *param_4,long *param_5
)
{
int iVar1;
int iVar2;
BIGNUM *pBVar3;
int local_34;
long local_30;
BIGNUM *local_28;
EC_POINT *local_20;
uchar *local_18;
size_t local_10;
local_28 = (BIGNUM *)0x0;
local_20 = (EC_POINT *)0x0;
local_18 = (uchar *)0x0;
local_10 = 0;
*param_5 = 0;
local_30 = sshbuf_new();
if (local_30 == 0) {
local_34 = -2;
}
else {
local_34 = sshbuf_put_stringb(local_30,param_2);
if (local_34 == 0) {
local_20 = EC_POINT_new(param_4);
if (local_20 == (EC_POINT *)0x0) {
local_34 = -2;
}
else {
local_34 = sshbuf_get_ec(local_30,local_20,param_4);
if (local_34 == 0) {
sshbuf_reset(local_30);
iVar1 = sshkey_ec_validate_public(param_4,local_20);
if (iVar1 == 0) {
iVar1 = EC_GROUP_get_degree(param_4);
iVar1 = __addvsi3(iVar1,7);
if (iVar1 < 0) {
iVar1 = iVar1 + 7;
}
iVar1 = iVar1 >> 3;
local_10 = (size_t)iVar1;
local_18 = (uchar *)malloc(local_10);
if ((local_18 == (uchar *)0x0) || (local_28 = BN_new(), local_28 == (BIGNUM *)0x0)) {
local_34 = -2;
}
else {
iVar2 = ECDH_compute_key(local_18,local_10,local_20,param_3,(KDF *)0x0);
if ((iVar2 == iVar1) &&
(pBVar3 = BN_bin2bn(local_18,iVar1,local_28), pBVar3 != (BIGNUM *)0x0)) {
local_34 = sshbuf_put_bignum2(local_30,local_28);
if (local_34 == 0) {
*param_5 = local_30;
local_30 = 0;
}
}
else {
local_34 = -0x16;
}
}
}
else {
local_34 = -3;
}
}
}
}
}
EC_POINT_clear_free(local_20);
BN_clear_free(local_28);
freezero(local_18,local_10);
sshbuf_free(local_30);
return local_34;
}
|
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 (
| char * setlocale(int __category,char *__locale)
{
halt_baddata();
}
|
static char **
save_dollar_vars ()
{
char **ret;
int i;
ret = strvec_create (10);
for (i = 1; i < 10; i++)
{
ret[i] = dollar_vars[i];
dollar_vars[i] = (char *)
((void *)0)
;
}
return ret;
}
| long save_dollar_vars()
{
int i;
long v2;
v2 = strvec_create(10LL);
for ( i = 1; i <= 9; ++i )
{
*(_QWORD *)(v2 + 8LL * i) = dollar_vars[i];
dollar_vars[i] = 0LL;
}
return v2;
}
|
struct predicate *
insert_primary (const struct parser_table *entry, const char *arg)
{
((void) sizeof ((
entry->pred_func !=
((void *)0)) ? 1 : 0), __extension__ ({ if (
entry->pred_func !=
((void *)0)) ; else __assert_fail (
"entry->pred_func != NULL"
, "util.c", 123, __extension__ __PRETTY_FUNCTION__); }))
;
return insert_primary_withpred (entry, entry->pred_func, arg);
}
| long insert_primary(long a1, long a2)
{
if ( !*(_QWORD *)(a1 + 24) )
_assert_fail("entry->pred_func != NULL", "util.c", 0x7Bu, "insert_primary");
return insert_primary_withpred(a1, *(_QWORD *)(a1 + 24), a2);
}
|
static inline __s32 rta_getattr_s32(const struct rtattr *rta)
{
return *(__s32 *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| int rta_getattr_s32(struct_0 *a0) {
return a0->field_4;
}
|
void
set_dollar_vars_changed ()
{
if (variable_context)
changed_dollar_vars |= 0x02;
else if (this_shell_builtin == set_builtin)
changed_dollar_vars |= 0x04;
else
changed_dollar_vars |= 0x01;
}
| void set_dollar_vars_changed(void)
{
if (variable_context == 0) {
if (this_shell_builtin == lRam0000000000100d76) {
changed_dollar_vars = changed_dollar_vars | 4;
}
else {
changed_dollar_vars = changed_dollar_vars | 1;
}
}
else {
changed_dollar_vars = changed_dollar_vars | 2;
}
return;
}
|
static
int get_init_default(void)
{
CHILD *ch;
int lvl = -1;
char *p;
for(ch = family; ch; ch = ch->next)
if (ch->action == 12) {
p = ch->rlevel;
while(*p) {
if (*p > lvl) lvl = *p;
p++;
}
break;
}
if (lvl > 0) {
if (
((*__ctype_b_loc ())[(int) ((
lvl
))] & (unsigned short int) _ISlower)
) lvl = toupper(lvl);
if (strchr("0123456789S", lvl) ==
((void *)0)
) {
initlog((1|2),
"Initdefault level '%c' is invalid", lvl);
lvl = 0;
}
}
if (lvl <= 0) lvl = ask_runlevel();
Write_Runlevel_Log(lvl);
return lvl;
}
| int get_init_default(unsigned long a0, unsigned int a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned int a5) {
unsigned int v0;
struct_0 *v1;
char *v2;
unsigned int v5;
v0 = -1;
v1 = family;
while (true) {
if (!v1)
break;
if (v1->field_30 != 12) {
v1 = v1->field_c0;
} else {
for (v2 = &v1->padding_0[36]; *(v2); v2 += 1) {
if (v0 < *(v2))
v0 = *(v2);
}
}
}
if (v0 > 0) {
v5 = *((*(__ctype_b_loc()) + v0 * 2)) & 0x200;
if (v5)
v0 = toupper(v0);
a1 = v0;
if (!strchr("0123456789S", v0)) {
initlog(0x3, "Initdefault level '%c' is invalid", v0, a3, a4, a5);
v0 = 0;
}
}
if (v0 <= 0)
v0 = ask_runlevel(a0, a1, a2, a3, a4, a5);
Write_Runlevel_Log(v0);
return v0;
}
|
void
refresh_progress_meter(int force_update)
{
char buf[512 + 1];
off_t transferred;
double elapsed, now;
int percent;
off_t bytes_left;
int cur_speed;
int hours, minutes, seconds;
int file_len;
if ((!force_update && !alarm_fired && !win_resized) || !can_output())
return;
alarm_fired = 0;
if (win_resized) {
setscreensize();
win_resized = 0;
}
transferred = *counter - (cur_pos ? cur_pos : start_pos);
cur_pos = *counter;
now = monotime_double();
bytes_left = end_pos - cur_pos;
if (bytes_left > 0)
elapsed = now - last_update;
else {
elapsed = now - start;
transferred = end_pos - start_pos;
bytes_per_second = 0;
}
if (elapsed != 0)
cur_speed = (transferred / elapsed);
else
cur_speed = transferred;
if (bytes_per_second != 0) {
bytes_per_second = (bytes_per_second * 0.9) +
(cur_speed * (1.0 - 0.9));
} else
bytes_per_second = cur_speed;
buf[0] = '\0';
file_len = win_size - 36;
if (file_len > 0) {
buf[0] = '\r';
snmprintf(buf+1, sizeof(buf)-1, &file_len, "%-*s",
file_len, file);
}
if (end_pos == 0 || cur_pos == end_pos)
percent = 100;
else
percent = ((float)cur_pos / end_pos) * 100;
snprintf(buf + strlen(buf), win_size - strlen(buf),
" %3d%% ", percent);
format_size(buf + strlen(buf), win_size - strlen(buf),
cur_pos);
strlcat(buf, " ", win_size);
format_rate(buf + strlen(buf), win_size - strlen(buf),
(off_t)bytes_per_second);
strlcat(buf, "/s ", win_size);
if (!transferred)
stalled += elapsed;
else
stalled = 0;
if (stalled >= 5)
strlcat(buf, "- stalled -", win_size);
else if (bytes_per_second == 0 && bytes_left)
strlcat(buf, " --:-- ETA", win_size);
else {
if (bytes_left > 0)
seconds = bytes_left / bytes_per_second;
else
seconds = elapsed;
hours = seconds / 3600;
seconds -= hours * 3600;
minutes = seconds / 60;
seconds -= minutes * 60;
if (hours != 0)
snprintf(buf + strlen(buf), win_size - strlen(buf),
"%d:%02d:%02d", hours, minutes, seconds);
else
snprintf(buf + strlen(buf), win_size - strlen(buf),
" %02d:%02d", minutes, seconds);
if (bytes_left > 0)
strlcat(buf, " ETA", win_size);
else
strlcat(buf, " ", win_size);
}
atomicio((ssize_t (*)(int, void *, size_t))write,
1
, buf, win_size - 1);
last_update = now;
}
| unsigned long refresh_progress_meter(int a1)
{
long v1;
long v2;
__int128 v3;
size_t v4;
size_t v5;
int v6;
size_t v7;
int v8;
size_t v9;
size_t v10;
size_t v11;
int v13;
unsigned int v14;
int v15;
int v16;
unsigned int v17;
unsigned int v18;
long v19;
double v20;
double v21;
long v22;
char s;
_BYTE v24[7];
unsigned long v25;
v25 = __readfsqword(0x28u);
if ( (a1 || alarm_fired || win_resized) && can_output() )
{
alarm_fired = 0;
if ( win_resized )
{
setscreensize();
win_resized = 0;
}
v1 = *(_QWORD *)counter;
if ( cur_pos )
v2 = cur_pos;
else
v2 = start_pos;
v19 = v1 - v2;
cur_pos = *(_QWORD *)counter;
v21 = monotime_double(v3, *((_QWORD *)&v3 + 1), v1);
v22 = end_pos - cur_pos;
if ( end_pos - cur_pos <= 0 )
{
v20 = v21 - *(double *)&start;
v19 = end_pos - start_pos;
bytes_per_second = 0;
}
else
{
v20 = v21 - *(double *)&last_update;
}
if ( v20 == 0.0 )
v15 = v19;
else
v15 = (int)((double)(int)v19 / v20);
if ( bytes_per_second )
bytes_per_second = (int)(0.09999999999999998 * (double)v15 + (double)bytes_per_second * 0.9);
else
bytes_per_second = v15;
s = 0;
v13 = win_size - 36;
if ( win_size - 36 > 0 )
{
s = 13;
snmprintf(v24, 512LL, &v13, "%-*s", v13, (const char *)file);
}
if ( end_pos && cur_pos != end_pos )
v14 = (int)(float)(100.0 * (float)((float)(int)cur_pos / (float)(int)end_pos));
else
v14 = 100;
v4 = win_size - strlen(&s);
v5 = strlen(&s);
snprintf(&v24[v5 - 1], v4, " %3d%% ", v14);
v6 = win_size - strlen(&s);
v7 = strlen(&s);
format_size(&v24[v7 - 1], v6, cur_pos);
strlcat(&s, " ", win_size);
v8 = win_size - strlen(&s);
v9 = strlen(&s);
format_rate(&v24[v9 - 1], v8, bytes_per_second);
strlcat(&s, "/s ", win_size);
if ( v19 )
stalled = 0LL;
else
stalled = (unsigned int)(int)((double)(int)stalled + v20);
if ( stalled <= 4 )
{
if ( bytes_per_second || !v22 )
{
if ( v22 <= 0 )
v16 = (int)v20;
else
v16 = v22 / bytes_per_second;
v17 = v16 / 3600;
v16 %= 3600;
v18 = v16 / 60;
v16 %= 60;
v10 = win_size - strlen(&s);
v11 = strlen(&s);
if ( v17 )
snprintf(&v24[v11 - 1], v10, "%d:%02d:%02d", v17, v18, (unsigned int)v16);
else
snprintf(&v24[v11 - 1], v10, " %02d:%02d", v18, (unsigned int)v16);
if ( v22 <= 0 )
strlcat(&s, " ", win_size);
else
strlcat(&s, " ETA", win_size);
}
else
{
strlcat(&s, " --:-- ETA", win_size);
}
}
else
{
strlcat(&s, "- stalled -", win_size);
}
atomicio(&write, 1LL, &s, win_size - 1);
last_update = *(_QWORD *)&v21;
}
return __readfsqword(0x28u) ^ v25;
}
|
void
xtrace_print_for_command_head (for_command)
FOR_COM *for_command;
{
xtrace_fp = (xtrace_fp ? xtrace_fp :
stderr
);
fprintf (xtrace_fp, "%s", indirection_level_string ());
fprintf (xtrace_fp, "for %s in ", for_command->name->word);
xtrace_print_word_list (for_command->map_list, 2);
}
| int xtrace_print_for_command_head(long a1)
{
FILE *v1;
const char *v2;
if ( xtrace_fp )
v1 = xtrace_fp;
else
v1 = stderr;
xtrace_fp = v1;
v2 = (const char *)indirection_level_string();
fprintf(xtrace_fp, "%s", v2);
fprintf(xtrace_fp, "for %s in ", **(const char ***)(a1 + 8));
return xtrace_print_word_list(*(long ****)(a1 + 16), 2);
}
|
int
remove_any_file (const char *file_name, enum remove_option option)
{
_Bool
try_unlink_first =
1
;
if (try_unlink_first)
{
if (unlinkat (chdir_fd, file_name, 0) == 0)
return 1;
if (
(*__errno_location ())
!=
1
&&
(*__errno_location ())
!=
21
)
return 0;
}
if (safer_rmdir (file_name) == 0)
return 1;
switch (
(*__errno_location ())
)
{
case
20
:
return !try_unlink_first && unlinkat (chdir_fd, file_name, 0) == 0;
case 0:
case
17
:
case
39
:
switch (option)
{
case ORDINARY_REMOVE_OPTION:
break;
case WANT_DIRECTORY_REMOVE_OPTION:
return -1;
case RECURSIVE_REMOVE_OPTION:
{
char *directory = tar_savedir (file_name, 0);
char const *entry;
size_t entrylen;
if (! directory)
return 0;
for (entry = directory;
(entrylen = strlen (entry)) != 0;
entry += entrylen + 1)
{
char *file_name_buffer = make_file_name (file_name, entry);
int r = remove_any_file (file_name_buffer,
RECURSIVE_REMOVE_OPTION);
int e =
(*__errno_location ())
;
free (file_name_buffer);
if (! r)
{
free (directory);
(*__errno_location ())
= e;
return 0;
}
}
free (directory);
return safer_rmdir (file_name) == 0;
}
}
break;
}
return 0;
}
| ulong remove_any_file(char *param_1,uint param_2)
{
int iVar1;
int iVar2;
int *piVar3;
char *__ptr;
void *__ptr_00;
size_t sVar4;
char *local_28;
iVar1 = unlinkat(chdir_fd,param_1,0);
if (iVar1 == 0) {
return 1;
}
piVar3 = __errno_location();
if ((*piVar3 != 1) && (piVar3 = __errno_location(), *piVar3 != 0x15)) {
return 0;
}
iVar1 = safer_rmdir();
if (iVar1 == 0) {
return 1;
}
piVar3 = __errno_location();
iVar1 = *piVar3;
if (iVar1 != 0x27) {
if (0x27 < iVar1) {
return 0;
}
if (iVar1 == 0x14) {
return 0;
}
if (0x14 < iVar1) {
return 0;
}
if ((iVar1 != 0) && (iVar1 != 0x11)) {
return 0;
}
}
if (param_2 == 2) {
return 0xffffffff;
}
if (((param_2 < 3) && (param_2 != 0)) && (param_2 == 1)) {
__ptr = (char *)tar_savedir(param_1,0);
local_28 = __ptr;
if (__ptr == (char *)0x0) {
return 0;
}
while( true ) {
sVar4 = strlen(local_28);
if (sVar4 == 0) {
free(__ptr);
iVar1 = safer_rmdir(param_1);
return (ulong)(iVar1 == 0);
}
__ptr_00 = (void *)make_file_name(param_1,local_28);
iVar2 = remove_any_file(__ptr_00,1);
piVar3 = __errno_location();
iVar1 = *piVar3;
free(__ptr_00);
if (iVar2 == 0) break;
local_28 = local_28 + sVar4 + 1;
}
free(__ptr);
piVar3 = __errno_location();
*piVar3 = iVar1;
return 0;
}
return 0;
}
|
static int
_path_readlink (path, buf, bufsiz)
char *path;
char *buf;
int bufsiz;
{
return readlink (path, buf, bufsiz);
}
| void _path_readlink(char *param_1,char *param_2,int param_3)
{
readlink(param_1,param_2,(long)param_3);
return;
}
|
int
decode_attrib(struct sshbuf *b, Attrib *a)
{
int r;
attrib_clear(a);
if ((r = sshbuf_get_u32(b, &a->flags)) != 0)
return r;
if (a->flags & 0x00000001) {
if ((r = sshbuf_get_u64(b, &a->size)) != 0)
return r;
}
if (a->flags & 0x00000002) {
if ((r = sshbuf_get_u32(b, &a->uid)) != 0 ||
(r = sshbuf_get_u32(b, &a->gid)) != 0)
return r;
}
if (a->flags & 0x00000004) {
if ((r = sshbuf_get_u32(b, &a->perm)) != 0)
return r;
}
if (a->flags & 0x00000008) {
if ((r = sshbuf_get_u32(b, &a->atime)) != 0 ||
(r = sshbuf_get_u32(b, &a->mtime)) != 0)
return r;
}
if (a->flags & 0x80000000) {
char *type;
u_char *data;
size_t dlen;
u_int i, count;
if ((r = sshbuf_get_u32(b, &count)) != 0)
return r;
for (i = 0; i < count; i++) {
if ((r = sshbuf_get_cstring(b, &type,
((void *)0)
)) != 0 ||
(r = sshbuf_get_string(b, &data, &dlen)) != 0)
return r;
sshlog("sftp-common.c", __func__, 144, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "Got file attribute \"%.100s\" len %zu", type, dlen)
;
free(type);
free(data);
}
}
return 0;
}
| int decode_attrib(undefined8 param_1,uint *param_2)
{
int iVar1;
long in_FS_OFFSET;
undefined8 uVar2;
uint local_34;
int local_30;
uint local_2c;
void *local_28;
void *local_20;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
attrib_clear(param_2);
local_30 = sshbuf_get_u32(param_1,param_2);
iVar1 = local_30;
if (((((local_30 == 0) &&
(((*param_2 & 1) == 0 ||
(local_30 = sshbuf_get_u64(param_1,param_2 + 2), iVar1 = local_30, local_30 == 0)))) &&
(((*param_2 & 2) == 0 ||
((local_30 = sshbuf_get_u32(param_1,param_2 + 4), iVar1 = local_30, local_30 == 0 &&
(local_30 = sshbuf_get_u32(param_1,param_2 + 5), iVar1 = local_30, local_30 == 0)))))) &&
(((*param_2 & 4) == 0 ||
(local_30 = sshbuf_get_u32(param_1,param_2 + 6), iVar1 = local_30, local_30 == 0)))) &&
(((*param_2 & 8) == 0 ||
((local_30 = sshbuf_get_u32(param_1,param_2 + 7), iVar1 = local_30, local_30 == 0 &&
(local_30 = sshbuf_get_u32(param_1,param_2 + 8), iVar1 = local_30, local_30 == 0)))))) {
if ((int)*param_2 < 0) {
local_30 = sshbuf_get_u32(param_1,&local_34);
iVar1 = local_30;
if (local_30 != 0) goto LAB_0010044c;
for (local_2c = 0; local_2c < local_34; local_2c = local_2c + 1) {
local_30 = sshbuf_get_cstring(param_1,&local_28,0);
iVar1 = local_30;
if (local_30 != 0) goto LAB_0010044c;
uVar2 = 0x1003c9;
local_30 = sshbuf_get_string(param_1,&local_20,&local_18);
iVar1 = local_30;
if (local_30 != 0) goto LAB_0010044c;
sshlog("sftp-common.c","decode_attrib",0x90,0,7,0,"Got file attribute \"%.100s\" len %zu",
local_28,local_18,uVar2);
free(local_28);
free(local_20);
}
}
iVar1 = 0;
}
LAB_0010044c:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return iVar1;
}
__stack_chk_fail();
}
|
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);
}
| void sshkey_load_private(undefined8 param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4
)
{
sshkey_load_private_type(0xe,param_1,param_2,param_3,param_4);
return;
}
|
static void ipvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
if (!tb)
return;
if (tb[IFLA_IPVLAN_MODE]) {
if (((int)((tb[IFLA_IPVLAN_MODE])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))) == sizeof(__u16)) {
__u16 mode = rta_getattr_u16(tb[IFLA_IPVLAN_MODE]);
const char *mode_str = mode == IPVLAN_MODE_L2 ? "l2" :
mode == IPVLAN_MODE_L3 ? "l3" :
mode == IPVLAN_MODE_L3S ? "l3s" : "unknown";
print_string(PRINT_ANY, "mode", " mode %s ", mode_str);
}
}
if (tb[IFLA_IPVLAN_FLAGS]) {
if (((int)((tb[IFLA_IPVLAN_FLAGS])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))) == sizeof(__u16)) {
__u16 flags = rta_getattr_u16(tb[IFLA_IPVLAN_FLAGS]);
if (flags & 0x01)
print_bool(PRINT_ANY, "private", "private ",
1
);
else if (flags & 0x02)
print_bool(PRINT_ANY, "vepa", "vepa ",
1
);
else
print_bool(PRINT_ANY, "bridge", "bridge ",
1
);
}
}
}
| long long ipvlan_print_opt(unsigned long a0, unsigned long a1, struct struct_0 *a2[3]) {
unsigned long v0;
unsigned long v1;
unsigned short v2;
unsigned short v3;
unsigned long long v4;
unsigned long long v6;
unsigned short *v7;
v1 = a0;
v0 = a1;
if (a2) {
if (a2[1] && a2[1]->field_0 == 6) {
v2 = rta_getattr_u16(a2[1]);
if (!v2) {
v6 = "l2";
} else if (v2 == 1) {
v6 = "l3";
} else if (v2 == 2) {
v6 = "l3s";
} else {
v6 = "unknown";
}
v4 = v6;
print_string(0x4, "mode", " mode %s ", v4);
}
v7 = a2[2];
if (a2[2]) {
v7 = a2[2]->field_0;
if (a2[2]->field_0 == 6) {
v3 = rta_getattr_u16(a2[2]);
if ((v3 & 1)) {
v7 = print_bool(0x4, "private", "private ", 0x1);
} else if ((v3 & 2)) {
v7 = print_bool(0x4, "vepa", "vepa ", 0x1);
} else {
v7 = print_bool(0x4, "bridge", "bridge ", 0x1);
}
}
}
}
return v7;
}
|
void
xattrs_acls_set (struct tar_stat_info const *st,
char const *file_name, char typeflag)
{
if (acls_option > 0 && typeflag != '2')
{
xattrs__acls_set (st, file_name,
(0x8000)
,
st->acls_a_ptr, st->acls_a_len,
0
);
if (typeflag == '5' || typeflag == 'D')
xattrs__acls_set (st, file_name,
(0x4000)
,
st->acls_d_ptr, st->acls_d_len,
1
);
}
}
| void xattrs_acls_set(long param_1,undefined8 param_2,char param_3)
{
if ((0 < acls_option) && (param_3 != '2')) {
xattrs__acls_set(param_1,param_2,0x8000,*(undefined8 *)(param_1 + 0x38),
*(undefined8 *)(param_1 + 0x40),0);
if ((param_3 == '5') || (param_3 == 'D')) {
xattrs__acls_set(param_1,param_2,0x4000,*(undefined8 *)(param_1 + 0x48),
*(undefined8 *)(param_1 + 0x50),1);
}
}
return;
}
|
int
forkshell(struct job *jp, union node *n, int mode)
{
int pid;
;
pid = fork();
if (pid == 0)
forkchild(jp, n, mode);
else
forkparent(jp, n, mode, pid);
return pid;
}
| long long forkshell(unsigned int a0, unsigned long long a1, unsigned long a2) {
unsigned int v0;
v0 = fork();
if (!v0) {
forkchild(a0, a1, a2);
return v0;
}
forkparent(a0, a1, a2, v0);
return v0;
}
|
static int
make_ancestor (char const *dir, char const *component, void *options)
{
struct cp_options const *x = options;
if (x->set_security_context
&& defaultcon (x->set_security_context, component,
0040000
) < 0
&& ! ignorable_ctx_err (
(*__errno_location ())
))
error (0,
(*__errno_location ())
, gettext ("failed to set default creation context for %s"),
quotearg_style (shell_escape_always_quoting_style, dir));
int r = mkdir (component, (
(0400|0200|0100)
|
(0400 >> 3)
|
(0100 >> 3)
|
((0400 >> 3) >> 3)
|
((0100 >> 3) >> 3)
));
if (r == 0)
announce_mkdir (dir, options);
return r;
}
| long long make_ancestor(unsigned long long a0, char *a1, struct_0 *a2) {
unsigned int v0;
unsigned long long v3;
if (a2->field_28 && defaultcon(a2->field_28, a1, 0x4000, a1) < 0 && (ignorable_ctx_err(*(__errno_location())) ^ 1)) {
v3 = quotearg_style(0x4, a0);
error(0x0, *(__errno_location()), gettext("failed to set default creation context for %s"));
}
v0 = mkdir(a1, 0x1ed);
if (!v0) {
announce_mkdir(a0, a2);
return v0;
}
return v0;
}
|
static void
add_temp_array_to_env (temp_array, do_alloc, do_supercede)
char **temp_array;
int do_alloc, do_supercede;
{
register int i;
if (temp_array == 0)
return;
for (i = 0; temp_array[i]; i++)
{
if (do_supercede)
export_env = add_or_supercede_exported_var (temp_array[i], do_alloc);
else
do { if (export_env_index >= (export_env_size - 1)) { export_env_size += 16; export_env = strvec_resize (export_env, export_env_size); environ = export_env; } export_env[export_env_index++] = (do_alloc) ? (char *)strcpy (sh_xmalloc((1 + strlen (temp_array[i])), "variables.c", 5059), (temp_array[i])) : temp_array[i]; export_env[export_env_index] = (char *)
((void *)0)
; } while (0);
}
sh_xfree((temp_array), "variables.c", 5062);
}
| void add_temp_array_to_env(void* a0, unsigned long a1, unsigned long a2) {
void* v1;
unsigned long long v2;
unsigned long long v3;
if (a0) {
for (v1 = 0; *((a0 + 0x8 * v1)); v1 = v1 + 1) {
if (a2) {
export_env = add_or_supercede_exported_var(*((a0 + 0x8 * v1)), a1);
} else {
if (export_env_size - 1 <= export_env_index) {
export_env_size = export_env_size + 16;
export_env = strvec_resize(export_env, export_env_size, export_env_size);
environ = export_env;
}
if (a1)
v2 = strcpy(sh_xmalloc(strlen(*((a0 + 0x8 * v1))) + 1, "variables.c", 0x13c3), *((a0 + 0x8 * v1)));
else
v2 = *((a0 + 0x8 * v1));
export_env_index = export_env_index + 1;
*((export_env_index * 8 + export_env)) = v2;
*((export_env + export_env_index * 8)) = 0;
}
}
v3 = sh_xfree(a0, "variables.c", 0x13c6);
}
return;
}
|
void check_resize_inode(e2fsck_t ctx)
{
ext2_filsys fs = ctx->fs;
struct ext2_inode inode;
struct problem_context pctx;
int i, gdt_off, ind_off;
dgrp_t j;
blk_t blk, pblk;
blk_t expect;
__u32 *dind_buf = 0, *ind_buf;
errcode_t retval;
clear_problem_context(&pctx);
if (ext2fs_has_feature_resize_inode(fs->super) &&
ext2fs_has_feature_meta_bg(fs->super) &&
fix_problem(ctx, 0x000051, &pctx)) {
ext2fs_clear_feature_resize_inode(fs->super);
fs->super->s_reserved_gdt_blocks = 0;
ext2fs_mark_super_dirty(fs);
}
if (!ext2fs_has_feature_resize_inode(fs->super)) {
if (fs->super->s_reserved_gdt_blocks) {
pctx.num = fs->super->s_reserved_gdt_blocks;
if (fix_problem(ctx, 0x00002E,
&pctx)) {
fs->super->s_reserved_gdt_blocks = 0;
ext2fs_mark_super_dirty(fs);
}
}
}
pctx.ino = 7;
retval = ext2fs_read_inode(fs, 7, &inode);
if (retval) {
if (ext2fs_has_feature_resize_inode(fs->super))
ctx->flags |= 0x0400;
return;
}
if (!ext2fs_has_feature_resize_inode(fs->super)) {
for (i=0; i < (((12 + 1) + 1) + 1); i++) {
if (inode.i_block[i])
break;
}
if ((i < (((12 + 1) + 1) + 1)) &&
fix_problem(ctx, 0x00002F, &pctx)) {
memset(&inode, 0, sizeof(inode));
e2fsck_write_inode(ctx, 7, &inode,
"clear_resize");
}
return;
}
blk = inode.i_block[(12 + 1)];
for (i=0; i < (((12 + 1) + 1) + 1); i++) {
if (i != (12 + 1) && inode.i_block[i])
break;
}
if ((i < (((12 + 1) + 1) + 1)) || !blk || !inode.i_links_count ||
!(inode.i_mode & 0100000) ||
(blk < fs->super->s_first_data_block ||
blk >= ext2fs_blocks_count(fs->super))) {
resize_inode_invalid:
if (fix_problem(ctx, 0x000030, &pctx)) {
memset(&inode, 0, sizeof(inode));
e2fsck_write_inode(ctx, 7, &inode,
"clear_resize");
ctx->flags |= 0x0400;
}
if (!(ctx->options & 0x0001)) {
fs->super->s_state &= ~0x0001;
ext2fs_mark_super_dirty(fs);
}
goto cleanup;
}
dind_buf = (__u32 *) e2fsck_allocate_memory(ctx, fs->blocksize * 2,
"resize dind buffer");
ind_buf = (__u32 *) ((char *) dind_buf + fs->blocksize);
retval = ext2fs_read_ind_block(fs, blk, dind_buf);
if (retval)
goto resize_inode_invalid;
gdt_off = fs->desc_blocks;
pblk = fs->super->s_first_data_block + 1 + fs->desc_blocks;
if (fs->blocksize == 1024 && fs->super->s_first_data_block == 0)
pblk++;
for (i = 0; i < fs->super->s_reserved_gdt_blocks / 4;
i++, gdt_off++, pblk++) {
gdt_off %= fs->blocksize/4;
if (dind_buf[gdt_off] != pblk)
goto resize_inode_invalid;
retval = ext2fs_read_ind_block(fs, pblk, ind_buf);
if (retval)
goto resize_inode_invalid;
ind_off = 0;
for (j = 1; j < fs->group_desc_count; j++) {
if (!ext2fs_bg_has_super(fs, j))
continue;
expect = pblk + ((blk64_t) ((fs->super)->s_blocks_per_group) * (j));
if (ind_buf[ind_off] != expect)
goto resize_inode_invalid;
ind_off++;
}
}
cleanup:
if (dind_buf)
ext2fs_free_mem(&dind_buf);
}
| void check_resize_inode(long *param_1)
{
int iVar1;
ulong uVar2;
long in_FS_OFFSET;
int local_154;
uint local_150;
int local_14c;
uint local_148;
int local_144;
long local_138;
long local_130;
long local_128;
long local_120;
undefined local_118 [8];
undefined4 local_110;
ulong local_c8;
short local_a8 [4];
int aiStack160 [4];
short local_8e;
int aiStack128 [24];
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_130 = *param_1;
local_138 = 0;
clear_problem_context(local_118);
iVar1 = ext2fs_has_feature_resize_inode(*(undefined8 *)(local_130 + 0x20));
if (((iVar1 != 0) &&
(iVar1 = ext2fs_has_feature_meta_bg(*(undefined8 *)(local_130 + 0x20)), iVar1 != 0)) &&
(iVar1 = fix_problem(param_1,0x51,local_118), iVar1 != 0)) {
ext2fs_clear_feature_resize_inode(*(undefined8 *)(local_130 + 0x20));
*(undefined2 *)(*(long *)(local_130 + 0x20) + 0xce) = 0;
ext2fs_mark_super_dirty(local_130);
}
iVar1 = ext2fs_has_feature_resize_inode(*(undefined8 *)(local_130 + 0x20));
if ((iVar1 == 0) && (*(short *)(*(long *)(local_130 + 0x20) + 0xce) != 0)) {
local_c8 = (ulong)*(ushort *)(*(long *)(local_130 + 0x20) + 0xce);
iVar1 = fix_problem(param_1,0x2e,local_118);
if (iVar1 != 0) {
*(undefined2 *)(*(long *)(local_130 + 0x20) + 0xce) = 0;
ext2fs_mark_super_dirty(local_130);
}
}
local_110 = 7;
local_128 = ext2fs_read_inode(local_130,7,local_a8);
if (local_128 != 0) {
iVar1 = ext2fs_has_feature_resize_inode(*(undefined8 *)(local_130 + 0x20));
if (iVar1 != 0) {
*(uint *)(param_1 + 9) = *(uint *)(param_1 + 9) | 0x400;
}
goto LAB_00101922;
}
iVar1 = ext2fs_has_feature_resize_inode(*(undefined8 *)(local_130 + 0x20));
if (iVar1 == 0) {
local_154 = 0;
while ((local_154 < 0xf && (aiStack160[(long)local_154 + 8] == 0))) {
local_154 = local_154 + 1;
}
if ((local_154 < 0xf) && (iVar1 = fix_problem(param_1,0x2f,local_118), iVar1 != 0)) {
memset(local_a8,0,0x80);
e2fsck_write_inode(param_1,7,local_a8,"clear_resize");
}
goto LAB_00101922;
}
local_154 = 0;
while ((local_154 < 0xf && ((local_154 == 0xd || (aiStack160[(long)local_154 + 8] == 0))))) {
local_154 = local_154 + 1;
}
if (((((local_154 < 0xf) || (aiStack128[13] == 0)) || (local_8e == 0)) ||
((-1 < local_a8[0] || ((uint)aiStack128[13] < *(uint *)(*(long *)(local_130 + 0x20) + 0x14))))
) || (uVar2 = ext2fs_blocks_count(*(undefined8 *)(local_130 + 0x20)),
uVar2 <= (uint)aiStack128[13])) {
LAB_001015fa:
iVar1 = fix_problem(param_1,0x30,local_118);
if (iVar1 != 0) {
memset(local_a8,0,0x80);
e2fsck_write_inode(param_1,7,local_a8,"clear_resize");
*(uint *)(param_1 + 9) = *(uint *)(param_1 + 9) | 0x400;
}
if ((*(uint *)((long)param_1 + 0x4c) & 1) == 0) {
*(ushort *)(*(long *)(local_130 + 0x20) + 0x3a) =
*(ushort *)(*(long *)(local_130 + 0x20) + 0x3a) & 0xfffe;
ext2fs_mark_super_dirty(local_130);
}
}
else {
local_138 = e2fsck_allocate_memory(param_1,*(int *)(local_130 + 0x28) * 2,"resize dind buffer");
local_120 = (ulong)*(uint *)(local_130 + 0x28) + local_138;
local_128 = ext2fs_read_ind_block(local_130,aiStack128[13],local_138);
if (local_128 != 0) goto LAB_001015fa;
local_150 = (uint)*(undefined8 *)(local_130 + 0x38);
iVar1 = (int)*(undefined8 *)(local_130 + 0x38) + *(int *)(*(long *)(local_130 + 0x20) + 0x14);
local_144 = iVar1 + 1;
if ((*(int *)(local_130 + 0x28) == 0x400) && (*(int *)(*(long *)(local_130 + 0x20) + 0x14) == 0)
) {
local_144 = iVar1 + 2;
}
for (local_154 = 0;
local_154 < (int)(uint)(*(ushort *)(*(long *)(local_130 + 0x20) + 0xce) >> 2);
local_154 = local_154 + 1) {
local_150 = local_150 % (*(uint *)(local_130 + 0x28) >> 2);
if ((local_144 != *(int *)(local_138 + (long)(int)local_150 * 4)) ||
(local_128 = ext2fs_read_ind_block(local_130,local_144,local_120), local_128 != 0))
goto LAB_001015fa;
local_14c = 0;
for (local_148 = 1; local_148 < *(uint *)(local_130 + 0x30); local_148 = local_148 + 1) {
iVar1 = ext2fs_bg_has_super(local_130);
if (iVar1 != 0) {
if (local_144 + *(int *)(*(long *)(local_130 + 0x20) + 0x20) * local_148 !=
*(int *)(local_120 + (long)local_14c * 4)) goto LAB_001015fa;
local_14c = local_14c + 1;
}
}
local_150 = local_150 + 1;
local_144 = local_144 + 1;
}
}
if (local_138 != 0) {
ext2fs_free_mem(&local_138);
}
LAB_00101922:
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
}
|
static void
conloop(void)
{
struct timespec seltime, now;
con *c;
int i;
monotime_ts(&now);
c = ((&tq)->tqh_first);
if (c && (((&c->c_ts)->tv_sec == (&now)->tv_sec) ? ((&c->c_ts)->tv_nsec > (&now)->tv_nsec) : ((&c->c_ts)->tv_sec > (&now)->tv_sec)))
do { (&seltime)->tv_sec = (&c->c_ts)->tv_sec - (&now)->tv_sec; (&seltime)->tv_nsec = (&c->c_ts)->tv_nsec - (&now)->tv_nsec; if ((&seltime)->tv_nsec < 0) { (&seltime)->tv_sec--; (&seltime)->tv_nsec += 1000000000L; } } while (0);
else
(&seltime)->tv_sec = (&seltime)->tv_nsec = 0;
while (ppoll(read_wait, maxfd, &seltime,
((void *)0)
) == -1) {
if (
(*__errno_location ())
==
11
||
(*__errno_location ())
==
4
||
(*__errno_location ())
==
11
)
continue;
sshlog("ssh-keyscan.c", __func__, 612, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "poll error");
}
for (i = 0; i < maxfd; i++) {
if (read_wait[i].revents & (
0x010
|
0x008
|
0x020
))
confree(i);
else if (read_wait[i].revents & (
0x001
|
0x010
))
conread(i);
}
c = ((&tq)->tqh_first);
while (c && (((&c->c_ts)->tv_sec == (&now)->tv_sec) ? ((&c->c_ts)->tv_nsec < (&now)->tv_nsec) : ((&c->c_ts)->tv_sec < (&now)->tv_sec))) {
int s = c->c_fd;
c = ((c)->c_link.tqe_next);
conrecycle(s);
}
}
| void conloop(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
unsigned long v4;
unsigned long v5;
char v6;
char v7;
char v8;
unsigned long long *v13;
unsigned long long v14;
monotime_ts(&v6, a1, a2, a3);
v3 = 172419746632;
if (v3) {
if (*((v3 + 80)) == *(&v6)) {
if (!(*((v3 + 88)) <= *(&v7)))
goto LABEL_401e23;
} else {
if (*((v3 + 80)) > *(&v6)) {
LABEL_401e23:
v4 = __subvdi3(*((v3 + 80)), *(&v6), *(&v6));
v5 = __subvdi3(*((v3 + 88)), *(&v7), *(&v7));
if (v5 < 0) {
v4 = __addvdi3(v4, 0xffffffffffffffff, a2, a3);
v5 = __addvdi3(v5, 0x3b9aca00, a2, a3);
goto LABEL_401ea0;
}
}
}
}
v5 = 0;
v4 = v5;
LABEL_401ea0:
while (true) {
do {
do {
do {
if (ppoll(0x64dc7d8930ec8348, 0x30ec8348e5894855, &v4, 0x0) != -1) {
for (v1 = 0; v1 < 3850979413; v1 = __addvsi3(v1, 0x1, v1 * 8, 0x0)) {
if ((*((7267821926853935944 + (v1 << 3) + 6)) & 56)) {
confree(v1);
} else if ((*((7267821926853935944 + (v1 << 3) + 6)) & 17)) {
conread(v1);
}
}
v3 = 172419746632;
while (true) {
if (!v3)
break;
if (*((v3 + 80)) == *(&v6)) {
if (*((v3 + 88)) >= *(&v7))
break;
} else {
if (*((v3 + 80)) >= *(&v6))
break;
}
v2 = *((v3 + 4));
v3 = *((v3 + 96));
conrecycle(v2);
}
v14 = *(&v8) ^ v13[5];
return;
}
} while (*(__errno_location()) == 11);
} while (*(__errno_location()) == 4);
} while (*(__errno_location()) == 11);
sshlog("ssh-keyscan.c", "conloop", 0x264, 0x0, 0x2, 0x0, "poll error", *(&v0));
}
}
|
keymacro_print(EditLine *el, const wchar_t *key)
{
if (el->el_keymacro.map ==
((void *)0)
&& *key == 0)
return;
el->el_keymacro.buf[0] = '"';
if (node_lookup(el, key, el->el_keymacro.map, (size_t)1) <= -1)
(void) fprintf(el->el_errfile, "Unbound extended key \"%ls"
"\"\n", key);
return;
}
| long long keymacro_print(struct_0 *a0, unsigned int *a1) {
unsigned long long v1;
if (!a0->field_448) {
v1 = *(a1);
if (!*(a1))
return v1;
}
a0->field_440->field_0 = 34;
v1 = node_lookup(a0, a1, a0->field_448, 0x1);
if (v1 < 0) {
v1 = fprintf(a0->field_18, "Unbound extended key \"%ls\"\n");
return v1;
}
return v1;
}
|
gnutls_x509_crt_t load_ca_cert(unsigned mand, common_info_st * info)
{
gnutls_x509_crt_t crt;
int ret;
gnutls_datum_t dat;
size_t size;
if (mand == 0 && info->ca ==
((void *)0)
) {
return
((void *)0)
;
}
if (info->ca ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-ca-certificate\n");
app_exit(1);
}
ret = gnutls_x509_crt_init(&crt);
if (ret < 0) {
fprintf(
stderr
, "crt_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
if (gnutls_url_is_supported(info->ca) != 0) {
ret = gnutls_x509_crt_import_url(crt, info->ca, 0);
if (ret < 0) {
fprintf(
stderr
, "error importing CA certificate: %s: %s\n",
info->ca, gnutls_strerror(ret));
app_exit(1);
}
return crt;
}
dat.data = (void *) _gnutls_read_file(info->ca, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-ca-certificate: %s\n",
info->ca);
app_exit(1);
}
ret = gnutls_x509_crt_import(crt, &dat, info->incert_format);
free(dat.data);
if (ret < 0) {
fprintf(
stderr
, "error importing CA certificate: %s: %s\n",
info->ca, gnutls_strerror(ret));
app_exit(1);
}
return crt;
}
| long load_ca_cert(int a1, long a2)
{
const char *v3;
const char *v4;
const char *v5;
int v6;
int v7;
int v8;
long v9;
long v10;
void *ptr;
int v12;
unsigned long v13;
v13 = __readfsqword(0x28u);
if ( !a1 && !*(_QWORD *)(a2 + 64) )
return 0LL;
if ( !*(_QWORD *)(a2 + 64) )
{
fprintf(stderr, "missing --load-ca-certificate\n");
app_exit(1LL);
}
v6 = gnutls_x509_crt_init(&v9);
if ( v6 < 0 )
{
v3 = (const char *)gnutls_strerror((unsigned int)v6);
fprintf(stderr, "crt_init: %s\n", v3);
app_exit(1LL);
}
if ( (unsigned int)gnutls_url_is_supported(*(_QWORD *)(a2 + 64)) )
{
v7 = gnutls_x509_crt_import_url(v9, *(_QWORD *)(a2 + 64), 0LL);
if ( v7 < 0 )
{
v4 = (const char *)gnutls_strerror((unsigned int)v7);
fprintf(stderr, "error importing CA certificate: %s: %s\n", *(const char **)(a2 + 64), v4);
app_exit(1LL);
}
return v9;
}
else
{
ptr = (void *)gnutls_read_file(*(_QWORD *)(a2 + 64), 1LL, &v10);
v12 = v10;
if ( !ptr )
{
fprintf(stderr, "error reading file at --load-ca-certificate: %s\n", *(const char **)(a2 + 64));
app_exit(1LL);
}
v8 = gnutls_x509_crt_import(v9, &ptr, *(unsigned int *)(a2 + 28));
free(ptr);
if ( v8 < 0 )
{
v5 = (const char *)gnutls_strerror((unsigned int)v8);
fprintf(stderr, "error importing CA certificate: %s: %s\n", *(const char **)(a2 + 64), v5);
app_exit(1LL);
}
return v9;
}
}
|
WORD_LIST *
dequote_list (list)
WORD_LIST *list;
{
register char *s;
register WORD_LIST *tlist;
for (tlist = list; tlist; tlist = tlist->next)
{
s = dequote_string (tlist->word->word);
if (((tlist->word->word)[0] == '\177' && (tlist->word->word)[1] == '\0'))
tlist->word->flags &= ~(1 << 18);
sh_xfree((tlist->word->word), "subst.c", 4965);
tlist->word->word = s;
}
return list;
}
| undefined8 * dequote_list(undefined8 *param_1)
{
undefined8 uVar1;
undefined8 *puVar2;
for (puVar2 = param_1; puVar2 != (undefined8 *)0x0; puVar2 = (undefined8 *)*puVar2) {
uVar1 = dequote_string(*(undefined8 *)puVar2[1]);
if ((**(char **)puVar2[1] == '\x7f') && (*(char *)(*(long *)puVar2[1] + 1) == '\0')) {
*(uint *)(puVar2[1] + 8) = *(uint *)(puVar2[1] + 8) & 0xfffbffff;
}
sh_xfree(*(undefined8 *)puVar2[1],"subst.c",0x1365);
*(undefined8 *)puVar2[1] = uVar1;
}
return param_1;
}
|
static void
tarobject_set_se_context(const char *matchpath, const char *path, mode_t mode)
{
dpkg_selabel_set_context(matchpath, path, mode);
}
| long tarobject_set_se_context(long a1, long a2, unsigned int a3)
{
return dpkg_selabel_set_context(a1, a2, a3);
}
|
int
conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in)
{
static struct varbuf target = { 0, 0,
((void *)0)
};
struct stat stab;
ssize_t r;
int loopprotect;
varbuf_reset(result);
varbuf_add_buf(result, instdir, strlen(instdir));
varbuf_add_buf(result, in, strlen(in));
varbuf_end_str(result);
loopprotect = 0;
for (;;) {
debug(dbg_conffdetail, "conffderef in='%s' current working='%s'",
in, result->buf);
if (lstat(result->buf, &stab)) {
if (
(*__errno_location ())
!=
2
)
warning(gettext("%s: unable to stat config file '%s'\n" " (= '%s'): %s")
,
pkg_name(pkg, pnaw_nonambig), in,
result->buf, strerror(
(*__errno_location ())
));
debug(dbg_conffdetail, "conffderef nonexistent");
return 0;
} else if (
((((
stab.st_mode
)) & 0170000) == (0100000))
) {
debug(dbg_conff, "conffderef in='%s' result='%s'",
in, result->buf);
return 0;
} else if (
((((
stab.st_mode
)) & 0170000) == (0120000))
) {
debug(dbg_conffdetail, "conffderef symlink loopprotect=%d",
loopprotect);
if (loopprotect++ >= 25) {
warning(gettext("%s: config file '%s' is a circular link\n" " (= '%s')")
,
pkg_name(pkg, pnaw_nonambig), in,
result->buf);
return -1;
}
varbuf_reset(&target);
varbuf_grow(&target, stab.st_size + 1);
r = readlink(result->buf, target.buf, target.size);
if (r < 0) {
warning(gettext("%s: unable to readlink conffile '%s'\n" " (= '%s'): %s")
,
pkg_name(pkg, pnaw_nonambig), in,
result->buf, strerror(
(*__errno_location ())
));
return -1;
} else if (r != stab.st_size) {
warning(gettext("symbolic link '%.250s' size has " "changed from %jd to %zd")
,
result->buf, (intmax_t)stab.st_size, r);
if (r > stab.st_size)
return -1;
}
varbuf_trunc(&target, r);
varbuf_end_str(&target);
debug(dbg_conffdetail,
"conffderef readlink gave %zd, '%s'",
r, target.buf);
if (target.buf[0] == '/') {
varbuf_reset(result);
varbuf_add_buf(result, instdir, strlen(instdir));
debug(dbg_conffdetail,
"conffderef readlink absolute");
} else {
for (r = result->used - 1; r > 0 && result->buf[r] != '/'; r--)
;
if (r < 0) {
warning(gettext("%s: conffile '%.250s' resolves to degenerate filename\n" " ('%s' is a symlink to '%s')")
,
pkg_name(pkg, pnaw_nonambig),
in, result->buf, target.buf);
return -1;
}
if (result->buf[r] == '/')
r++;
varbuf_trunc(result, r);
debug(dbg_conffdetail,
"conffderef readlink relative to '%.*s'",
(int)result->used, result->buf);
}
varbuf_add_buf(result, target.buf, target.used);
varbuf_end_str(result);
} else {
warning(gettext("%s: conffile '%.250s' is not a plain file or symlink (= '%s')"),
pkg_name(pkg, pnaw_nonambig), in, result->buf);
return -1;
}
}
}
| undefined8 conffderef(undefined8 param_1,long *param_2,char *param_3)
{
long lVar1;
long lVar2;
int iVar3;
size_t sVar4;
int *piVar5;
char *pcVar6;
undefined8 uVar7;
undefined8 uVar8;
ssize_t sVar9;
long in_FS_OFFSET;
int local_d4;
long local_d0;
stat local_c8;
long local_30;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
varbuf_reset(param_2);
sVar4 = strlen(instdir);
varbuf_add_buf(param_2,instdir,sVar4);
sVar4 = strlen(param_3);
varbuf_add_buf(param_2,param_3,sVar4);
varbuf_end_str(param_2);
local_d4 = 0;
do {
debug(0x80,"conffderef in=\'%s\' current working=\'%s\'",param_3,param_2[2]);
iVar3 = lstat((char *)param_2[2],&local_c8);
if (iVar3 != 0) {
piVar5 = __errno_location();
if (*piVar5 != 2) {
piVar5 = __errno_location();
pcVar6 = strerror(*piVar5);
lVar1 = param_2[2];
uVar7 = pkg_name(param_1,1);
uVar8 = gettext("%s: unable to stat config file \'%s\'\n (= \'%s\'): %s");
warning(uVar8,uVar7,param_3,lVar1,pcVar6);
}
debug(0x80,"conffderef nonexistent");
uVar7 = 0;
LAB_00101f90:
if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar7;
}
__stack_chk_fail();
}
if ((local_c8.st_mode & 0xf000) == 0x8000) {
debug(0x10,"conffderef in=\'%s\' result=\'%s\'",param_3,param_2[2]);
uVar7 = 0;
goto LAB_00101f90;
}
if ((local_c8.st_mode & 0xf000) != 0xa000) {
lVar1 = param_2[2];
uVar7 = pkg_name(param_1,1);
uVar8 = gettext("%s: conffile \'%.250s\' is not a plain file or symlink (= \'%s\')");
warning(uVar8,uVar7,param_3,lVar1);
uVar7 = 0xffffffff;
goto LAB_00101f90;
}
debug(0x80,"conffderef symlink loopprotect=%d",local_d4);
if (0x18 < local_d4) {
lVar1 = param_2[2];
uVar7 = pkg_name(param_1,1);
uVar8 = gettext("%s: config file \'%s\' is a circular link\n (= \'%s\')");
warning(uVar8,uVar7,param_3,lVar1);
uVar7 = 0xffffffff;
goto LAB_00101f90;
}
varbuf_reset(target_6492);
varbuf_grow(target_6492,local_c8.st_size + 1);
sVar9 = readlink((char *)param_2[2],target_6492._16_8_,target_6492._8_8_);
lVar1 = local_c8.st_size;
if (sVar9 < 0) {
piVar5 = __errno_location();
pcVar6 = strerror(*piVar5);
lVar1 = param_2[2];
uVar7 = pkg_name(param_1,1);
uVar8 = gettext("%s: unable to readlink conffile \'%s\'\n (= \'%s\'): %s");
warning(uVar8,uVar7,param_3,lVar1,pcVar6);
uVar7 = 0xffffffff;
goto LAB_00101f90;
}
if (sVar9 != local_c8.st_size) {
lVar2 = param_2[2];
uVar7 = gettext("symbolic link \'%.250s\' size has changed from %jd to %zd");
warning(uVar7,lVar2,lVar1,sVar9);
if (local_c8.st_size < sVar9) {
uVar7 = 0xffffffff;
goto LAB_00101f90;
}
}
varbuf_trunc(target_6492,sVar9);
varbuf_end_str(target_6492);
debug(0x80,"conffderef readlink gave %zd, \'%s\'",sVar9,target_6492._16_8_);
pcVar6 = target_6492._16_8_;
if (*target_6492._16_8_ == '/') {
varbuf_reset(param_2);
sVar4 = strlen(instdir);
varbuf_add_buf(param_2,instdir,sVar4);
debug(0x80,"conffderef readlink absolute");
}
else {
local_d0 = *param_2;
do {
lVar1 = local_d0;
local_d0 = lVar1 + -1;
if (local_d0 < 1) break;
} while (*(char *)(local_d0 + param_2[2]) != '/');
if (local_d0 < 0) {
lVar1 = param_2[2];
uVar7 = pkg_name(param_1,1);
uVar8 = gettext(
"%s: conffile \'%.250s\' resolves to degenerate filename\n (\'%s\' is a symlink to \'%s\')"
);
warning(uVar8,uVar7,param_3,lVar1,pcVar6);
uVar7 = 0xffffffff;
goto LAB_00101f90;
}
if (*(char *)(local_d0 + param_2[2]) == '/') {
local_d0 = lVar1;
}
varbuf_trunc(param_2,local_d0);
debug(0x80,"conffderef readlink relative to \'%.*s\'",*param_2,param_2[2]);
}
varbuf_add_buf(param_2,target_6492._16_8_,target_6492._0_8_);
varbuf_end_str(param_2);
local_d4 = local_d4 + 1;
} while( true );
}
|
static _rl_search_cxt *
_rl_nsearch_init (int dir, int pchar)
{
_rl_search_cxt *cxt;
char *p;
cxt = _rl_scxt_alloc (0x02, 0);
if (dir < 0)
cxt->sflags |= 0x01;
if ((rl_editing_mode == 0 && _rl_keymap == vi_movement_keymap) && (pchar == '?' || pchar == '/'))
cxt->sflags |= 0x10;
cxt->direction = dir;
cxt->history_pos = cxt->save_line;
rl_maybe_save_line ();
rl_undo_list = 0;
rl_line_buffer[0] = 0;
rl_end = rl_point = 0;
p = _rl_make_prompt_for_search (pchar ? pchar : ':');
rl_message ("%s", p);
xfree (p);
(rl_readline_state |= (0x0000100));
_rl_nscxt = cxt;
return cxt;
}
| int _rl_nsearch_init(unsigned long a0, unsigned long a1) {
unsigned int v0[26];
int tmp_15;
unsigned long long v1;
char *v4;
*(&v0[0]) = _rl_scxt_alloc(0x2, 0x0);
if (a0 < 0)
v0[1] = v0[1] | 1;
if (!rl_editing_mode && _rl_keymap == 5243088) {
switch (a1) {
case 47: case 63:
v0[1] = v0[1] | 16;
break;
default:
goto LABEL_4003e0;
}
}
LABEL_4003e0:
v0[25] = a0;
v0[24] = v0[14];
rl_maybe_save_line();
rl_undo_list = 0;
*(rl_line_buffer) = 0;
rl_point = 0;
rl_end = rl_point;
v1 = _rl_make_prompt_for_search((!a1 ? a1 : 58));
rl_message("%s", v1);
xfree(v1);
v4 = rl_readline_state;
*(&v4) = (rl_readline_state >> 8) | 1;
tmp_15 = v4;
rl_readline_state = tmp_15;
*(&_rl_nscxt[0]) = v0;
return v0;
}
|
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;
}
|
void
sshbuf_free(struct sshbuf *buf)
{
if (buf ==
((void *)0)
)
return;
if (sshbuf_check_sanity(buf) != 0)
return;
buf->refcount--;
if (buf->refcount > 0)
return;
sshbuf_free(buf->parent);
buf->parent =
((void *)0)
;
if (!buf->readonly) {
explicit_bzero(buf->d, buf->alloc);
free(buf->d);
}
freezero(buf, sizeof(*buf));
}
| void sshbuf_free(struct_0 *a0) {
unsigned long long v2;
unsigned long long v3;
if (a0 && !sshbuf_check_sanity(a0)) {
a0->field_38 = a0->field_38 - 1;
v2 = a0->field_38;
if (!a0->field_38) {
sshbuf_free(a0->field_40);
a0->field_40 = 0;
if (!a0->field_30) {
explicit_bzero(a0->field_0, a0->field_28);
free(a0->field_0);
}
v3 = freezero(a0, 0x48);
}
}
return;
}
|
static int hsr_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
int ifindex;
unsigned char multicast_spec;
unsigned char protocol_version;
unsigned char protocol = HSR_PROTOCOL_HSR;
while (argc > 0) {
if (matches(*argv, "supervision") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u8(&multicast_spec, *argv, 0))
invarg("ADDR-BYTE is invalid", *argv);
addattr_l(n, 1024, IFLA_HSR_MULTICAST_SPEC,
&multicast_spec, 1);
} else if (matches(*argv, "version") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (!(get_u8(&protocol_version, *argv, 0) == 0 ||
get_u8(&protocol_version, *argv, 0) == 1))
invarg("version is invalid", *argv);
addattr_l(n, 1024, IFLA_HSR_VERSION,
&protocol_version, 1);
} else if (matches(*argv, "proto") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (!(get_u8(&protocol, *argv, 0) == HSR_PROTOCOL_HSR ||
get_u8(&protocol, *argv, 0) == HSR_PROTOCOL_PRP))
invarg("protocol is invalid", *argv);
addattr_l(n, 1024, IFLA_HSR_PROTOCOL,
&protocol, 1);
} else if (matches(*argv, "slave1") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
ifindex = ll_name_to_index(*argv);
if (ifindex == 0)
invarg("No such interface", *argv);
addattr_l(n, 1024, IFLA_HSR_SLAVE1, &ifindex, 4);
} else if (matches(*argv, "slave2") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
ifindex = ll_name_to_index(*argv);
if (ifindex == 0)
invarg("No such interface", *argv);
addattr_l(n, 1024, IFLA_HSR_SLAVE2, &ifindex, 4);
} else if (matches(*argv, "help") == 0) {
usage();
return -1;
} else {
fprintf(
stderr
, "hsr: what is \"%s\"?\n", *argv);
usage();
return -1;
}
argc--, argv++;
}
return 0;
}
| long hsr_parse_opt(long a1, int a2, const char **a3, long a4)
{
const char **v7;
int v9;
char v10;
char v11;
char v12;
int v13;
unsigned long v14;
v14 = __readfsqword(0x28u);
v12 = 0;
while ( 1 )
{
if ( a2 <= 0 )
return 0LL;
if ( (unsigned char)matches(*a3, "supervision") != 1 )
{
v7 = a3 + 1;
v9 = a2 - 1;
if ( v9 <= 0 )
incomplete_command();
if ( (unsigned int)get_u8(&v10, *v7, 0LL) )
invarg("ADDR-BYTE is invalid", *v7);
addattr_l(a4, 1024LL, 3LL, &v10, 1LL);
goto LABEL_37;
}
if ( (unsigned char)matches(*a3, "version") != 1 )
{
v7 = a3 + 1;
v9 = a2 - 1;
if ( v9 <= 0 )
incomplete_command();
if ( (unsigned int)get_u8(&v11, *v7, 0LL) && (unsigned int)get_u8(&v11, *v7, 0LL) != 1 )
invarg("version is invalid", *v7);
addattr_l(a4, 1024LL, 6LL, &v11, 1LL);
goto LABEL_37;
}
if ( (unsigned char)matches(*a3, "proto") != 1 )
{
v7 = a3 + 1;
v9 = a2 - 1;
if ( v9 <= 0 )
incomplete_command();
if ( (unsigned int)get_u8(&v12, *v7, 0LL) && (unsigned int)get_u8(&v12, *v7, 0LL) != 1 )
invarg("protocol is invalid", *v7);
addattr_l(a4, 1024LL, 7LL, &v12, 1LL);
goto LABEL_37;
}
if ( (unsigned char)matches(*a3, "slave1") != 1 )
{
v7 = a3 + 1;
v9 = a2 - 1;
if ( v9 <= 0 )
incomplete_command();
v13 = ll_name_to_index(*v7);
if ( !v13 )
invarg("No such interface", *v7);
addattr_l(a4, 1024LL, 1LL, &v13, 4LL);
goto LABEL_37;
}
if ( (unsigned char)matches(*a3, "slave2") == 1 )
break;
v7 = a3 + 1;
v9 = a2 - 1;
if ( v9 <= 0 )
incomplete_command();
v13 = ll_name_to_index(*v7);
if ( !v13 )
invarg("No such interface", *v7);
addattr_l(a4, 1024LL, 2LL, &v13, 4LL);
LABEL_37:
a2 = v9 - 1;
a3 = v7 + 1;
}
if ( (unsigned char)matches(*a3, "help") == 1 )
fprintf(stderr, "hsr: what is \"%s\"?\n", *a3);
usage();
return 0xFFFFFFFFLL;
}
|
static void
re_update_line(EditLine *el, wchar_t *old, wchar_t *new, int i)
{
wchar_t *o, *n, *p, c;
wchar_t *ofd, *ols, *oe, *nfd, *nls, *ne;
wchar_t *osb, *ose, *nsb, *nse;
int fx, sx;
size_t len;
for (o = old, n = new; *o && (*o == *n); o++, n++)
continue;
ofd = o;
nfd = n;
while (*o)
o++;
while (ofd < o) {
if (o[-1] != ' ')
break;
o--;
}
oe = o;
*oe = '\0';
while (*n)
n++;
while (nfd < n) {
if (n[-1] != ' ')
break;
n--;
}
ne = n;
*ne = '\0';
if (*ofd == '\0' && *nfd == '\0') {
;
return;
}
while ((o > ofd) && (n > nfd) && (*--o == *--n))
continue;
ols = ++o;
nls = ++n;
osb = ols;
nsb = nls;
ose = ols;
nse = nls;
if (*ofd) {
for (c = *ofd, n = nfd; n < nls; n++) {
if (c == *n) {
for (o = ofd, p = n;
p < nls && o < ols && *o == *p;
o++, p++)
continue;
if (((nse - nsb) < (p - n)) &&
(2 * (p - n) > n - nfd)) {
nsb = n;
nse = p;
osb = ofd;
ose = o;
}
}
}
}
if (*nfd) {
for (c = *nfd, o = ofd; o < ols; o++) {
if (c == *o) {
for (n = nfd, p = o;
p < ols && n < nls && *p == *n;
p++, n++)
continue;
if (((ose - osb) < (p - o)) &&
(2 * (p - o) > o - ofd)) {
nsb = nfd;
nse = n;
osb = o;
ose = p;
}
}
}
}
if ((oe - ols) < 4) {
ols = oe;
nls = ne;
}
fx = (int)((nsb - nfd) - (osb - ofd));
sx = (int)((nls - nse) - (ols - ose));
if (!((el)->el_terminal.t_flags & 0x001)) {
if (fx > 0) {
osb = ols;
ose = ols;
nsb = nls;
nse = nls;
}
if (sx > 0) {
ols = oe;
nls = ne;
}
if ((ols - ofd) < (nls - nfd)) {
ols = oe;
nls = ne;
}
}
if (!((el)->el_terminal.t_flags & 0x002)) {
if (fx < 0) {
osb = ols;
ose = ols;
nsb = nls;
nse = nls;
}
if (sx < 0) {
ols = oe;
nls = ne;
}
if ((ols - ofd) > (nls - nfd)) {
ols = oe;
nls = ne;
}
}
if ((ose - osb) < 4) {
osb = ols;
ose = ols;
nsb = nls;
nse = nls;
}
fx = (int)((nsb - nfd) - (osb - ofd));
sx = (int)((nls - nse) - (ols - ose));
;
;
;
;
;
terminal_move_to_line(el, i);
p = (ols != oe) ? oe : ose;
if ((nsb != nfd) && fx > 0 &&
((p - old) + fx <= el->el_terminal.t_size.h)) {
;
terminal_move_to_char(el, (int)(nfd - new));
if (nsb != ne) {
;
if (fx > 0) {
;
terminal_insertwrite(el, nfd, fx);
re_insert(el, old, (int)(ofd - old),
el->el_terminal.t_size.h, nfd, fx);
}
len = (size_t) ((nsb - nfd) - fx);
terminal_overwrite(el, (nfd + fx), len);
re__strncopy(ofd + fx, nfd + fx, len);
} else {
;
len = (size_t)(nsb - nfd);
terminal_overwrite(el, nfd, len);
re__strncopy(ofd, nfd, len);
return;
}
} else if (fx < 0) {
;
terminal_move_to_char(el, (int)(ofd - old));
if (osb != oe) {
;
if (fx < 0) {
;
terminal_deletechars(el, -fx);
re_delete(el, old, (int)(ofd - old),
el->el_terminal.t_size.h, -fx);
}
len = (size_t) (nsb - nfd);
terminal_overwrite(el, nfd, len);
re__strncopy(ofd, nfd, len);
} else {
;
terminal_overwrite(el, nfd, (size_t)(nsb - nfd));
re_clear_eol(el, fx, sx,
(int)((oe - old) - (ne - new)));
return;
}
} else
fx = 0;
if (sx < 0 && (ose - old) + fx < el->el_terminal.t_size.h) {
;
terminal_move_to_char(el, (int)((ose - old) + fx));
if (ols != oe) {
;
if (sx < 0) {
;
terminal_deletechars(el, -sx);
}
terminal_overwrite(el, nse, (size_t)(nls - nse));
} else {
;
terminal_overwrite(el, nse, (size_t)(nls - nse));
re_clear_eol(el, fx, sx,
(int)((oe - old) - (ne - new)));
}
}
if ((nsb != nfd) && (osb - ofd) <= (nsb - nfd) && (fx == 0)) {
;
terminal_move_to_char(el, (int)(nfd - new));
if (nsb != ne) {
;
fx = (int)((nsb - nfd) - (osb - ofd));
if (fx > 0) {
;
terminal_insertwrite(el, nfd, fx);
re_insert(el, old, (int)(ofd - old),
el->el_terminal.t_size.h, nfd, fx);
}
len = (size_t) ((nsb - nfd) - fx);
terminal_overwrite(el, (nfd + fx), len);
re__strncopy(ofd + fx, nfd + fx, len);
} else {
;
len = (size_t) (nsb - nfd);
terminal_overwrite(el, nfd, len);
re__strncopy(ofd, nfd, len);
}
}
if (sx >= 0) {
;
terminal_move_to_char(el, (int)(nse - new));
if (ols != oe) {
;
if (sx > 0) {
;
terminal_insertwrite(el, nse, sx);
}
terminal_overwrite(el, (nse + sx),
(size_t)((nls - nse) - sx));
} else {
;
terminal_overwrite(el, nse, (size_t)(nls - nse));
}
}
;
}
| void re_update_line(long param_1,int *param_2,int *param_3,undefined4 param_4)
{
int *piVar1;
int *piVar2;
int *piVar3;
int *piVar4;
int *piVar5;
int iVar6;
int iVar7;
long lVar8;
int local_84;
int *local_78;
int *local_70;
int *local_68;
int *local_60;
int *local_58;
int *local_50;
int *local_48;
int *local_40;
int *local_38;
local_70 = param_3;
for (local_78 = param_2;
(piVar3 = local_70, piVar1 = local_78, *local_78 != 0 && (*local_78 == *local_70));
local_78 = local_78 + 1) {
local_70 = local_70 + 1;
}
for (; *local_78 != 0; local_78 = local_78 + 1) {
}
for (; (piVar2 = local_78, piVar1 < local_78 && (local_78[-1] == 0x20)); local_78 = local_78 + -1)
{
}
*local_78 = 0;
for (; *local_70 != 0; local_70 = local_70 + 1) {
}
for (; (piVar4 = local_70, piVar3 < local_70 && (local_70[-1] == 0x20)); local_70 = local_70 + -1)
{
}
*local_70 = 0;
if ((*piVar1 != 0) || (*piVar3 != 0)) {
do {
if ((local_78 <= piVar1) || (local_70 <= piVar3)) break;
local_78 = local_78 + -1;
local_70 = local_70 + -1;
} while (*local_78 == *local_70);
local_60 = local_78 + 1;
local_58 = local_70 + 1;
local_50 = local_60;
local_48 = local_60;
local_40 = local_58;
local_38 = local_58;
if (*piVar1 != 0) {
for (local_70 = piVar3; local_70 < local_58; local_70 = local_70 + 1) {
if (*piVar1 == *local_70) {
local_68 = local_70;
for (local_78 = piVar1;
((local_68 < local_58 && (local_78 < local_60)) && (*local_78 == *local_68));
local_78 = local_78 + 1) {
local_68 = local_68 + 1;
}
if (((long)local_38 - (long)local_40 < (long)local_68 - (long)local_70) &&
((long)local_70 - (long)piVar3 >> 2 < (long)local_68 - (long)local_70 >> 1)) {
local_40 = local_70;
local_38 = local_68;
local_50 = piVar1;
local_48 = local_78;
}
}
}
}
if (*piVar3 != 0) {
for (local_78 = piVar1; local_78 < local_60; local_78 = local_78 + 1) {
if (*piVar3 == *local_78) {
local_70 = piVar3;
for (local_68 = local_78;
((local_68 < local_60 && (local_70 < local_58)) && (*local_68 == *local_70));
local_68 = local_68 + 1) {
local_70 = local_70 + 1;
}
if (((long)local_48 - (long)local_50 < (long)local_68 - (long)local_78) &&
((long)local_78 - (long)piVar1 >> 2 < (long)local_68 - (long)local_78 >> 1)) {
local_40 = piVar3;
local_38 = local_70;
local_50 = local_78;
local_48 = local_68;
}
}
}
}
if ((long)piVar2 - (long)local_60 < 0xd) {
local_60 = piVar2;
local_58 = piVar4;
}
iVar6 = (int)((long)local_40 - (long)piVar3 >> 2) - (int)((long)local_50 - (long)piVar1 >> 2);
iVar7 = (int)((long)local_58 - (long)local_38 >> 2) -
(int)((long)local_60 - (long)local_48 >> 2);
if ((*(uint *)(param_1 + 0x98) & 1) == 0) {
if (0 < iVar6) {
local_50 = local_60;
local_48 = local_60;
local_40 = local_58;
local_38 = local_58;
}
if (0 < iVar7) {
local_60 = piVar2;
local_58 = piVar4;
}
if ((long)local_60 - (long)piVar1 < (long)local_58 - (long)piVar3) {
local_60 = piVar2;
local_58 = piVar4;
}
}
if ((*(uint *)(param_1 + 0x98) & 2) == 0) {
if (iVar6 < 0) {
local_50 = local_60;
local_48 = local_60;
local_40 = local_58;
local_38 = local_58;
}
if (iVar7 < 0) {
local_60 = piVar2;
local_58 = piVar4;
}
if ((long)local_58 - (long)piVar3 < (long)local_60 - (long)piVar1) {
local_60 = piVar2;
local_58 = piVar4;
}
}
if ((long)local_48 - (long)local_50 < 0xd) {
local_50 = local_60;
local_48 = local_60;
local_40 = local_58;
local_38 = local_58;
}
local_84 = (int)((long)local_40 - (long)piVar3 >> 2) - (int)((long)local_50 - (long)piVar1 >> 2)
;
iVar6 = (int)((long)local_58 - (long)local_38 >> 2) -
(int)((long)local_60 - (long)local_48 >> 2);
terminal_move_to_line(param_1,param_4);
piVar5 = local_48;
if (local_60 != piVar2) {
piVar5 = piVar2;
}
if (((local_40 == piVar3) || (local_84 < 1)) ||
((long)*(int *)(param_1 + 0x90) < ((long)piVar5 - (long)param_2 >> 2) + (long)local_84)) {
if (local_84 < 0) {
terminal_move_to_char(param_1,(long)piVar1 - (long)param_2 >> 2 & 0xffffffff);
if (local_50 == piVar2) {
terminal_overwrite(param_1,piVar3,(long)local_40 - (long)piVar3 >> 2);
re_clear_eol(param_1,local_84,iVar6,
(int)((long)piVar2 - (long)param_2 >> 2) -
(int)((long)piVar4 - (long)param_3 >> 2));
return;
}
if (local_84 < 0) {
terminal_deletechars(param_1,-local_84);
re_delete(param_1,param_2,(long)piVar1 - (long)param_2 >> 2 & 0xffffffff,
*(undefined4 *)(param_1 + 0x90),-local_84);
}
lVar8 = (long)local_40 - (long)piVar3 >> 2;
terminal_overwrite(param_1,piVar3,lVar8);
re__strncopy(piVar1,piVar3,lVar8);
}
else {
local_84 = 0;
}
}
else {
terminal_move_to_char(param_1,(long)piVar3 - (long)param_3 >> 2 & 0xffffffff);
if (local_40 == piVar4) {
lVar8 = (long)local_40 - (long)piVar3 >> 2;
terminal_overwrite(param_1,piVar3,lVar8);
re__strncopy(piVar1,piVar3,lVar8);
return;
}
if (0 < local_84) {
terminal_insertwrite(param_1,piVar3,local_84);
re_insert(param_1,param_2,(long)piVar1 - (long)param_2 >> 2 & 0xffffffff,
*(undefined4 *)(param_1 + 0x90),piVar3,local_84);
}
lVar8 = ((long)local_40 - (long)piVar3 >> 2) - (long)local_84;
terminal_overwrite(param_1,piVar3 + local_84,lVar8);
re__strncopy(piVar1 + local_84,piVar3 + local_84,lVar8);
}
if ((iVar6 < 0) &&
(((long)local_48 - (long)param_2 >> 2) + (long)local_84 < (long)*(int *)(param_1 + 0x90))) {
terminal_move_to_char(param_1,local_84 + (int)((long)local_48 - (long)param_2 >> 2));
if (local_60 == piVar2) {
terminal_overwrite(param_1,local_38,(long)local_58 - (long)local_38 >> 2);
re_clear_eol(param_1,local_84,iVar6,
(int)((long)piVar2 - (long)param_2 >> 2) -
(int)((long)piVar4 - (long)param_3 >> 2));
}
else {
if (iVar6 < 0) {
terminal_deletechars(param_1,-iVar6);
}
terminal_overwrite(param_1,local_38,(long)local_58 - (long)local_38 >> 2);
}
}
if (((local_40 != piVar3) && ((long)local_50 - (long)piVar1 <= (long)local_40 - (long)piVar3))
&& (local_84 == 0)) {
terminal_move_to_char(param_1,(long)piVar3 - (long)param_3 >> 2 & 0xffffffff);
if (local_40 == piVar4) {
lVar8 = (long)local_40 - (long)piVar3 >> 2;
terminal_overwrite(param_1,piVar3,lVar8);
re__strncopy(piVar1,piVar3,lVar8);
}
else {
iVar7 = (int)((long)local_40 - (long)piVar3 >> 2) -
(int)((long)local_50 - (long)piVar1 >> 2);
if (0 < iVar7) {
terminal_insertwrite(param_1,piVar3,iVar7);
re_insert(param_1,param_2,(long)piVar1 - (long)param_2 >> 2 & 0xffffffff,
*(undefined4 *)(param_1 + 0x90),piVar3,iVar7);
}
lVar8 = ((long)local_40 - (long)piVar3 >> 2) - (long)iVar7;
terminal_overwrite(param_1,piVar3 + iVar7,lVar8);
re__strncopy(piVar1 + iVar7,piVar3 + iVar7,lVar8);
}
}
if (-1 < iVar6) {
terminal_move_to_char(param_1,(long)local_38 - (long)param_3 >> 2 & 0xffffffff);
if (local_60 == piVar2) {
terminal_overwrite(param_1,local_38,(long)local_58 - (long)local_38 >> 2);
}
else {
if (0 < iVar6) {
terminal_insertwrite(param_1,local_38,iVar6);
}
terminal_overwrite(param_1,local_38 + iVar6,
((long)local_58 - (long)local_38 >> 2) - (long)iVar6);
}
}
}
return;
}
|
tty_bind_char(EditLine *el, int force)
{
unsigned char *t_n = el->el_tty.t_c[1];
unsigned char *t_o = el->el_tty.t_ed.c_cc;
wchar_t new[2], old[2];
const ttymap_t *tp;
el_action_t *map, *alt;
const el_action_t *dmap, *dalt;
new[1] = old[1] = '\0';
map = el->el_map.key;
alt = el->el_map.alt;
if (el->el_map.type == 1) {
dmap = el->el_map.vii;
dalt = el->el_map.vic;
} else {
dmap = el->el_map.emacs;
dalt =
((void *)0)
;
}
for (tp = tty_map; tp->nch != (wint_t)-1; tp++) {
new[0] = (wchar_t)t_n[tp->nch];
old[0] = (wchar_t)t_o[tp->och];
if (new[0] == old[0] && !force)
continue;
keymacro_clear(el, map, old);
map[(unsigned char)old[0]] = dmap[(unsigned char)old[0]];
keymacro_clear(el, map, new);
map[(unsigned char)new[0]] = tp->bind[el->el_map.type];
if (dalt) {
keymacro_clear(el, alt, old);
alt[(unsigned char)old[0]] =
dalt[(unsigned char)old[0]];
keymacro_clear(el, alt, new);
alt[(unsigned char)new[0]] =
tp->bind[el->el_map.type + 1];
}
}
}
| void tty_bind_char(long param_1,int param_2)
{
long lVar1;
long lVar2;
long in_FS_OFFSET;
undefined1 *local_58;
long local_50;
long local_48;
uint local_20;
undefined4 local_1c;
uint local_18;
undefined4 local_14;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_14 = 0;
local_1c = 0;
lVar1 = *(long *)(param_1 + 0x3f8);
lVar2 = *(long *)(param_1 + 0x3f0);
if (*(int *)(param_1 + 0x420) == 1) {
local_50 = *(long *)(param_1 + 0x418);
local_48 = *(long *)(param_1 + 0x410);
}
else {
local_50 = *(long *)(param_1 + 0x408);
local_48 = 0;
}
for (local_58 = tty_map; *(uint *)local_58 != 0xffffffff;
local_58 = (undefined1 *)((long)local_58 + 0xc)) {
local_20 = (uint)*(byte *)(param_1 + 0x1d9 + (ulong)*(uint *)local_58);
local_18 = (uint)*(byte *)(param_1 + 0x295 + (ulong)*(uint *)((long)local_58 + 4));
if ((local_20 != local_18) || (param_2 != 0)) {
keymacro_clear(param_1,lVar1,&local_18);
*(undefined *)(lVar1 + (ulong)(local_18 & 0xff)) =
*(undefined *)(local_50 + (ulong)(local_18 & 0xff));
keymacro_clear(param_1,lVar1,&local_20);
*(undefined *)((ulong)(local_20 & 0xff) + lVar1) =
*(undefined *)((long)local_58 + (long)*(int *)(param_1 + 0x420) + 8);
if (local_48 != 0) {
keymacro_clear(param_1,lVar2,&local_18);
*(undefined *)(lVar2 + (ulong)(local_18 & 0xff)) =
*(undefined *)(local_48 + (ulong)(local_18 & 0xff));
keymacro_clear(param_1,lVar2,&local_20);
*(undefined *)((ulong)(local_20 & 0xff) + lVar2) =
*(undefined *)((long)local_58 + (long)(*(int *)(param_1 + 0x420) + 1) + 8);
}
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
int
set_locale_var (var, value)
char *var, *value;
{
int r;
char *x;
x = "";
(*__errno_location ())
= 0;
if (var[0] == 'T' && var[10] == 0)
{
do { if (default_domain) sh_xfree((default_domain), "locale.c", 187); } while (0);
default_domain = value ? (char *)strcpy (sh_xmalloc((1 + strlen (value)), "locale.c", 188), (value)) : (char *)
((void *)0)
;
if (default_dir && *default_dir)
bindtextdomain (default_domain, default_dir);
return (1);
}
else if (var[0] == 'T')
{
do { if (default_dir) sh_xfree((default_dir), "locale.c", 195); } while (0);
default_dir = value ? (char *)strcpy (sh_xmalloc((1 + strlen (value)), "locale.c", 196), (value)) : (char *)
((void *)0)
;
if (default_domain && *default_domain)
bindtextdomain (default_domain, default_dir);
return (1);
}
else if (var[3] == 'A')
{
do { if (lc_all) sh_xfree((lc_all), "locale.c", 206); } while (0);
if (value)
lc_all = (char *)strcpy (sh_xmalloc((1 + strlen (value)), "locale.c", 208), (value));
else
{
lc_all = (char *)sh_xmalloc((1), "locale.c", 211);
lc_all[0] = '\0';
}
r = *lc_all ? ((x = setlocale (
6
, lc_all)) != 0) : reset_locale_vars ();
if (x == 0)
{
if (
(*__errno_location ())
== 0)
internal_warning(gettext("setlocale: LC_ALL: cannot change locale (%s)"), lc_all);
else
internal_warning(gettext("setlocale: LC_ALL: cannot change locale (%s): %s"), lc_all, strerror (
(*__errno_location ())
));
}
locale_setblanks ();
locale_mb_cur_max =
(__ctype_get_mb_cur_max ())
;
if (*lc_all && x)
locale_utf8locale = locale_isutf8 (lc_all);
locale_shiftstates = mblen ((char *)
((void *)0)
, 0);
u32reset ();
return r;
}
else if (var[3] == 'C' && var[4] == 'T')
{
if (lc_all == 0 || *lc_all == '\0')
{
x = setlocale (
0
, get_locale_var ("LC_CTYPE"));
locale_setblanks ();
locale_mb_cur_max =
(__ctype_get_mb_cur_max ())
;
if (x)
locale_utf8locale = locale_isutf8 (x);
locale_shiftstates = mblen ((char *)
((void *)0)
, 0);
u32reset ();
}
}
else if (var[3] == 'C' && var[4] == 'O')
{
if (lc_all == 0 || *lc_all == '\0')
x = setlocale (
3
, get_locale_var ("LC_COLLATE"));
}
else if (var[3] == 'M' && var[4] == 'E')
{
if (lc_all == 0 || *lc_all == '\0')
x = setlocale (
5
, get_locale_var ("LC_MESSAGES"));
}
else if (var[3] == 'N' && var[4] == 'U')
{
if (lc_all == 0 || *lc_all == '\0')
x = setlocale (
1
, get_locale_var ("LC_NUMERIC"));
}
else if (var[3] == 'T' && var[4] == 'I')
{
if (lc_all == 0 || *lc_all == '\0')
x = setlocale (
2
, get_locale_var ("LC_TIME"));
}
if (x == 0)
{
if (
(*__errno_location ())
== 0)
internal_warning(gettext("setlocale: %s: cannot change locale (%s)"), var, get_locale_var (var));
else
internal_warning(gettext("setlocale: %s: cannot change locale (%s): %s"), var, get_locale_var (var), strerror (
(*__errno_location ())
));
}
return (x != 0);
}
| void set_locale_var(char a0[11], char *a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
unsigned long long v1;
void* v3;
void* v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long v9;
unsigned long long v10;
v1 = &g_401480;
*(__errno_location()) = 0;
if (a0[0] == 84 && !a0[10]) {
if (default_domain)
sh_xfree(default_domain, "locale.c", 0xbb);
if (!a1)
v3 = 0;
else
v3 = strcpy(sh_xmalloc(strlen(a1) + 1, "locale.c", 0xbc), a1);
default_domain = v3;
if (default_dir && *(default_dir))
bindtextdomain(default_domain, default_dir);
v5 = 1;
return;
}
if (a0[0] == 84) {
if (default_dir)
sh_xfree(default_dir, "locale.c", 0xc3);
if (!a1)
v4 = 0;
else
v4 = strcpy(sh_xmalloc(strlen(a1) + 1, "locale.c", 0xc4), a1);
default_dir = v4;
if (default_domain && *(default_domain))
bindtextdomain(default_domain, default_dir);
v6 = 1;
return;
} else if (a0[3] != 65) {
if (a0[3] != 67 || a0[4] != 84) {
if (a0[3] != 67 || a0[4] != 79) {
if (a0[3] != 77 || a0[4] != 69) {
if (a0[3] != 78 || a0[4] != 85) {
if (a0[3] == 84 && a0[4] == 73 && (!lc_all || !*(lc_all)))
v1 = setlocale(0x2, get_locale_var("LC_TIME"));
} else {
if (!lc_all || !*(lc_all))
v1 = setlocale(0x1, get_locale_var("LC_NUMERIC"));
}
} else {
if (!lc_all || !*(lc_all))
v1 = setlocale(0x5, get_locale_var("LC_MESSAGES"));
}
} else {
if (!lc_all || !*(lc_all))
v1 = setlocale(0x3, get_locale_var("LC_COLLATE"));
}
} else {
if (!lc_all || !*(lc_all)) {
v1 = setlocale(0x0, get_locale_var("LC_CTYPE"));
locale_setblanks();
locale_mb_cur_max = __ctype_get_mb_cur_max(0x0, a1, a2, a3, a4, a5);
if (v1)
locale_mb_cur_max = locale_isutf8(v1);
locale_shiftstates = mblen(NULL, 0x0);
u32reset(0x0, 0x0, a2, a3, a4, a5);
}
}
if (!v1) {
if (*(__errno_location())) {
strerror(*(__errno_location()));
get_locale_var(a0);
internal_warning(gettext("setlocale: %s: cannot change locale (%s): %s"), a0);
} else {
get_locale_var(a0);
internal_warning(gettext("setlocale: %s: cannot change locale (%s)"), a0);
}
}
v9 = v1;
return;
} else {
if (lc_all)
sh_xfree(lc_all, "locale.c", 0xce);
if (a1) {
lc_all = strcpy(sh_xmalloc(strlen(a1) + 1, "locale.c", 0xd0), a1);
} else {
lc_all = sh_xmalloc(0x1, "locale.c", 0xd3);
*(lc_all) = 0;
}
if (!*(lc_all)) {
v7 = reset_locale_vars(a0, a1, a2, a3, a4, a5);
} else {
v1 = setlocale(0x6, lc_all);
v7 = v1;
}
v0 = v7;
if (!v1) {
*(&v7) = *(__errno_location());
if (!v7) {
internal_warning(gettext("setlocale: LC_ALL: cannot change locale (%s)"), lc_all);
} else {
strerror(*(__errno_location()));
internal_warning(gettext("setlocale: LC_ALL: cannot change locale (%s): %s"), lc_all);
}
}
locale_setblanks();
locale_mb_cur_max = __ctype_get_mb_cur_max(a0, a1, a2, a3, a4, a5);
if (*(lc_all) && v1)
locale_mb_cur_max = locale_isutf8(lc_all);
locale_shiftstates = mblen(NULL, 0x0);
u32reset(0x0, 0x0, a2, a3, a4, a5);
v10 = v0;
return;
}
}
|
void
bashline_reset ()
{
tilde_initialize ();
rl_attempted_completion_function = attempt_shell_completion;
rl_completion_entry_function =
((void *)0)
;
rl_ignore_some_completions_function = filename_completion_ignore;
complete_fullquote = 1;
rl_filename_quote_characters = default_filename_quote_characters;
set_filename_bstab (rl_filename_quote_characters);
set_directory_hook ();
rl_filename_stat_hook = bash_filename_stat_hook;
bashline_reset_event_hook ();
rl_sort_completion_matches = 1;
}
| long long bashline_reset() {
tilde_initialize();
rl_attempted_completion_function = attempt_shell_completion;
rl_completion_entry_function = 0;
rl_ignore_some_completions_function = filename_completion_ignore;
complete_fullquote = 1;
rl_filename_quote_characters = default_filename_quote_characters;
set_filename_bstab(rl_filename_quote_characters);
set_directory_hook();
rl_filename_stat_hook = bash_filename_stat_hook;
rl_sort_completion_matches = 1;
return bashline_reset_event_hook();
}
|
sharefile_handle
sharefile_init (const char *mode)
{
struct Hash_tuning;
struct sharefile *p = malloc (sizeof (struct sharefile));
if (p)
{
p->mode = strdup (mode);
if (p->mode)
{
p->table = hash_initialize (DefaultHashTableSize,
((void *)0)
,
entry_hashfunc,
entry_comparator,
entry_free);
if (p->table)
{
return p;
}
else
{
free (p->mode);
free (p);
}
}
else
{
free (p);
}
}
return
((void *)0)
;
}
| long long sharefile_init(char *a0) {
void* v0;
void* v2;
v0 = malloc(0x10);
if (!v0) {
v2 = 0;
return v2;
}
*(v0) = strdup(a0);
if (!*(v0)) {
free(v0);
v2 = 0;
return v2;
}
*(&v0[8]) = hash_initialize(0xb, 0x0, entry_hashfunc, entry_comparator, entry_free);
if (v0[8]) {
v2 = v0;
return v2;
}
free(*(v0));
free(v0);
v2 = 0;
return v2;
}
|
static
_Bool
parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr)
{
options.stay_on_filesystem =
1
;
return parse_noop (entry, argv, arg_ptr);
}
| long parse_xdev()
{
BYTE5(options[1]) = 1;
return parse_noop();
}
|
static void
try_help ()
{
fprintf (
stderr
, "Try `%s --help' for more information.\n",
program_name);
do_exit (1);
}
| void try_help() {
fprintf(stderr, "Try `%s --help' for more information.\n", -116028600);
do_exit(0x1);
}
|
static void unlock_group_files (void)
{
if (gr_unlock () == 0) {
fprintf (
stderr
, gettext ("%s: failed to unlock %s\n"), Prog, gr_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failed to unlock %s", gr_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
gr_locked =
0
;
if (is_shadow_grp) {
if (sgr_unlock () == 0) {
fprintf (
stderr
, gettext ("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failed to unlock %s", sgr_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
sgr_locked =
0
;
}
}
| void unlock_group_files() {
void* v0;
void* v1;
char *v2;
char *v3;
unsigned long long v5;
unsigned long long v6;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
if (!gr_unlock()) {
v5 = gr_dbname();
fprintf(stderr, gettext("%s: failed to unlock %s\n"));
v2 = setlocale(0x6, NULL);
v0 = 0;
if (v2)
v0 = strdup(v2);
if (v0)
setlocale(0x6, "C");
gr_dbname();
syslog(0x3, "failed to unlock %s");
if (v0) {
setlocale(0x6, v0);
free(v0);
}
}
gr_locked = 0;
v6 = is_shadow_grp;
if (is_shadow_grp) {
if (!sgr_unlock()) {
v8 = sgr_dbname();
fprintf(stderr, gettext("%s: failed to unlock %s\n"));
v3 = setlocale(0x6, NULL);
v1 = 0;
if (v3)
v1 = strdup(v3);
if (v1)
setlocale(0x6, "C");
sgr_dbname();
v9 = syslog(0x3, "failed to unlock %s");
if (v1) {
setlocale(0x6, v1);
v10 = free(v1);
}
}
sgr_locked = 0;
}
return;
}
|
int
_ssh_send_banner(struct ssh *ssh, struct sshbuf *banner)
{
char *cp;
int r;
if ((r = sshbuf_putf(banner, "SSH-2.0-%.100s\r\n", "OpenSSH_9.1")) != 0)
return r;
if ((r = sshbuf_putb(ssh_packet_get_output(ssh), banner)) != 0)
return r;
if ((r = sshbuf_consume_end(banner, 2)) != 0)
return r;
if ((cp = sshbuf_dup_string(banner)) ==
((void *)0)
)
return -2;
sshlog("ssh_api.c", __func__, 422, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Local version string %.100s", cp);
free(cp);
return 0;
}
| int _ssh_send_banner(unsigned long long a0, unsigned long long a1) {
unsigned int v0;
void* v1;
unsigned int v3;
v0 = sshbuf_putf(a1, "SSH-2.0-%.100s\r\n", "OpenSSH_9.1");
if (v0) {
v3 = v0;
} else {
v3 = ssh_packet_get_output(a0);
v0 = sshbuf_putb(v3, a1, v3);
if (v0) {
v3 = v0;
} else {
v0 = sshbuf_consume_end(a1, 0x2);
if (v0) {
v3 = v0;
} else {
v1 = sshbuf_dup_string(a1);
if (!v1) {
v3 = -2;
} else {
sshlog("ssh_api.c", "_ssh_send_banner", 0x1a6, 0x0, 0x5, 0x0, "Local version string %.100s", v1);
free(v1);
v3 = 0;
}
}
}
}
return v3;
}
|
void
print_context_script (struct change *script,
_Bool
unidiff)
{
if (ignore_blank_lines || ignore_regexp.fastmap)
mark_ignorable (script);
else
{
struct change *e;
for (e = script; e; e = e->link)
e->ignore =
0
;
}
find_function_last_search = - files[0].prefix_lines;
find_function_last_match =
(9223372036854775807L)
;
if (unidiff)
print_script (script, find_hunk, pr_unidiff_hunk);
else
print_script (script, find_hunk, pr_context_hunk);
}
| long long print_context_script(unsigned long a0, unsigned long a1) {
struct_0 *v0;
unsigned long long v2;
if (!ignore_blank_lines && !c_isspace) {
for (v0 = a0; v0; v0 = v0->field_0) {
v0->field_28 = 0;
}
}
if (ignore_blank_lines || c_isspace)
mark_ignorable(a0);
find_function_last_search = -(*(5243216));
find_function_last_match = 9223372036854775807;
if (a1)
v2 = print_script(a0, find_hunk, pr_unidiff_hunk);
else
v2 = print_script(a0, find_hunk, pr_context_hunk);
return v2;
}
|
0
)
do { fprintf (
stderr
, gettext ("Try '%s --help' for more information.\n"), program_name); } while (0);
| int fprintf(FILE *__stream,char *__format,...)
{
halt_baddata();
}
|
static
_Bool
edit (struct line_filter *left, char const *lname, lin lline, lin llen,
struct line_filter *right, char const *rname, lin rline, lin rlen,
FILE *outfile)
{
for (;;)
{
int cmd0 ;
int cmd1 ;
_Bool
gotcmd =
0
;
while (! gotcmd)
{
if (putchar_unlocked ('%') != '%')
perror_fatal (gettext ("write failed"));
ck_fflush (
stdout
);
cmd0 = skip_white ();
switch (cmd0)
{
case '1': case '2': case 'l': case 'r':
case 's': case 'v': case 'q':
if (skip_white () != '\n')
{
give_help ();
flush_line ();
continue;
}
gotcmd =
1
;
break;
case 'e':
cmd1 = skip_white ();
switch (cmd1)
{
case '1': case '2': case 'b': case 'd': case 'l': case 'r':
if (skip_white () != '\n')
{
give_help ();
flush_line ();
continue;
}
gotcmd =
1
;
break;
case '\n':
gotcmd =
1
;
break;
default:
give_help ();
flush_line ();
continue;
}
break;
case
(-1)
:
if (feof_unlocked (
stdin
))
{
gotcmd =
1
;
cmd0 = 'q';
break;
}
__attribute__ ((__fallthrough__));
default:
flush_line ();
__attribute__ ((__fallthrough__));
case '\n':
give_help ();
continue;
}
}
switch (cmd0)
{
case '1': case 'l':
lf_copy (left, llen, outfile);
lf_skip (right, rlen);
return
1
;
case '2': case 'r':
lf_copy (right, rlen, outfile);
lf_skip (left, llen);
return
1
;
case 's':
suppress_common_lines =
1
;
break;
case 'v':
suppress_common_lines =
0
;
break;
case 'q':
return
0
;
case 'e':
{
int fd;
if (tmpname)
tmp = fopen (tmpname, "w");
else
{
if ((fd = temporary_file ()) < 0)
perror_fatal ("mkstemp");
tmp = fdopen (fd, "w");
}
if (! tmp)
perror_fatal (tmpname);
switch (cmd1)
{
case 'd':
if (llen)
{
printint l1 = lline;
printint l2 = lline + llen - 1;
if (llen == 1)
fprintf (tmp, "--- %s %""l""d\n", lname, l1);
else
fprintf (tmp, "--- %s %""l""d,%""l""d\n", lname, l1, l2);
}
__attribute__ ((__fallthrough__));
case '1': case 'b': case 'l':
lf_copy (left, llen, tmp);
break;
default:
lf_skip (left, llen);
break;
}
switch (cmd1)
{
case 'd':
if (rlen)
{
printint l1 = rline;
printint l2 = rline + rlen - 1;
if (rlen == 1)
fprintf (tmp, "+++ %s %""l""d\n", rname, l1);
else
fprintf (tmp, "+++ %s %""l""d,%""l""d\n", rname, l1, l2);
}
__attribute__ ((__fallthrough__));
case '2': case 'b': case 'r':
lf_copy (right, rlen, tmp);
break;
default:
lf_skip (right, rlen);
break;
}
ck_fclose (tmp);
{
int wstatus;
int werrno = 0;
char const *argv[3];
ignore_SIGINT =
1
;
checksigs ();
argv[0] = editor_program;
argv[1] = tmpname;
argv[2] = 0;
{
pid_t pid;
pid = fork ();
if (pid == 0)
{
execvp (editor_program, (char **) argv);
_exit (
(*__errno_location ())
==
2
? 127 : 126);
}
if (pid < 0)
perror_fatal ("fork");
while (waitpid (pid, &wstatus, 0) < 0)
if (
(*__errno_location ())
==
4
)
checksigs ();
else
perror_fatal ("waitpid");
}
ignore_SIGINT =
0
;
check_child_status (werrno, wstatus,
0
,
editor_program);
}
{
char buf[((size_t) 65536)];
size_t size;
tmp = ck_fopen (tmpname, "r");
while ((size = ck_fread (buf, ((size_t) 65536), tmp)) != 0)
{
checksigs ();
ck_fwrite (buf, size, outfile);
}
ck_fclose (tmp);
}
return
1
;
}
default:
give_help ();
break;
}
}
}
| int edit(void* a0, unsigned long long a1, unsigned long a2, unsigned int a3, void* a4, unsigned long long a5, unsigned long v19, unsigned int a6, void* a7) {
void* v0;
char v1;
char v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned long v8;
unsigned long v9;
unsigned long v10;
unsigned long v11;
unsigned long v12;
unsigned long v13;
void* v14;
char v15;
char v16;
unsigned long long v17;
unsigned long v18;
unsigned long long *v20;
unsigned int v21;
do {
v17 = v17;
} while (&v17 != &v16);
v0 = a7;
v18 = v20[5];
while (true) {
v1 = 0;
while ((v1 ^ 1)) {
v21 = putchar_unlocked(0x25);
if (v21 != 37)
perror_fatal(gettext("write failed"));
ck_fflush(stdout);
v3 = skip_white(a0, a1, 1 << ((v4 - 98) & 63), v4 - 98, a4, a5);
if (v3 != 118 && v3 <= 118 && v3 <= 115 && v3 < 113 && v3 != 108 && v3 <= 108) {
if (v3 == 101) {
v4 = skip_white(a0, a1, 1 << ((v4 - 98) & 63), v4 - 98, a4, a5);
if (v4 <= 114) {
if (v4 < 98 && v4 == 10)
v1 = 1;
if (v4 < 98 || ((1 << ((v4 - 98) & 63)) & 66565)) {
if (v4 >= 98 || v4 - 49 <= 1 && v4 != 10 && v4 >= 10) {
v21 = skip_white(a0, a1, 1 << ((v4 - 98) & 63), v4 - 98, a4, a5);
if (v21 != 10) {
give_help();
flush_line();
continue;
} else {
v1 = 1;
}
}
if ((v4 == 10 || v21 == 10) && (v4 < 98 || v21 == 10) && (v4 == 10 || v4 - 49 <= 1 || v4 >= 98) && (v4 == 10 || v4 >= 98 || v4 >= 10))
continue;
}
}
if (v4 > 114 || !((1 << ((v4 - 98) & 63)) & 66565) && v4 >= 98 || v4 < 98 && v4 < 10 && v4 != 10 || v4 < 98 && v4 != 10 && v4 - 49 > 1) {
give_help();
flush_line();
continue;
}
} else if (v3 <= 101 && v3 <= 50 && v3 < 49 && v3 == -1) {
v21 = feof_unlocked(stdin);
if (v21) {
v1 = 1;
v3 = 113;
continue;
}
}
}
if (v3 == 118 || v3 <= 118 && v3 <= 115 && v3 != 118 && v3 >= 113 || v3 <= 118 && v3 < 113 && v3 == 108 && v3 <= 115 && v3 != 118 || v3 <= 118 && v3 <= 101 && v3 <= 50 && v3 < 113 && v3 <= 108 && v3 <= 115 && v3 != 118 && v3 != 101 && v3 != 108 && v3 >= 49) {
v21 = skip_white(a0, a1, 1 << ((v4 - 98) & 63), v4 - 98, a4, a5);
if (v21 != 10) {
give_help();
flush_line();
continue;
} else {
v1 = 1;
continue;
}
}
if (v3 > 118 && v3 != 118 || v3 <= 118 && v3 != 118 && v3 > 115 || v3 <= 118 && v3 < 113 && v3 <= 115 && v3 != 118 && v3 != 108 && v3 > 108 || v3 <= 118 && v3 < 113 && v3 <= 108 && v3 <= 115 && v3 > 101 && v3 != 118 && v3 != 101 && v3 != 108 || v3 <= 118 && v3 <= 101 && v3 < 113 && v3 <= 108 && v3 <= 115 && v3 != 118 && v3 > 50 && v3 != 101 && v3 != 108 || v3 <= 118 && !v21 && v3 == -1 && v3 <= 101 && v3 <= 50 && v3 < 113 && v3 < 49 && v3 <= 108 && v3 <= 115 && v3 != 118 && v3 != 101 && v3 != 108 || v3 <= 118 && v3 <= 101 && v3 <= 50 && v3 < 113 && v3 < 49 && v3 <= 108 && v3 <= 115 && v3 != -1 && v3 != 118 && v3 != 10 && v3 != 101 && v3 != 108)
flush_line();
if (v3 != 101 || !v21 || v3 != 118 || v3 < 113 || v3 != 108 || v3 < 49)
give_help();
}
if (v3 <= 118 && v3 >= 101) {
switch (v3) {
case 101:
if (tmpname) {
tmp = fopen(tmpname, "w");
} else {
v5 = temporary_file();
if (v5 < 0)
perror_fatal("mkstemp");
tmp = fdopen(v5, "w");
}
if (tmpname || v5 >= 0) {
if (!tmp)
perror_fatal(tmpname);
if (v4 != 108) {
if (v4 <= 108 && v4 == 100 && a3) {
v8 = a3 + a2 - 1;
if (a3 == 1)
fprintf(tmp, "--- %s %ld\n", a1, a2);
else
fprintf(tmp, "--- %s %ld,%ld\n", a1, a2, v8);
}
if ((v4 != 100 || v4 > 108) && (v4 != 98 || v4 > 100 || v4 > 108) && (v4 != 49 || v4 > 100 || v4 > 108))
lf_skip(a0, a3);
}
if (v4 == 108 || v4 == 100 && v4 <= 108 || v4 == 98 && v4 <= 100 && v4 <= 108 || v4 == 49 && v4 <= 100 && v4 <= 108)
lf_copy(a0, a3, tmp);
if (v4 != 114) {
if (v4 <= 114 && v4 == 100 && *(&a6)) {
v9 = v19;
v10 = *(&a6) + v19 - 1;
if (*(&a6) == 1)
fprintf(tmp, "+++ %s %ld\n", a5, v9);
else
fprintf(tmp, "+++ %s %ld,%ld\n", a5, v9, v10);
}
if ((v4 != 100 || v4 > 114) && (v4 != 98 || v4 > 114 || v4 > 100) && (v4 != 50 || v4 > 114 || v4 > 100))
lf_skip(a4, *(&a6));
}
if (v4 == 114 || v4 == 100 && v4 <= 114 || v4 == 98 && v4 <= 114 && v4 <= 100 || v4 == 50 && v4 <= 114 && v4 <= 100)
lf_copy(a4, *(&a6), tmp);
ck_fclose(tmp);
v6 = 0;
ignore_SIGINT = 1;
checksigs();
v12 = editor_program;
v13 = tmpname;
v14 = 0;
v7 = fork();
execvp(editor_program, &v12);
v21 = *(__errno_location());
if (v21 == 2)
v21 = 127;
else
v21 = 126;
_exit(v21);
perror_fatal("fork");
while (true) {
v21 = waitpid(v7, &v2, 0x0);
if (v21 < 0) {
v21 = *(__errno_location());
if (v21 == 4)
checksigs();
else
perror_fatal("waitpid");
} else {
ignore_SIGINT = 0;
check_child_status(v6, *(&v2), 0x0, editor_program);
tmp = ck_fopen(tmpname, "r");
while (true) {
v11 = ck_fread(&v15, 0x10000, tmp);
if (!v11)
break;
checksigs();
ck_fwrite(&v15, v11, v0);
}
ck_fclose(tmp);
v21 = 1;
break;
}
}
}
case 108:
lf_copy(a0, a3, v0);
lf_skip(a4, *(&a6));
v21 = 1;
break;
case 113:
v21 = 0;
break;
case 114:
lf_copy(a4, *(&a6), v0);
lf_skip(a0, a3);
v21 = 1;
break;
case 115:
suppress_common_lines = 1;
case 118:
suppress_common_lines = 0;
default:
give_help();
}
}
if ((v18 ^ v20[5]))
__stack_chk_fail();
return v21;
}
}
|
errcode_t e2fsck_allocate_context(e2fsck_t *ret)
{
e2fsck_t context;
errcode_t retval;
char *time_env;
retval = ext2fs_get_mem(sizeof(struct e2fsck_struct), &context);
if (retval)
return retval;
memset(context, 0, sizeof(struct e2fsck_struct));
context->process_inode_size = 256;
context->ext_attr_ver = 2;
context->blocks_per_page = 1;
context->htree_slack_percentage = 255;
time_env = getenv("E2FSCK_TIME");
if (time_env)
context->now = (time_t) strtoull(time_env,
((void *)0)
, 0);
else {
context->now = time(0);
if (context->now < 1262322000)
context->flags |= 0x2000;
}
*ret = context;
return 0;
}
| long long e2fsck_allocate_context(unsigned long long *a0) {
char v0;
int tmp_21;
unsigned long long v1;
char *v2;
void* v4;
unsigned long long v6;
v1 = ext2fs_get_mem(0x3f8, &v0);
if (v1) {
v4 = v1;
} else {
memset(*(&v0), 0x0, 0x3f8);
*((*(&v0) + 600)) = 0x100;
*((*(&v0) + 856)) = 2;
*((*(&v0) + 872)) = 1;
*((*(&v0) + 608)) = 255;
v2 = getenv("E2FSCK_TIME");
if (v2) {
*((*(&v0) + 840)) = strtoull(v2, NULL, 0x0);
} else {
*((*(&v0) + 840)) = time(NULL);
if (*((*(&v0) + 840)) <= 1262321999) {
v6 = *((*(&v0) + 72));
*(&v6) = (*((*(&v0) + 72)) >> 8) | 32;
tmp_21 = v6;
*((*(&v0) + 72)) = tmp_21;
}
}
*(a0) = *(&v0);
v4 = 0;
}
return v4;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.