input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
int
strsnvisx(char *mbdst, size_t dlen, const char *mbsrc, size_t len, int flags,
const char *mbextra)
{
return istrsenvisxna(mbdst, &dlen, mbsrc, len, flags, mbextra,
((void *)0)
);
}
| long long strsnvisx(unsigned int a0, unsigned long a1, char *a2, unsigned long a3, unsigned long a4, void* a5) {
unsigned long v0;
v0 = a1;
return istrsenvisxna(a0, &v0, a2, a3, a4, a5, NULL);
}
|
em_kill_region(EditLine *el, wint_t c __attribute__((__unused__)))
{
wchar_t *kp, *cp;
if (!el->el_chared.c_kill.mark)
return 6;
if (el->el_chared.c_kill.mark > el->el_line.cursor) {
cp = el->el_line.cursor;
kp = el->el_chared.c_kill.buf;
while (cp < el->el_chared.c_kill.mark)
*kp++ = *cp++;
el->el_chared.c_kill.last = kp;
c_delafter(el, (int)(cp - el->el_line.cursor));
} else {
cp = el->el_chared.c_kill.mark;
kp = el->el_chared.c_kill.buf;
while (cp < el->el_line.cursor)
*kp++ = *cp++;
el->el_chared.c_kill.last = kp;
c_delbefore(el, (int)(cp - el->el_chared.c_kill.mark));
el->el_line.cursor = el->el_chared.c_kill.mark;
}
return 4;
}
| long long em_kill_region(unsigned long long a0[115], unsigned long a1) {
unsigned int v0;
int tmp_10;
unsigned long long v1;
unsigned int *v2;
unsigned long long v4;
unsigned int *v5;
unsigned int *v6;
v0 = a1;
if (!a0[114]) {
v4 = 6;
return v4;
} else if (a0[114] > a0[11]) {
v2 = a0[11];
for (v1 = a0[112]; v2 < a0[114]; *(v6) = *(tmp_10)) {
tmp_10 = v2;
v2 = v2 + 1;
v6 = v1;
v1 += 4;
}
a0[113] = v1;
c_delafter(a0, v2 + -1 * a0[11] >> 2, v2 + -1 * a0[11] >> 2);
v4 = 4;
return v4;
} else {
v2 = a0[114];
for (v1 = a0[112]; v2 < a0[11]; *(v5) = *(tmp_10)) {
tmp_10 = v2;
v2 = v2 + 1;
v5 = v1;
v1 += 4;
}
a0[113] = v1;
c_delbefore(a0, v2 + -1 * a0[114] >> 2, v2 + -1 * a0[114] >> 2);
a0[11] = a0[114];
v4 = 4;
return v4;
}
}
|
void *
reallocf(void *ptr, size_t size)
{
void *nptr;
nptr = realloc(ptr, size);
if (!nptr && ptr && size != 0)
free(ptr);
return (nptr);
}
| void * reallocf(void *a1, size_t a2)
{
void *v3;
v3 = realloc(a1, a2);
if ( !v3 && a1 && a2 )
free(a1);
return v3;
}
|
static int __ipnh_cache_parse_nlmsg(const struct nlmsghdr *n,
struct nh_entry *nhe)
{
int err, len;
len = n->nlmsg_len - ( ((((sizeof(struct nhmsg)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))))+4U -1) & ~(4U -1) );
if (len < 0) {
fprintf(
stderr
, "BUG: wrong nlmsg len %d\n", len);
return -
22
;
}
err = ipnh_parse_nhmsg(
stderr
, ((void *)(((char *)n) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) )))), len, nhe);
if (err) {
fprintf(
stderr
, "Error parsing nexthop: %s\n", strerror(-err));
return err;
}
return 0;
}
| int __ipnh_cache_parse_nlmsg(unsigned int *a0, void* a1) {
unsigned int v0;
unsigned int v1;
unsigned int v3;
v0 = *(a0) - 24;
if (v0 < 0) {
fprintf(*(&stderr), "BUG: wrong nlmsg len %d\n", v0);
v3 = -22;
return v3;
}
v1 = ipnh_parse_nhmsg(*(&stderr), a0 + 4, v0, a1);
if (!v1) {
v3 = 0;
return v3;
}
fprintf(*(&stderr), "Error parsing nexthop: %s\n", strerror(-(v1)));
v3 = v1;
return v3;
}
|
static inline void
emit_mandatory_arg_note (void)
{
fputs_unlocked (gettext ("\nMandatory arguments to long options are mandatory for short options too.\n"),
stdout
)
;
}
| void emit_mandatory_arg_note() {
unsigned long long v1;
v1 = fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory for short options too.\n"), stdout);
return;
}
|
char *
match_list(const char *client, const char *server, u_int *next)
{
char *sproposals[40];
char *c, *s, *p, *ret, *cp, *sp;
int i, j, nproposals;
c = cp = xstrdup(client);
s = sp = xstrdup(server);
for ((p = strsep(&sp, ",")), i=0; p && *p != '\0';
(p = strsep(&sp, ",")), i++) {
if (i < 40)
sproposals[i] = p;
else
break;
}
nproposals = i;
for ((p = strsep(&cp, ",")), i=0; p && *p != '\0';
(p = strsep(&cp, ",")), i++) {
for (j = 0; j < nproposals; j++) {
if (strcmp(p, sproposals[j]) == 0) {
ret = xstrdup(p);
if (next !=
((void *)0)
)
*next = (cp ==
((void *)0)
) ?
strlen(c) : (u_int)(cp - c);
free(c);
free(s);
return ret;
}
}
}
if (next !=
((void *)0)
)
*next = strlen(c);
free(c);
free(s);
return
((void *)0)
;
}
| long match_list(long a1, long a2, int *a3)
{
int v3;
int i;
int v7;
int j;
int v9;
char *v10;
char *stringp;
char *s1;
char *s;
void *ptr;
long v15;
char *s2[42];
s2[41] = (char *)__readfsqword(0x28u);
v10 = (char *)xstrdup(a1);
s = v10;
stringp = (char *)xstrdup(a2);
ptr = stringp;
s1 = strsep(&stringp, ",");
for ( i = 0; s1 && *s1 && i <= 39; ++i )
{
s2[i] = s1;
s1 = strsep(&stringp, ",");
}
v9 = i;
s1 = strsep(&v10, ",");
v7 = 0;
LABEL_18:
if ( s1 && *s1 )
{
for ( j = 0; ; ++j )
{
if ( j >= v9 )
{
s1 = strsep(&v10, ",");
++v7;
goto LABEL_18;
}
if ( !strcmp(s1, s2[j]) )
break;
}
v15 = xstrdup(s1);
if ( a3 )
{
if ( v10 )
v3 = (_DWORD)v10 - (_DWORD)s;
else
v3 = strlen(s);
*a3 = v3;
}
free(s);
free(ptr);
return v15;
}
else
{
if ( a3 )
*a3 = strlen(s);
free(s);
free(ptr);
return 0LL;
}
}
|
char *
find_token_in_alist (token, alist, flags)
int token;
STRING_INT_ALIST *alist;
int flags;
{
register int i;
for (i = 0; alist[i].word; i++)
{
if (alist[i].token == token)
return ((char *)strcpy (sh_xmalloc((1 + strlen (alist[i].word)), "stringlib.c", 88), (alist[i].word)));
}
return ((char *)
((void *)0)
);
}
| long long find_token_in_alist(unsigned long a0, void* a1, unsigned long a2) {
unsigned int v0;
void* v2;
void* v3;
v0 = a2;
v2 = 0;
while (true) {
if (!*((a1 + 0x10 * v2))) {
v3 = 0;
break;
} else if (a0 == *((8 + a1 + 0x10 * v2))) {
v3 = strcpy(sh_xmalloc(strlen(*((a1 + 0x10 * v2))) + 1, "stringlib.c", 0x58), *((a1 + 0x10 * v2)));
break;
} else {
v2 = v2 + 1;
}
}
return v3;
}
|
void
usage (int status)
{
if (status !=
0
)
do { fprintf (
stderr
, gettext ("Try '%s --help' for more information.\n"), program_name); } while (0);
else
{
printf (gettext ("Usage: %s [OPTION]... [OWNER][:[GROUP]] FILE...\n or: %s [OPTION]... --reference=RFILE FILE...\n")
,
program_name, program_name);
fputs_unlocked (gettext ("Change the owner and/or group of each FILE to OWNER and/or GROUP.\nWith --reference, change the owner and group of each FILE to those of RFILE.\n\n"),
stdout
)
;
fputs_unlocked (gettext (" -c, --changes like verbose but report only when a change is made\n -f, --silent, --quiet suppress most error messages\n -v, --verbose output a diagnostic for every file processed\n"),
stdout
)
;
fputs_unlocked (gettext (" --dereference affect the referent of each symbolic link (this is\n the default), rather than the symbolic link itself\n -h, --no-dereference affect symbolic links instead of any referenced file\n"),
stdout
)
;
fputs_unlocked (gettext (" (useful only on systems that can change the\n ownership of a symlink)\n"),
stdout
)
;
fputs_unlocked (gettext (" --from=CURRENT_OWNER:CURRENT_GROUP\n change the owner and/or group of each file only if\n its current owner and/or group match those specified\n here. Either may be omitted, in which case a match\n is not required for the omitted attribute\n"),
stdout
)
;
fputs_unlocked (gettext (" --no-preserve-root do not treat '/' specially (the default)\n --preserve-root fail to operate recursively on '/'\n"),
stdout
)
;
fputs_unlocked (gettext (" --reference=RFILE use RFILE's owner and group rather than\n specifying OWNER:GROUP values\n"),
stdout
)
;
fputs_unlocked (gettext (" -R, --recursive operate on files and directories recursively\n"),
stdout
)
;
fputs_unlocked (gettext ("\nThe following options modify how a hierarchy is traversed when the -R\noption is also specified. If more than one is specified, only the final\none takes effect.\n\n -H if a command line argument is a symbolic link\n to a directory, traverse it\n -L traverse every symbolic link to a directory\n encountered\n -P do not traverse any symbolic links (default)\n\n"),
stdout
)
;
fputs_unlocked (gettext (" --help display this help and exit\n"),
stdout
);
fputs_unlocked (gettext (" --version output version information and exit\n"),
stdout
);
fputs_unlocked (gettext ("\nOwner is unchanged if missing. Group is unchanged if missing, but changed\nto login group if implied by a ':' following a symbolic OWNER.\nOWNER and GROUP may be numeric as well as symbolic.\n"),
stdout
)
;
printf (gettext ("\nExamples:\n %s root /u Change the owner of /u to \"root\".\n %s root:staff /u Likewise, but also change its group to \"staff\".\n %s -hR root /u Change the owner of /u and subfiles to \"root\".\n")
,
program_name, program_name, program_name);
emit_ancillary_info ("chown");
}
exit (status);
}
| void usage(int a1)
{
long v1;
char *v2;
long v3;
long v4;
char *v5;
FILE *v6;
char *v7;
FILE *v8;
char *v9;
FILE *v10;
char *v11;
FILE *v12;
char *v13;
FILE *v14;
char *v15;
FILE *v16;
char *v17;
FILE *v18;
char *v19;
FILE *v20;
char *v21;
FILE *v22;
char *v23;
FILE *v24;
char *v25;
FILE *v26;
char *v27;
FILE *v28;
char *v29;
long v30;
long v31;
long v32;
char *v33;
if ( a1 )
{
v1 = program_name;
v2 = gettext("Try '%s --help' for more information.\n");
fprintf(stderr, v2, v1);
}
else
{
v3 = program_name;
v4 = program_name;
v5 = gettext("Usage: %s [OPTION]... [OWNER][:[GROUP]] FILE...\n or: %s [OPTION]... --reference=RFILE FILE...\n");
printf(v5, v4, v3);
v6 = stdout;
v7 = gettext(
"Change the owner and/or group of each FILE to OWNER and/or GROUP.\n"
"With --reference, change the owner and group of each FILE to those of RFILE.\n"
"\n");
fputs_unlocked(v7, v6);
v8 = stdout;
v9 = gettext(
" -c, --changes like verbose but report only when a change is made\n"
" -f, --silent, --quiet suppress most error messages\n"
" -v, --verbose output a diagnostic for every file processed\n");
fputs_unlocked(v9, v8);
v10 = stdout;
v11 = gettext(
" --dereference affect the referent of each symbolic link (this is\n"
" the default), rather than the symbolic link itself\n"
" -h, --no-dereference affect symbolic links instead of any referenced file\n");
fputs_unlocked(v11, v10);
v12 = stdout;
v13 = gettext(
" (useful only on systems that can change the\n"
" ownership of a symlink)\n");
fputs_unlocked(v13, v12);
v14 = stdout;
v15 = gettext(
" --from=CURRENT_OWNER:CURRENT_GROUP\n"
" change the owner and/or group of each file only if\n"
" its current owner and/or group match those specified\n"
" here. Either may be omitted, in which case a match\n"
" is not required for the omitted attribute\n");
fputs_unlocked(v15, v14);
v16 = stdout;
v17 = gettext(
" --no-preserve-root do not treat '/' specially (the default)\n"
" --preserve-root fail to operate recursively on '/'\n");
fputs_unlocked(v17, v16);
v18 = stdout;
v19 = gettext(
" --reference=RFILE use RFILE's owner and group rather than\n"
" specifying OWNER:GROUP values\n");
fputs_unlocked(v19, v18);
v20 = stdout;
v21 = gettext(" -R, --recursive operate on files and directories recursively\n");
fputs_unlocked(v21, v20);
v22 = stdout;
v23 = gettext(
"\n"
"The following options modify how a hierarchy is traversed when the -R\n"
"option is also specified. If more than one is specified, only the final\n"
"one takes effect.\n"
"\n"
" -H if a command line argument is a symbolic link\n"
" to a directory, traverse it\n"
" -L traverse every symbolic link to a directory\n"
" encountered\n"
" -P do not traverse any symbolic links (default)\n"
"\n");
fputs_unlocked(v23, v22);
v24 = stdout;
v25 = gettext(" --help display this help and exit\n");
fputs_unlocked(v25, v24);
v26 = stdout;
v27 = gettext(" --version output version information and exit\n");
fputs_unlocked(v27, v26);
v28 = stdout;
v29 = gettext(
"\n"
"Owner is unchanged if missing. Group is unchanged if missing, but changed\n"
"to login group if implied by a ':' following a symbolic OWNER.\n"
"OWNER and GROUP may be numeric as well as symbolic.\n");
fputs_unlocked(v29, v28);
v30 = program_name;
v31 = program_name;
v32 = program_name;
v33 = gettext(
"\n"
"Examples:\n"
" %s root /u Change the owner of /u to \"root\".\n"
" %s root:staff /u Likewise, but also change its group to \"staff\".\n"
" %s -hR root /u Change the owner of /u and subfiles to \"root\".\n");
printf(v33, v32, v31, v30);
emit_ancillary_info("chown");
}
exit(a1);
}
|
void *
realloc (mem, nbytes)
void * mem;
size_t nbytes;
{
return internal_realloc (mem, nbytes, (char *)
((void *)0)
, 0, 0);
}
| long long realloc(unsigned long a0, unsigned int a1) {
return internal_realloc(a0, a1, 0x0, 0x0, 0x0);
}
|
user *
load_user (int crontab_fd, struct passwd *pw, const char *uname,
const char *fname, const char *tabname) {
char envstr[131072];
FILE *file;
user *u;
entry *e;
int status = 1, save_errno = 0;
char **envp =
((void *)0)
, **tenvp;
int envs = 0, entries = 0;
if (!(file = fdopen(crontab_fd, "r"))) {
save_errno =
(*__errno_location ())
;
log_it(uname, getpid (), "FAILED", "fdopen on crontab_fd in load_user",
save_errno);
close(crontab_fd);
return (
((void *)0)
);
}
if ((DebugFlags & (0x0008)) != 0) printf ("load_user()\n");
if ((u = (user *) malloc (sizeof (user))) ==
((void *)0)
) {
save_errno =
(*__errno_location ())
;
goto done;
}
memset(u, 0, sizeof(*u));
if (((u->name = strdup(fname)) ==
((void *)0)
)
|| ((u->tabname = strdup(tabname)) ==
((void *)0)
)) {
save_errno =
(*__errno_location ())
;
goto done;
}
u->system = pw ==
((void *)0)
;
if ((envp = env_init()) ==
((void *)0)
) {
save_errno =
(*__errno_location ())
;
goto done;
}
if (env_set_from_environ(&envp) == 0) {
save_errno =
(*__errno_location ())
;
goto done;
}
while (status >= 0) {
if (!skip_comments(file) && !u->system) {
log_error("too many garbage characters");
status = 1;
break;
}
status = load_env (envstr, file);
switch (status) {
case (-1):
if (envstr[0] != '\0') {
FileName = tabname;
log_error("missing newline before EOF");
}
break;
case 0:
++entries;
if (!u->system && entries > 10000) {
log_error("too many entries");
status = 1;
goto done;
}
FileName = tabname;
e = load_entry(file, log_error, pw, envp);
if (e) {
e->next = u->crontab;
u->crontab = e;
}
break;
case 1:
++envs;
if (!u->system && envs > 1000) {
log_error("too many environment variables");
goto done;
}
if ((tenvp = env_set (envp, envstr)) ==
((void *)0)
) {
save_errno =
(*__errno_location ())
;
goto done;
}
envp = tenvp;
break;
}
}
done:
if (status == 1) {
log_it(uname, getpid(), "FAILED", "loading cron table",
save_errno);
free_user(u);
u =
((void *)0)
;
}
if (envp)
env_free(envp);
fclose(file);
if ((DebugFlags & (0x0008)) != 0) printf ("...load_user() done\n");
(*__errno_location ())
= save_errno;
return (u);
}
| long long load_user(unsigned long a0, unsigned long long a1, unsigned long long a2, char *a3, char *a4) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
void* v5;
void* v6;
void* v7;
unsigned long v8;
unsigned long long *v9;
char v10;
char v11;
unsigned long long v12;
unsigned long v13;
unsigned long long *v15;
void* v16;
do {
v12 = v12;
} while (&v12 != &v11);
v13 = v15[5];
v1 = 1;
v2 = 0;
v5 = 0;
v3 = 0;
v4 = 0;
v7 = fdopen(a0, "r");
if (!v7) {
v2 = *(__errno_location());
log_it(a2, getpid(), "FAILED", "fdopen on crontab_fd in load_user", v2);
close(*(&v0));
v16 = 0;
} else {
if ((DebugFlags & 8))
printf("load_user()\n");
v6 = malloc(0x38);
if (!v6) {
v2 = *(__errno_location());
} else {
memset(v6, 0x0, 0x38);
*(&v6[16]) = strdup(a3);
if (!v6[16]) {
LABEL_40027c:
v2 = *(__errno_location());
} else {
*(&v6[24]) = strdup(a4);
if (!v6[24])
goto LABEL_40027c;
*(&v6[52]) = !a1;
v5 = env_init();
if (!v5) {
v2 = *(__errno_location());
} else if (!env_set_from_environ(&v5)) {
v2 = *(__errno_location());
} else {
while (true) {
if (v1 < 0)
break;
if (!skip_comments(v7) && !v6[52]) {
log_error("too many garbage characters");
v1 = 1;
break;
}
v1 = load_env(&v10, v7, v7);
if (v1 != 1) {
if (!(v1 <= 1))
continue;
if (v1 != -1) {
if (!(!v1))
continue;
v4 += 1;
if (!v6[52] && v4 > 10000) {
log_error("too many entries");
v1 = 1;
break;
}
FileName = a4;
v9 = load_entry(v7, log_error, a1, v5);
if (v9) {
*(v9) = v6[40];
*(&v6[40]) = v9;
}
} else if (v10) {
FileName = a4;
log_error("missing newline before EOF");
}
} else {
v3 += 1;
if (!v6[52] && v3 > 1000) {
log_error("too many environment variables");
break;
}
v8 = env_set(v5, &v10, &v10);
if (!v8) {
v2 = *(__errno_location());
break;
} else {
v5 = v8;
}
}
}
}
}
}
if (v1 == 1) {
log_it(a2, getpid(), "FAILED", "loading cron table", v2);
free_user(v6);
v6 = 0;
}
if (v5)
env_free(v5);
fclose(v7);
if ((DebugFlags & 8))
printf("...load_user() done\n");
*(__errno_location()) = v2;
v16 = v6;
}
if (!(v13 ^ v15[5]))
return v16;
__stack_chk_fail();
}
|
sh_builtin_func_t *
builtin_address (name)
char *name;
{
current_builtin = builtin_address_internal (name, 1);
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)
((void *)0)
);
}
| long builtin_address(const char *a1)
{
current_builtin = builtin_address_internal(a1, 1);
if ( current_builtin )
return *(_QWORD *)(current_builtin + 8LL);
else
return 0LL;
}
|
int
_rl_qsort_string_compare(char **s1, char **s2)
{
return strcoll(*s1, *s2);
}
| long long _rl_qsort_string_compare(unsigned long long *a0, unsigned long long *a1) {
return strcoll(*(a0), *(a1));
}
|
cv__isword(wint_t p)
{
if (iswalnum(p) || p == L'_')
return 1;
if (iswgraph(p))
return 2;
return 0;
}
| long long cv__isword(unsigned long a0) {
char v0;
unsigned long long v2;
unsigned long long v3;
v2 = iswalnum(a0);
if (!v2 && *(&v0) != 95) {
if (iswgraph(*(&v0)))
v3 = 2;
else
v3 = 0;
}
if (*(&v0) == 95 || v2)
v3 = 1;
return v3;
}
|
static const wchar_t *
noedit_wgets(EditLine *el, int *nread)
{
el_line_t *lp = &el->el_line;
int num;
while ((num = (*el->el_read->read_char)(el, lp->lastchar)) == 1) {
if (lp->lastchar + 1 >= lp->limit &&
!ch_enlargebufs(el, (size_t)2))
break;
lp->lastchar++;
if (el->el_flags & 0x008 ||
lp->lastchar[-1] == '\r' ||
lp->lastchar[-1] == '\n')
break;
}
if (num == -1 &&
(*__errno_location ())
==
4
)
lp->lastchar = lp->buffer;
lp->cursor = lp->lastchar;
*lp->lastchar = '\0';
*nread = (int)(lp->lastchar - lp->buffer);
return *nread ? lp->buffer :
((void *)0)
;
}
| void noedit_wgets(struct_0 *a0, unsigned int *a1) {
unsigned int v0;
struct_2 *v1;
unsigned long long v3;
void* v4;
unsigned long long v5;
v1 = &a0->padding_30[32];
do {
v0 = a0->field_4c0->field_10(a0, v1->field_10, v1->field_10, a0->field_4c0->field_10);
if (v0 != 1)
break;
if (v1->field_10 + 1 >= v1->field_18) {
v3 = ch_enlargebufs(a0, 0x2);
if (!v3)
break;
}
if (v3) {
v1->field_10 = v1->field_10 + 1;
if ((a0->field_2c & 8))
break;
if (!(a0->field_2c & 8)) {
if (v1->field_10[1].field_0 == 13)
break;
}
}
} while (v1->field_10[1].field_0 != 10);
if (v0 == -1) {
*(&v3) = *(__errno_location());
if (v3 == 4)
v1->field_10 = v1->field_0;
}
v1->field_8 = v1->field_10;
v1->field_10->field_0 = 0;
*(a1) = v1->field_10 + -1 * v1->field_0 >> 2;
if (*(a1))
v5 = v1->field_0;
else
v4 = 0;
return;
}
|
int isconsole(char *s, char *res, int rlen)
{
struct consdev *c;
int l, sl, i, fd;
char *p, *q;
sl = strlen(s);
for (c = consdev; c->cmdline; c++) {
l = strlen(c->cmdline);
if (sl <= l) continue;
p = s + l;
if (strncmp(s, c->cmdline, l) != 0)
continue;
for (i = 0; i < 2; i++) {
snprintf(res, rlen, i ? c->dev1 : c->dev2, p);
if ((q = strchr(res, ',')) !=
((void *)0)
) *q = 0;
if ((fd = open(res,
00
|
04000
)) >= 0) {
close(fd);
return 1;
}
}
}
snprintf(res, rlen, "/dev/%s", s);
if ((q = strchr(res, ',')) !=
((void *)0)
) *q = 0;
if (istty(res))
return 1;
return 0;
}
| int isconsole(char *a0, char *a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long long v4;
char *v5;
unsigned long v6;
unsigned int v8;
unsigned int v9;
v1 = strlen(a0);
for (v4 = &consdev; *(v4); v4 += 24) {
v2 = strlen(*(v4));
if (v1 > v2) {
v6 = &a0[v2];
if (!strncmp(a0, *(v4), v2)) {
for (v0 = 0; v0 <= 1; v0 += 1) {
v8 = (!v0 ? *((v4 + 8)) : *((v4 + 16)));
snprintf(a1, a2, v8);
v5 = strchr(a1, 0x2c);
if (v5)
*(v5) = 0;
v3 = open(a1, 0x800, a2);
if (v3 >= 0) {
close(v3);
v8 = 1;
return v8;
}
}
}
}
}
snprintf(a1, a2, "/dev/%s", a0);
v9 = 44;
v5 = strchr(a1, 0x2c);
if (v5)
*(v5) = 0;
v8 = istty(a1, reg_64, "/dev/%s");
v8 = (!v8 ? 1 : 0);
return v8;
}
|
static void gre_print_help(struct link_util *lu, int argc, char **argv, FILE *f)
{
fprintf(f,
"Usage: ... %-9s [ remote ADDR ]\n"
" [ local ADDR ]\n"
" [ [no][i|o]seq ]\n"
" [ [i|o]key KEY | no[i|o]key ]\n"
" [ [no][i|o]csum ]\n"
" [ hoplimit TTL ]\n"
" [ encaplimit ELIM ]\n"
" [ tclass TCLASS ]\n"
" [ flowlabel FLOWLABEL ]\n"
" [ dscp inherit ]\n"
" [ dev PHYS_DEV ]\n"
" [ fwmark MARK ]\n"
" [ [no]allow-localremote ]\n"
" [ external ]\n"
" [ noencap ]\n"
" [ encap { fou | gue | none } ]\n"
" [ encap-sport PORT ]\n"
" [ encap-dport PORT ]\n"
" [ [no]encap-csum ]\n"
" [ [no]encap-csum6 ]\n"
" [ [no]encap-remcsum ]\n"
" [ erspan_ver version ]\n"
" [ erspan IDX ]\n"
" [ erspan_dir { ingress | egress } ]\n"
" [ erspan_hwid hwid ]\n"
"\n"
"Where: ADDR := IPV6_ADDRESS\n"
" TTL := { 0..255 } (default=%d)\n"
" KEY := { DOTTED_QUAD | NUMBER }\n"
" ELIM := { none | 0..255 }(default=%d)\n"
" TCLASS := { 0x0..0xff | inherit }\n"
" FLOWLABEL := { 0x0..0xfffff | inherit }\n"
" MARK := { 0x0..0xffffffff | inherit }\n",
lu->id,
(64), 4);
}
| void gre_print_help(struct_0 *a0, unsigned long a1, unsigned long a2, void* a3) {
unsigned long v0;
unsigned int v1;
unsigned long long v3;
v1 = a1;
v0 = a2;
v3 = fprintf(a3, "Usage: ... %-9s\t[ remote ADDR ]\n\t\t\t[ local ADDR ]\n\t\t\t[ [no][i|o]seq ]\n\t\t\t[ [i|o]key KEY | no[i|o]key ]\n\t\t\t[ [no][i|o]csum ]\n\t\t\t[ hoplimit TTL ]\n\t\t\t[ encaplimit ELIM ]\n\t\t\t[ tclass TCLASS ]\n\t\t\t[ flowlabel FLOWLABEL ]\n\t\t\t[ dscp inherit ]\n\t\t\t[ dev PHYS_DEV ]\n\t\t\t[ fwmark MARK ]\n\t\t\t[ [no]allow-localremote ]\n\t\t\t[ external ]\n\t\t\t[ noencap ]\n\t\t\t[ encap { fou | gue | none } ]\n\t\t\t[ encap-sport PORT ]\n\t\t\t[ encap-dport PORT ]\n\t\t\t[ [no]encap-csum ]\n\t\t\t[ [no]encap-csum6 ]\n\t\t\t[ [no]encap-remcsum ]\n\t\t\t[ erspan_ver version ]\n\t\t\t[ erspan IDX ]\n\t\t\t[ erspan_dir { ingress | egress } ]\n\t\t\t[ erspan_hwid hwid ]\n\nWhere:\tADDR\t := IPV6_ADDRESS\n\tTTL\t := { 0..255 } (default=%d)\n\tKEY\t := { DOTTED_QUAD | NUMBER }\n\tELIM\t := { none | 0..255 }(default=%d)\n\tTCLASS\t := { 0x0..0xff | inherit }\n\tFLOWLABEL := { 0x0..0xfffff | inherit }\n\tMARK\t := { 0x0..0xffffffff | inherit }\n", a0->field_8, 64);
return;
}
|
static void
save_attestation(struct sshbuf *attest, const char *path)
{
mode_t omask;
int r;
if (path ==
((void *)0)
)
return;
if (attest ==
((void *)0)
|| sshbuf_len(attest) == 0)
sshfatal("ssh-keygen.c", __func__, 3227, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Enrollment did not return attestation data");
omask = umask(077);
r = sshbuf_write_file(path, attest);
umask(omask);
if (r != 0)
sshfatal("ssh-keygen.c", __func__, 3232, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Unable to write attestation data \"%s\"", path);
if (!quiet)
printf("Your FIDO attestation certificate has been saved in "
"%s\n", path);
}
| void save_attestation(unsigned long long a0, unsigned long long a1) {
unsigned int v0;
unsigned int v1;
unsigned long v2;
char v3;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
if (a1) {
if (!a0 || !sshbuf_len(a0))
sshfatal("ssh-keygen.c", "save_attestation", 0xc9b, 0x0, 0x1, 0x0, "Enrollment did not return attestation data");
v0 = umask(0x3f);
v1 = sshbuf_write_file(a1, a0);
umask(v0);
if (v1) {
v6 = ssh_err(v1);
v2 = a1;
v0 = "Unable to write attestation data \"%s\"";
sshfatal("ssh-keygen.c", "save_attestation", 0xca0, 0x0, 0x1, v6, *(&v3));
}
v7 = quiet;
if (!quiet)
v8 = printf("Your FIDO attestation certificate has been saved in %s\n", a1);
}
return;
}
|
static int
diversion_list(const char *const *argv)
{
struct fsys_hash_iter *iter;
struct fsys_namenode *namenode;
struct glob_node *glob_list =
((void *)0)
;
const char *pattern;
while ((pattern = *argv++))
glob_list_prepend(&glob_list, m_strdup(pattern));
if (glob_list ==
((void *)0)
)
glob_list_prepend(&glob_list, m_strdup("*"));
iter = fsys_hash_iter_new();
while ((namenode = fsys_hash_iter_next(iter))) {
struct glob_node *g;
struct fsys_diversion *contest = namenode->divert;
struct fsys_diversion *altname;
const char *pkgname;
if (contest ==
((void *)0)
|| contest->useinstead ==
((void *)0)
)
continue;
altname = contest->useinstead->divert;
pkgname = diversion_pkg_name(contest);
for (g = glob_list; g; g = g->next) {
if (fnmatch(g->pattern, pkgname, 0) == 0 ||
fnmatch(g->pattern, contest->useinstead->name, 0) == 0 ||
fnmatch(g->pattern, altname->camefrom->name, 0) == 0) {
printf("%s\n", diversion_describe(contest));
break;
}
}
}
fsys_hash_iter_free(iter);
glob_list_free(glob_list);
return 0;
}
| long diversion_list(long *a1)
{
long v1;
long *v2;
long v3;
const char *v4;
long i;
long j;
long v9;
long v10;
long v11;
_QWORD *v12;
long v13;
char *name;
unsigned long v15;
v15 = __readfsqword(0x28u);
for ( i = 0LL; ; glob_list_prepend(&i, v1) )
{
v2 = a1++;
v9 = *v2;
if ( !v9 )
break;
v1 = m_strdup(v9);
}
if ( !i )
{
v3 = m_strdup("*");
glob_list_prepend(&i, v3);
}
v10 = fsys_hash_iter_new();
LABEL_16:
while ( 1 )
{
v11 = fsys_hash_iter_next(v10);
if ( !v11 )
break;
v12 = *(_QWORD **)(v11 + 24);
if ( v12 && *v12 )
{
v13 = *(_QWORD *)(*v12 + 24LL);
name = (char *)diversion_pkg_name((long)v12);
for ( j = i; j; j = *(_QWORD *)j )
{
if ( !fnmatch(*(const char **)(j + 8), name, 0)
|| !fnmatch(*(const char **)(j + 8), *(const char **)(*v12 + 8LL), 0)
|| !fnmatch(*(const char **)(j + 8), *(const char **)(*(_QWORD *)(v13 + 8) + 8LL), 0) )
{
v4 = (const char *)diversion_describe(v12);
printf("%s\n", v4);
goto LABEL_16;
}
}
}
}
fsys_hash_iter_free(v10);
glob_list_free(i);
return 0LL;
}
|
int
stravis(char **outp, const char *src, int flag)
{
char *buf;
int len, serrno;
buf = reallocarray(
((void *)0)
, 4, strlen(src) + 1);
if (buf ==
((void *)0)
)
return -1;
len = strvis(buf, src, flag);
serrno =
(*__errno_location ())
;
*outp = realloc(buf, len + 1);
if (*outp ==
((void *)0)
) {
*outp = buf;
(*__errno_location ())
= serrno;
}
return (len);
}
| long long stravis(unsigned long long *a0, unsigned long a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
void* v2;
unsigned long long v4;
v2 = reallocarray(NULL, 0x4, strlen(a1) + 1);
if (!v2) {
v4 = 4294967295;
return v4;
}
v0 = strvis(v2, a1, a2);
v1 = *(__errno_location());
*(a0) = realloc(v2, __addvsi3(v0, 0x1));
if (!*(a0)) {
*(a0) = v2;
*(__errno_location()) = v1;
}
v4 = v0;
return v4;
}
|
void
channel_cancel_cleanup(struct ssh *ssh, int id)
{
Channel *c = channel_by_id(ssh, id);
if (c ==
((void *)0)
) {
sshlog("channels.c", __func__, 1053, 1, SYSLOG_LEVEL_INFO,
((void *)0)
, "%d: bad id", id);
return;
}
c->detach_user =
((void *)0)
;
c->detach_close = 0;
}
| long long channel_cancel_cleanup(void* a0, unsigned long a1) {
unsigned long v0;
struct_0 *v1;
struct_0 *v3;
v1 = channel_by_id(a0, a1);
if (!v1) {
v0 = a1;
v3 = sshlog("channels.c", "channel_cancel_cleanup", 0x41d, 0x1, 0x3, 0x0, "%d: bad id");
} else {
v1->field_e0 = 0;
v3 = v1;
v1->field_e8 = 0;
}
return v3;
}
|
static void
append_entry (char prefix, char const *item, char const *arg)
{
if (print_ls_colors)
{
append_quoted ("\x1B[");
append_quoted (arg);
__extension__ ({ struct obstack *__o = (&lsc_obstack); if (__extension__ ({ struct obstack const *__o1 = (__o); (size_t) (__o1->chunk_limit - __o1->next_free); }) < 1) _obstack_newchunk (__o, 1); ((void) (*((__o)->next_free)++ = ('m'))); });
}
if (prefix)
__extension__ ({ struct obstack *__o = (&lsc_obstack); if (__extension__ ({ struct obstack const *__o1 = (__o); (size_t) (__o1->chunk_limit - __o1->next_free); }) < 1) _obstack_newchunk (__o, 1); ((void) (*((__o)->next_free)++ = (prefix))); });
append_quoted (item);
__extension__ ({ struct obstack *__o = (&lsc_obstack); if (__extension__ ({ struct obstack const *__o1 = (__o); (size_t) (__o1->chunk_limit - __o1->next_free); }) < 1) _obstack_newchunk (__o, 1); ((void) (*((__o)->next_free)++ = (print_ls_colors ? '\t' : '='))); });
append_quoted (arg);
if (print_ls_colors)
append_quoted ("\x1B[0m");
__extension__ ({ struct obstack *__o = (&lsc_obstack); if (__extension__ ({ struct obstack const *__o1 = (__o); (size_t) (__o1->chunk_limit - __o1->next_free); }) < 1) _obstack_newchunk (__o, 1); ((void) (*((__o)->next_free)++ = (print_ls_colors ? '\n' : ':'))); });
}
| char * append_entry(char a1, char *a2, char *a3)
{
char *next_free;
char *v4;
char v5;
char *v6;
char v7;
char *result;
if ( print_ls_colors )
{
append_quoted("\x1B[");
append_quoted(a3);
if ( lsc_obstack.chunk_limit == lsc_obstack.next_free )
obstack_newchunk(&lsc_obstack, 1);
next_free = lsc_obstack.next_free;
lsc_obstack.next_free = next_free + 1;
*next_free = 109;
}
if ( a1 )
{
if ( lsc_obstack.chunk_limit == lsc_obstack.next_free )
obstack_newchunk(&lsc_obstack, 1);
v4 = lsc_obstack.next_free;
lsc_obstack.next_free = v4 + 1;
*v4 = a1;
}
append_quoted(a2);
if ( lsc_obstack.chunk_limit == lsc_obstack.next_free )
obstack_newchunk(&lsc_obstack, 1);
if ( print_ls_colors )
v5 = 9;
else
v5 = 61;
v6 = lsc_obstack.next_free;
lsc_obstack.next_free = v6 + 1;
*v6 = v5;
append_quoted(a3);
if ( print_ls_colors )
append_quoted("\x1B[0m");
if ( lsc_obstack.chunk_limit == lsc_obstack.next_free )
obstack_newchunk(&lsc_obstack, 1);
if ( print_ls_colors )
v7 = 10;
else
v7 = 58;
result = lsc_obstack.next_free;
lsc_obstack.next_free = result + 1;
*result = v7;
return result;
}
|
int
rl_getc (FILE *stream)
{
int result;
unsigned char c;
int fd;
sigset_t empty_set;
fd_set readfds;
fd = fileno (stream);
while (1)
{
do { if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); } while (0);
result = 0;
do { unsigned int __i; fd_set *__arr = (
&readfds
); for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) ((__arr)->fds_bits)[__i] = 0; } while (0)
;
((void) (((
&readfds
)->fds_bits)[((
fd
) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((
fd
) % (8 * (int) sizeof (__fd_mask)))))))
;
result = _rl_timeout_select (fd + 1, &readfds,
((void *)0)
,
((void *)0)
,
((void *)0)
, &_rl_orig_sigset);
if (result == 0)
_rl_timeout_handle ();
if (result >= 0)
result = read (fd, &c, sizeof (unsigned char));
if (result == sizeof (unsigned char))
return (c);
if (result == 0)
return (
(-1)
);
if (
(*__errno_location ())
==
11
||
(*__errno_location ())
==
11
)
{
if (sh_unset_nodelay_mode (fd) < 0)
return (
(-1)
);
continue;
}
handle_error:
if (
(*__errno_location ())
!=
4
)
return ((rl_readline_state & (0x0000008)) ? (-2) :
(-1)
);
else if (_rl_caught_signal ==
1
|| _rl_caught_signal ==
15
)
return ((rl_readline_state & (0x0000008)) ? (-2) :
(-1)
);
else if (_rl_caught_signal ==
2
|| _rl_caught_signal ==
3
)
do { if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); } while (0);
else if (_rl_caught_signal ==
20
)
do { if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); } while (0);
else if (_rl_caught_signal ==
28
)
do { if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); } while (0);
else if (_rl_caught_signal ==
14
|| _rl_caught_signal ==
26
)
do { if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); } while (0);
if (rl_signal_event_hook)
(*rl_signal_event_hook) ();
}
}
| int rl_getc(void* a0) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long long *v4;
char v5;
unsigned int v7;
unsigned int v8;
unsigned int v10;
v3 = fileno(a0);
while (true) {
if (_rl_caught_signal)
_rl_signal_handler(_rl_caught_signal);
v1 = 0;
v4 = &v5;
for (v2 = 0; v2 <= 15; v2 += 1) {
v4[v2] = 0;
}
*(&(&v5)[8 * ((v3 < 0 ? v3 + 63 : v3) >> 6)]) = *(&(&v5)[8 * ((v3 < 0 ? v3 + 63 : v3) >> 6)]) | 1 << (((v3 + (v3 >> 31 >> 26) & 63) - (v3 >> 31 >> 26)) & 63);
v1 = _rl_timeout_select(v3 + 1, &v5, 0x0, 0x0, 0x0, 0x5000b0);
if (!v1)
_rl_timeout_handle();
if (v1 >= 0)
v1 = read(v3, &v0, 0x1);
if (v1 == 1) {
v10 = v0;
break;
} else if (!v1) {
v10 = -1;
break;
} else {
v7 = *(__errno_location());
if (v7 != 11) {
v8 = *(__errno_location());
if (v8 != 11) {
if (*(__errno_location()) == 4) {
if (_rl_caught_signal != 1 && _rl_caught_signal != 15) {
if (_rl_caught_signal != 2 && _rl_caught_signal != 3) {
if (_rl_caught_signal == 20) {
if (_rl_caught_signal)
_rl_signal_handler(_rl_caught_signal);
} else {
if (_rl_caught_signal == 28) {
if (_rl_caught_signal)
_rl_signal_handler(_rl_caught_signal);
} else {
if ((_rl_caught_signal == 26 || _rl_caught_signal == 14) && _rl_caught_signal)
_rl_signal_handler(_rl_caught_signal);
}
}
}
if ((_rl_caught_signal == 3 || _rl_caught_signal == 2) && _rl_caught_signal)
_rl_signal_handler(_rl_caught_signal);
if (!rl_signal_event_hook)
continue;
*(4199752)();
continue;
}
if (_rl_caught_signal == 1 || _rl_caught_signal == 15) {
if ((*(&rl_readline_state) & 8)) {
v10 = -2;
break;
} else {
v10 = -1;
break;
}
}
} else if ((*(&rl_readline_state) & 8)) {
v10 = -2;
break;
} else {
v10 = -1;
break;
}
}
}
if (v8 == 11 || v7 == 11) {
v10 = sh_unset_nodelay_mode(v3);
if (v10 >= 0)
continue;
v10 = -1;
break;
}
}
}
return v10;
}
|
static SHELL_VAR *
make_new_variable (name, table)
const char *name;
HASH_TABLE *table;
{
SHELL_VAR *entry;
BUCKET_CONTENTS *elt;
entry = new_shell_variable (name);
if (shell_variables == 0)
create_variable_tables ();
elt = hash_insert ((char *)strcpy (sh_xmalloc((1 + strlen (name)), "variables.c", 2803), (name)), table, 0x01);
elt->data = (void *)entry;
return entry;
}
| undefined8 make_new_variable(char *param_1,undefined8 param_2)
{
undefined8 uVar1;
size_t sVar2;
char *pcVar3;
long lVar4;
uVar1 = new_shell_variable(param_1);
if (shell_variables == 0) {
create_variable_tables();
}
sVar2 = strlen(param_1);
pcVar3 = (char *)sh_xmalloc(sVar2 + 1,"variables.c",0xaf3);
pcVar3 = strcpy(pcVar3,param_1);
lVar4 = hash_insert(pcVar3,param_2,1);
*(undefined8 *)(lVar4 + 0x10) = uVar1;
return uVar1;
}
|
static inline __u32 rta_getattr_u32(const struct rtattr *rta)
{
return *(__u32 *)((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
| undefined4 rta_getattr_u32(long param_1)
{
return *(undefined4 *)(param_1 + 4);
}
|
static void print_encap_bpf(FILE *fp, struct rtattr *encap)
{
struct rtattr *tb[(__LWT_BPF_MAX - 1)+1];
(parse_rtattr_flags((tb), ((__LWT_BPF_MAX - 1)), ((void*)(((char*)(encap)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), ((int)((encap)->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), (1 << 15)));
if (tb[LWT_BPF_IN])
print_encap_bpf_prog(fp, tb[LWT_BPF_IN], "in");
if (tb[LWT_BPF_OUT])
print_encap_bpf_prog(fp, tb[LWT_BPF_OUT], "out");
if (tb[LWT_BPF_XMIT])
print_encap_bpf_prog(fp, tb[LWT_BPF_XMIT], "xmit");
if (tb[LWT_BPF_XMIT_HEADROOM])
print_uint(PRINT_ANY, "headroom",
" %u ", rta_getattr_u32(tb[LWT_BPF_XMIT_HEADROOM]));
}
| void print_encap_bpf(void* a0, unsigned short *a1) {
char v0;
char v1;
char v2;
char v3;
char v4;
char v5;
unsigned long long *v7;
unsigned long long v8;
parse_rtattr_flags(&v0, 0x4, a1 + 2, *(a1) - 4, 0x8000);
if (*(&v1))
print_encap_bpf_prog(a0, *(&v1), "in");
if (*(&v2))
print_encap_bpf_prog(a0, *(&v2), "out");
if (*(&v3))
print_encap_bpf_prog(a0, *(&v3), "xmit");
if (*(&v4))
print_uint(0x4, "headroom", " %u ", rta_getattr_u32(*(&v4)));
v8 = *(&v5) ^ v7[5];
return;
}
|
int
sshkey_cert_check_authority_now(const struct sshkey *k,
int want_host, int require_principal, int wildcard_pattern,
const char *name, const char **reason)
{
time_t now;
if ((now = time(
((void *)0)
)) < 0) {
*reason = "Certificate invalid: not yet valid";
return -25;
}
return sshkey_cert_check_authority(k, want_host, require_principal,
wildcard_pattern, (uint64_t)now, name, reason);
}
| undefined8
sshkey_cert_check_authority_now
(undefined8 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
undefined8 param_5,char **param_6)
{
time_t tVar1;
undefined8 uVar2;
uVar2 = 0x1075cb;
tVar1 = time((time_t *)0x0);
if (tVar1 < 0) {
*param_6 = "Certificate invalid: not yet valid";
uVar2 = 0xffffffe7;
}
else {
uVar2 = sshkey_cert_check_authority(param_1,param_2,param_3,param_4,tVar1,param_5,param_6,uVar2)
;
}
return uVar2;
}
|
static gl_list_node_t
gl_linked_nx_add_first (gl_list_t list, const void *elt)
{
gl_list_node_t node =
(struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl));
if (node ==
((void *)0)
)
return
((void *)0)
;
node->value = elt;
node->prev = &list->root;
node->next = list->root.next;
node->next->prev = node;
list->root.next = node;
list->count++;
return node;
}
| long * gl_linked_nx_add_first(long param_1,long param_2)
{
long *plVar1;
plVar1 = (long *)malloc(0x18);
if (plVar1 == (long *)0x0) {
plVar1 = (long *)0x0;
}
else {
plVar1[2] = param_2;
plVar1[1] = param_1 + 0x28;
*plVar1 = *(long *)(param_1 + 0x28);
*(long **)(*plVar1 + 8) = plVar1;
*(long **)(param_1 + 0x28) = plVar1;
*(long *)(param_1 + 0x40) = *(long *)(param_1 + 0x40) + 1;
}
return plVar1;
}
|
_Bool
findbreakcycle(struct pkginfo *pkg)
{
struct pkg_hash_iter *iter;
struct pkginfo *tpkg;
iter = pkg_hash_iter_new();
while ((tpkg = pkg_hash_iter_next_pkg(iter))) {
ensure_package_clientdata(tpkg);
tpkg->clientdata->color = PKG_CYCLE_WHITE;
}
pkg_hash_iter_free(iter);
return findbreakcyclerecursive(pkg,
((void *)0)
);
}
| void findbreakcycle(undefined8 param_1)
{
undefined8 uVar1;
long lVar2;
uVar1 = pkg_hash_iter_new();
while( true ) {
lVar2 = pkg_hash_iter_next_pkg(uVar1);
if (lVar2 == 0) break;
ensure_package_clientdata(lVar2);
*(undefined4 *)(*(long *)(lVar2 + 0x138) + 4) = 0;
}
pkg_hash_iter_free(uVar1);
findbreakcyclerecursive(param_1,0);
return;
}
|
int
check_unbind_variable (name)
const char *name;
{
SHELL_VAR *v;
v = find_variable (name);
if (v && ((((v)->attributes) & (0x0000002))))
{
internal_error (gettext("%s: cannot unset: readonly %s"), name, "variable");
return -2;
}
else if (v && ((((v)->attributes) & (0x0002000))))
{
internal_error (gettext("%s: cannot unset"), name);
return -2;
}
return (unbind_variable (name));
}
| undefined8 check_unbind_variable(undefined8 param_1)
{
long lVar1;
undefined8 uVar2;
lVar1 = find_variable(param_1);
if ((lVar1 == 0) || ((*(uint *)(lVar1 + 0x28) & 2) == 0)) {
if ((lVar1 == 0) || ((*(uint *)(lVar1 + 0x28) & 0x2000) == 0)) {
uVar2 = unbind_variable(param_1);
}
else {
uVar2 = gettext("%s: cannot unset");
internal_error(uVar2,param_1);
uVar2 = 0xfffffffe;
}
}
else {
uVar2 = gettext("%s: cannot unset: readonly %s");
internal_error(uVar2,param_1,"variable");
uVar2 = 0xfffffffe;
}
return uVar2;
}
|
static int output_aliases_bin(struct depmod *depmod, FILE *out)
{
struct index_node *idx;
size_t i;
if (out ==
stdout
)
return 0;
idx = index_create();
if (idx ==
((void *)0)
)
return -
12
;
for (i = 0; i < depmod->modules.count; i++) {
const struct mod *mod = depmod->modules.array[i];
struct kmod_list *l;
for (l = ((mod->info_list) ==
((void *)0)
) ?
((void *)0)
: (mod->info_list); l !=
((void *)0)
; l = (l->node.next == &((mod->info_list)->node)) ?
((void *)0)
: ((struct kmod_list *) ((char *)(l->node.next) -
__builtin_offsetof (
struct kmod_list
,
node
)
) - ((typeof(*(l->node.next)) *)0 != (typeof(((struct kmod_list *)0)->node) *)0))) {
const char *key = kmod_module_info_get_key(l);
const char *value = kmod_module_info_get_value(l);
char buf[
4096
];
const char *alias;
int duplicate;
if (!(strcmp((key), ("alias")) == 0))
continue;
if (alias_normalize(value, buf,
((void *)0)
) < 0) {
log_printf(
4
, "Unmatched bracket in %s\n", value);
continue;
}
alias = buf;
duplicate = index_insert(idx, alias, mod->modname,
mod->idx);
if (duplicate && depmod->cfg->warn_dups)
log_printf(
4
, "duplicate module alias:\n%s %s\n", alias, mod->modname)
;
}
}
index_write(idx, out);
index_destroy(idx);
return 0;
}
| long long output_aliases_bin(struct_0 *a0, void* a1, unsigned long a2, unsigned long a3, unsigned long long a4) {
unsigned int v0;
void* v1;
void* v2;
void* v3;
struct_2 *v4;
char *v5;
unsigned long long v6;
char *v7;
char v8;
char v9;
unsigned long long v11;
void* v14;
v9 = *(&v9);
if (a1 == stdout) {
v11 = 0;
} else {
v3 = index_create();
if (!v3) {
v11 = 4294967284;
} else {
for (v1 = 0; v1 < a0->field_18; v1 += 1) {
v4 = *((a0->field_10 + v1 * 8));
for (v2 = v4->field_20; v2; v2 = v14) {
v5 = kmod_module_info_get_key(v2);
v6 = kmod_module_info_get_value(v2);
if (!strcmp(v5, "alias")) {
if (alias_normalize(v6, &v8, 0x0, &v8) < 0) {
log_printf(0x4, "Unmatched bracket in %s\n", v6, &v8, a4);
} else {
v7 = &v8;
v0 = index_insert(v3, v7, &v4[1].padding_0[14], v4->field_68);
if (v0 && a0->field_0->field_1013)
log_printf(0x4, "duplicate module alias:\n%s %s\n", v7, &v4[1].padding_0[14], a4);
}
}
if (*(v2) != v4->field_20)
v14 = *(v2);
else
v14 = 0;
}
}
index_write(v3, a1);
index_destroy(v3);
v11 = 0;
}
}
return v11;
}
|
void
argv_free(char **av, int ac)
{
int i;
if (av ==
((void *)0)
)
return;
for (i = 0; i < ac; i++)
free(av[i]);
free(av);
}
| long long argv_free(unsigned long long *a0, unsigned long a1) {
unsigned int v0;
if (a0) {
for (v0 = 0; v0 < a1; v0 = __addvsi3(v0, 0x1)) {
free(a0[v0]);
}
}
return free(a0);
}
|
static int process_block(ext2_filsys fs,
blk64_t *block_nr,
e2_blkcnt_t blockcnt,
blk64_t ref_block __attribute__((unused)),
int ref_offset __attribute__((unused)),
void *priv_data)
{
struct process_block_struct *p;
struct problem_context *pctx;
blk64_t blk = *block_nr;
int ret_code = 0;
problem_t problem = 0;
e2fsck_t ctx;
p = (struct process_block_struct *) priv_data;
pctx = p->pctx;
ctx = p->ctx;
if (p->is_dir && blockcnt == 0 && blk == 0) {
pctx->errcode = ext2fs_add_dir_block2(fs->dblist, p->ino, 0, 0);
if (pctx->errcode) {
pctx->blk = blk;
pctx->num = blockcnt;
goto failed_add_dir_block;
}
p->last_db_block++;
}
if (blk == 0)
return 0;
if (p->previous_block && p->ino != 7) {
if (p->previous_block+1 != blk) {
if (ctx->options & 0x0800) {
char type = '?';
if (p->is_dir)
type = 'd';
else if (p->is_reg)
type = 'f';
printf((gettext ("%6lu(%c): expecting %6lu " "got phys %6lu (blkcnt %lld)\n"))
,
(unsigned long) pctx->ino, type,
(unsigned long) p->previous_block+1,
(unsigned long) blk,
(long long) blockcnt);
}
p->fragmented = 1;
}
}
if (p->is_dir && !ext2fs_has_feature_largedir(fs->super) &&
!pctx->inode->i_size_high &&
blockcnt > (1 << (21 - fs->super->s_log_block_size)))
problem = 0x010044;
if (p->is_dir && p->num_blocks + 1 >= p->max_blocks)
problem = 0x010044;
if (p->is_reg && p->num_blocks + 1 >= p->max_blocks)
problem = 0x010045;
if (!p->is_dir && !p->is_reg && blockcnt > 0)
problem = 0x010046;
if (blk < fs->super->s_first_data_block ||
blk >= ext2fs_blocks_count(fs->super))
problem = 0x01000E;
if (blockcnt < 0 &&
p->ino != 7 &&
blk < ctx->fs->super->s_blocks_count &&
ext2fs_test_block_bitmap2(ctx->block_metadata_map, blk)) {
pctx->blk = blk;
fix_problem(ctx, 0x010071, pctx);
if ((ctx->options & 0x0008) == 0)
ctx->flags |= 0x0008;
}
if (problem) {
p->num_illegal_blocks++;
if (p->ino != 7 &&
ref_block != 0 &&
ext2fs_test_block_bitmap2(ctx->block_metadata_map,
ref_block)) {
*block_nr = 0;
return 0;
}
if (!p->suppress && (p->num_illegal_blocks % 12) == 0) {
if (fix_problem(ctx, 0x010011, pctx)) {
p->clear = 1;
return 2;
}
if (fix_problem(ctx, 0x01002D, pctx)) {
p->suppress = 1;
set_latch_flags(0x0010,
0x0008, 0);
}
}
pctx->blk = blk;
pctx->blkcount = blockcnt;
if (fix_problem(ctx, problem, pctx)) {
blk = *block_nr = 0;
ret_code = 1;
p->inode_modified = 1;
if (problem == 0x010044)
return ret_code;
goto mark_dir;
} else
return 0;
}
if (p->ino == 7) {
if (blockcnt == (-2))
mark_block_used(ctx, blk);
p->num_blocks++;
} else if (!(ctx->fs->cluster_ratio_bits &&
p->previous_block &&
(((blk) >> (ctx->fs)->cluster_ratio_bits) ==
((p->previous_block) >> (ctx->fs)->cluster_ratio_bits)) &&
(blk & ((1 << (ctx->fs)->cluster_ratio_bits) - 1)) ==
((unsigned) blockcnt & ((1 << (ctx->fs)->cluster_ratio_bits) - 1)))) {
mark_block_used(ctx, blk);
p->num_blocks++;
} else if (has_unaligned_cluster_map(ctx, p->previous_block,
p->last_block, blk, blockcnt)) {
pctx->blk = blockcnt;
pctx->blk2 = blk;
fix_problem(ctx, 0x010074, pctx);
mark_block_used(ctx, blk);
mark_block_used(ctx, blk);
}
if (blockcnt >= 0)
p->last_block = blockcnt;
p->previous_block = blk;
mark_dir:
if (p->is_dir && (blockcnt >= 0)) {
while (++p->last_db_block < blockcnt) {
pctx->errcode = ext2fs_add_dir_block2(fs->dblist,
p->ino, 0,
p->last_db_block);
if (pctx->errcode) {
pctx->blk = 0;
pctx->num = p->last_db_block;
goto failed_add_dir_block;
}
}
pctx->errcode = ext2fs_add_dir_block2(fs->dblist, p->ino,
blk, blockcnt);
if (pctx->errcode) {
pctx->blk = blk;
pctx->num = blockcnt;
failed_add_dir_block:
fix_problem(ctx, 0x01002B, pctx);
ctx->flags |= 0x0001;
return 2;
}
}
return ret_code;
}
| long long process_block(struct_0 *a0, unsigned long long *a1, unsigned long a2, unsigned long long a3, unsigned long a4, struct_2 *a5) {
unsigned int v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned long v4;
struct_6 *v5;
struct_3 *v6;
unsigned long long v8;
v0 = a4;
v4 = *(a1);
v2 = 0;
v3 = 0;
v5 = a5->field_48;
v6 = a5->field_58;
if ((a5->field_4 & 1) && !a2 && !v4) {
v5->field_0 = ext2fs_add_dir_block2(a0->field_90, a5->field_0, 0x0, 0x0);
if (v5->field_0) {
v5->field_28 = v4;
v5->field_50 = a2;
goto LABEL_40aca1;
} else {
a5->field_28 = a5->field_28 + 1;
}
}
if (!v4) {
v8 = 0;
goto LABEL_40acd3;
}
if (a5->field_38 && a5->field_0 != 7 && v4 != a5->field_38 + 1) {
if ((v6->field_4c & 0x800)) {
v1 = 63;
if ((a5->field_4 & 1)) {
v1 = 100;
} else if ((a5->field_4 & 2)) {
v1 = 102;
}
printf(gettext("%6lu(%c): expecting %6lu got phys %6lu (blkcnt %lld)\n"));
}
a5->field_4 = a5->field_4 | 16;
}
if ((a5->field_4 & 1) && !ext2fs_has_feature_largedir(a0->field_20) && !v5->field_18->field_6c && a2 > 1 << ((21 - a0->field_20->field_18) & 31))
v3 = 65604;
if ((a5->field_4 & 1) && a5->field_8 + 1 >= a5->field_10)
v3 = 65604;
if ((a5->field_4 & 2) && a5->field_8 + 1 >= a5->field_10)
v3 = 65605;
if (!(a5->field_4 & 1) && !(a5->field_4 & 2) && a2 > 0)
v3 = 65606;
if (v4 >= a0->field_20->field_14 && v4 < ext2fs_blocks_count(a0->field_20))
goto LABEL_40a7e9;
v3 = 65550;
LABEL_40a7e9:
if ((a2 - 0 >> 63) && a5->field_0 != 7 && v4 < v6->field_0->field_20->field_4 && ext2fs_test_block_bitmap2(v6->field_390, v4, v4)) {
v5->field_28 = v4;
fix_problem(v6, 0x10071, v5);
if (!(v6->field_4c & 8))
v6->field_48 = v6->field_48 | 8;
}
if (!v3) {
if (a5->field_0 == 7) {
if (a2 == -2)
mark_block_used(v6, v4);
a5->field_8 = a5->field_8 + 1;
} else if (!v6->field_0->field_c0) {
LABEL_40aaed:
mark_block_used(v6, v4);
a5->field_8 = a5->field_8 + 1;
} else {
if (!a5->field_38)
goto LABEL_40aaed;
if (!(v4 >> (v6->field_0->field_c0 & 63) == a5->field_38 >> (v6->field_0->field_c0 & 63)))
goto LABEL_40aaed;
if (!(((1 << (v6->field_0->field_c0 & 31)) - 1 & v4) == ((1 << (v6->field_0->field_c0 & 31)) - 1 & a2)))
goto LABEL_40aaed;
if (has_unaligned_cluster_map(v6, a5->field_38, a5->field_18, v4, a2)) {
v5->field_28 = a2;
v5->field_30 = v4;
fix_problem(v6, 0x10074, v5);
mark_block_used(v6, v4);
mark_block_used(v6, v4);
}
}
if (!((a2 - 0 >> 63)))
a5->field_18 = a2;
a5->field_38 = v4;
} else {
a5->field_30 = a5->field_30 + 1;
if (a5->field_0 != 7 && a3 && ext2fs_test_block_bitmap2(v6->field_390, a3, a3)) {
*(a1) = 0;
v8 = 0;
goto LABEL_40acd3;
}
if (!(a5->field_4 & 8) && !a5->field_30 - ((((a5->field_30 * 715827883 >> 33) - (a5->field_30 >> 31)) << 1) + ((a5->field_30 * 715827883 >> 33) - (a5->field_30 >> 31)) << 2)) {
if (fix_problem(v6, 0x10011, v5)) {
a5->field_4 = a5->field_4 | 4;
v8 = 2;
goto LABEL_40acd3;
} else if (fix_problem(v6, 0x1002d, v5)) {
a5->field_4 = a5->field_4 | 8;
set_latch_flags(0x10, 0x8, 0x0);
}
}
v5->field_28 = v4;
v5->field_38 = a2;
if (!fix_problem(v6, v3, v5)) {
v8 = 0;
goto LABEL_40acd3;
} else {
*(a1) = 0;
v4 = *(a1);
v2 = 1;
a5->field_4 = a5->field_4 | -128;
if (v3 == 65604) {
v8 = v2;
goto LABEL_40acd3;
}
}
}
if ((a5->field_4 & 1) && !((a2 - 0 >> 63))) {
do {
a5->field_28 = a5->field_28 + 1;
if (a2 <= a5->field_28) {
v5->field_0 = ext2fs_add_dir_block2(a0->field_90, a5->field_0, v4, a2);
if (!v5->field_0)
goto LABEL_40acd0;
v5->field_28 = v4;
v5->field_50 = a2;
goto LABEL_40aca1;
}
v5->field_0 = ext2fs_add_dir_block2(a0->field_90, a5->field_0, 0x0, a5->field_28);
} while (!v5->field_0);
v5->field_28 = 0;
v5->field_50 = a5->field_28;
LABEL_40aca1:
fix_problem(v6, 0x1002b, v5);
v6->field_48 = v6->field_48 | 1;
v8 = 2;
goto LABEL_40acd3;
}
LABEL_40acd0:
v8 = v2;
LABEL_40acd3:
return v8;
}
|
int
get_numeric_arg (list, fatal, count)
WORD_LIST *list;
int fatal;
intmax_t *count;
{
char *arg;
if (count)
*count = 1;
if (list && list->word && (list->word->word[0] == '-' && list->word->word[1] == '-' && !list->word->word[2]))
list = list->next;
if (list)
{
arg = list->word->word;
if (arg == 0 || (legal_number (arg, count) == 0))
{
sh_neednumarg (list->word->word ? list->word->word : "`'");
if (fatal == 0)
return 0;
else if (fatal == 1)
throw_to_top_level ();
else
{
top_level_cleanup ();
jump_to_top_level (2);
}
}
no_args (list->next);
}
return (1);
}
| long long get_numeric_arg(unsigned long long a0, unsigned long long a1, unsigned long long *a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
struct_0 *v0;
char v1[3];
unsigned long long v4;
v0 = a0;
if (a2)
*(a2) = 1;
if (v0 && v0->field_8 && *(v0->field_8)->field_0 == 45 && *(v0->field_8)->field_1 == 45 && !*(v0->field_8)->field_2)
v0 = v0->field_0;
if (!v0) {
v4 = 1;
return v4;
}
*(&v1) = *(v0->field_8);
if (!v1 || !legal_number(v1, a2, a2)) {
sh_neednumarg((!*(v0->field_8) ? *(v0->field_8) : "`'"));
switch (a1) {
case 0:
v4 = 0;
return v4;
case 1:
throw_to_top_level();
break;
default:
top_level_cleanup(a0, a2, a2, a3, a4, a5);
jump_to_top_level(0x2);
}
}
no_args(v0->field_0, a1, a2, a3, a4, a5);
v4 = 1;
return v4;
}
|
static void
apply_delayed_links (void)
{
struct delayed_link *ds;
for (ds = delayed_link_head; ds; )
{
struct string_list *sources = ds->sources;
char const *valid_source = 0;
chdir_do (ds->change_dir);
for (sources = ds->sources; sources; sources = sources->next)
{
char const *source = sources->string;
struct stat st;
if (fstatat (chdir_fd, source, &st,
0x100
) == 0
&& st.st_dev == ds->dev
&& st.st_ino == ds->ino
&& timespec_cmp (get_stat_birthtime (&st), ds->birthtime) == 0)
{
if (unlinkat (chdir_fd, source, 0) != 0)
unlink_error (source);
else if (valid_source
&& (linkat (chdir_fd, valid_source, chdir_fd, source, 0)
== 0))
;
else if (!ds->is_symlink)
{
if (linkat (chdir_fd, ds->target, chdir_fd, source, 0) != 0)
link_error (ds->target, source);
}
else if (symlinkat (ds->target, chdir_fd, source) != 0)
symlink_error (ds->target, source);
else
{
struct tar_stat_info st1;
st1.stat.st_mode = ds->mode;
st1.stat.st_uid = ds->uid;
st1.stat.st_gid = ds->gid;
st1.atime = ds->atime;
st1.mtime = ds->mtime;
st1.cntx_name = ds->cntx_name;
st1.acls_a_ptr = ds->acls_a_ptr;
st1.acls_a_len = ds->acls_a_len;
st1.acls_d_ptr = ds->acls_d_ptr;
st1.acls_d_len = ds->acls_d_len;
st1.xattr_map = ds->xattr_map;
st1.xattr_map_size = ds->xattr_map_size;
set_stat (source, &st1, -1, 0, 0, '2',
0
,
0x100
);
valid_source = source;
}
}
}
for (sources = ds->sources; sources; )
{
struct string_list *next = sources->next;
free (sources);
sources = next;
}
xheader_xattr_free (ds->xattr_map, ds->xattr_map_size);
free (ds->cntx_name);
{
struct delayed_link *next = ds->next;
free (ds);
ds = next;
}
}
delayed_link_head = 0;
}
| void apply_delayed_links(void)
{
int iVar1;
undefined8 *puVar2;
long in_FS_OFFSET;
undefined auVar3 [16];
undefined8 *local_298;
undefined8 *local_290;
undefined8 *local_288;
stat local_268;
undefined local_1d8 [48];
undefined8 local_1a8;
undefined8 local_1a0;
undefined8 local_198;
undefined8 local_190;
undefined8 local_188;
undefined4 local_168;
undefined4 local_164;
undefined4 local_160;
undefined8 local_f0;
undefined8 local_e8;
undefined8 local_e0;
undefined8 local_d8;
undefined8 local_80;
undefined8 local_78;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_298 = delayed_link_head;
do {
if (local_298 == (undefined8 *)0x0) {
delayed_link_head = (undefined8 *)0x0;
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
delayed_link_head = (undefined8 *)0x0;
return;
}
local_288 = (undefined8 *)0x0;
chdir_do();
for (local_290 = (undefined8 *)local_298[0xc]; local_290 != (undefined8 *)0x0;
local_290 = (undefined8 *)*local_290) {
puVar2 = local_290 + 1;
iVar1 = fstatat(chdir_fd,(char *)puVar2,&local_268,0x100);
if (((iVar1 == 0) && (local_268.st_dev == local_298[1])) && (local_268.st_ino == local_298[2])
) {
auVar3 = get_stat_birthtime(&local_268);
iVar1 = timespec_cmp(SUB168(auVar3,0),SUB168(auVar3 >> 0x40,0),local_298[3],local_298[4]);
if (iVar1 == 0) {
iVar1 = unlinkat(chdir_fd,(char *)puVar2,0);
if (iVar1 == 0) {
if (local_288 != (undefined8 *)0x0) {
iVar1 = linkat(chdir_fd,(char *)local_288,chdir_fd,(char *)puVar2,0);
if (iVar1 == 0) goto LAB_00103ee2;
}
if (*(char *)(local_298 + 5) == '\x01') {
iVar1 = symlinkat((char *)(local_298 + 0x14),chdir_fd,(char *)puVar2);
if (iVar1 == 0) {
local_168 = *(undefined4 *)((long)local_298 + 0x2c);
local_164 = *(undefined4 *)(local_298 + 6);
local_160 = *(undefined4 *)((long)local_298 + 0x34);
local_e8 = local_298[8];
local_f0 = local_298[7];
local_d8 = local_298[10];
local_e0 = local_298[9];
local_1a8 = local_298[0xd];
local_1a0 = local_298[0xe];
local_198 = local_298[0xf];
local_190 = local_298[0x10];
local_188 = local_298[0x11];
local_78 = local_298[0x13];
local_80 = local_298[0x12];
set_stat(puVar2,local_1d8,0xffffffff,0,0,0x32,0,0x100);
local_288 = puVar2;
}
else {
symlink_error(local_298 + 0x14,puVar2);
}
}
else {
iVar1 = linkat(chdir_fd,(char *)(local_298 + 0x14),chdir_fd,(char *)puVar2,0);
if (iVar1 != 0) {
link_error(local_298 + 0x14,puVar2);
}
}
}
else {
unlink_error();
}
}
}
LAB_00103ee2:
}
local_290 = (undefined8 *)local_298[0xc];
while (local_290 != (undefined8 *)0x0) {
puVar2 = (undefined8 *)*local_290;
free(local_290);
local_290 = puVar2;
}
xheader_xattr_free(local_298[0x13],local_298[0x12]);
free((void *)local_298[0xd]);
puVar2 = (undefined8 *)*local_298;
free(local_298);
local_298 = puVar2;
} while( true );
}
|
static int
closefrom_procfs(int lowfd)
{
const char *path;
DIR *dirp;
struct dirent *dent;
int *fd_array =
((void *)0)
;
int fd_array_used = 0;
int fd_array_size = 0;
int ret = 0;
int i;
path = "/proc/self/fd";
dirp = opendir(path);
if (dirp ==
((void *)0)
)
return -1;
while ((dent = readdir(dirp)) !=
((void *)0)
) {
const char *errstr;
int fd;
fd = strtonum(dent->d_name, lowfd, 0x7fffffff, &errstr);
if (errstr !=
((void *)0)
|| fd == dirfd(dirp))
continue;
if (fd_array_used >= fd_array_size) {
int *ptr;
if (fd_array_size > 0)
fd_array_size *= 2;
else
fd_array_size = 32;
ptr = reallocarray(fd_array, fd_array_size, sizeof(int));
if (ptr ==
((void *)0)
) {
ret = -1;
break;
}
fd_array = ptr;
}
fd_array[fd_array_used++] = fd;
}
for (i = 0; i < fd_array_used; i++)
closefrom_close(fd_array[i]);
free(fd_array);
(void)closedir(dirp);
return ret;
}
| int closefrom_procfs(unsigned long a0) {
unsigned int v0;
int tmp_12;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
char v5;
void* v6;
unsigned long long v7;
unsigned long long v8;
unsigned long v9;
void* v10;
unsigned int v12;
v6 = 0;
v0 = 0;
v1 = 0;
v2 = 0;
v7 = "/proc/self/fd";
v8 = opendir(v7);
if (!v8) {
v12 = -1;
} else {
while (true) {
v9 = readdir(v8);
if (v9) {
v4 = strtonum(v9 + 19, a0, 0x7fffffff, &v5);
if (*(&v5))
continue;
v12 = dirfd(v8);
if (v4 == v12)
continue;
if (v4 != v12) {
if (v0 >= v1) {
if (v1 > 0)
v1 *= 2;
else
v1 = 32;
v10 = reallocarray(v6, v1, 0x4);
if (!v10)
v2 = -1;
else
v6 = v10;
}
if (v0 < v1 || v10) {
tmp_12 = v0;
v0 += 1;
*((4 * tmp_12 + v6)) = v4;
continue;
}
}
}
if (!v9 || !v10 && v0 >= v1 && v4 != v12) {
v3 = 0;
break;
}
}
for (; v3 < v0; v3 += 1) {
closefrom_close(*((v6 + 4 * v3)));
}
free(v6);
closedir(v8);
v12 = v2;
}
return v12;
}
|
static _rl_search_cxt *
_rl_isearch_init (int direction)
{
_rl_search_cxt *cxt;
register int i;
HIST_ENTRY **hlist;
cxt = _rl_scxt_alloc (0x01, 0);
if (direction < 0)
cxt->sflags |= 0x01;
cxt->search_terminators = _rl_isearch_terminators ? _rl_isearch_terminators
: default_isearch_terminators;
hlist = history_list ();
rl_maybe_replace_line ();
i = 0;
if (hlist)
for (i = 0; hlist[i]; i++);
cxt->lines = (char **)xmalloc ((1 + (cxt->hlen = i)) * sizeof (char *));
for (i = 0; i < cxt->hlen; i++)
cxt->lines[i] = hlist[i]->line;
if (_rl_saved_line_for_history)
cxt->lines[i] = _rl_saved_line_for_history->line;
else
{
cxt->allocated_line = (char *)xmalloc (1 + strlen (rl_line_buffer));
strcpy (cxt->allocated_line, &rl_line_buffer[0]);
cxt->lines[i] = cxt->allocated_line;
}
cxt->hlen++;
cxt->history_pos = cxt->save_line;
rl_save_prompt ();
cxt->search_string = (char *)xmalloc (cxt->search_string_size = 128);
cxt->search_string[cxt->search_string_index = 0] = '\0';
cxt->direction = (direction >= 0) ? 1 : -1;
cxt->sline = rl_line_buffer;
cxt->sline_len = strlen (cxt->sline);
cxt->sline_index = rl_point;
_rl_iscxt = cxt;
_rl_init_executing_keyseq ();
return cxt;
}
| int _rl_isearch_init(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
struct_1 *v0;
void* v1;
unsigned long long v3;
void* v4;
void* v5;
unsigned int v6;
v0 = _rl_scxt_alloc(0x1, 0x0, a2, a3, a4, a5);
if (a0 < 0)
v0->field_4 = v0->field_4 | 1;
if (!_rl_isearch_terminators)
v3 = &g_401e4c;
else
v3 = _rl_isearch_terminators;
v0->field_a0 = v3;
v1 = history_list();
rl_maybe_replace_line(0x1, 0x0, a2, a3, a4, a5);
if (v1) {
for (v4 = 0; *((v1 + 0x8 * v4)); v4 = v4 + 1);
}
v0->field_28 = 0;
v0->field_18 = xmalloc((v0->field_28 + 1) * 8);
for (v5 = 0; v5 < v0->field_28; v5 = v5 + 1) {
*((&v0->field_18->field_0 + 0x8 * v5)) = *(*((v1 + 0x8 * v5)));
}
if (_rl_saved_line_for_history) {
*((&v0->field_18->field_0 + 0x8 * v5)) = *(_rl_saved_line_for_history);
} else {
v0->field_20 = xmalloc(strlen(rl_line_buffer) + 1);
strcpy(v0->field_20, rl_line_buffer);
*((0x8 * v5 + &v0->field_18->field_0)) = v0->field_20;
}
v0->field_28 = v0->field_28 + 1;
v0->field_60 = v0->field_38;
rl_save_prompt();
v0->field_14 = 128;
v0->field_8 = xmalloc(0x80);
v0->field_10 = 0;
v0->field_8->field_0 = 0;
if (a0 < 0)
v6 = -1;
else
v6 = 1;
v0->field_64 = v6;
v0->field_90 = rl_line_buffer;
v0->field_98 = strlen(v0->field_90);
v0->field_9c = rl_point;
_rl_iscxt = &v0->padding_0;
_rl_init_executing_keyseq(a0, a1, rl_point, a3, a4, a5);
return v0;
}
|
void cu_prerminfavour(int argc, void **argv) {
struct pkginfo *conflictor= (struct pkginfo*)argv[0];
struct pkginfo *infavour= (struct pkginfo*)argv[1];
if (cleanup_conflictor_failed++) return;
maintscript_postinst(conflictor, "abort-remove",
"in-favour",
pkgbin_name(infavour, &infavour->available,
pnaw_nonambig),
versiondescribe(&infavour->available.version,
vdew_nonambig),
((void *)0)
);
pkg_clear_eflags(conflictor, PKG_EFLAG_REINSTREQ);
post_postinst_tasks(conflictor, PKG_STAT_INSTALLED);
cleanup_conflictor_failed--;
}
| long long cu_prerminfavour(unsigned long a0, unsigned long long a1[2]) {
unsigned int v0;
unsigned long long v1;
unsigned long long v2;
unsigned long long v4;
v0 = a0;
v1 = a1[0];
v2 = a1[1];
v4 = cleanup_conflictor_failed;
cleanup_conflictor_failed = cleanup_conflictor_failed + 1;
if (!v4) {
versiondescribe(v2 + 272, 0x1);
maintscript_postinst(v1, "abort-remove", "in-favour", pkgbin_name(v2, v2 + 192, 0x1, v2 + 192));
pkg_clear_eflags(v1, 0x1);
post_postinst_tasks(v1, 0x7);
v4 = cleanup_conflictor_failed - 1;
cleanup_conflictor_failed = cleanup_conflictor_failed - 1;
}
return v4;
}
|
void
request_stdin (const char *rpl_option)
{
if (stdin_used_by)
do { if (error_hook) error_hook (); error (0, 0, gettext ("Options '%s' and '%s' both want standard input"), stdin_used_by, rpl_option); usage (2); } while (0)
;
stdin_used_by = rpl_option;
}
| void request_stdin(unsigned long long a0) {
unsigned long long v1;
if (!stdin_used_by) {
v1 = a0;
stdin_used_by = a0;
return;
}
if (error_hook)
*(5242888)();
error(0x0, 0x0, gettext("Options '%s' and '%s' both want standard input"));
usage(0x2);
}
|
c->istate != 3) {
sshlog("nchan.c", __func__, 214, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "channel %d: cannot send close for istate/ostate %d/%d", c->self, c->istate, c->ostate)
;
} else if (c->flags & 0x01) {
| void sshlog(void)
{
halt_baddata();
}
|
void log_setup_kmod_log(struct kmod_ctx *ctx, int priority)
{
log_priority = priority;
kmod_set_log_priority(ctx, log_priority);
kmod_set_log_fn(ctx, log_kmod,
((void *)0)
);
}
| long long log_setup_kmod_log(unsigned long long a0, unsigned long a1) {
log_priority = a1;
kmod_set_log_priority(a0, log_priority, log_priority);
return kmod_set_log_fn(a0, log_kmod, 0x0);
}
|
static int
client_input_channel_req(int type, u_int32_t seq, struct ssh *ssh)
{
Channel *c =
((void *)0)
;
char *rtype =
((void *)0)
;
u_char reply;
u_int id, exitval;
int r, success = 0;
if ((r = sshpkt_get_u32(ssh, &id)) != 0)
return r;
if (id <= 0x7fffffff)
c = channel_lookup(ssh, id);
if (channel_proxy_upstream(c, type, seq, ssh))
return 0;
if ((r = sshpkt_get_cstring(ssh, &rtype,
((void *)0)
)) != 0 ||
(r = sshpkt_get_u8(ssh, &reply)) != 0)
goto out;
sshlog("clientloop.c", __func__, 1744, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "client_input_channel_req: channel %u rtype %s reply %d", id, rtype, reply)
;
if (c ==
((void *)0)
) {
sshlog("clientloop.c", __func__, 1748, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "client_input_channel_req: channel %d: " "unknown channel", id)
;
} else if (strcmp(rtype, "eow@openssh.com") == 0) {
if ((r = sshpkt_get_end(ssh)) != 0)
goto out;
chan_rcvd_eow(ssh, c);
} else if (strcmp(rtype, "exit-status") == 0) {
if ((r = sshpkt_get_u32(ssh, &exitval)) != 0)
goto out;
if (c->ctl_chan != -1) {
mux_exit_message(ssh, c, exitval);
success = 1;
} else if ((int)id == session_ident) {
success = 1;
exit_status = exitval;
} else {
sshlog("clientloop.c", __func__, 1766, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "no sink for exit-status on channel %d", id)
;
}
if ((r = sshpkt_get_end(ssh)) != 0)
goto out;
}
if (reply && c !=
((void *)0)
&& !(c->flags & 0x01)) {
if (!c->have_remote_id)
sshfatal("clientloop.c", __func__, 1774, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "channel %d: no remote_id", c->self);
if ((r = sshpkt_start(ssh, success ?
99 : 100)) != 0 ||
(r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
sshpkt_fatal(ssh, r, "%s: send failure", __func__);
}
r = 0;
out:
free(rtype);
return r;
}
| long long client_input_channel_req(unsigned long a0, unsigned long a1, unsigned long long a2) {
unsigned long long v0;
unsigned long v1;
unsigned long long v2;
unsigned long v3;
unsigned long long v4;
char v5;
char v6;
char v7;
unsigned int v8;
unsigned int v9;
void* v10;
void* v11;
void* v13;
unsigned long long v15;
unsigned long long v16;
unsigned long long v17;
v4 = a2;
v11 = 0;
v10 = 0;
v9 = 0;
v8 = sshpkt_get_u32(v4, &v6, &v6);
if (v8) {
v13 = v8;
} else {
if (*(&v6) >= 0)
v11 = channel_lookup(v4, *(&v6), *(&v6));
if (channel_proxy_upstream(v11, a0, a1, v4)) {
v13 = 0;
} else {
v8 = sshpkt_get_cstring(v4, &v10, 0x0, &v10);
if (!v8) {
v8 = sshpkt_get_u8(v4, &v5, &v5);
if (!v8) {
v3 = v5;
v2 = v10;
v1 = *(&v6);
v0 = "client_input_channel_req: channel %u rtype %s reply %d";
sshlog("clientloop.c", "client_input_channel_req", 0x6d0, 0x0, 0x5, 0x0);
if (!v11) {
v3 = *(&v6);
v2 = "client_input_channel_req: channel %d: unknown channel";
sshlog("clientloop.c", "client_input_channel_req", 0x6d4, 0x0, 0x2, 0x0);
} else {
v15 = strcmp(v10, "eow@openssh.com");
if (!v15) {
v8 = sshpkt_get_end(v4);
if (!v8)
chan_rcvd_eow(v4, v11, v11);
} else {
v16 = strcmp(v10, "exit-status");
if (!v16) {
v8 = sshpkt_get_u32(v4, &v7, &v7);
if (!v8) {
if (v11[68] != -1) {
mux_exit_message(v4, v11, *(&v7), v11);
v9 = 1;
} else if (*(&v6) == session_ident) {
v9 = 1;
exit_status = *(&v7);
} else {
v3 = *(&v6);
v2 = "no sink for exit-status on channel %d";
sshlog("clientloop.c", "client_input_channel_req", 0x6e6, 0x1, 0x5, 0x0);
}
v8 = sshpkt_get_end(v4);
}
}
}
}
if (!v11 || !v8 && !v15 || v15 && v16 || !v8 && !v8 && v15) {
if (v5 && v11 && !(v11[24] & 1)) {
if (!v11[12]) {
v3 = v11[4];
v2 = "channel %d: no remote_id";
sshfatal("clientloop.c", "client_input_channel_req", 0x6ee, 0x1, 0x1, 0x0);
}
if (v9)
v17 = 99;
else
v17 = 100;
v8 = sshpkt_start(v4, v17);
if (!v8) {
v8 = sshpkt_put_u32(v4, v11[8]);
if (!v8)
v8 = sshpkt_send(v4);
}
if (v8 || v8 || v8)
sshpkt_fatal(v4, v8, "%s: send failure", "client_input_channel_req");
}
v8 = 0;
}
}
}
free(v10);
v13 = v8;
}
}
return v13;
}
|
int
strunvisx(char *dst, const char *src, int flag)
{
return strnunvisx(dst, (size_t)~0, src, flag);
}
| long strunvisx(_BYTE *a1, char *a2, short a3)
{
return strnunvisx(a1, -1LL, a2, a3);
}
|
static void macvlan_print_help(struct link_util *lu, int argc, char **argv,
FILE *f)
{
print_explain(lu, f);
}
| int macvlan_print_help(long a1, long a2, long a3, FILE *a4)
{
return print_explain(a1, a4);
}
|
static int command_do(struct kmod_module *module, const char *type,
const char *command, const char *cmdline_opts)
{
const char *modname = kmod_module_get_name(module);
char *p, *cmd =
((void *)0)
;
size_t cmdlen, cmdline_opts_len, varlen;
int ret = 0;
if (cmdline_opts ==
((void *)0)
)
cmdline_opts = "";
cmdline_opts_len = strlen(cmdline_opts);
cmd = strdup(command);
if (cmd ==
((void *)0)
)
return -
12
;
cmdlen = strlen(cmd);
varlen = sizeof("$CMDLINE_OPTS") - 1;
while ((p = strstr(cmd, "$CMDLINE_OPTS")) !=
((void *)0)
) {
size_t prefixlen = p - cmd;
size_t suffixlen = cmdlen - prefixlen - varlen;
size_t slen = cmdlen - varlen + cmdline_opts_len;
char *suffix = p + varlen;
char *s = malloc(slen + 1);
if (s ==
((void *)0)
) {
free(cmd);
return -
12
;
}
memcpy(s, cmd, p - cmd);
memcpy(s + prefixlen, cmdline_opts, cmdline_opts_len);
memcpy(s + prefixlen + cmdline_opts_len, suffix, suffixlen);
s[slen] = '\0';
free(cmd);
cmd = s;
cmdlen = slen;
}
_show("%s %s\n", type, cmd);
if (dry_run)
goto end;
setenv("MODPROBE_MODULE", modname, 1);
ret = system(cmd);
unsetenv("MODPROBE_MODULE");
if (ret == -1 ||
(((
ret
) & 0xff00) >> 8)
) {
log_printf(log_priority, "Error running %s command for %s\n", type, modname);
if (ret != -1)
ret = -
(((
ret
) & 0xff00) >> 8)
;
}
end:
free(cmd);
return ret;
}
| int command_do(unsigned long long a0, unsigned long long a1, char *a2, void* a3) {
unsigned long long v0;
unsigned int v1;
char *v2;
char *v3;
char *v4;
unsigned int v5;
unsigned long long v6;
unsigned long v7;
unsigned long v8;
unsigned int v9;
char *v10;
void* v11;
char *v12;
unsigned int v14;
v0 = a3;
v4 = kmod_module_get_name(a0);
v2 = 0;
v1 = 0;
if (!v0)
v0 = &g_400bf1;
*(&v5) = strlen(v0);
v2 = strdup(a2);
if (!v2) {
v14 = -12;
} else {
v3 = strlen(v2);
v6 = 13;
while (true) {
v7 = strstr(v2, "$CMDLINE_OPTS");
if (v7) {
v8 = v7 + -0x1 * v2;
*(&v9) = &v3[-1 * v8 + -1 * v6];
v10 = &v3[-1 * v6 + *(&v5)];
v11 = v6 + v7;
v12 = malloc(v10 + 1);
if (!v12) {
free(v2);
v14 = -12;
break;
} else {
memcpy(v12, v2, v7 + -0x1 * v2);
memcpy(&v12[v8], v0, *(&v5));
memcpy(&v12[*(&v5) + v8], v11, *(&v9));
*((v10 + v12)) = 0;
free(v2);
v2 = v12;
v3 = v10;
}
} else {
_show();
if (!dry_run) {
setenv("MODPROBE_MODULE", v4, 0x1);
v1 = system(v2);
unsetenv("MODPROBE_MODULE");
if (v1 != -1 && (v1 >> 8))
v1 = -((v1 >> 8));
if (v1 == -1 || (v1 >> 8))
log_printf(log_priority, "Error running %s command for %s\n", a1);
}
free(v2);
v14 = v1;
break;
}
}
}
return v14;
}
|
int
sshkey_format_text(const struct sshkey *key, struct sshbuf *b)
{
int r = -1;
char *uu =
((void *)0)
;
if ((r = sshkey_to_base64(key, &uu)) != 0)
goto out;
if ((r = sshbuf_putf(b, "%s %s",
sshkey_ssh_name(key), uu)) != 0)
goto out;
r = 0;
out:
free(uu);
return r;
}
| long sshkey_format_text(int *a1, long a2)
{
const char *v2;
char *v3;
unsigned int v5;
void *ptr[4];
ptr[1] = (void *)__readfsqword(0x28u);
ptr[0] = 0LL;
v5 = sshkey_to_base64((long)a1, ptr);
if ( !v5 )
{
v2 = (const char *)ptr[0];
v3 = sshkey_ssh_name(a1);
v5 = sshbuf_putf(a2, "%s %s", v3, v2);
if ( !v5 )
v5 = 0;
}
free(ptr[0]);
return v5;
}
|
static void
checked_fwrite (void *p, size_t siz, size_t nmemb, struct format_val *dest)
{
const size_t items_written = fwrite (p, siz, nmemb, dest->stream);
if (items_written < nmemb)
nonfatal_nontarget_file_error (
(*__errno_location ())
, dest->filename);
}
| size_t checked_fwrite(const void *a1, size_t a2, size_t a3, long a4)
{
size_t result;
long v5;
int *v6;
result = fwrite(a1, a2, a3, *(FILE **)(a4 + 8));
if ( result < a3 )
{
v5 = *(_QWORD *)(a4 + 16);
v6 = _errno_location();
return nonfatal_nontarget_file_error((unsigned int)*v6, v5);
}
return result;
}
|
static void
copy_attr_error (__attribute__ ((__unused__)) struct error_context *ctx,
char const *fmt, ...)
{
if (!errno_unsupported (
(*__errno_location ())
))
{
int err =
(*__errno_location ())
;
va_list ap;
__builtin_va_start(
ap
,
fmt
)
;
verror (0, err, fmt, ap);
__builtin_va_end(
ap
)
;
}
}
| unsigned long copy_attr_error(long a1, long a2, long a3, long a4, long a5, long a6, ...)
{
int *v6;
unsigned int v8;
gcc_va_list va;
unsigned long v10;
long v11;
long v12;
long v13;
long v14;
v11 = a3;
v12 = a4;
v13 = a5;
v14 = a6;
v10 = __readfsqword(0x28u);
v6 = _errno_location();
if ( !errno_unsupported(*v6) )
{
v8 = *_errno_location();
va_start(va, a6);
verror(0LL, v8, a2, va);
}
return __readfsqword(0x28u) ^ v10;
}
|
void
set_var_read_only (name)
char *name;
{
SHELL_VAR *entry;
do { entry = find_variable (name); if (!entry) { entry = bind_variable (name, "", 0); if (entry) entry->attributes |= 0x0001000; } } while (0);
((entry)->attributes |= (0x0000002));
}
| long long set_var_read_only(unsigned long long a0) {
struct_0 *v0;
int tmp_17;
unsigned long long v2;
v0 = find_variable(a0);
if (!v0) {
v0 = bind_variable(a0, &g_40bcf4, 0x0);
if (v0) {
v2 = v0->field_28;
*(&v2) = (v0->field_28 >> 8) | 16;
tmp_17 = v2;
v0->field_28 = tmp_17;
}
}
v0->field_28 = v0->field_28 | 2;
return v0;
}
|
static WORD_LIST *
quote_list (list)
WORD_LIST *list;
{
register WORD_LIST *w;
char *t;
for (w = list; w; w = w->next)
{
t = w->word->word;
w->word->word = quote_string (t);
if (*t == 0)
w->word->flags |= (1 << 18);
w->word->flags |= (1 << 1);
sh_xfree((t), "subst.c", 4932);
}
return list;
}
| undefined8 * quote_list(undefined8 *param_1)
{
char *pcVar1;
undefined8 *puVar2;
undefined8 uVar3;
undefined8 *puVar4;
for (puVar4 = param_1; puVar4 != (undefined8 *)0x0; puVar4 = (undefined8 *)*puVar4) {
pcVar1 = *(char **)puVar4[1];
puVar2 = (undefined8 *)puVar4[1];
uVar3 = quote_string(pcVar1);
*puVar2 = uVar3;
if (*pcVar1 == '\0') {
*(uint *)(puVar4[1] + 8) = *(uint *)(puVar4[1] + 8) | 0x40000;
}
*(uint *)(puVar4[1] + 8) = *(uint *)(puVar4[1] + 8) | 2;
sh_xfree(pcVar1,"subst.c",0x1344);
}
return param_1;
}
|
static inline void
emit_ancillary_info (char const *program)
{
struct infomap { char const *program; char const *node; } const infomap[] = {
{ "[", "test invocation" },
{ "coreutils", "Multi-call invocation" },
{ "sha224sum", "sha2 utilities" },
{ "sha256sum", "sha2 utilities" },
{ "sha384sum", "sha2 utilities" },
{ "sha512sum", "sha2 utilities" },
{
((void *)0)
,
((void *)0)
}
};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && ! (strcmp (program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
}
| void emit_ancillary_info(char *a0) {
unsigned long long v0;
unsigned long long v1[2];
char *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void* v16;
void* v17;
char v18;
unsigned long long v20;
unsigned long long *v21;
unsigned long long v22;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
v1[0] = &v4;
while (true) {
if (!v1[0])
break;
if (!strcmp(a0, v1[0]))
break;
v1[0] = v1 + 1;
}
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
if (!strcmp(a0, "["))
v20 = "test";
else
v20 = a0;
v3 = v20;
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v22 = *(&v18) ^ v21[5];
return;
}
|
static char *
string_extract_double_quoted (string, sindex, flags)
char *string;
int *sindex, flags;
{
size_t slen;
char *send;
int j, i, t;
unsigned char c;
char *temp, *ret;
int pass_next, backquote, si;
int dquote;
int stripdq;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
slen = strlen (string + *sindex) + *sindex;
send = string + slen;
stripdq = (flags & 0x0800);
pass_next = backquote = dquote = 0;
temp = (char *)sh_xmalloc((1 + slen - *sindex), "subst.c", 880);
j = 0;
i = *sindex;
while (c = string[i])
{
if (pass_next)
{
if ((stripdq == 0 && c != '"') ||
(stripdq && ((dquote && (sh_syntaxtab[c] & 0x0040)) || dquote == 0)))
temp[j++] = '\\';
pass_next = 0;
add_one_character:
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _k; _k = is_basic ((string)[(i)]); if (_k) mblength = 1; else if (locale_utf8locale && ((string)[(i)] & 0x80) == 0) mblength = (string)[(i)] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (send) - ((string)+(i)), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; mblength = 1; } else mblength = (mblength < 1) ? 1 : mblength; for (_k = 0; _k < mblength; _k++) temp[j++] = string[i++]; } else temp[j++] = string[i++]; } while (0);
continue;
}
if (c == '\\')
{
pass_next++;
i++;
continue;
}
if (backquote)
{
if (c == '`')
backquote = 0;
temp[j++] = c;
i++;
continue;
}
if (c == '`')
{
temp[j++] = c;
backquote++;
i++;
continue;
}
if (c == '$' && ((string[i + 1] == '(') || (string[i + 1] == '{')))
{
int free_ret = 1;
si = i + 2;
if (string[i + 1] == '(')
ret = extract_command_subst (string, &si, (flags & 0x0400));
else
ret = extract_dollar_brace_string (string, &si, 0x001, 0);
temp[j++] = '$';
temp[j++] = string[i + 1];
if (ret == 0 && no_longjmp_on_fatal_error)
{
free_ret = 0;
ret = string + i + 2;
}
for (t = 0; ret[t]; t++, j++)
temp[j] = ret[t];
temp[j] = string[si];
if (si < i + 2)
i += 2;
else if (string[si])
{
j++;
i = si + 1;
}
else
i = si;
if (free_ret)
sh_xfree((ret), "subst.c", 992);
continue;
}
if (c != '"')
goto add_one_character;
if (stripdq)
{
dquote ^= 1;
i++;
continue;
}
break;
}
temp[j] = '\0';
if (c)
i++;
*sindex = i;
return (temp);
}
static int
skip_double_quoted (string, slen, sind, flags)
char *string;
size_t slen;
int sind;
int flags;
{
int c, i;
char *ret;
int pass_next, backquote, si;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
pass_next = backquote = 0;
i = sind;
while (c = string[i])
{
if (pass_next)
{
pass_next = 0;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
continue;
}
else if (c == '\\')
{
pass_next++;
i++;
continue;
}
else if (backquote)
{
if (c == '`')
backquote = 0;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
continue;
}
else if (c == '`')
{
backquote++;
i++;
continue;
}
else if (c == '$' && ((string[i + 1] == '(') || (string[i + 1] == '{')))
{
si = i + 2;
if (string[i + 1] == '(')
ret = extract_command_subst (string, &si, 0x0001|(flags&0x0400));
else
ret = extract_dollar_brace_string (string, &si, 0x001, 0x0001);
if (si >= slen) { i = slen; c = 0; break; } else;
i = si + 1;
continue;
}
else if (c != '"')
{
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
continue;
}
else
break;
}
if (c)
i++;
return (i);
}
static inline char *
string_extract_single_quoted (string, sindex, allowesc)
char *string;
int *sindex;
int allowesc;
{
register int i;
size_t slen;
char *t;
int pass_next;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
slen = (
(__ctype_get_mb_cur_max ())
> 1) ? strlen (string + *sindex) + *sindex : 0;
i = *sindex;
pass_next = 0;
while (string[i])
{
if (pass_next)
{
pass_next = 0;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
continue;
}
if (allowesc && string[i] == '\\')
pass_next++;
else if (string[i] == '\'')
break;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
}
t = substring (string, *sindex, i);
if (string[i])
i++;
*sindex = i;
return (t);
}
static inline int
skip_single_quoted (string, slen, sind, flags)
const char *string;
size_t slen;
int sind;
int flags;
{
register int c;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
c = sind;
while (string[c] && string[c] != '\'')
{
if ((flags & 0x0400) && string[c] == '\\' && string[c+1] == '\'' && string[c+2])
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[c]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[c] & 0x80) == 0)) mblength = (string)[c] != 0; else { state_bak = state; mblength = mbrlen ((string) + (c), (slen) - (c), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (c)++; } else if (mblength == 0) (c)++; else (c) += mblength; } else (c)++; } while (0);
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[c]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[c] & 0x80) == 0)) mblength = (string)[c] != 0; else { state_bak = state; mblength = mbrlen ((string) + (c), (slen) - (c), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (c)++; } else if (mblength == 0) (c)++; else (c) += mblength; } else (c)++; } while (0);
}
if (string[c])
c++;
return c;
}
static char *
string_extract_verbatim (string, slen, sindex, charlist, flags)
char *string;
size_t slen;
int *sindex;
char *charlist;
int flags;
{
register int i;
wchar_t *wcharlist;
int c;
char *temp;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
if ((flags & 0x0010) && charlist[0] == '\'' && charlist[1] == '\0')
{
temp = string_extract_single_quoted (string, sindex, 0);
--*sindex;
return temp;
}
if (*charlist == 0)
{
temp = string + *sindex;
c = (*sindex == 0) ? slen : (((temp) && (temp)[0]) ? ((temp)[1] ? ((temp)[2] ? strlen(temp) : 2) : 1) : 0);
temp = (char *)strcpy (sh_xmalloc((1 + strlen (temp)), "subst.c", 1195), (temp));
*sindex += c;
return temp;
}
i = *sindex;
wcharlist = 0;
while (c = string[i])
{
size_t mblength;
if ((flags & 0x0010) == 0 && c == '\001')
{
i += 2;
if (i >= slen) { i = slen; c = 0; break; } else;
continue;
}
else if ((flags & 0x0020) == 0 && c == '\001' && string[i+1] == '\177')
{
i += 2;
if (i >= slen) { i = slen; c = 0; break; } else;
continue;
}
if (locale_utf8locale && slen > i && (((string[i]) & 0x80) == 0))
mblength = (string[i] != 0) ? 1 : 0;
else
mblength = ((
(__ctype_get_mb_cur_max ())
> 1) ? mblen ((string + i), (slen - i)) : 1);
if (mblength > 1)
{
wchar_t wc;
mblength = mbtowc (&wc, string + i, slen - i);
if (((mblength) == (size_t)-1 || (mblength) == (size_t)-2))
{
if ((((c) && c == (charlist)[0] && !(charlist)[1]) || (((c) ? ((char *)mbschr ((charlist), (c)) != (char *)
((void *)0)
) : 0))))
break;
}
else
{
if (wcharlist == 0)
{
size_t len;
len = mbstowcs (wcharlist, charlist, 0);
if (len == -1)
len = 0;
wcharlist = (wchar_t *)sh_xmalloc((sizeof (wchar_t) * (len + 1)), "subst.c", 1247);
mbstowcs (wcharlist, charlist, len + 1);
}
if (wcschr (wcharlist, wc))
break;
}
}
else
if ((((c) && c == (charlist)[0] && !(charlist)[1]) || (((c) ? ((char *)mbschr ((charlist), (c)) != (char *)
((void *)0)
) : 0))))
break;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
}
do { if (wcharlist) sh_xfree((wcharlist), "subst.c", 1264); } while (0);
temp = substring (string, *sindex, i);
*sindex = i;
return (temp);
}
char *
extract_command_subst (string, sindex, xflags)
char *string;
int *sindex;
int xflags;
{
char *ret;
if (string[*sindex] == '(' || (xflags & 0x0400))
return (extract_delimited_string (string, sindex, "$(", "(", ")", xflags|0x0008));
else
{
xflags |= (no_longjmp_on_fatal_error ? 0x0040 : 0);
ret = xparse_dolparen (string, string+*sindex, sindex, xflags);
return ret;
}
}
char *
extract_arithmetic_subst (string, sindex)
char *string;
int *sindex;
{
return (extract_delimited_string (string, sindex, "$[", "[", "]", 0));
}
char *
extract_process_subst (string, starter, sindex, xflags)
char *string;
char *starter;
int *sindex;
int xflags;
{
xflags |= (no_longjmp_on_fatal_error ? 0x0040 : 0);
return (xparse_dolparen (string, string+*sindex, sindex, xflags));
}
char *
extract_array_assignment_list (string, sindex)
char *string;
int *sindex;
{
int slen;
char *ret;
slen = strlen (string);
if (string[slen - 1] == ')')
{
ret = substring (string, *sindex, slen - 1);
*sindex = slen - 1;
return ret;
}
return 0;
}
static char *
extract_delimited_string (string, sindex, opener, alt_opener, closer, flags)
char *string;
int *sindex;
char *opener, *alt_opener, *closer;
int flags;
{
int i, c, si;
size_t slen;
char *t, *result;
int pass_character, nesting_level, in_comment;
int len_closer, len_opener, len_alt_opener;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
slen = strlen (string + *sindex) + *sindex;
len_opener = (((opener) && (opener)[0]) ? ((opener)[1] ? ((opener)[2] ? strlen(opener) : 2) : 1) : 0);
len_alt_opener = (((alt_opener) && (alt_opener)[0]) ? ((alt_opener)[1] ? ((alt_opener)[2] ? strlen(alt_opener) : 2) : 1) : 0);
len_closer = (((closer) && (closer)[0]) ? ((closer)[1] ? ((closer)[2] ? strlen(closer) : 2) : 1) : 0);
pass_character = in_comment = 0;
nesting_level = 1;
i = *sindex;
while (nesting_level)
{
c = string[i];
if (i > slen)
{
i = slen;
c = string[i = slen];
break;
}
if (c == 0)
break;
if (in_comment)
{
if (c == '\n')
in_comment = 0;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
continue;
}
if (pass_character)
{
pass_character = 0;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
continue;
}
if ((flags & 0x0008) && c == '#' && (i == 0 || string[i - 1] == '\n' || (sh_syntaxtab[(unsigned char)(string[i - 1])] & 0x2000)))
{
in_comment = 1;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
continue;
}
if (c == '\001' || c == '\\')
{
pass_character++;
i++;
continue;
}
if ((flags & 0x0008) && string[i] == '$' && string[i+1] == '(')
{
si = i + 2;
t = extract_command_subst (string, &si, flags|0x0001);
if (si >= slen) { i = slen; c = 0; break; } else;
i = si + 1;
continue;
}
if (((len_opener == 0) ? (1) : ((string + i)[0] == (opener)[0] && strncmp(string + i, opener, len_opener) == 0)))
{
si = i + len_opener;
t = extract_delimited_string (string, &si, opener, alt_opener, closer, flags|0x0001);
if (si >= slen) { i = slen; c = 0; break; } else;
i = si + 1;
continue;
}
if (len_alt_opener && ((len_alt_opener == 0) ? (1) : ((string + i)[0] == (alt_opener)[0] && strncmp(string + i, alt_opener, len_alt_opener) == 0)))
{
si = i + len_alt_opener;
t = extract_delimited_string (string, &si, alt_opener, alt_opener, closer, flags|0x0001);
if (si >= slen) { i = slen; c = 0; break; } else;
i = si + 1;
continue;
}
if (((len_closer == 0) ? (1) : ((string + i)[0] == (closer)[0] && strncmp(string + i, closer, len_closer) == 0)))
{
i += len_closer - 1;
nesting_level--;
if (nesting_level == 0)
break;
}
if (c == '`')
{
si = i + 1;
t = string_extract (string, &si, "`", flags|0x0001);
if (si >= slen) { i = slen; c = 0; break; } else;
i = si + 1;
continue;
}
if (c == '\'' || c == '"')
{
si = i + 1;
i = (c == '\'') ? skip_single_quoted (string, slen, si, 0)
: skip_double_quoted (string, slen, si, 0);
continue;
}
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
}
if (c == 0 && nesting_level)
{
if (no_longjmp_on_fatal_error == 0)
{
last_command_exit_value = 1;
report_error (gettext("bad substitution: no closing `%s' in %s"), closer, string);
exp_jump_to_top_level (2);
}
else
{
*sindex = i;
return (char *)
((void *)0)
;
}
}
si = i - *sindex - len_closer + 1;
if (flags & 0x0001)
result = (char *)
((void *)0)
;
else
{
result = (char *)sh_xmalloc((1 + si), "subst.c", 1513);
strncpy (result, string + *sindex, si);
result[si] = '\0';
}
*sindex = i;
return (result);
}
static char *
extract_heredoc_dolbrace_string (string, sindex, quoted, flags)
char *string;
int *sindex, quoted, flags;
{
register int i, c;
size_t slen, tlen, result_index, result_size;
int pass_character, nesting_level, si, dolbrace_state;
char *result, *t, *send;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
pass_character = 0;
nesting_level = 1;
slen = strlen (string + *sindex) + *sindex;
send = string + slen;
result_size = slen;
result_index = 0;
result = sh_xmalloc((result_size + 1), "subst.c", 1548);
dolbrace_state = 0x40;
i = *sindex;
while (c = string[i])
{
if (pass_character)
{
pass_character = 0;
do { if ((result_index) + (locale_mb_cur_max + 1) >= result_size) { while ((result_index) + (locale_mb_cur_max + 1) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1559); } } while (0);
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _k; _k = is_basic ((string)[(i)]); if (_k) mblength = 1; else if (locale_utf8locale && ((string)[(i)] & 0x80) == 0) mblength = (string)[(i)] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (send) - ((string)+(i)), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; mblength = 1; } else mblength = (mblength < 1) ? 1 : mblength; for (_k = 0; _k < mblength; _k++) result[result_index++] = string[i++]; } else result[result_index++] = string[i++]; } while (0);
continue;
}
if (c == '\001' || c == '\\')
{
pass_character++;
do { if ((result_index) + (2) >= result_size) { while ((result_index) + (2) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1568); } } while (0);
result[result_index++] = c;
i++;
continue;
}
if (c == '$' && string[i+1] == '\'')
{
char *ttrans;
int ttranslen;
if ((posixly_correct || extended_quote == 0) && dolbrace_state != 0x40 && dolbrace_state != 0x80)
{
do { if ((result_index) + (3) >= result_size) { while ((result_index) + (3) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1582); } } while (0);
result[result_index++] = '$';
result[result_index++] = '\'';
i += 2;
continue;
}
si = i + 2;
t = string_extract_single_quoted (string, &si, 1);
if (si >= slen) { i = slen; c = 0; break; } else;
tlen = si - i - 2;
ttrans = ansiexpand (t, 0, tlen, &ttranslen);
sh_xfree((t), "subst.c", 1595);
if (dolbrace_state == 0x40 || dolbrace_state == 0x80)
{
t = sh_single_quote (ttrans);
tlen = strlen (t);
sh_xfree((ttrans), "subst.c", 1602);
}
else if (extended_quote)
{
t = ttrans;
tlen = strlen (t);
}
do { if ((result_index) + (tlen + 1) >= result_size) { while ((result_index) + (tlen + 1) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1611); } } while (0);
strncpy (result + result_index, t, tlen);
result_index += tlen;
sh_xfree((t), "subst.c", 1614);
i = si;
continue;
}
if (c == '$' && string[i+1] == '"')
{
char *ttrans;
int ttranslen;
si = i + 2;
t = string_extract_double_quoted (string, &si, flags);
if (si >= slen) { i = slen; c = 0; break; } else;
tlen = si - i - 2;
ttrans = locale_expand (t, 0, tlen, line_number, &ttranslen);
sh_xfree((t), "subst.c", 1631);
t = singlequote_translations ? sh_single_quote (ttrans) : sh_mkdoublequoted (ttrans, ttranslen, 0);
tlen = strlen (t);
sh_xfree((ttrans), "subst.c", 1635);
do { if ((result_index) + (tlen + 1) >= result_size) { while ((result_index) + (tlen + 1) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1637); } } while (0);
strncpy (result + result_index, t, tlen);
result_index += tlen;
sh_xfree((t), "subst.c", 1640);
i = si;
continue;
}
if (c == '$' && string[i+1] == '{')
{
nesting_level++;
do { if ((result_index) + (3) >= result_size) { while ((result_index) + (3) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1649); } } while (0);
result[result_index++] = c;
result[result_index++] = string[i+1];
i += 2;
if (dolbrace_state == 0x40 || dolbrace_state == 0x80 || dolbrace_state == 0x04)
dolbrace_state = 0x01;
continue;
}
if (c == '}')
{
nesting_level--;
if (nesting_level == 0)
break;
do { if ((result_index) + (2) >= result_size) { while ((result_index) + (2) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1663); } } while (0);
result[result_index++] = c;
i++;
continue;
}
if (c == '`')
{
si = i + 1;
t = string_extract (string, &si, "`", flags);
if (si >= slen) { i = slen; c = 0; break; } else;
tlen = si - i - 1;
do { if ((result_index) + (tlen + 3) >= result_size) { while ((result_index) + (tlen + 3) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1678); } } while (0);
result[result_index++] = c;
strncpy (result + result_index, t, tlen);
result_index += tlen;
result[result_index++] = string[si];
sh_xfree((t), "subst.c", 1683);
i = si + 1;
continue;
}
if (string[i] == '$' && string[i+1] == '(')
{
si = i + 2;
t = extract_command_subst (string, &si, flags);
if (si >= slen) { i = slen; c = 0; break; } else;
tlen = si - i - 1;
do { if ((result_index) + (tlen + 4) >= result_size) { while ((result_index) + (tlen + 4) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1697); } } while (0);
result[result_index++] = c;
result[result_index++] = '(';
strncpy (result + result_index, t, tlen);
result_index += tlen;
result[result_index++] = string[si];
sh_xfree((t), "subst.c", 1703);
i = si + 1;
continue;
}
if ((string[i] == '<' || string[i] == '>') && string[i+1] == '(')
{
si = i + 2;
t = extract_process_subst (string, (string[i] == '<' ? "<(" : ">)"), &si, flags);
if (si >= slen) { i = slen; c = 0; break; } else;
tlen = si - i - 1;
do { if ((result_index) + (tlen + 4) >= result_size) { while ((result_index) + (tlen + 4) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1717); } } while (0);
result[result_index++] = c;
result[result_index++] = '(';
strncpy (result + result_index, t, tlen);
result_index += tlen;
result[result_index++] = string[si];
sh_xfree((t), "subst.c", 1723);
i = si + 1;
continue;
}
if (c == '\'' && posixly_correct && shell_compatibility_level > 42 && dolbrace_state != 0x40)
{
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _k; _k = is_basic ((string)[(i)]); if (_k) mblength = 1; else if (locale_utf8locale && ((string)[(i)] & 0x80) == 0) mblength = (string)[(i)] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (send) - ((string)+(i)), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; mblength = 1; } else mblength = (mblength < 1) ? 1 : mblength; for (_k = 0; _k < mblength; _k++) result[result_index++] = string[i++]; } else result[result_index++] = string[i++]; } while (0);
continue;
}
if (c == '"' || c == '\'')
{
si = i + 1;
if (c == '"')
t = string_extract_double_quoted (string, &si, flags);
else
t = string_extract_single_quoted (string, &si, 0);
if (si >= slen) { i = slen; c = 0; break; } else;
tlen = si - i - 2;
do { if ((result_index) + (tlen + 3) >= result_size) { while ((result_index) + (tlen + 3) >= result_size) result_size += (64); result = sh_xrealloc((result), (result_size), "subst.c", 1746); } } while (0);
result[result_index++] = c;
strncpy (result + result_index, t, tlen);
result_index += tlen;
result[result_index++] = string[si - 1];
sh_xfree((t), "subst.c", 1751);
i = si;
continue;
}
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _k; _k = is_basic ((string)[(i)]); if (_k) mblength = 1; else if (locale_utf8locale && ((string)[(i)] & 0x80) == 0) mblength = (string)[(i)] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (send) - ((string)+(i)), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; mblength = 1; } else mblength = (mblength < 1) ? 1 : mblength; for (_k = 0; _k < mblength; _k++) result[result_index++] = string[i++]; } else result[result_index++] = string[i++]; } while (0);
if (dolbrace_state == 0x01 && c == '%' && (i - *sindex) > 1)
dolbrace_state = 0x40;
else if (dolbrace_state == 0x01 && c == '#' && (i - *sindex) > 1)
dolbrace_state = 0x40;
else if (dolbrace_state == 0x01 && c == '/' && (i - *sindex) > 1)
dolbrace_state = 0x80;
else if (dolbrace_state == 0x01 && c == '^' && (i - *sindex) > 1)
dolbrace_state = 0x40;
else if (dolbrace_state == 0x01 && c == ',' && (i - *sindex) > 1)
dolbrace_state = 0x40;
else if (dolbrace_state == 0x01 && strchr ("#%^,~:-=?+/", c) != 0)
dolbrace_state = 0x02;
else if (dolbrace_state == 0x02 && strchr ("#%^,~:-=?+/", c) == 0)
dolbrace_state = 0x04;
}
if (c == 0 && nesting_level)
{
sh_xfree((result), "subst.c", 1781);
if (no_longjmp_on_fatal_error == 0)
{
last_command_exit_value = 1;
report_error (gettext("bad substitution: no closing `%s' in %s"), "}", string);
exp_jump_to_top_level (2);
}
else
{
*sindex = i;
return ((char *)
((void *)0)
);
}
}
*sindex = i;
result[result_index] = '\0';
return (result);
}
static char *
extract_dollar_brace_string (string, sindex, quoted, flags)
char *string;
int *sindex, quoted, flags;
{
register int i, c;
size_t slen;
int pass_character, nesting_level, si, dolbrace_state;
char *result, *t;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
dolbrace_state = (flags & 0x0200) ? 0x04 : 0x01;
if ((quoted & (0x002|0x001)) && (flags & 0x0100))
dolbrace_state = 0x40;
if (quoted == 0x002 && dolbrace_state == 0x40 && (flags & 0x0001) == 0)
return (extract_heredoc_dolbrace_string (string, sindex, quoted, flags));
pass_character = 0;
nesting_level = 1;
slen = strlen (string + *sindex) + *sindex;
i = *sindex;
while (c = string[i])
{
if (pass_character)
{
pass_character = 0;
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
continue;
}
if (c == '\001' || c == '\\')
{
pass_character++;
i++;
continue;
}
if (string[i] == '$' && string[i+1] == '{')
{
nesting_level++;
i += 2;
if (dolbrace_state == 0x40 || dolbrace_state == 0x04)
dolbrace_state = 0x01;
continue;
}
if (c == '}')
{
nesting_level--;
if (nesting_level == 0)
break;
i++;
continue;
}
if (c == '`')
{
si = i + 1;
t = string_extract (string, &si, "`", flags|0x0001);
if (si >= slen) { i = slen; c = 0; break; } else;
i = si + 1;
continue;
}
if (string[i] == '$' && string[i+1] == '(')
{
si = i + 2;
t = extract_command_subst (string, &si, flags|0x0001);
if (si >= slen) { i = slen; c = 0; break; } else;
i = si + 1;
continue;
}
if ((string[i] == '<' || string[i] == '>') && string[i+1] == '(')
{
si = i + 2;
t = extract_process_subst (string, (string[i] == '<' ? "<(" : ">)"), &si, flags|0x0001);
if (si >= slen) { i = slen; c = 0; break; } else;
i = si + 1;
continue;
}
if (c == '"')
{
si = i + 1;
i = skip_double_quoted (string, slen, si, 0);
continue;
}
if (c == '\'')
{
if (posixly_correct && shell_compatibility_level > 42 && dolbrace_state != 0x40 && (quoted & (0x002|0x001)))
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
else
{
si = i + 1;
i = skip_single_quoted (string, slen, si, 0);
}
continue;
}
if (c == '[' && dolbrace_state == 0x01)
{
si = skipsubscript (string, i, 0);
if (si >= slen) { i = slen; c = 0; break; } else;
if (string[si] == ']')
c = string[i = si];
}
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic ((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0);
if (dolbrace_state == 0x01 && c == '%' && (i - *sindex) > 1)
dolbrace_state = 0x40;
else if (dolbrace_state == 0x01 && c == '#' && (i - *sindex) > 1)
dolbrace_state = 0x40;
else if (dolbrace_state == 0x01 && c == '/' && (i - *sindex) > 1)
dolbrace_state = 0x80;
else if (dolbrace_state == 0x01 && c == '^' && (i - *sindex) > 1)
dolbrace_state = 0x40;
else if (dolbrace_state == 0x01 && c == ',' && (i - *sindex) > 1)
dolbrace_state = 0x40;
else if (dolbrace_state == 0x01 && strchr ("#%^,~:-=?+/", c) != 0)
dolbrace_state = 0x02;
else if (dolbrace_state == 0x02 && strchr ("#%^,~:-=?+/", c) == 0)
dolbrace_state = 0x04;
}
if (c == 0 && nesting_level)
{
if (no_longjmp_on_fatal_error == 0)
{
last_command_exit_value = 1;
report_error (gettext("bad substitution: no closing `%s' in %s"), "}", string);
exp_jump_to_top_level (2);
}
else
{
*sindex = i;
return ((char *)
((void *)0)
);
}
}
result = (flags & 0x0001) ? (char *)
((void *)0)
: substring (string, *sindex, i);
*sindex = i;
return (result);
}
| long string_extract_double_quoted(long a1, int *a2, short a3)
{
int v3;
long v4;
int v5;
_BYTE *v6;
int v7;
int v8;
_BYTE *v9;
int v10;
int v11;
int v12;
int v13;
int v14;
unsigned char v17;
int v18;
int v19;
int v20;
int j;
int v22;
int v23;
int v24;
int i;
int v26;
int v27;
long v28;
unsigned long v29;
size_t v30;
long v31;
long v32;
long s;
long v34;
unsigned long v35;
v35 = __readfsqword(0x28u);
memset(&s, 0, sizeof(s));
v30 = *a2 + strlen((const char *)(*a2 + a1));
v31 = a1 + v30;
v27 = a3 & 0x800;
v24 = 0;
v23 = 0;
v22 = 0;
v32 = sh_xmalloc(v30 - *a2 + 1, "subst.c", 880LL);
v19 = 0;
v20 = *a2;
while ( 1 )
{
v17 = *(_BYTE *)(v20 + a1);
if ( !v17 )
break;
if ( v22 )
{
if ( !v27 && v17 != 34 || v27 && (v24 && (sh_syntaxtab[v17] & 0x40) != 0 || !v24) )
{
v3 = v19++;
*(_BYTE *)(v3 + v32) = 92;
}
v22 = 0;
LABEL_11:
if ( locale_mb_cur_max <= 1 )
{
v8 = v20++;
v9 = (_BYTE *)(v8 + a1);
v10 = v19++;
*(_BYTE *)(v32 + v10) = *v9;
}
else
{
i = is_basic(*(_BYTE *)(v20 + a1));
if ( i )
{
v29 = 1LL;
}
else if ( locale_utf8locale && *(char *)(v20 + a1) >= 0 )
{
v29 = *(_BYTE *)(v20 + a1) != 0;
}
else
{
v34 = s;
v29 = mbrlen((const char *)(v20 + a1), v31 - (a1 + v20), (mbstate_t *)&s);
}
if ( v29 < 0xFFFFFFFFFFFFFFFELL )
{
if ( v29 )
v4 = v29;
else
v4 = 1LL;
v29 = v4;
}
else
{
s = v34;
v29 = 1LL;
}
for ( i = 0; v29 > i; ++i )
{
v5 = v20++;
v6 = (_BYTE *)(v5 + a1);
v7 = v19++;
*(_BYTE *)(v32 + v7) = *v6;
}
}
}
else if ( v17 == 92 )
{
++v22;
++v20;
}
else if ( v23 )
{
if ( v17 == 96 )
v23 = 0;
v11 = v19++;
*(_BYTE *)(v32 + v11) = v17;
++v20;
}
else if ( v17 == 96 )
{
v12 = v19++;
*(_BYTE *)(v32 + v12) = 96;
++v23;
++v20;
}
else if ( v17 == 36 && (*(_BYTE *)(v20 + 1LL + a1) == 40 || *(_BYTE *)(v20 + 1LL + a1) == 123) )
{
v26 = 1;
v18 = v20 + 2;
if ( *(_BYTE *)(v20 + 1LL + a1) == 40 )
v28 = (long)extract_command_subst(a1, &v18, a3 & 0x400);
else
v28 = extract_dollar_brace_string(a1, &v18, 1, 0);
v13 = v19++;
*(_BYTE *)(v13 + v32) = 36;
v14 = v19++;
*(_BYTE *)(v32 + v14) = *(_BYTE *)(v20 + 1LL + a1);
if ( !v28 && no_longjmp_on_fatal_error )
{
v26 = 0;
v28 = v20 + 2LL + a1;
}
for ( j = 0; *(_BYTE *)(j + v28); *(_BYTE *)(v19++ + v32) = *(_BYTE *)(j++ + v28) )
;
*(_BYTE *)(v19 + v32) = *(_BYTE *)(v18 + a1);
if ( v20 + 1 < v18 )
{
if ( *(_BYTE *)(v18 + a1) )
{
++v19;
v20 = v18 + 1;
}
else
{
v20 = v18;
}
}
else
{
v20 += 2;
}
if ( v26 )
sh_xfree(v28, "subst.c", 992LL);
}
else
{
if ( v17 != 34 )
goto LABEL_11;
if ( !v27 )
break;
v24 ^= 1u;
++v20;
}
}
*(_BYTE *)(v19 + v32) = 0;
if ( v17 )
++v20;
*a2 = v20;
return v32;
}
|
static void
read_profile(const char *name)
{
name = expandstr(name);
if (setinputfile(name, INPUT_PUSH_FILE | INPUT_NOFILE_OK) < 0)
return;
cmdloop(0);
popfile();
}
| long read_profile(long a1)
{
long result;
long v2;
v2 = expandstr(a1);
result = setinputfile(v2, 3LL);
if ( (int)result >= 0 )
{
cmdloop(0);
return popfile();
}
return result;
}
|
int
acl_delete_def_file_at (int fd, char const *file )
{
;
if (fd ==
-100
||
(((
file
)[0]) == '/')
)
return (acl_delete_def_file (file ));
{
struct saved_cwd saved_cwd;
int saved_errno;
int err;
{
char proc_buf[
((4096) < (4096 - 64) ? (4096) : (4096 - 64))
];
char *proc_file = openat_proc_name (proc_buf, fd, file);
if (proc_file)
{
int proc_result = (acl_delete_def_file (proc_file ));
int proc_errno =
(*__errno_location ())
;
if (proc_file != proc_buf)
free (proc_file);
if (-1 != proc_result)
return proc_result;
if (!
((
proc_errno
) == 20 || (
proc_errno
) == 2 || (
proc_errno
) == 1 || (
proc_errno
) == 13 || (
proc_errno
) == 38 || (
proc_errno
) == 95 )
)
{
(*__errno_location ())
= proc_errno;
return proc_result;
}
}
}
if (save_cwd (&saved_cwd) != 0)
openat_save_fail (
(*__errno_location ())
);
if (0 <= fd && fd == saved_cwd.desc)
{
free_cwd (&saved_cwd);
(*__errno_location ())
=
9
;
return -1;
}
if (fchdir (fd) != 0)
{
saved_errno =
(*__errno_location ())
;
free_cwd (&saved_cwd);
(*__errno_location ())
= saved_errno;
return -1;
}
err = (acl_delete_def_file (file ));
saved_errno = (err == -1 ?
(*__errno_location ())
: 0);
if (restore_cwd (&saved_cwd) != 0)
openat_restore_fail (
(*__errno_location ())
);
free_cwd (&saved_cwd);
if (saved_errno)
(*__errno_location ())
= saved_errno;
return err;
}
}
| int acl_delete_def_file_at(unsigned long a0, char *a1) {
unsigned long long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
void* v5;
char v6;
char v7;
unsigned int v9;
v0 = *(&v0);
if (a0 != -100 && *(a1) != 47) {
v5 = openat_proc_name(&v7, a0, a1, a0);
if (!v5)
goto LABEL_400666;
v1 = acl_delete_def_file(v5);
v2 = *(__errno_location());
if (v5 != &v7)
free(v5);
if (v1 != -1) {
v9 = v1;
return v9;
}
switch (v2) {
case 1: case 2: case 13: case 20: case 38: case 95:
LABEL_400666:
if (save_cwd(&v6))
openat_save_fail(*(__errno_location()));
if (a0 >= 0 && a0 == *(&v6)) {
free_cwd(&v6);
*(__errno_location()) = 9;
v9 = -1;
return v9;
}
if (fchdir(a0)) {
v4 = *(__errno_location());
free_cwd(&v6);
*(__errno_location()) = v4;
v9 = -1;
return v9;
}
v3 = acl_delete_def_file(a1);
v4 = (v3 == -1 ? 0 : *(__errno_location()));
if (restore_cwd(&v6))
openat_restore_fail(*(__errno_location()));
free_cwd(&v6);
if (v4) {
*(__errno_location()) = v4;
break;
}
v9 = v3;
return v9;
default:
*(__errno_location()) = v2;
v9 = v1;
return v9;
}
}
v9 = acl_delete_def_file(a1);
return v9;
}
|
static
_Bool
three_arguments (void)
{
_Bool
value;
if (binop (argv[pos + 1]))
value = binary_operator (
0
);
else if ((strcmp (argv[pos], "!") == 0))
{
advance (
1
);
value = !two_arguments ();
}
else if ((strcmp (argv[pos], "(") == 0) && (strcmp (argv[pos + 2], ")") == 0))
{
advance (
0
);
value = one_argument ();
advance (
0
);
}
else if ((strcmp (argv[pos + 1], "-a") == 0) || (strcmp (argv[pos + 1], "-o") == 0))
value = expr ();
else
test_syntax_error (gettext ("%s: binary operator expected"),
quote (argv[pos + 1]));
return (value);
}
| int three_arguments() {
char v0;
unsigned long long v2;
if (binop(*((argv + (pos + 1 << 3))))) {
v0 = binary_operator(0x0);
return v0;
} else if (strcmp(*((argv + (pos << 3))), "!")) {
if (!strcmp(*((argv + (pos << 3))), "(") && !strcmp(*((argv + (pos + 2 << 3))), ")")) {
advance(0x0);
v0 = one_argument();
advance(0x0);
return v0;
}
if (strcmp(*((argv + (pos + 1 << 3))), "-a") && strcmp(*((argv + (pos + 1 << 3))), "-o"))
test_syntax_error(gettext("%s: binary operator expected"), quote(*((argv + (pos + 1) * 8))));
v0 = expr();
return v0;
} else {
advance(0x1);
v2 = two_arguments();
*(&v2) = v2;
*(&v2) = v2 ^ 1;
v0 = v2;
v0 &= 1;
return v0;
}
}
|
static void freeze(unsigned int a[32])
{
unsigned int aorig[32];
unsigned int j;
unsigned int negative;
for (j = 0;j < 32;++j) aorig[j] = a[j];
add(a,a,minusp);
negative = -((a[31] >> 7) & 1);
for (j = 0;j < 32;++j) a[j] ^= negative & (aorig[j] ^ a[j]);
}
| void freeze(unsigned int a0[32]) {
unsigned int v0;
unsigned int v1;
char v2;
char v3;
unsigned long long *v5;
unsigned long long v6;
for (v0 = 0; v0 <= 31; v0 += 1) {
*(&(&v2)[4 * v0]) = a0[v0];
}
add(a0, a0, &minusp);
v1 = -((a0[31] >> 7) & 1);
for (v0 = 0; v0 <= 31; v0 += 1) {
a0[v0] = (a0[v0] ^ *(&(&v2)[4 * v0])) & v1 ^ a0[v0];
}
v6 = *(&v3) ^ v5[5];
return;
}
|
static
_Bool
binary_operator (
_Bool
l_is_l)
{
int op;
struct stat stat_buf, stat_spare;
_Bool
r_is_l;
if (l_is_l)
advance (
0
);
op = pos + 1;
if ((op < argc - 2) && (strcmp (argv[op + 1], "-l") == 0))
{
r_is_l =
1
;
advance (
0
);
}
else
r_is_l =
0
;
if (argv[op][0] == '-')
{
if ((((argv[op][1] == 'l' || argv[op][1] == 'g')
&& (argv[op][2] == 'e' || argv[op][2] == 't'))
|| (argv[op][1] == 'e' && argv[op][2] == 'q')
|| (argv[op][1] == 'n' && argv[op][2] == 'e'))
&& !argv[op][3])
{
char lbuf[((((((sizeof (uintmax_t) * 8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)];
char rbuf[((((((sizeof (uintmax_t) * 8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)];
char const *l = (l_is_l
? umaxtostr (strlen (argv[op - 1]), lbuf)
: find_int (argv[op - 1]));
char const *r = (r_is_l
? umaxtostr (strlen (argv[op + 2]), rbuf)
: find_int (argv[op + 1]));
int cmp = strintcmp (l, r);
_Bool
xe_operator = (argv[op][2] == 'e');
pos += 3;
return (argv[op][1] == 'l' ? cmp < xe_operator
: argv[op][1] == 'g' ? cmp > - xe_operator
: (cmp != 0) == xe_operator);
}
switch (argv[op][1])
{
default:
break;
case 'n':
if (argv[op][2] == 't' && !argv[op][3])
{
struct timespec lt, rt;
_Bool
le, re;
pos += 3;
if (l_is_l || r_is_l)
test_syntax_error (gettext ("-nt does not accept -l"));
le = get_mtime (argv[op - 1], <);
re = get_mtime (argv[op + 1], &rt);
return le && (!re || timespec_cmp (lt, rt) > 0);
}
break;
case 'e':
if (argv[op][2] == 'f' && !argv[op][3])
{
pos += 3;
if (l_is_l || r_is_l)
test_syntax_error (gettext ("-ef does not accept -l"));
return (stat (argv[op - 1], &stat_buf) == 0
&& stat (argv[op + 1], &stat_spare) == 0
&& stat_buf.st_dev == stat_spare.st_dev
&& stat_buf.st_ino == stat_spare.st_ino);
}
break;
case 'o':
if ('t' == argv[op][2] && '\000' == argv[op][3])
{
struct timespec lt, rt;
_Bool
le, re;
pos += 3;
if (l_is_l || r_is_l)
test_syntax_error (gettext ("-ot does not accept -l"));
le = get_mtime (argv[op - 1], <);
re = get_mtime (argv[op + 1], &rt);
return re && (!le || timespec_cmp (lt, rt) < 0);
}
break;
}
test_syntax_error (gettext ("%s: unknown binary operator"), quote (argv[op]));
}
if (argv[op][0] == '='
&& (!argv[op][1] || ((argv[op][1] == '=') && !argv[op][2])))
{
_Bool
value = (strcmp (argv[pos], argv[pos + 2]) == 0);
pos += 3;
return value;
}
if ((strcmp (argv[op], "!=") == 0))
{
_Bool
value = !(strcmp (argv[pos], argv[pos + 2]) == 0);
pos += 3;
return value;
}
abort ();
}
| int binary_operator(unsigned long a0) {
char v0;
char v1;
char v2;
char v3;
char v4;
char v5;
char v6;
char v7;
unsigned int v8;
unsigned int v9;
unsigned long long v10;
unsigned int v11;
char v12;
char v13;
char v14;
char v15;
char v16;
char v17;
char v18;
char v19;
char v20;
char v21;
unsigned int v23;
unsigned long long v24;
unsigned long long v25;
unsigned long long v26;
if (a0)
advance(0x0);
v8 = pos + 1;
if (v8 < argc - 2) {
v23 = strcmp(*((argv + (v8 + 1) * 8)), "-l");
if (!v23) {
v0 = 1;
advance(0x0);
}
}
if (v8 >= argc - 2 || v23)
v0 = 0;
if (*(*((argv + (v8 << 3)))) != 45) {
if (*(*((argv + (v8 << 3)))) == 61 && (!*((*((argv + (v8 << 3))) + 1)) || !*((*((argv + (v8 << 3))) + 2))) && (!*((*((argv + (v8 << 3))) + 1)) || *((*((argv + (v8 << 3))) + 1)) == 61)) {
v1 = !strcmp(*((argv + (pos << 3))), *((argv + (pos + 2 << 3))));
pos = pos + 3;
v23 = v1;
}
if (*(*((argv + (v8 << 3)))) != 61 || *((*((argv + (v8 << 3))) + 1)) && *((*((argv + (v8 << 3))) + 2)) || *((*((argv + (v8 << 3))) + 1)) && *((*((argv + (v8 << 3))) + 1)) != 61) {
v23 = strcmp(*((argv + v8 * 8)), "!=");
if (!v23) {
v2 = strcmp(*((argv + (pos << 3))), *((argv + (pos + 2 << 3))));
pos = pos + 3;
v23 = v2;
} else {
abort();
}
}
}
if (...) {
if (a0) {
v25 = strlen(*((argv + v8 * 8 - 8)));
v24 = umaxtostr(v25, &v20, v25);
} else {
v24 = find_int(*((argv + v8 * 8 - 8)));
}
v10 = v24;
if (v0) {
v26 = strlen(*((argv + (v8 + 2) * 8)));
v23 = umaxtostr(v26, &v21, v26);
} else {
v23 = find_int(*((argv + (v8 + 1) * 8)));
}
v11 = v23;
v9 = strintcmp(v10, *(&v11), *(&v11));
v3 = *((*((argv + (v8 << 3))) + 2)) == 101;
pos = pos + 3;
if (*((*((argv + (v8 << 3))) + 1)) == 108) {
v23 = v3;
*(&v23) = v9 < v3;
} else if (*((*((argv + (v8 << 3))) + 1)) == 103) {
v23 = -(v3);
*(&v23) = -(v3) < v9;
} else {
v23 = v3;
*(&v23) = v9 == v3;
}
}
if (...) {
if (*((*((argv + (v8 << 3))) + 1)) != 111) {
if (*((*((argv + (v8 << 3))) + 1)) <= 111) {
if (*((*((argv + (v8 << 3))) + 1)) != 101) {
if (*((*((argv + (v8 << 3))) + 2)) == 116 && *((*((argv + (v8 << 3))) + 1)) == 110 && !*((*((argv + (v8 << 3))) + 3))) {
pos = pos + 3;
if (!a0 && !v0) {
v6 = get_mtime(*((argv + v8 * 8 - 8)), &v12);
v7 = get_mtime(*((argv + (v8 + 1) * 8)), &v14);
if (v6) {
if (!(v7 ^ 1))
v23 = timespec_cmp(*(&v12), *(&v13), *(&v14), *(&v15));
if (v23 > 0 || (v7 ^ 1))
v23 = 1;
}
if (!v6 || v23 <= 0 && !(v7 ^ 1))
v23 = 0;
v23 &= 1;
}
}
} else {
if (*((*((argv + (v8 << 3))) + 2)) == 102 && !*((*((argv + (v8 << 3))) + 3))) {
pos = pos + 3;
if (!a0 && !v0) {
v23 = stat(*((argv + v8 * 8 - 8)), &v16);
if (!v23) {
v23 = stat(*((argv + (v8 + 1) * 8)), &v18);
if (!v23 && *(&v16) == *(&v18) && *(&v17) == *(&v19))
v23 = 1;
}
if (v23 || v23 || *(&v16) != *(&v18) || *(&v17) != *(&v19))
v23 = 0;
v23 &= 1;
}
}
}
}
} else {
if (*((*((argv + (v8 << 3))) + 2)) == 116 && !*((*((argv + (v8 << 3))) + 3))) {
pos = pos + 3;
if (!a0 && !v0) {
v4 = get_mtime(*((argv + v8 * 8 - 8)), &v12);
v5 = get_mtime(*((argv + (v8 + 1) * 8)), &v14);
if (v5) {
if (!(v4 ^ 1))
v23 = timespec_cmp(*(&v12), *(&v13), *(&v14), *(&v15));
if (v23 < 0 || (v4 ^ 1))
v23 = 1;
}
if (!v5 || !(v4 ^ 1) && v23 >= 0)
v23 = 0;
v23 &= 1;
}
}
}
}
if (...)
test_syntax_error(gettext("-ot does not accept -l"), "-l");
if (...)
test_syntax_error(gettext("-ef does not accept -l"), "-l");
if (...)
test_syntax_error(gettext("%s: unknown binary operator"), quote(*((argv + v8 * 8))));
if (...)
test_syntax_error(gettext("-nt does not accept -l"), "-l");
if (...)
return v23;
}
|
struct monitor *
monitor_init(void)
{
struct monitor *mon;
mon = xcalloc(1, sizeof(*mon));
monitor_openfds(mon, 1);
return mon;
}
| undefined8 monitor_init(void)
{
undefined8 uVar1;
uVar1 = xcalloc(1,0x20);
monitor_openfds(uVar1,1);
return uVar1;
}
|
static void
set_mtime_to_now (struct stat *st)
{
gettime (&((st)->st_mtim));
}
| void set_mtime_to_now(long param_1)
{
gettime(param_1 + 0x58);
return;
}
|
static
_Bool
isdir (char const *path)
{
struct stat sb;
if (stat (path, &sb) != 0)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"cannot stat %s\"), quotearg_style (shell_escape_always_quoting_style, path)), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, gettext ("cannot stat %s"), quotearg_style (shell_escape_always_quoting_style, path)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, gettext ("cannot stat %s"), quotearg_style (shell_escape_always_quoting_style, path)), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
return
((((
sb.st_mode
)) & 0170000) == (0040000))
;
}
| bool isdir(const char *a1)
{
long v1;
char *v2;
int *v3;
struct stat v5;
unsigned long v6;
v6 = __readfsqword(0x28u);
if ( stat(a1, &v5) )
{
v1 = quotearg_style(4LL, a1);
v2 = gettext("cannot stat %s");
v3 = _errno_location();
error(1, *v3, v2, v1);
}
return (v5.st_mode & 0xF000) == 0x4000;
}
|
void
client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem,
const char *term, struct termios *tiop, int in_fd, struct sshbuf *cmd,
char **env)
{
size_t i, j, len;
int matched, r;
char *name, *val;
Channel *c =
((void *)0)
;
sshlog("clientloop.c", __func__, 2475, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "id %d", id);
if ((c = channel_lookup(ssh, id)) ==
((void *)0)
)
sshfatal("clientloop.c", __func__, 2478, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "channel %d: unknown channel", id);
ssh_packet_set_interactive(ssh, want_tty,
options.ip_qos_interactive, options.ip_qos_bulk);
if (want_tty) {
struct winsize ws;
if (ioctl(in_fd,
0x5413
, &ws) == -1)
memset(&ws, 0, sizeof(ws));
channel_request_start(ssh, id, "pty-req", 1);
client_expect_confirm(ssh, id, "PTY allocation", CONFIRM_TTY);
if ((r = sshpkt_put_cstring(ssh, term !=
((void *)0)
? term : ""))
!= 0 ||
(r = sshpkt_put_u32(ssh, (u_int)ws.ws_col)) != 0 ||
(r = sshpkt_put_u32(ssh, (u_int)ws.ws_row)) != 0 ||
(r = sshpkt_put_u32(ssh, (u_int)ws.ws_xpixel)) != 0 ||
(r = sshpkt_put_u32(ssh, (u_int)ws.ws_ypixel)) != 0)
sshfatal("clientloop.c", __func__, 2498, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "build pty-req");
if (tiop ==
((void *)0)
)
tiop = get_saved_tio();
ssh_tty_make_modes(ssh, -1, tiop);
if ((r = sshpkt_send(ssh)) != 0)
sshfatal("clientloop.c", __func__, 2503, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send pty-req");
c->client_tty = 1;
}
if (options.num_send_env != 0 && env !=
((void *)0)
) {
sshlog("clientloop.c", __func__, 2510, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Sending environment.");
for (i = 0; env[i] !=
((void *)0)
; i++) {
name = xstrdup(env[i]);
if ((val = strchr(name, '=')) ==
((void *)0)
) {
free(name);
continue;
}
*val++ = '\0';
matched = 0;
for (j = 0; j < options.num_send_env; j++) {
if (match_pattern(name, options.send_env[j])) {
matched = 1;
break;
}
}
if (!matched) {
sshlog("clientloop.c", __func__, 2528, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "Ignored env %s", name);
free(name);
continue;
}
client_send_env(ssh, id, name, val);
free(name);
}
}
for (i = 0; i < options.num_setenv; i++) {
name = xstrdup(options.setenv[i]);
if ((val = strchr(name, '=')) ==
((void *)0)
) {
free(name);
continue;
}
*val++ = '\0';
client_send_env(ssh, id, name, val);
free(name);
}
len = sshbuf_len(cmd);
if (len > 0) {
if (len > 900)
len = 900;
if (want_subsystem) {
sshlog("clientloop.c", __func__, 2553, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Sending subsystem: %.*s", (int)len, (const u_char*)sshbuf_ptr(cmd))
;
channel_request_start(ssh, id, "subsystem", 1);
client_expect_confirm(ssh, id, "subsystem",
CONFIRM_CLOSE);
} else {
sshlog("clientloop.c", __func__, 2559, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Sending command: %.*s", (int)len, (const u_char*)sshbuf_ptr(cmd))
;
channel_request_start(ssh, id, "exec", 1);
client_expect_confirm(ssh, id, "exec", CONFIRM_CLOSE);
}
if ((r = sshpkt_put_stringb(ssh, cmd)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
sshfatal("clientloop.c", __func__, 2566, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send command");
} else {
channel_request_start(ssh, id, "shell", 1);
client_expect_confirm(ssh, id, "shell", CONFIRM_CLOSE);
if ((r = sshpkt_send(ssh)) != 0)
sshfatal("clientloop.c", __func__, 2571, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send shell");
}
}
| long long client_session2_setup(unsigned long long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long long a5, unsigned int v19, unsigned long long a6, unsigned long a7) {
unsigned long long v0;
int tmp_12;
unsigned long v1;
void* v2;
unsigned long long v3;
unsigned long long v4;
unsigned int v5;
unsigned int v6;
void* v7;
void* v8;
unsigned long long v9;
void* v10;
void* v11;
unsigned long long v12;
unsigned long long v13;
char v14;
char v15;
char v16;
unsigned long long v17;
unsigned long v18;
char *v21;
v4 = a5;
v3 = a6;
v2 = a7;
v10 = 0;
v1 = a1;
v0 = "id %d";
sshlog("clientloop.c", "client_session2_setup", 0x9ab, 0x1, 0x6, 0x0);
v10 = channel_lookup(a0, a1, a1);
if (!v10) {
v1 = a1;
v0 = "channel %d: unknown channel";
sshfatal("clientloop.c", "client_session2_setup", 0x9ae, 0x1, 0x1, 0x0);
}
ssh_packet_set_interactive(a0, a2, g_50009c, strerror);
if (a2) {
if (ioctl(v19, 0x5413) == -1)
memset(&v13, 0x0, 0x8);
channel_request_start(a0, a1, "pty-req", 0x1);
client_expect_confirm(a0, a1, "PTY allocation", 0x2);
v6 = sshpkt_put_cstring(a0, (!a4 ? a4 : &g_408c6c));
if (v6) {
LABEL_407d60:
v17 = "build pty-req";
sshfatal("clientloop.c", "client_session2_setup", 0x9c2, 0x1, 0x1, ssh_err(v6));
} else {
v6 = sshpkt_put_u32(a0, *(&v14));
if (!(!v6) || !((v6 = sshpkt_put_u32(a0, *(&v13)), !v6)))
goto LABEL_407d60;
v6 = sshpkt_put_u32(a0, *(&v15));
if (v6 || (v6 = sshpkt_put_u32(a0, *(&v16)), v6))
goto LABEL_407d60;
}
if (!v4)
v4 = get_saved_tio();
ssh_tty_make_modes(a0, 0xffffffff, v4);
v6 = sshpkt_send(a0);
if (v6) {
v17 = "send pty-req";
sshfatal("clientloop.c", "client_session2_setup", 0x9c7, 0x1, 0x1, ssh_err(v6));
}
v10->field_4c = 1;
}
if (*(5247860) && v2) {
v17 = "Sending environment.";
sshlog("clientloop.c", "client_session2_setup", 0x9ce, 0x0, 0x5, 0x0);
for (v7 = 0; *((v2 + 0x8 * v7)); v7 += 1) {
v11 = xstrdup(*((v2 + 0x8 * v7)));
v12 = strchr(v11, 0x3d);
if (!v12) {
free(v11);
} else {
v21 = v12;
v12 += 1;
*(v21) = 0;
v5 = 0;
v8 = 0;
while (true) {
if (v8 >= *(5247860))
break;
if (!match_pattern(v11, *((*(5247864) + (v8 << 3))), *((*(5247864) + (v8 << 3))))) {
v8 += 1;
} else {
v5 = 1;
break;
}
}
if (v5) {
client_send_env(a0, a1, v11, v12);
free(v11);
} else {
v18 = v11;
v17 = "Ignored env %s";
sshlog("clientloop.c", "client_session2_setup", 0x9e0, 0x0, 0x7, 0x0);
free(v11);
}
}
}
}
for (v7 = 0; v7 < *(5247872); v7 += 1) {
v11 = xstrdup(*((*(5247880) + v7 * 8)));
v12 = strchr(v11, 0x3d);
if (!v12) {
free(v11);
} else {
tmp_12 = v12;
v12 += 1;
*(tmp_12) = 0;
client_send_env(a0, a1, v11, v12);
free(v11);
}
}
v9 = sshbuf_len(v3);
if (v9) {
if (v9 > 900)
v9 = 900;
if (a3) {
v17 = sshbuf_ptr(v3);
v13 = v9;
v12 = "Sending subsystem: %.*s";
sshlog("clientloop.c", "client_session2_setup", 0x9f9, 0x0, 0x5, 0x0);
channel_request_start(a0, a1, "subsystem", 0x1);
client_expect_confirm(a0, a1, "subsystem", 0x1);
} else {
v17 = sshbuf_ptr(v3);
v13 = v9;
v12 = "Sending command: %.*s";
sshlog("clientloop.c", "client_session2_setup", 0x9ff, 0x0, 0x5, 0x0);
channel_request_start(a0, a1, "exec", 0x1);
client_expect_confirm(a0, a1, "exec", 0x1);
}
v6 = sshpkt_put_stringb(a0, v3, v3);
if (!v6) {
v6 = sshpkt_send(a0);
if (!v6)
return 0;
}
v17 = "send command";
sshfatal("clientloop.c", "client_session2_setup", 0xa06, 0x1, 0x1, ssh_err(v6));
}
channel_request_start(a0, a1, "shell", 0x1);
client_expect_confirm(a0, a1, "shell", 0x1);
v6 = sshpkt_send(a0);
if (v6) {
v17 = "send shell";
sshfatal("clientloop.c", "client_session2_setup", 0xa0b, 0x1, 0x1, ssh_err(v6));
return 0;
}
return 0;
}
|
static void
client_process_net_input(struct ssh *ssh)
{
int r;
schedule_server_alive_check();
if ((r = ssh_packet_process_read(ssh, connection_in)) == 0)
return;
if (r == -24) {
if (
(*__errno_location ())
==
11
||
(*__errno_location ())
==
4
||
(*__errno_location ())
==
11
)
return;
if (
(*__errno_location ())
==
32
) {
quit_message("Connection to %s closed by remote host.",
host);
return;
}
}
quit_message("Read from remote host %s: %s", host, ssh_err(r));
}
| void client_process_net_input(undefined8 param_1)
{
int iVar1;
int *piVar2;
undefined8 uVar3;
schedule_server_alive_check();
iVar1 = ssh_packet_process_read(param_1,connection_in);
if (iVar1 == 0) {
return;
}
if (iVar1 == -0x18) {
piVar2 = __errno_location();
if (*piVar2 == 0xb) {
return;
}
piVar2 = __errno_location();
if (*piVar2 == 4) {
return;
}
piVar2 = __errno_location();
if (*piVar2 == 0xb) {
return;
}
piVar2 = __errno_location();
if (*piVar2 == 0x20) {
quit_message("Connection to %s closed by remote host.",host);
return;
}
}
uVar3 = ssh_err(iVar1);
quit_message("Read from remote host %s: %s",host,uVar3);
return;
}
|
int
bind_keyseq_to_unix_command (line)
char *line;
{
Keymap kmap, cmd_xmap;
char *kseq, *value;
int i, kstart;
kmap = rl_get_keymap ();
i = isolate_sequence (line, 0, 1, &kstart);
if (i < 0)
return -1;
kseq = substring (line, kstart, i);
for ( ; line[i] && line[i] != ':'; i++)
;
if (line[i] != ':')
{
builtin_error (gettext("%s: missing colon separator"), line);
do { if (kseq) sh_xfree((kseq), "bashline.c", 4699); } while (0);
return -1;
}
i = isolate_sequence (line, i + 1, 0, &kstart);
if (i < 0)
{
do { if (kseq) sh_xfree((kseq), "bashline.c", 4706); } while (0);
return -1;
}
value = substring (line, kstart, i);
cmd_xmap = get_cmd_xmap_from_keymap (kmap);
rl_generic_bind (2, kseq, value, cmd_xmap);
rl_bind_keyseq_in_map (kseq, bash_execute_unix_command, kmap);
sh_xfree((kseq), "bashline.c", 4721);
return 0;
}
| long bind_keyseq_to_unix_command(long a1)
{
char *v2;
unsigned int v3;
unsigned int v4;
void *keymap;
long v6;
long v7;
long cmd_xmap_from_keymap;
unsigned long v9;
v9 = __readfsqword(0x28u);
keymap = (void *)rl_get_keymap();
v4 = isolate_sequence(a1, 0, 1, &v3);
if ( (v4 & 0x80000000) != 0 )
return 0xFFFFFFFFLL;
v6 = substring(a1, v3, v4);
while ( *(_BYTE *)((int)v4 + a1) && *(_BYTE *)((int)v4 + a1) != 58 )
++v4;
if ( *(_BYTE *)((int)v4 + a1) == 58 )
{
v4 = isolate_sequence(a1, v4 + 1, 0, &v3);
if ( (v4 & 0x80000000) == 0 )
{
v7 = substring(a1, v3, v4);
cmd_xmap_from_keymap = get_cmd_xmap_from_keymap(keymap);
rl_generic_bind(2LL, v6, v7, cmd_xmap_from_keymap);
rl_bind_keyseq_in_map(v6, bash_execute_unix_command, keymap);
sh_xfree(v6, "bashline.c", 4721LL);
return 0LL;
}
else
{
if ( v6 )
sh_xfree(v6, "bashline.c", 4706LL);
return 0xFFFFFFFFLL;
}
}
else
{
v2 = gettext("%s: missing colon separator");
builtin_error(v2, a1, v2);
if ( v6 )
sh_xfree(v6, "bashline.c", 4699LL);
return 0xFFFFFFFFLL;
}
}
|
int
ssh_hmac_update(struct ssh_hmac_ctx *ctx, const void *m, size_t mlen)
{
return ssh_digest_update(ctx->digest, m, mlen);
}
| void ssh_hmac_update(long param_1,undefined8 param_2,undefined8 param_3)
{
ssh_digest_update(*(undefined8 *)(param_1 + 0x18),param_2,param_3);
return;
}
|
int get_tls_client_status(void)
{
if (batch) {
return cfg.tls_www_client;
} else {
return
read_yesno
("Is this a TLS web client certificate? (y/N): ", 0);
}
}
| ulong get_tls_client_status(void)
{
ulong uVar1;
if (*piRam000000000010747c == 0) {
uVar1 = read_yesno("Is this a TLS web client certificate? (y/N): ",0);
}
else {
uVar1 = (ulong)*(uint *)(lRam0000000000107489 + 0x224);
}
return uVar1;
}
|
int
opt_match(const char **opts, const char *term)
{
if (strncasecmp((*opts), term, strlen(term)) == 0 &&
(*opts)[strlen(term)] == '=') {
*opts += strlen(term) + 1;
return 1;
}
return 0;
}
| long long opt_match(unsigned long long *a0, char *a1) {
unsigned long long v1;
unsigned long long v2;
v1 = strncasecmp(*(a0), a1, strlen(a1));
if (!v1) {
*(&v1) = *((strlen(a1) + *(a0)));
if (v1 == 61) {
*(a0) = *(a0) + strlen(a1) + 1;
v2 = 1;
}
}
if (v1 || v1 != 61)
v2 = 0;
return v2;
}
|
static Channel *
server_request_tun(struct ssh *ssh)
{
Channel *c =
((void *)0)
;
u_int mode, tun;
int r, sock;
char *tmp, *ifname =
((void *)0)
;
if ((r = sshpkt_get_u32(ssh, &mode)) != 0)
sshpkt_fatal(ssh, r, "%s: parse mode", __func__);
switch (mode) {
case 0x01:
case 0x02:
break;
default:
ssh_packet_send_debug(ssh, "Unsupported tunnel device mode.");
return
((void *)0)
;
}
if ((options.permit_tun & mode) == 0) {
ssh_packet_send_debug(ssh, "Server has rejected tunnel device "
"forwarding");
return
((void *)0)
;
}
if ((r = sshpkt_get_u32(ssh, &tun)) != 0)
sshpkt_fatal(ssh, r, "%s: parse device", __func__);
if (tun > 0x7fffffff) {
sshlog("serverloop.c", __func__, 546, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "invalid tun");
goto done;
}
if (auth_opts->force_tun_device != -1) {
if (tun != 0x7fffffff &&
auth_opts->force_tun_device != (int)tun)
goto done;
tun = auth_opts->force_tun_device;
}
sock = tun_open(tun, mode, &ifname);
if (sock < 0)
goto done;
sshlog("serverloop.c", __func__, 558, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Tunnel forwarding using interface %s", ifname);
c = channel_new(ssh, "tun", 4, sock, sock, -1,
(64*(32*1024)), (32*1024), 0, "tun", 1);
c->datagram = 1;
if (mode == 0x01)
channel_register_filter(ssh, c->self, sys_tun_infilter,
sys_tun_outfilter,
((void *)0)
,
((void *)0)
);
tmp = tun_fwd_ifnames;
xasprintf(&tun_fwd_ifnames, "%s%s%s",
tun_fwd_ifnames ==
((void *)0)
? "" : tun_fwd_ifnames,
tun_fwd_ifnames ==
((void *)0)
? "" : ",",
ifname);
free(tmp);
free(ifname);
done:
if (c ==
((void *)0)
)
ssh_packet_send_debug(ssh, "Failed to open the tunnel device.");
return c;
}
| int server_request_tun(unsigned long long a0) {
void* v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
void* v5;
void* v6;
struct_0 *v7;
unsigned long v9;
unsigned long long v10;
v6 = 0;
v5 = 0;
v3 = sshpkt_get_u32(a0, &v1, &v1);
if (v3)
sshpkt_fatal(a0, v3, "%s: parse mode", "server_request_tun");
if (*(&v1) - 1 > 1) {
ssh_packet_send_debug(a0, "Unsupported tunnel device mode.");
v9 = 0;
} else if (!(*(&v1) & *(5250596))) {
ssh_packet_send_debug(a0, "Server has rejected tunnel device forwarding");
v9 = 0;
} else {
v3 = sshpkt_get_u32(a0, &v2, &v2);
if (v3)
sshpkt_fatal(a0, v3, "%s: parse device", "server_request_tun");
if (*(&v2) < 0) {
sshlog("serverloop.c", "server_request_tun", 0x222, 0x1, 0x5, 0x0, "invalid tun");
} else {
if (*((auth_opts + 48)) != -1 && (*((auth_opts + 48)) == *(&v2) || *(&v2) == 2147483647))
v2 = *((auth_opts + 48));
if (*((auth_opts + 48)) == *(&v2) || *(&v2) == 2147483647 || *((auth_opts + 48)) == -1) {
v4 = tun_open(v2, *(&v1), &v5, v2);
if (v4 >= 0) {
v0 = v5;
sshlog("serverloop.c", "server_request_tun", 0x22e, 0x0, 0x5, 0x0, "Tunnel forwarding using interface %s");
v6 = channel_new(a0, "tun", 0x4, v4, v4, 0xffffffff, 0x200000, 0x8000, 0x0, "tun");
*(&v6[288]) = 1;
if (*(&v1) == 1)
channel_register_filter(a0, v6[4], got.sys_tun_infilter, got.sys_tun_outfilter, 0x0, 0x0);
v7 = tun_fwd_ifnames;
if (!tun_fwd_ifnames)
v10 = &g_403301;
else
v10 = ",";
if (tun_fwd_ifnames)
v9 = tun_fwd_ifnames;
else
v9 = &g_403301;
xasprintf(&tun_fwd_ifnames, "%s%s%s", v9, v10, v5);
free(v7);
free(v5);
}
}
}
if (!v6)
ssh_packet_send_debug(a0, "Failed to open the tunnel device.");
*(&v9) = v6;
}
return v9;
}
|
static inline void
emit_ancillary_info (char const *program)
{
struct infomap { char const *program; char const *node; } const infomap[] = {
{ "[", "test invocation" },
{ "coreutils", "Multi-call invocation" },
{ "sha224sum", "sha2 utilities" },
{ "sha256sum", "sha2 utilities" },
{ "sha384sum", "sha2 utilities" },
{ "sha512sum", "sha2 utilities" },
{
((void *)0)
,
((void *)0)
}
};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && ! (strcmp (program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
}
| void emit_ancillary_info(char *a0) {
unsigned long v0;
unsigned long long v1[2];
char *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void* v16;
void* v17;
char v18;
unsigned long long v20;
unsigned long long *v21;
unsigned long long v22;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
v1[0] = &v4;
while (true) {
if (!v1[0])
break;
if (!strcmp(a0, v1[0]))
break;
v1[0] = v1 + 1;
}
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
if (!strcmp(a0, "["))
v20 = "test";
else
v20 = a0;
v3 = v20;
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v22 = *(&v18) ^ v21[5];
return;
}
|
static inline
_Bool
is_range_start_index (uintmax_t k)
{
return k == current_rp->lo;
}
| ulong is_range_start_index(ulong param_1)
{
return *current_rp & 0xffffffffffffff00 | (ulong)(param_1 == *current_rp);
}
|
static void
set_instdir(const struct cmdinfo *cip, const char *value)
{
instdir = dpkg_fsys_set_dir(value);
}
| long long set_instdir(unsigned long a0, unsigned long long a1) {
unsigned long v0;
v0 = a0;
instdir = dpkg_fsys_set_dir(a1);
return instdir;
}
|
static char *
fixup_extra_acl_fields (char *ptr)
{
char *src = ptr;
char *dst = ptr;
while (*src)
{
const char *old = src;
size_t len = 0;
src = skip_to_ext_fields (src);
len = src - old;
if (old != dst)
memmove (dst, old, len);
dst += len;
if (*src == ':')
src += strcspn (src, "\n,");
if ((*src == '\n') || (*src == ','))
*dst++ = *src++;
}
if (src != dst)
*dst = 0;
return ptr;
}
| char * fixup_extra_acl_fields(char *a1)
{
const char *v1;
char *v2;
const char *s;
char *dest;
char *src;
size_t n;
s = a1;
dest = a1;
while ( *s )
{
src = (char *)s;
s = skip_to_ext_fields(s);
n = s - src;
if ( src != dest )
memmove(dest, src, n);
dest += n;
if ( *s == 58 )
s += strcspn(s, "\n,");
if ( *s == 10 || *s == 44 )
{
v1 = s++;
v2 = dest++;
*v2 = *v1;
}
}
if ( s != dest )
*dest = 0;
return a1;
}
|
COMMAND *
make_if_command (test, true_case, false_case)
COMMAND *test, *true_case, *false_case;
{
IF_COM *temp;
temp = (IF_COM *)sh_xmalloc((sizeof (IF_COM)), "make_cmd.c", 390);
temp->flags = 0;
temp->test = test;
temp->true_case = true_case;
temp->false_case = false_case;
return (make_command (cm_if, (SIMPLE_COM *)temp));
}
| void make_if_command(undefined8 param_1,undefined8 param_2,undefined8 param_3)
{
undefined4 *puVar1;
puVar1 = (undefined4 *)sh_xmalloc(0x20,"make_cmd.c",0x186);
*puVar1 = 0;
*(undefined8 *)(puVar1 + 2) = param_1;
*(undefined8 *)(puVar1 + 4) = param_2;
*(undefined8 *)(puVar1 + 6) = param_3;
make_command(3,puVar1);
return;
}
|
ch_reset(EditLine *el)
{
el->el_line.cursor = el->el_line.buffer;
el->el_line.lastchar = el->el_line.buffer;
el->el_chared.c_undo.len = -1;
el->el_chared.c_undo.cursor = 0;
el->el_chared.c_vcmd.action = 0x00;
el->el_chared.c_vcmd.pos = el->el_line.buffer;
el->el_chared.c_kill.mark = el->el_line.buffer;
el->el_map.current = el->el_map.key;
el->el_state.inputmode = 0;
el->el_state.doingarg = 0;
el->el_state.metanext = 0;
el->el_state.argument = 1;
el->el_state.lastcmd = 28;
el->el_history.eventno = 0;
}
| void ch_reset(struct_0 *a0) {
char v0;
struct_0 *v2;
unsigned long long v3;
a0->field_58 = a0->field_50;
a0->field_60 = a0->field_50;
a0->field_368 = -1;
a0->field_370 = 0;
a0->field_3c0 = 0;
a0->field_3c8 = a0->field_50;
a0->field_390 = a0->field_50;
a0->field_400 = a0->field_3f8;
a0->field_70 = 0;
a0->field_74 = 0;
a0->field_7c = 0;
a0->field_78 = 1;
a0->field_80 = 28;
v2 = a0;
a0->field_470 = 0;
v3 = *(&v0);
return;
}
|
void
servconf_add_hostkey(const char *file, const int line,
ServerOptions *options, const char *path, int userprovided)
{
char *apath = derelativise_path(path);
opt_array_append2(file, line, "HostKey",
&options->host_key_files, &options->host_key_file_userprovided,
&options->num_host_key_files, apath, userprovided);
free(apath);
}
| void servconf_add_hostkey(unsigned long long a0, unsigned long a1, unsigned long a2, char *a3, unsigned long a4) {
unsigned long v0;
void* v1;
unsigned long long v3;
v1 = derelativise_path(a3);
v0 = a4;
opt_array_append2(a0, a1, "HostKey", a2 + 1072, a2 + 1080, a2 + 1088, v1);
v3 = free(v1);
return;
}
|
static int output_builtin_alias_bin(struct depmod *depmod, FILE *out)
{
FILE *in;
struct index_node *idx;
int ret;
if (out ==
stdout
)
return 0;
in = dfdopen(depmod->cfg->dirname, "modules.builtin.modinfo",
00
, "r");
if (in ==
((void *)0)
)
return 0;
idx = index_create();
if (idx ==
((void *)0)
) {
fclose(in);
return -
12
;
}
while (!feof(in) && !ferror(in)) {
char alias[
4096
];
char modname[
4096
];
char value[
4096
];
size_t len;
len = flush_stream_to(in, '.', modname, sizeof(modname));
modname[len] = '\0';
if (!len)
continue;
len = flush_stream_to(in, '=', value, sizeof(value));
value[len] = '\0';
if (!(strcmp((value), ("alias")) == 0)) {
flush_stream(in, '\0');
continue;
}
len = flush_stream_to(in, '\0', value, sizeof(value));
value[len] = '\0';
if (!len)
continue;
alias[0] = '\0';
if (alias_normalize(value, alias,
((void *)0)
) < 0) {
log_printf(
4
, "Unmatched bracket in %s\n", value);
continue;
}
index_insert(idx, alias, modname, 0);
}
if (ferror(in)) {
ret = -
22
;
} else {
index_write(idx, out);
ret = 0;
}
index_destroy(idx);
fclose(in);
return ret;
}
| long long output_builtin_alias_bin(unsigned long long *a0, void* a1, unsigned long a2, unsigned long a3, unsigned long long a4) {
unsigned int v0;
void* v1;
void* v2;
char *v3;
char v4;
unsigned long long v5;
char v6;
char v7;
char v8;
unsigned long long v9;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
v9 = *(&v9);
v7 = *(&v7);
v5 = *(&v5);
if (a1 == stdout) {
v11 = 0;
} else {
v1 = dfdopen(*(a0) + 8, "modules.builtin.modinfo", 0x0, "r", a4);
if (!v1) {
v11 = 0;
} else {
v2 = index_create();
if (!v2) {
fclose(v1);
v11 = 4294967284;
} else {
while (true) {
v12 = feof(v1);
if (!v12) {
v13 = ferror(v1);
if (!v13) {
v3 = flush_stream_to(v1, 0x2e, &v6, 0x1000);
*((v3 + &v6)) = 0;
if (!v3)
continue;
v3 = flush_stream_to(v1, 0x3d, &v8, 0x1000);
*((v3 + &v8)) = 0;
if (strcmp(&v8, "alias")) {
flush_stream(v1, 0x0);
continue;
} else {
v3 = flush_stream_to(v1, 0x0, &v8, 0x1000);
*((v3 + &v8)) = 0;
if (!v3)
continue;
v4 = 0;
if (alias_normalize(&v8, &v4, 0x0, &v4) < 0) {
log_printf(0x4, "Unmatched bracket in %s\n", &v8, &v4, a4);
continue;
} else {
index_insert(v2, &v4, &v6, 0x0);
continue;
}
}
}
}
if (v12 || v13) {
if (ferror(v1)) {
v0 = -22;
} else {
index_write(v2, a1);
v0 = 0;
}
index_destroy(v2);
fclose(v1);
v11 = v0;
break;
}
}
}
}
}
return v11;
}
|
struct pidfh *
pidfile_open(const char *path, mode_t mode, pid_t *pidptr)
{
struct pidfh *pfh;
struct stat sb;
int error, fd, len, count;
struct timespec rqtp;
pfh = malloc(sizeof(*pfh));
if (pfh ==
((void *)0)
)
return (
((void *)0)
);
if (path ==
((void *)0)
) {
len = asprintf(&pfh->pf_path, "/var/run/%s.pid", getprogname());
if (len < 0) {
free(pfh);
return (
((void *)0)
);
}
} else
pfh->pf_path = strdup(path);
fd = flopen(pfh->pf_path,
01
|
0100
|
01000
|
04000
, mode);
if (fd == -1) {
if (
(*__errno_location ())
==
11
) {
if (pidptr ==
((void *)0)
) {
(*__errno_location ())
=
17
;
} else {
count = 20;
rqtp.tv_sec = 0;
rqtp.tv_nsec = 5000000;
for (;;) {
(*__errno_location ())
= pidfile_read(pfh->pf_path,
pidptr);
if (
(*__errno_location ())
!=
11
|| --count == 0)
break;
nanosleep(&rqtp, 0);
}
if (
(*__errno_location ())
==
11
)
*pidptr = -1;
if (
(*__errno_location ())
== 0 ||
(*__errno_location ())
==
11
)
(*__errno_location ())
=
17
;
}
}
error =
(*__errno_location ())
;
free(pfh->pf_path);
free(pfh);
(*__errno_location ())
= error;
return (
((void *)0)
);
}
if (fstat(fd, &sb) == -1) {
error =
(*__errno_location ())
;
unlink(pfh->pf_path);
free(pfh->pf_path);
close(fd);
free(pfh);
(*__errno_location ())
= error;
return (
((void *)0)
);
}
pfh->pf_fd = fd;
pfh->pf_dev = sb.st_dev;
pfh->pf_ino = sb.st_ino;
return (pfh);
}
| long long pidfile_open(char *a0, unsigned long a1, unsigned int *a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
void* v4;
void* v5;
unsigned long long v6;
char v7;
char v8;
void* v10;
unsigned int v15;
v4 = malloc(0x20);
if (!v4) {
v10 = 0;
} else {
if (!a0) {
v1 = asprintf(v4 + 8, "/var/run/%s.pid", getprogname());
if (v1 < 0) {
free(v4);
v10 = 0;
}
} else {
*(&v4[8]) = strdup(a0);
}
if (v1 >= 0 || a0) {
v2 = flopen(v4[8], 0xa41, a1);
if (v2 == -1) {
if (*(__errno_location()) == 11) {
if (!a2) {
*(__errno_location()) = 17;
} else {
v0 = 20;
v5 = 0;
v6 = 5000000;
while (true) {
*(__errno_location()) = pidfile_read(v4[8], a2, a2);
if (*(__errno_location()) != 11)
break;
v0 -= 1;
if (!v0)
break;
nanosleep(&v5, NULL);
}
if (*(__errno_location()) == 11)
*(a2) = -1;
v15 = *(__errno_location());
if (!v15 || *(__errno_location()) == 11)
*(__errno_location()) = 17;
}
}
v3 = *(__errno_location());
free(v4[8]);
free(v4);
*(__errno_location()) = v3;
v10 = 0;
} else if (fstat(v2, &v7) == -1) {
v3 = *(__errno_location());
unlink(v4[8]);
free(v4[8]);
close(v2);
free(v4);
*(__errno_location()) = v3;
v10 = 0;
} else {
*(v4) = v2;
*(&v4[16]) = *(&v7);
*(&v4[24]) = *(&v8);
v10 = v4;
}
}
}
return v10;
}
|
const char *
log_level_name(LogLevel level)
{
u_int i;
for (i = 0; log_levels[i].name !=
((void *)0)
; i++)
if (log_levels[i].val == level)
return log_levels[i].name;
return
((void *)0)
;
}
| undefined8 log_level_name(int param_1)
{
uint local_c;
local_c = 0;
while( true ) {
if (*(long *)(log_levels + (ulong)local_c * 0x10) == 0) {
return 0;
}
if (param_1 == *(int *)(log_levels + (ulong)local_c * 0x10 + 8)) break;
local_c = local_c + 1;
}
return *(undefined8 *)(log_levels + (ulong)local_c * 0x10);
}
|
int
num_fifos ()
{
return nfds;
}
| long long num_fifos() {
return nfds;
}
|
static enum EvaluationCost
get_pred_cost (const struct predicate *p)
{
enum EvaluationCost data_requirement_cost = NeedsNothing;
enum EvaluationCost inherent_cost = NeedsUnknown;
if (p->need_stat)
{
data_requirement_cost = NeedsStatInfo;
}
else if (p->need_inum)
{
data_requirement_cost = NeedsInodeNumber;
}
else if (p->need_type)
{
data_requirement_cost = NeedsType;
}
else
{
data_requirement_cost = NeedsNothing;
}
if (( ((p)->pred_func) == (pred_exec) ) || ( ((p)->pred_func) == (pred_execdir) ))
{
if (p->args.exec_vec.multiple)
inherent_cost = NeedsEventualExec;
else
inherent_cost = NeedsImmediateExec;
}
else if (( ((p)->pred_func) == (pred_fprintf) ))
{
inherent_cost = p->p_cost;
}
else
{
struct pred_cost_lookup key;
void *entry;
if (!pred_table_sorted)
{
qsort (costlookup,
sizeof(costlookup)/sizeof(costlookup[0]),
sizeof(costlookup[0]),
cost_table_comparison);
if (!check_sorted (costlookup,
sizeof(costlookup)/sizeof(costlookup[0]),
sizeof(costlookup[0]),
cost_table_comparison))
{
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, \"failed to sort the costlookup array\"), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, "failed to sort the costlookup array"), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, "failed to sort the costlookup array"), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
}
pred_table_sorted = 1;
}
key.fn = p->pred_func;
entry = bsearch (&key, costlookup,
sizeof(costlookup)/sizeof(costlookup[0]),
sizeof(costlookup[0]),
cost_table_comparison);
if (entry)
{
inherent_cost = ((const struct pred_cost_lookup*)entry)->cost;
}
else
{
error (0, 0,
gettext ("warning: there is no entry in the predicate evaluation " "cost table for predicate %s; please report this as a bug")
,
p->p_name);
inherent_cost = NeedsUnknown;
}
}
if (inherent_cost > data_requirement_cost)
return inherent_cost;
else
return data_requirement_cost;
}
| int get_pred_cost(struct_0 *a0) {
unsigned int v0;
unsigned int v1;
struct_1 *v2;
unsigned long v3;
char v5;
unsigned int v6;
v0 = 0;
v1 = 10;
if (a0->field_1a) {
v0 = 3;
} else if (a0->field_1c) {
v0 = 1;
} else if (a0->field_1b) {
v0 = 2;
} else {
v0 = 0;
}
if (a0->field_0 != got.pred_exec && a0->field_0 != got.pred_execdir) {
if (a0->field_0 == got.pred_fprintf) {
v1 = a0->field_20;
} else {
if (!pred_table_sorted) {
qsort(&costlookup, 0x3b, 0x10, cost_table_comparison);
v5 = check_sorted(&costlookup, 0x3b, 0x10, cost_table_comparison) ^ 1;
if (v5)
error(0x1, 0x0, "failed to sort the costlookup array");
pred_table_sorted = 1;
}
if (!v5 || pred_table_sorted) {
v3 = a0->field_0;
v2 = bsearch(&v3, &costlookup, 0x3b, 0x10, cost_table_comparison);
if (v2) {
v1 = v2->field_8;
} else {
error(0x0, 0x0, gettext("warning: there is no entry in the predicate ev"));
v1 = 10;
}
}
}
}
if (a0->field_0 == got.pred_execdir || a0->field_0 == got.pred_exec) {
if (a0->field_38)
v1 = 7;
else
v1 = 8;
}
if (a0->field_0 == got.pred_execdir || a0->field_0 == got.pred_exec || !v5 || a0->field_0 == got.pred_fprintf || pred_table_sorted) {
if (v1 > v0)
v6 = v1;
else
v6 = v0;
return v6;
}
}
|
static inline void
duinfo_set (struct duinfo *a, uintmax_t size, struct timespec tmax)
{
a->size = size;
a->inodes = 1;
a->tmax = tmax;
}
| void duinfo_set(unsigned long long a0[4], unsigned long a1, unsigned long long a2, unsigned long a3) {
char v0;
unsigned long long v2;
unsigned long long v3;
a0[0] = a1;
a0[1] = 1;
v2 = a2;
a0[2] = a2;
a0[3] = a3;
v3 = *(&v0);
return;
}
|
static int
parse_df_flags(const char *cmd, char **argv, int argc, int *hflag, int *iflag)
{
int ch;
BSDoptind = BSDoptreset = 1;
BSDopterr = 0;
*hflag = *iflag = 0;
while ((ch = BSDgetopt(argc, argv, "hi")) != -1) {
switch (ch) {
case 'h':
*hflag = 1;
break;
case 'i':
*iflag = 1;
break;
default:
sshlog("sftp.c", __func__, 554, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "%s: Invalid flag -%c", cmd, BSDoptopt);
return -1;
}
}
return BSDoptind;
}
| long parse_df_flags(const char *a1, long a2, unsigned int a3, _DWORD *a4, _DWORD *a5)
{
int i;
BSDoptreset = 1;
BSDoptind = 1;
BSDopterr = 0;
*a5 = 0;
*a4 = *a5;
for ( i = BSDgetopt(a3, a2, &unk_99DC); i != -1; i = BSDgetopt(a3, a2, &unk_99DC) )
{
if ( i == 104 )
{
*a4 = 1;
}
else
{
if ( i != 105 )
{
sshlog("sftp.c", "parse_df_flags", 554LL, 0LL, 2LL, 0LL, "%s: Invalid flag -%c", a1, BSDoptopt);
return 0xFFFFFFFFLL;
}
*a5 = 1;
}
}
return BSDoptind;
}
|
int
rl_vi_bword (int count, int ignore)
{
int opoint;
while (count-- && rl_point > 0)
{
int prev_is_ident, cur_is_ident;
if (!(((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t')) &&
(((rl_line_buffer[rl_point - 1]) == ' ') || ((rl_line_buffer[rl_point - 1]) == '\t')))
if (--rl_point == 0)
break;
cur_is_ident = ((1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)rl_line_buffer[rl_point]
))] & (unsigned short int) _ISalnum)
) || (rl_line_buffer[rl_point]) == '_');
opoint = _rl_vi_backup_point ();
prev_is_ident = ((1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)rl_line_buffer[rl_point]
))] & (unsigned short int) _ISalnum)
) || (rl_line_buffer[rl_point]) == '_');
if ((cur_is_ident && !prev_is_ident) || (!cur_is_ident && prev_is_ident))
;
else
rl_point = opoint;
while (rl_point > 0 && (((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t')))
_rl_vi_backup_point ();
if (rl_point > 0)
{
opoint = rl_point;
if (((1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)rl_line_buffer[rl_point]
))] & (unsigned short int) _ISalnum)
) || (rl_line_buffer[rl_point]) == '_'))
do
opoint = _rl_vi_backup_point ();
while (rl_point > 0 && ((1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)rl_line_buffer[rl_point]
))] & (unsigned short int) _ISalnum)
) || (rl_line_buffer[rl_point]) == '_'));
else
do
opoint = _rl_vi_backup_point ();
while (rl_point > 0 && !((1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)rl_line_buffer[rl_point]
))] & (unsigned short int) _ISalnum)
) || (rl_line_buffer[rl_point]) == '_') &&
!(((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t')));
if (rl_point > 0)
rl_point = opoint;
if (rl_point < 0)
rl_point = 0;
}
}
return (0);
}
| long long rl_vi_bword(unsigned long a0, unsigned long a1) {
unsigned int v0;
int tmp_9;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
unsigned int v11;
unsigned int v12;
unsigned int v13;
v1 = a0;
v0 = a1;
while (true) {
do {
while (true) {
tmp_9 = v1;
v1 -= 1;
if (tmp_9 && rl_point > 0) {
if (*((rl_point + rl_line_buffer)) != 32 && *((rl_point + rl_line_buffer)) != 9 && (*((rl_line_buffer + rl_point - 1)) == 32 || *((rl_line_buffer + rl_point - 1)) == 9))
rl_point = rl_point - 1;
if ((*((rl_point + rl_line_buffer)) == 32 || *((rl_point + rl_line_buffer)) == 9 || rl_point || *((rl_line_buffer + rl_point - 1)) != 32) && (*((rl_point + rl_line_buffer)) == 32 || *((rl_point + rl_line_buffer)) == 9 || rl_point || *((rl_line_buffer + rl_point - 1)) != 9)) {
v7 = *((*(__ctype_b_loc()) + *((rl_point + rl_line_buffer)) * 2)) & 8;
if (!v7 && *((rl_point + rl_line_buffer)) != 95)
v8 = 0;
if (*((rl_point + rl_line_buffer)) == 95 || v7)
v8 = 1;
v3 = v8;
v2 = _rl_vi_backup_point();
*(&v8) = *((*(__ctype_b_loc()) + *((rl_point + rl_line_buffer)) * 2));
v9 = v8 & 8;
if (!v9 && *((rl_point + rl_line_buffer)) != 95)
v10 = 0;
if (*((rl_point + rl_line_buffer)) == 95 || v9)
v10 = 1;
v4 = v10;
if ((!v3 || v4) && (!v4 || v3))
rl_point = v2;
while (rl_point > 0) {
if (*((rl_point + rl_line_buffer)) != 32) {
if (*((rl_point + rl_line_buffer)) != 9)
break;
}
_rl_vi_backup_point();
}
if (rl_point <= 0)
continue;
v2 = rl_point;
*(&v10) = *((*(__ctype_b_loc()) + *((rl_point + rl_line_buffer)) * 2));
v11 = v10 & 8;
if (!v11 && *((rl_point + rl_line_buffer)) != 95) {
do {
v2 = _rl_vi_backup_point();
if (rl_point <= 0)
break;
*(&v11) = *((*(__ctype_b_loc()) + *((rl_point + rl_line_buffer)) * 2));
v13 = v11 & 8;
if (v13)
break;
if (!v13) {
if (*((rl_point + rl_line_buffer)) == 95)
break;
if (*((rl_point + rl_line_buffer)) != 95) {
if (*((rl_point + rl_line_buffer)) == 32)
break;
}
}
} while (*((rl_point + rl_line_buffer)) != 9);
}
if (*((rl_point + rl_line_buffer)) == 95 || v11) {
do {
v2 = _rl_vi_backup_point();
if (rl_point <= 0)
break;
*(&v11) = *((*(__ctype_b_loc()) + *((rl_point + rl_line_buffer)) * 2));
v12 = v11 & 8;
if (v12)
continue;
} while (*((rl_point + rl_line_buffer)) == 95);
break;
}
}
}
if (rl_point <= 0 || !tmp_9 || !rl_point && *((rl_line_buffer + rl_point - 1)) == 32 && *((rl_point + rl_line_buffer)) != 32 && *((rl_point + rl_line_buffer)) != 9 || !rl_point && *((rl_line_buffer + rl_point - 1)) == 9 && *((rl_point + rl_line_buffer)) != 32 && *((rl_point + rl_line_buffer)) != 9)
return 0;
}
if (rl_point > 0)
rl_point = v2;
} while (rl_point >= 0);
rl_point = 0;
}
}
|
char *
remove_quoted_ifs (string)
char *string;
{
register size_t slen;
register int i, j;
char *ret, *send;
mbstate_t state; memset (&state, '\0', sizeof (mbstate_t));
slen = strlen (string);
send = string + slen;
i = j = 0;
ret = (char *)sh_xmalloc((slen + 1), "subst.c", 5006);
while (i < slen)
{
if (string[i] == '\001')
{
i++;
if (string[i] == 0 || (ifs_cmap[(unsigned char)(string[i])] != 0) == 0)
ret[j++] = '\001';
if (i == slen)
break;
}
do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _k; _k = is_basic ((string)[(i)]); if (_k) mblength = 1; else if (locale_utf8locale && ((string)[(i)] & 0x80) == 0) mblength = (string)[(i)] != 0; else { state_bak = state; mblength = mbrlen ((string) + (i), (send) - ((string)+(i)), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; mblength = 1; } else mblength = (mblength < 1) ? 1 : mblength; for (_k = 0; _k < mblength; _k++) ret[j++] = string[i++]; } else ret[j++] = string[i++]; } while (0);
}
ret[j] = '\0';
return (ret);
}
| int remove_quoted_ifs(void* a0) {
int tmp_6;
int tmp_10;
int tmp_27;
unsigned int v0;
int tmp_14;
int tmp_31;
unsigned long long v1;
unsigned long v2;
void* v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v7;
void* v8;
unsigned long v10;
void* v11;
memset(&v4, 0x0, 0x8);
v7 = strlen(a0);
v2 = a0 + v7;
v8 = 0;
v11 = 0;
v3 = sh_xmalloc(v7 + 1, "subst.c", 0x138e);
while (true) {
if (v7 <= v11)
break;
if (*((a0 + v11)) == 1) {
v11 = v11 + 1;
if (!*((a0 + v11)) || !*(*((a0 + v11)) + &ifs_cmap)) {
tmp_6 = v8;
v8 += 1;
*(v3 + tmp_6) = 1;
}
if (v7 == v11)
break;
}
if (locale_mb_cur_max <= 1) {
tmp_10 = v11;
v11 += 1;
tmp_27 = v8;
v8 += 1;
*(tmp_27 + v3) = *(tmp_10 + a0);
} else {
v0 = is_basic(*((a0 + v11)));
if (v0) {
v1 = 1;
} else if (!locale_utf8locale || *((a0 + v11)) < 0) {
v5 = v4;
v1 = mbrlen(v11 + a0, v2 - (v11 + a0), &v4, v11 + a0);
} else {
v1 = *((a0 + v11));
}
if (v1 == -2 || v1 == -1) {
v4 = v5;
v1 = 1;
} else {
v10 = (!v1 ? v1 : 1);
v1 = v10;
}
for (v0 = 0; v1 > v0; v0 += 1) {
tmp_14 = v11;
v11 += 1;
tmp_31 = v8;
v8 += 1;
*(&v10) = *(tmp_14 + a0);
*(tmp_31 + v3) = v10;
}
}
}
*((v3 + v8)) = 0;
return v3;
}
|
static inline
_Bool
is_nul (void const *buf, size_t length)
{
const unsigned char *p = buf;
unsigned char word;
if (! length)
return
1
;
while (__builtin_expect ((length & (sizeof word - 1)), 0))
{
if (*p)
return
0
;
p++;
length--;
if (! length)
return
1
;
}
for (;;)
{
memcpy (&word, p, sizeof word);
if (word)
return
0
;
p += sizeof word;
length -= sizeof word;
if (! length)
return
1
;
if (__builtin_expect ((length & 15), 0) == 0)
break;
}
return memcmp (buf, p, length) == 0;
}
| bool is_nul(void *a1, size_t a2)
{
size_t n;
char dest;
void *src;
unsigned long v6;
n = a2;
v6 = __readfsqword(0x28u);
src = a1;
if ( !a2 )
return 1;
do
{
memcpy(&dest, src, sizeof(dest));
if ( dest )
return 0;
src = (char *)src + 1;
if ( !--n )
return 1;
}
while ( (n & 0xF) != 0 );
return memcmp(a1, src, n) == 0;
}
|
static int
_rl_vi_arg_dispatch (int c)
{
int key;
key = c;
if (c >= 0 && _rl_keymap[c].type == 0 && _rl_keymap[c].function == rl_universal_argument)
{
rl_numeric_arg *= 4;
return 1;
}
c = ((c) & (~0x080));
if (((c) >= '0' && (c) <= '9'))
{
if (rl_explicit_arg)
rl_numeric_arg = (rl_numeric_arg * 10) + ((c) - '0');
else
rl_numeric_arg = ((c) - '0');
rl_explicit_arg = 1;
return 1;
}
else
{
rl_clear_message ();
rl_stuff_char (key);
return 0;
}
}
| int _rl_vi_arg_dispatch(unsigned long a0) {
unsigned int v0;
unsigned int v1;
unsigned int v3;
v0 = a0;
v1 = v0;
if (v0 >= 0 && !*((_rl_keymap + (v0 << 4))) && *((_rl_keymap + (v0 << 4) + 8)) == got.rl_universal_argument) {
rl_numeric_arg = rl_numeric_arg * 4;
v3 = 1;
return v3;
}
v0 &= -129;
if (v0 > 47 && v0 <= 57) {
if (rl_explicit_arg)
rl_numeric_arg = v0 - 48 + ((rl_numeric_arg * 4) + rl_numeric_arg) * 2;
else
rl_numeric_arg = v0 - 48;
rl_explicit_arg = 1;
v3 = 1;
return v3;
}
rl_clear_message();
rl_stuff_char(v1);
v3 = 0;
return v3;
}
|
static
_Bool
src_to_dest_compare (void const *x, void const *y)
{
struct Src_to_dest const *a = x;
struct Src_to_dest const *b = y;
return ((*a).st_ino == (*b).st_ino && (*a).st_dev == (*b).st_dev) ?
1
:
0
;
}
| long long src_to_dest_compare(unsigned long long a0[2], unsigned long long a1[2]) {
unsigned int v1;
unsigned long long v2;
if (a0[0] != a1[0] || a0[1] != a1[1])
v1 = 0;
else
v1 = 1;
v2 = v1 & 1;
return v2;
}
|
int
el_getc(EditLine *el, char *cp)
{
int num_read;
wchar_t wc = 0;
num_read = el_wgetc(el, &wc);
*cp = '\0';
if (num_read <= 0)
return num_read;
num_read = wctob(wc);
if (num_read ==
(-1)
) {
(*__errno_location ())
=
34
;
return -1;
} else {
*cp = (char)num_read;
return 1;
}
}
| long long el_getc(unsigned long long a0, char *a1) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
v0 = 0;
v1 = el_wgetc(a0, &v0, &v0);
*(a1) = 0;
if (v1 <= 0) {
v3 = v1;
return v3;
}
v1 = wctob(v0);
if (v1 != -1) {
*(a1) = v1;
v3 = 1;
return v3;
}
*(__errno_location()) = 34;
v3 = 4294967295;
return v3;
}
|
static void open_files (void)
{
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);
}
if (is_shadow_pwd) {
if (spw_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, spw_dbname ());
fail_exit (1);
}
spw_locked =
1
;
if (spw_open (
0100
|
02
) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot open %s\n"),
Prog, spw_dbname ());
fail_exit (1);
}
}
if (gr_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, gr_dbname ());
fail_exit (10);
}
gr_locked =
1
;
if (gr_open (
0100
|
02
) == 0) {
fprintf (
stderr
, gettext ("%s: cannot open %s\n"), Prog, gr_dbname ());
fail_exit (10);
}
if (is_shadow_grp) {
if (sgr_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, sgr_dbname ());
fail_exit (10);
}
sgr_locked=
1
;
if (sgr_open (
0100
|
02
) == 0) {
fprintf (
stderr
, gettext ("%s: cannot open %s\n"),
Prog, sgr_dbname ());
fail_exit (10);
}
}
if (is_sub_uid) {
if (sub_uid_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, sub_uid_dbname ());
fail_exit (16);
}
sub_uid_locked =
1
;
if (sub_uid_open (
0100
|
02
) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot open %s\n"), Prog, sub_uid_dbname ());
fail_exit (16);
}
}
if (is_sub_gid) {
if (sub_gid_lock () == 0) {
fprintf (
stderr
,
gettext ("%s: cannot lock %s; try again later.\n"),
Prog, sub_gid_dbname ());
fail_exit (18);
}
sub_gid_locked =
1
;
if (sub_gid_open (
0100
|
02
) == 0) {
fprintf (
stderr
,
gettext ("%s: cannot open %s\n"), Prog, sub_gid_dbname ());
fail_exit (18);
}
}
}
| void open_files() {
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v13;
unsigned long long v14;
if (!pw_lock()) {
v1 = pw_dbname();
fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n"));
fail_exit(0x1);
}
pw_locked = 1;
if (!pw_open(0x42)) {
v2 = pw_dbname();
fprintf(*(&stderr), gettext("%s: cannot open %s\n"));
fail_exit(0x1);
}
if (is_shadow_pwd) {
if (!spw_lock()) {
v3 = spw_dbname();
fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n"));
fail_exit(0x1);
}
spw_locked = 1;
if (!spw_open(0x42)) {
v4 = spw_dbname();
fprintf(*(&stderr), gettext("%s: cannot open %s\n"));
fail_exit(0x1);
}
}
if (!gr_lock()) {
v5 = gr_dbname();
fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n"));
fail_exit(0xa);
}
gr_locked = 1;
if (!gr_open(0x42)) {
v6 = gr_dbname();
fprintf(*(&stderr), gettext("%s: cannot open %s\n"));
fail_exit(0xa);
}
if (is_shadow_grp) {
if (!sgr_lock()) {
v7 = sgr_dbname();
fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n"));
fail_exit(0xa);
}
sgr_locked = 1;
if (!sgr_open(0x42)) {
v8 = sgr_dbname();
fprintf(*(&stderr), gettext("%s: cannot open %s\n"));
fail_exit(0xa);
}
}
if (is_sub_uid) {
if (!sub_uid_lock()) {
v9 = sub_uid_dbname();
fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n"));
fail_exit(0x10);
}
sub_uid_locked = 1;
if (!sub_uid_open(0x42)) {
v11 = sub_uid_dbname();
fprintf(*(&stderr), gettext("%s: cannot open %s\n"));
fail_exit(0x10);
}
}
v10 = is_sub_gid;
if (!is_sub_gid) {
return;
} else if (!sub_gid_lock()) {
v13 = sub_gid_dbname();
fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n"));
fail_exit(0x12);
} else {
sub_gid_locked = 1;
if (!sub_gid_open(0x42)) {
v14 = sub_gid_dbname();
fprintf(*(&stderr), gettext("%s: cannot open %s\n"));
fail_exit(0x12);
}
return;
}
}
|
static void bridge_print_stats_stp(const struct rtattr *attr)
{
struct bridge_stp_xstats *sstats;
sstats = ((void*)(((char*)(attr)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
open_json_object("stp");
print_string(PRINT_FP,
((void *)0)
,
"%-16s STP BPDU: ", "");
print_u64(PRINT_ANY, "rx_bpdu", "RX: %llu ",
sstats->rx_bpdu);
print_u64(PRINT_ANY, "tx_bpdu", "TX: %llu\n",
sstats->tx_bpdu);
print_string(PRINT_FP,
((void *)0)
,
"%-16s STP TCN: ", "");
print_u64(PRINT_ANY, "rx_tcn", "RX: %llu ",
sstats->rx_tcn);
print_u64(PRINT_ANY, "tx_tcn", "TX: %llu\n",
sstats->tx_tcn);
print_string(PRINT_FP,
((void *)0)
,
"%-16s STP Transitions: ", "");
print_u64(PRINT_ANY, "transition_blk", "Blocked: %llu ",
sstats->transition_blk);
print_u64(PRINT_ANY, "transition_fwd", "Forwarding: %llu\n",
sstats->transition_fwd);
close_json_object();
}
| void bridge_print_stats_stp(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned long long v0[6];
unsigned long long v2;
v0[0] = a0 + 4;
open_json_object("stp");
print_string(0x1, 0x0, "%-16s STP BPDU: ", &g_403fde);
print_u64(0x4, "rx_bpdu", "RX: %llu ", v0[2]);
print_u64(0x4, "tx_bpdu", "TX: %llu\n", v0[3]);
print_string(0x1, 0x0, "%-16s STP TCN: ", &g_403fde);
print_u64(0x4, "rx_tcn", "RX: %llu ", v0[4]);
print_u64(0x4, "tx_tcn", "TX: %llu\n", v0[5]);
print_string(0x1, 0x0, "%-16s STP Transitions: ", &g_403fde);
print_u64(0x4, "transition_blk", "Blocked: %llu ", v0[0]);
print_u64(0x4, "transition_fwd", "Forwarding: %llu\n", v0[1]);
v2 = close_json_object(0x4, "transition_fwd", "Forwarding: %llu\n", a3, a4, a5);
return;
}
|
static int
bash_dabbrev_expand (count, key)
int count, key;
{
int r, orig_suppress, orig_sort;
rl_compentry_func_t *orig_func;
rl_completion_func_t *orig_attempt_func;
rl_compignore_func_t *orig_ignore_func;
orig_func = rl_menu_completion_entry_function;
orig_attempt_func = rl_attempted_completion_function;
orig_ignore_func = rl_ignore_some_completions_function;
orig_suppress = rl_completion_suppress_append;
orig_sort = rl_sort_completion_matches;
rl_menu_completion_entry_function = history_completion_generator;
rl_attempted_completion_function = (rl_completion_func_t *)
((void *)0)
;
rl_ignore_some_completions_function = filename_completion_ignore;
rl_filename_completion_desired = 0;
rl_completion_suppress_append = 1;
rl_sort_completion_matches = 0;
dabbrev_expand_active = 1;
if (rl_last_func == bash_dabbrev_expand)
rl_last_func = rl_menu_complete;
r = rl_menu_complete (count, key);
dabbrev_expand_active = 0;
rl_last_func = bash_dabbrev_expand;
rl_menu_completion_entry_function = orig_func;
rl_attempted_completion_function = orig_attempt_func;
rl_ignore_some_completions_function = orig_ignore_func;
rl_completion_suppress_append = orig_suppress;
rl_sort_completion_matches = orig_sort;
return r;
}
| long long bash_dabbrev_expand(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
v3 = rl_menu_completion_entry_function;
v4 = rl_attempted_completion_function;
v5 = rl_ignore_some_completions_function;
v0 = rl_completion_suppress_append;
v1 = rl_sort_completion_matches;
rl_menu_completion_entry_function = history_completion_generator;
rl_attempted_completion_function = 0;
rl_ignore_some_completions_function = filename_completion_ignore;
rl_filename_completion_desired = 0;
rl_completion_suppress_append = 1;
rl_sort_completion_matches = 0;
dabbrev_expand_active = 1;
if (rl_last_func == bash_dabbrev_expand)
rl_last_func = got.rl_menu_complete;
v2 = rl_menu_complete(a0, a1, a1);
dabbrev_expand_active = 0;
rl_last_func = bash_dabbrev_expand;
rl_menu_completion_entry_function = v3;
rl_attempted_completion_function = v4;
rl_ignore_some_completions_function = v5;
rl_completion_suppress_append = v0;
rl_sort_completion_matches = v1;
return v2;
}
|
static int
getissuer_callback(const gnutls_x509_trust_list_t tlist,
const gnutls_x509_crt_t cert,
gnutls_x509_crt_t **issuers,
unsigned int *issuers_size)
{
gnutls_datum_t ud;
int ret;
gnutls_datum_t resp;
char *url =
((void *)0)
;
char headers[1024];
char _service[16];
unsigned char *p;
const char *_hostname;
const char *path = "";
unsigned i;
unsigned int headers_size = 0, port;
socket_st hd;
gnutls_x509_crt_t issuer;
gnutls_datum_t data = {
((void *)0)
, 0 };
static char buffer[4096 + 1];
sockets_init();
i = 0;
do {
ret = gnutls_x509_crt_get_authority_info_access(cert, i++,
GNUTLS_IA_CAISSUERS_URI,
&data,
((void *)0)
);
} while (ret == -105);
if (ret < 0) {
fprintf(
stderr
,
"*** Cannot find caIssuer URI in certificate: %s\n",
gnutls_strerror(ret));
return 0;
}
url = malloc(data.size + 1);
if (url ==
((void *)0)
) {
return -1;
}
memcpy(url, data.data, data.size);
url[data.size] = 0;
gnutls_free((void *) (data.data)), data.data=
((void *)0)
;
_hostname = host_from_url(url, &port, &path);
if (port != 0)
snprintf(_service, sizeof(_service), "%u", port);
else
strcpy(_service, "80");
fprintf(
stderr
, "Connecting to caIssuer server: %s...\n", _hostname);
memset(&ud, 0, sizeof(ud));
snprintf(headers, sizeof(headers), "GET /%s HTTP/1.0\r\n" "Host: %s\r\n" "Accept: */*\r\n" "Connection: close\r\n\r\n", path, _hostname);
headers_size = strlen(headers);
socket_open2(&hd, _hostname, _service,
((void *)0)
, (1<<3)|(1<<5), "Connecting to",
((void *)0)
,
((void *)0)
,
((void *)0)
,
((void *)0)
);
socket_send(&hd, headers, headers_size);
do {
ret = socket_recv(&hd, buffer, sizeof(buffer));
if (ret > 0)
get_data(buffer, ret, 1, &ud);
} while (ret > 0);
if (ret < 0 || ud.size == 0) {
perror("recv");
ret = -1;
socket_bye(&hd, 0);
goto cleanup;
}
socket_bye(&hd, 0);
p = memmem(ud.data, ud.size, "\r\n\r\n", 4);
if (p ==
((void *)0)
) {
fprintf(
stderr
, "Cannot interpret HTTP response\n");
ret = -1;
goto cleanup;
}
p += 4;
resp.size = ud.size - (p - ud.data);
resp.data = p;
ret = gnutls_x509_crt_init(&issuer);
if (ret < 0) {
fprintf(
stderr
, "Memory error\n");
ret = -1;
goto cleanup;
}
ret = gnutls_x509_crt_list_import2(issuers, issuers_size, &resp,
GNUTLS_X509_FMT_DER, 0);
if (ret < 0) {
fprintf(
stderr
, "Decoding error: %s\n", gnutls_strerror(ret));
ret = -1;
goto cleanup;
}
ret = 0;
cleanup:
gnutls_free((void *) (data.data)), data.data=
((void *)0)
;
free(ud.data);
free(url);
return ret;
}
| int getissuer_callback(undefined8 param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4)
{
int iVar1;
undefined8 uVar2;
size_t sVar3;
long in_FS_OFFSET;
uint local_5a0;
int local_59c;
int local_598;
undefined4 local_594;
undefined *local_590;
undefined local_588 [8];
void *local_580;
undefined8 local_578;
void *local_570;
void *local_568;
uint local_560;
void *local_558;
int local_550;
void *local_548;
uint local_540;
undefined local_538 [272];
char local_428 [16];
char local_418 [1032];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_580 = (void *)0x0;
local_590 = &DAT_00107819;
local_594 = 0;
local_548 = (void *)0x0;
local_540 = 0;
sockets_init();
local_598 = 0;
do {
iVar1 = local_598;
local_598 = local_598 + 1;
local_59c = gnutls_x509_crt_get_authority_info_access(param_2,iVar1,0x277a,&local_548,0);
} while (local_59c == -0x69);
if (local_59c < 0) {
uVar2 = gnutls_strerror(local_59c);
fprintf(stderr,"*** Cannot find caIssuer URI in certificate: %s\n",uVar2);
iVar1 = 0;
}
else {
local_580 = malloc((ulong)(local_540 + 1));
if (local_580 == (void *)0x0) {
iVar1 = -1;
}
else {
memcpy(local_580,local_548,(ulong)local_540);
*(undefined *)((long)local_580 + (ulong)local_540) = 0;
(*gnutls_free)(local_548);
local_548 = (void *)0x0;
local_578 = host_from_url(local_580,&local_5a0,&local_590);
if (local_5a0 == 0) {
strcpy(local_428,"80");
}
else {
snprintf(local_428,0x10,"%u",(ulong)local_5a0);
}
fprintf(stderr,"Connecting to caIssuer server: %s...\n",local_578);
memset(&local_568,0,0x10);
snprintf(local_418,0x400,
"GET /%s HTTP/1.0\r\nHost: %s\r\nAccept: *
__stack_chk_fail();
}
return iVar1;
}
|
int
builtin_arrayref_flags (w, baseflags)
WORD_DESC *w;
int baseflags;
{
char *t;
int vflags;
vflags = baseflags;
if (w->flags & (1 << 9))
vflags |= 0x002|0x001;
return vflags;
}
| long long builtin_arrayref_flags(struct_0 *a0, unsigned long a1) {
unsigned int v0;
v0 = a1;
if ((a0->field_8 & 0x200))
v0 |= 3;
return v0;
}
|
static inline void
emit_ancillary_info (char const *program)
{
struct infomap { char const *program; char const *node; } const infomap[] = {
{ "[", "test invocation" },
{ "coreutils", "Multi-call invocation" },
{ "sha224sum", "sha2 utilities" },
{ "sha256sum", "sha2 utilities" },
{ "sha384sum", "sha2 utilities" },
{ "sha512sum", "sha2 utilities" },
{
((void *)0)
,
((void *)0)
}
};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && ! (strcmp (program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
}
| void emit_ancillary_info(char *a0) {
unsigned long long v0;
unsigned long long v1[2];
char *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void* v16;
void* v17;
char v18;
unsigned long long v23;
unsigned long long *v24;
unsigned long long v25;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
for (v1[0] = &v4; v1[0]; v1[0] = v1 + 1) {
if (!strcmp(a0, v1[0]))
break;
}
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
if (strcmp(a0, "["))
v23 = a0;
else
v23 = "test";
v3 = v23;
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v25 = *(&v18) ^ v24[5];
return;
}
|
static const char *
str_days (parser_control *pc, char *buffer, int n)
{
static char const ordinal_values[][11] = {
"last",
"this",
"next/first",
"(SECOND)",
"third",
"fourth",
"fifth",
"sixth",
"seventh",
"eight",
"ninth",
"tenth",
"eleventh",
"twelfth"
};
static char const days_values[][4] = {
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
};
int len;
if (pc->debug_ordinal_day_seen)
{
len = (-1 <= pc->day_ordinal && pc->day_ordinal <= 12
? snprintf (buffer, n, "%s", ordinal_values[pc->day_ordinal + 1])
: snprintf (buffer, n, "%"
"l" "d"
, pc->day_ordinal));
}
else
{
buffer[0] = '\0';
len = 0;
}
if (0 <= pc->day_number && pc->day_number <= 6 && 0 <= len && len < n)
snprintf (buffer + len, n - len, &" %s"[len == 0],
days_values[pc->day_number]);
else
{
}
return buffer;
}
| char * str_days(long param_1,char *param_2,int param_3)
{
int local_c;
if (*(char *)(param_1 + 0xdf) == '\0') {
*param_2 = '\0';
local_c = 0;
}
else if ((*(long *)(param_1 + 8) < -1) || (0xc < *(long *)(param_1 + 8))) {
local_c = snprintf(param_2,(long)param_3,"%ld",*(undefined8 *)(param_1 + 8));
}
else {
local_c = snprintf(param_2,(long)param_3,"%s",
&ordinal_values_4078 + (*(long *)(param_1 + 8) + 1) * 0xb);
}
if ((((-1 < *(int *)(param_1 + 0x10)) && (*(int *)(param_1 + 0x10) < 7)) && (-1 < local_c)) &&
(local_c < param_3)) {
snprintf(param_2 + local_c,(long)(param_3 - local_c),&DAT_00106a8e + (int)(uint)(local_c == 0),
days_values_4079 + (long)*(int *)(param_1 + 0x10) * 4);
}
return param_2;
}
|
int
kex_c25519_dec(struct kex *kex, const struct sshbuf *server_blob,
struct sshbuf **shared_secretp)
{
struct sshbuf *buf =
((void *)0)
;
const u_char *server_pub;
int r;
*shared_secretp =
((void *)0)
;
if (sshbuf_len(server_blob) != 32) {
r = -21;
goto out;
}
server_pub = sshbuf_ptr(server_blob);
if ((buf = sshbuf_new()) ==
((void *)0)
) {
r = -2;
goto out;
}
if ((r = kexc25519_shared_key_ext(kex->c25519_client_key, server_pub,
buf, 0)) < 0)
goto out;
*shared_secretp = buf;
buf =
((void *)0)
;
out:
sshbuf_free(buf);
return r;
}
| long long kex_c25519_dec(unsigned long a0, unsigned long long a1, unsigned long long *a2) {
unsigned int v0;
void* v1;
unsigned long long v2;
v1 = 0;
*(a2) = 0;
if (sshbuf_len(a1) != 32) {
v0 = -21;
} else {
v2 = sshbuf_ptr(a1);
v1 = sshbuf_new();
if (!v1) {
v0 = -2;
} else {
v0 = kexc25519_shared_key_ext(a0 + 320, v2, v1, 0x0);
if (v0 >= 0) {
*(a2) = v1;
v1 = 0;
}
}
}
sshbuf_free(v1);
return v0;
}
|
static char const *
find_function (char const * const *linbuf, lin linenum)
{
lin i = linenum;
lin last = find_function_last_search;
find_function_last_search = i;
while (last <= --i)
{
char const *line = linbuf[i];
size_t linelen = linbuf[i + 1] - line - 1;
int len = ((linelen) <= (0x7fffffff) ? (linelen) : (0x7fffffff));
if (0 <= re_search (&function_regexp, line, len, 0, len,
((void *)0)
))
{
find_function_last_match = i;
return line;
}
}
if (find_function_last_match !=
(9223372036854775807L)
)
return linbuf[find_function_last_match];
return
((void *)0)
;
}
| char * find_function(long a1, long a2)
{
long v2;
long v4;
long v5;
char *string;
v4 = a2;
v5 = find_function_last_search;
find_function_last_search = a2;
while ( --v4 >= v5 )
{
string = *(char **)(8 * v4 + a1);
LODWORD(v2) = 0x7FFFFFFF;
if ( (unsigned long)(*(_QWORD *)(8 * (v4 + 1) + a1) - (_QWORD)string - 1LL) < 0x80000000 )
v2 = *(_QWORD *)(8 * (v4 + 1) + a1) - (_QWORD)string - 1LL;
if ( re_search(&function_regexp, string, v2, 0, v2, 0LL) >= 0 )
{
find_function_last_match = v4;
return string;
}
}
if ( find_function_last_match == 0x7FFFFFFFFFFFFFFFLL )
return 0LL;
else
return *(char **)(8 * find_function_last_match + a1);
}
|
int
sh_contains_shell_metas (string)
const char *string;
{
const char *s;
for (s = string; s && *s; s++)
{
switch (*s)
{
case ' ': case '\t': case '\n':
case '\'': case '"': case '\\':
case '|': case '&': case ';':
case '(': case ')': case '<': case '>':
case '!': case '{': case '}':
case '*': case '[': case '?': case ']':
case '^':
case '$': case '`':
return (1);
case '~':
if (s == string || s[-1] == '=' || s[-1] == ':')
return (1);
break;
case '#':
if (s == string)
return (1);
default:
break;
}
}
return (0);
}
| undefined8 sh_contains_shell_metas(char *param_1)
{
char *local_10;
local_10 = param_1;
do {
if ((local_10 == (char *)0x0) || (*local_10 == '\0')) {
return 0;
}
switch(*local_10) {
case '\t':
case '\n':
case ' ':
case '!':
case '\"':
case '$':
case '&':
case '\'':
case '(':
case ')':
case '*':
case ';':
case '<':
case '>':
case '?':
case '[':
case '\\':
case ']':
case '^':
case '`':
case '{':
case '|':
case '}':
return 1;
case '#':
if (local_10 == param_1) {
return 1;
}
break;
case '~':
if (((local_10 == param_1) || (local_10[-1] == '=')) || (local_10[-1] == ':')) {
return 1;
}
}
local_10 = local_10 + 1;
} while( true );
}
|
static int
pkcs11_start_helper_methods(void)
{
if (helper_rsa !=
((void *)0)
)
return (0);
int (*orig_sign)(int, const unsigned char *, int, unsigned char *,
unsigned int *, const BIGNUM *, const BIGNUM *, EC_KEY *) =
((void *)0)
;
if (helper_ecdsa !=
((void *)0)
)
return (0);
helper_ecdsa = EC_KEY_METHOD_new(EC_KEY_OpenSSL());
if (helper_ecdsa ==
((void *)0)
)
return (-1);
EC_KEY_METHOD_get_sign(helper_ecdsa, &orig_sign,
((void *)0)
,
((void *)0)
);
EC_KEY_METHOD_set_sign(helper_ecdsa, orig_sign,
((void *)0)
, ecdsa_do_sign);
if ((helper_rsa = RSA_meth_dup(RSA_get_default_method())) ==
((void *)0)
)
sshfatal("ssh-pkcs11-client.c", __func__, 263, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "RSA_meth_dup failed");
if (!RSA_meth_set1_name(helper_rsa, "ssh-pkcs11-helper") ||
!RSA_meth_set_priv_enc(helper_rsa, rsa_encrypt))
sshfatal("ssh-pkcs11-client.c", __func__, 266, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "failed to prepare method");
return (0);
}
| int pkcs11_start_helper_methods(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned long long v0;
void* v1;
unsigned long long v2;
unsigned int v4;
if (helper_rsa) {
v4 = 0;
} else {
v1 = 0;
if (helper_ecdsa) {
v4 = 0;
} else {
helper_ecdsa = EC_KEY_METHOD_new(EC_KEY_OpenSSL());
if (!helper_ecdsa) {
v4 = -1;
} else {
EC_KEY_METHOD_get_sign(helper_ecdsa, &v1, 0x0, 0x0);
EC_KEY_METHOD_set_sign(helper_ecdsa, v1, 0x0, ecdsa_do_sign);
helper_rsa = RSA_meth_dup(RSA_get_default_method(a0, a1, 0x0, ecdsa_do_sign, a4, a5));
if (!helper_rsa) {
v0 = "RSA_meth_dup failed";
sshfatal("ssh-pkcs11-client.c", "pkcs11_start_helper_methods", 0x107, 0x1, 0x1, 0x0);
}
v4 = RSA_meth_set1_name(helper_rsa, "ssh-pkcs11-helper");
if (v4)
v4 = RSA_meth_set_priv_enc(helper_rsa, rsa_encrypt);
if (!v4 || !v4) {
v2 = "failed to prepare method";
sshfatal("ssh-pkcs11-client.c", "pkcs11_start_helper_methods", 0x10a, 0x1, 0x1, 0x0);
}
v4 = 0;
}
}
}
return v4;
}
|
void
_rl_get_screen_size (int tty, int ignore_env)
{
char *ss;
struct winsize window_size;
int wr, wc;
wr = wc = -1;
if (ioctl (tty,
0x5413
, &window_size) == 0)
{
wc = (int) window_size.ws_col;
wr = (int) window_size.ws_row;
}
if (ignore_env || rl_prefer_env_winsize == 0)
{
_rl_screenwidth = wc;
_rl_screenheight = wr;
}
else
_rl_screenwidth = _rl_screenheight = -1;
if (_rl_screenwidth <= 0)
{
if (ignore_env == 0 && (ss = sh_get_env_value ("COLUMNS")))
_rl_screenwidth = atoi (ss);
if (_rl_screenwidth <= 0)
_rl_screenwidth = wc;
if (_rl_screenwidth <= 0 && term_string_buffer)
_rl_screenwidth = tgetnum ("co");
}
if (_rl_screenheight <= 0)
{
if (ignore_env == 0 && (ss = sh_get_env_value ("LINES")))
_rl_screenheight = atoi (ss);
if (_rl_screenheight <= 0)
_rl_screenheight = wr;
if (_rl_screenheight <= 0 && term_string_buffer)
_rl_screenheight = tgetnum ("li");
}
if (_rl_screenwidth <= 1)
_rl_screenwidth = 80;
if (_rl_screenheight <= 0)
_rl_screenheight = 24;
if (rl_change_environment)
sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
if (_rl_term_autowrap == 0)
_rl_screenwidth--;
_rl_screenchars = _rl_screenwidth * _rl_screenheight;
}
| void _rl_get_screen_size(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
char *v2;
char v3;
char v4;
char v5;
unsigned long long *v7;
unsigned long long v8;
v1 = -1;
v0 = v1;
if (!ioctl(a0, 0x5413)) {
v1 = *(&v4);
v0 = *(&v3);
}
if (a1 || !rl_prefer_env_winsize) {
_rl_enable_keypad = v1;
_rl_enable_keypad = v0;
} else {
_rl_enable_keypad = -1;
_rl_enable_keypad = 3525336957436119125;
}
if (!a1) {
v2 = sh_get_env_value("COLUMNS");
if (v2)
_rl_enable_keypad = atoi(v2);
}
if (true)
_rl_enable_keypad = v1;
if (true && term_string_buffer)
_rl_enable_keypad = tgetnum("co");
if (!a1) {
v2 = sh_get_env_value("LINES");
if (v2)
_rl_enable_keypad = atoi(v2);
}
if (true)
_rl_enable_keypad = v0;
if (true && term_string_buffer)
_rl_enable_keypad = tgetnum("li");
_rl_enable_keypad = 80;
_rl_enable_keypad = 24;
if (rl_change_environment)
sh_set_lines_and_columns(0x30ec8348e5894855, 0x30ec8348e5894855, 0x30ec8348e5894855);
if (!_rl_term_autowrap)
_rl_enable_keypad = 3850979412;
_rl_enable_keypad = 3525336957436119125 * 3525336957436119125;
v8 = *(&v5) ^ v7[5];
return;
}
|
static void tls_log_func(int level, const char *str)
{
fprintf(
stderr
, "|<%d>| %s", level, str);
}
| void tls_log_func(uint param_1,undefined8 param_2)
{
fprintf(stderr,"|<%d>| %s",(ulong)param_1,param_2);
return;
}
|
void
server_loop2(struct ssh *ssh, Authctxt *authctxt)
{
struct pollfd *pfd =
((void *)0)
;
u_int npfd_alloc = 0, npfd_active = 0;
int r, conn_in_ready, conn_out_ready;
u_int connection_in, connection_out;
u_int64_t rekey_timeout_ms = 0;
sigset_t bsigset, osigset;
sshlog("serverloop.c", __func__, 344, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Entering interactive session for SSH2.");
if (sigemptyset(&bsigset) == -1 || sigaddset(&bsigset,
17
) == -1)
sshlog("serverloop.c", __func__, 347, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "bsigset setup: %s", strerror(
(*__errno_location ())
));
ssh_signal(
17
, sigchld_handler);
child_terminated = 0;
connection_in = ssh_packet_get_connection_in(ssh);
connection_out = ssh_packet_get_connection_out(ssh);
if (!use_privsep) {
ssh_signal(
15
, sigterm_handler);
ssh_signal(
2
, sigterm_handler);
ssh_signal(
3
, sigterm_handler);
}
server_init_dispatch(ssh);
for (;;) {
process_buffered_input_packets(ssh);
if (!ssh_packet_is_rekeying(ssh) &&
ssh_packet_not_very_much_data_to_write(ssh))
channel_output_poll(ssh);
if (options.rekey_interval > 0 &&
!ssh_packet_is_rekeying(ssh)) {
rekey_timeout_ms = ssh_packet_get_rekey_timeout(ssh) *
1000;
} else {
rekey_timeout_ms = 0;
}
if (sigprocmask(
0
, &bsigset, &osigset) == -1)
sshlog("serverloop.c", __func__, 381, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "bsigset sigprocmask: %s", strerror(
(*__errno_location ())
));
collect_children(ssh);
wait_until_can_do_something(ssh, connection_in, connection_out,
&pfd, &npfd_alloc, &npfd_active, rekey_timeout_ms, &osigset,
&conn_in_ready, &conn_out_ready);
if (sigprocmask(
1
, &bsigset, &osigset) == -1)
sshlog("serverloop.c", __func__, 387, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "osigset sigprocmask: %s", strerror(
(*__errno_location ())
));
if (received_sigterm) {
sshlog("serverloop.c", __func__, 390, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Exiting on signal %d", (int)received_sigterm);
cleanup_exit(255);
}
channel_after_poll(ssh, pfd, npfd_active);
if (conn_in_ready &&
process_input(ssh, connection_in) < 0)
break;
if ((r = ssh_packet_check_rekey(ssh)) != 0)
sshfatal("serverloop.c", __func__, 401, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "cannot start rekeying");
if (conn_out_ready)
process_output(ssh, connection_out);
}
collect_children(ssh);
free(pfd);
channel_free_all(ssh);
session_destroy_all(ssh,
((void *)0)
);
}
| void server_loop2(undefined8 param_1,undefined8 param_2)
{
int iVar1;
int *piVar2;
char *pcVar3;
undefined8 uVar4;
undefined8 *puVar5;
long in_FS_OFFSET;
sigset_t *apsStackY384 [3];
undefined8 uStack344;
undefined8 local_150;
undefined4 local_144;
undefined4 local_140;
int local_13c;
int local_138;
undefined4 local_134;
undefined4 local_130;
int local_12c;
void *local_128;
undefined8 local_120;
sigset_t local_118;
sigset_t local_98;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_128 = (void *)0x0;
local_144 = 0;
local_140 = 0;
local_120 = 0;
uStack344 = param_2;
local_150 = param_1;
sshlog("serverloop.c","server_loop2",0x158,0,5,0,"Entering interactive session for SSH2.");
puVar5 = (undefined8 *)&stack0xfffffffffffffea8;
iVar1 = sigemptyset(&local_118);
if (iVar1 != -1) {
iVar1 = sigaddset(&local_118,0x11);
if (iVar1 != -1) goto LAB_00100a15;
}
piVar2 = __errno_location();
pcVar3 = strerror(*piVar2);
sshlog("serverloop.c","server_loop2",0x15b,1,2,0,"bsigset setup: %s",pcVar3);
LAB_00100a15:
ssh_signal(0x11,sigchld_handler);
child_terminated = 0;
local_134 = ssh_packet_get_connection_in(local_150);
local_130 = ssh_packet_get_connection_out(local_150);
if (use_privsep == 0) {
ssh_signal(0xf,sigterm_handler);
ssh_signal(2,sigterm_handler);
ssh_signal(3,sigterm_handler);
}
server_init_dispatch(local_150);
do {
*(undefined8 *)((long)puVar5 + -8) = 0x100ab5;
process_buffered_input_packets(local_150);
*(undefined8 *)((long)puVar5 + -8) = 0x100ac4;
iVar1 = ssh_packet_is_rekeying(local_150);
if (iVar1 == 0) {
*(undefined8 *)((long)puVar5 + -8) = 0x100ad7;
iVar1 = ssh_packet_not_very_much_data_to_write(local_150);
if (iVar1 != 0) {
*(undefined8 *)((long)puVar5 + -8) = 0x100aea;
channel_output_poll(local_150);
}
}
if (_DAT_00105e90 < 1) {
LAB_00100b2c:
local_120 = 0;
}
else {
*(undefined8 *)((long)puVar5 + -8) = 0x100b03;
iVar1 = ssh_packet_is_rekeying(local_150);
if (iVar1 != 0) goto LAB_00100b2c;
*(undefined8 *)((long)puVar5 + -8) = 0x100b16;
uVar4 = ssh_packet_get_rekey_timeout(local_150);
*(undefined8 *)((long)puVar5 + -8) = 0x100b23;
local_120 = __mulvdi3(uVar4,1000);
}
*(undefined8 *)((long)puVar5 + -8) = 0x100b52;
iVar1 = sigprocmask(0,&local_118,&local_98);
if (iVar1 == -1) {
*(undefined8 *)((long)puVar5 + -8) = 0x100b5c;
piVar2 = __errno_location();
iVar1 = *piVar2;
*(undefined8 *)((long)puVar5 + -8) = 0x100b65;
pcVar3 = strerror(iVar1);
*(char **)((long)puVar5 + -8) = pcVar3;
*(char **)((long)puVar5 + -0x10) = "bsigset sigprocmask: %s";
*(undefined8 *)((long)puVar5 + -0x18) = 0x100b9c;
sshlog("serverloop.c","server_loop2",0x17d,1,2,0);
}
*(undefined8 *)((long)puVar5 + -8) = 0x100baf;
collect_children(local_150);
*(int **)((long)puVar5 + -8) = &local_138;
*(int **)((long)puVar5 + -0x10) = &local_13c;
*(sigset_t **)((long)puVar5 + -0x18) = &local_98;
*(undefined8 *)((long)puVar5 + -0x20) = local_120;
*(undefined8 *)((long)puVar5 + -0x28) = 0x100bfd;
wait_until_can_do_something(local_150,local_134,local_130,&local_128,&local_144,&local_140);
*(undefined8 *)((long)puVar5 + -8) = 0x100c1c;
iVar1 = sigprocmask(1,&local_118,&local_98);
if (iVar1 == -1) {
*(undefined8 *)((long)puVar5 + -8) = 0x100c26;
piVar2 = __errno_location();
iVar1 = *piVar2;
*(undefined8 *)((long)puVar5 + -8) = 0x100c2f;
pcVar3 = strerror(iVar1);
*(char **)((long)puVar5 + -8) = pcVar3;
*(char **)((long)puVar5 + -0x10) = "osigset sigprocmask: %s";
*(undefined8 *)((long)puVar5 + -0x18) = 0x100c66;
sshlog("serverloop.c","server_loop2",0x183,1,2,0);
}
if (received_sigterm != 0) {
*(ulong *)((long)puVar5 + -8) = (ulong)received_sigterm;
*(char **)((long)puVar5 + -0x10) = "Exiting on signal %d";
*(undefined8 *)((long)puVar5 + -0x18) = 0x100cb1;
sshlog("serverloop.c","server_loop2",0x186,0,3,0);
*(undefined8 *)((long)puVar5 + -8) = 0x100cbf;
cleanup_exit(0xff);
}
*(undefined8 *)((long)puVar5 + -8) = 0x100cde;
channel_after_poll(local_150,local_128,local_140);
if (local_13c != 0) {
*(undefined8 *)((long)puVar5 + -8) = 0x100cff;
iVar1 = process_input(local_150,local_134);
if (iVar1 < 0) {
*(undefined8 *)((long)puVar5 + -8) = 0x100da3;
collect_children(local_150);
*(undefined8 *)((long)puVar5 + -8) = 0x100db2;
free(local_128);
*(undefined8 *)((long)puVar5 + -8) = 0x100dc1;
channel_free_all(local_150);
*(undefined8 *)((long)puVar5 + -8) = 0x100dd5;
session_destroy_all(local_150,0);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)((long)puVar5 + -8) = 0x100dea;
__stack_chk_fail();
}
return;
}
}
*(undefined8 *)((long)puVar5 + -8) = 0x100d16;
local_12c = ssh_packet_check_rekey(local_150);
if (local_12c != 0) {
*(undefined8 *)((long)puVar5 + -8) = 0x100d32;
uVar4 = ssh_err(local_12c);
*(char **)((long)puVar5 + -0x10) = "cannot start rekeying";
*(undefined8 *)((long)puVar5 + -0x18) = 0x100d69;
sshfatal("serverloop.c","server_loop2",0x191,1,1,uVar4);
puVar5 = (undefined8 *)((long)puVar5 + -0x10);
}
if (local_138 != 0) {
*(undefined8 *)((long)puVar5 + -8) = 0x100d8e;
process_output(local_150,local_130);
}
} while( true );
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.