input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
int
c_strcasecmp (const char *s1, const char *s2)
{
register const unsigned char *p1 = (const unsigned char *) s1;
register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (p1 == p2)
return 0;
do
{
c1 = c_tolower (*p1);
c2 = c_tolower (*p2);
if (c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);
if (
(0x7f * 2 + 1)
<= 0x7fffffff)
return c1 - c2;
else
return (((c1) > (c2)) - ((c1) < (c2)));
}
| long long c_strcasecmp(unsigned long long a0, unsigned long long a1) {
char v0;
char v1;
char *v3;
char *v4;
void* v5;
v3 = a0;
v4 = a1;
if (a0 == a1) {
v5 = 0;
return v5;
}
do {
v0 = c_tolower(*(v3));
v1 = c_tolower(*(v4));
if (!(v0) || !((v3 += 1, v4 += 1, v0 == v1)))
break;
} while ((v3 += 1, v4 += 1, v0 == v1));
v5 = v0 - v1;
return v5;
}
|
int
sshbuf_put_eckey(struct sshbuf *buf, const EC_KEY *v)
{
return sshbuf_put_ec(buf, EC_KEY_get0_public_key(v),
EC_KEY_get0_group(v));
}
| long sshbuf_put_eckey(long a1, long a2)
{
long v2;
long v3;
v2 = EC_KEY_get0_group(a2);
v3 = EC_KEY_get0_public_key(a2);
return sshbuf_put_ec(a1, v3, v2);
}
|
static void
keyprint(con *c, struct sshkey *key)
{
char *hosts = c->c_output_name ? c->c_output_name : c->c_name;
char *host, *ohosts;
if (key ==
((void *)0)
)
return;
if (get_cert || (!hash_hosts && ssh_port == 22)) {
keyprint_one(hosts, key);
return;
}
ohosts = hosts = xstrdup(hosts);
while ((host = strsep(&hosts, ",")) !=
((void *)0)
)
keyprint_one(host, key);
free(ohosts);
}
| void keyprint(unsigned long long a0[8], unsigned long long a1) {
unsigned long long v0;
void* v1;
unsigned long long v2;
char v3;
unsigned long long v5;
unsigned long long *v6;
unsigned long long v7;
if (a0[7])
v5 = a0[7];
else
v5 = a0[5];
v0 = v5;
if (a1) {
if (!get_cert && (hash_hosts || ssh_port != 22)) {
v0 = xstrdup(v0);
v1 = v0;
while (true) {
v2 = strsep(&v0, ",");
if (!v2)
break;
keyprint_one(v2, a1);
}
free(v1);
}
if (get_cert || !hash_hosts && ssh_port == 22)
keyprint_one(v0, a1);
}
v7 = *(&v3) ^ v6[5];
return;
}
|
BUILTIN_DESC *
copy_builtin (builtin)
BUILTIN_DESC *builtin;
{
BUILTIN_DESC *new;
new = (BUILTIN_DESC *)xmalloc (sizeof (BUILTIN_DESC));
new->name = strcpy (xmalloc (1 + strlen (builtin->name)), (builtin->name));
new->shortdoc = strcpy (xmalloc (1 + strlen (builtin->shortdoc)), (builtin->shortdoc));
new->longdoc = copy_string_array (builtin->longdoc);
new->dependencies = copy_string_array (builtin->dependencies);
new->function =
builtin->function ? strcpy (xmalloc (1 + strlen (builtin->function)), (builtin->function)) : (char *)
((void *)0)
;
new->docname =
builtin->docname ? strcpy (xmalloc (1 + strlen (builtin->docname)), (builtin->docname)) : (char *)
((void *)0)
;
return (new);
}
| char ** copy_builtin(char **param_1)
{
char **ppcVar1;
size_t sVar2;
char *pcVar3;
char *pcVar4;
ppcVar1 = (char **)xmalloc(0x38);
pcVar4 = *param_1;
sVar2 = strlen(*param_1);
pcVar3 = (char *)xmalloc(sVar2 + 1);
pcVar4 = strcpy(pcVar3,pcVar4);
*ppcVar1 = pcVar4;
pcVar4 = param_1[2];
sVar2 = strlen(param_1[2]);
pcVar3 = (char *)xmalloc(sVar2 + 1);
pcVar4 = strcpy(pcVar3,pcVar4);
ppcVar1[2] = pcVar4;
pcVar4 = (char *)copy_string_array(param_1[4]);
ppcVar1[4] = pcVar4;
pcVar4 = (char *)copy_string_array(param_1[5]);
ppcVar1[5] = pcVar4;
if (param_1[1] == (char *)0x0) {
pcVar4 = (char *)0x0;
}
else {
pcVar4 = param_1[1];
sVar2 = strlen(param_1[1]);
pcVar3 = (char *)xmalloc(sVar2 + 1);
pcVar4 = strcpy(pcVar3,pcVar4);
}
ppcVar1[1] = pcVar4;
if (param_1[3] == (char *)0x0) {
pcVar4 = (char *)0x0;
}
else {
pcVar4 = param_1[3];
sVar2 = strlen(param_1[3]);
pcVar3 = (char *)xmalloc(sVar2 + 1);
pcVar4 = strcpy(pcVar3,pcVar4);
}
ppcVar1[3] = pcVar4;
return ppcVar1;
}
|
void
ssh_dispatch_run_fatal(struct ssh *ssh, int mode, volatile sig_atomic_t *done)
{
int r;
if ((r = ssh_dispatch_run(ssh, mode, done)) != 0)
sshpkt_fatal(ssh, r, "%s", __func__);
}
| long long ssh_dispatch_run_fatal(unsigned long long a0, unsigned long a1, unsigned int *a2) {
unsigned int v0;
unsigned long long v2;
v2 = ssh_dispatch_run(a0, a1, a2);
v0 = v2;
if (v0)
v2 = sshpkt_fatal(a0, v0, "%s", "ssh_dispatch_run_fatal");
return v2;
}
|
void
name_term (void)
{
free (name_buffer);
}
| void name_term(void)
{
free(name_buffer);
return;
}
|
int
mm_answer_authserv(struct ssh *ssh, int sock, struct sshbuf *m)
{
int r;
monitor_permit_authentications(1);
if ((r = sshbuf_get_cstring(m, &authctxt->service,
((void *)0)
)) != 0 ||
(r = sshbuf_get_cstring(m, &authctxt->style,
((void *)0)
)) != 0)
sshfatal("monitor.c", __func__, 835, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse");
sshlog("monitor.c", __func__, 836, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "service=%s, style=%s", authctxt->service, authctxt->style);
if (strlen(authctxt->style) == 0) {
free(authctxt->style);
authctxt->style =
((void *)0)
;
}
return (0);
}
| undefined8 mm_answer_authserv(undefined8 param_1,undefined8 param_2,undefined8 param_3)
{
size_t sVar1;
undefined8 uVar2;
undefined8 uVar3;
int local_c;
monitor_permit_authentications(1);
local_c = sshbuf_get_cstring(param_3,authctxt + 0x28,0);
if (local_c == 0) {
uVar2 = 0x102d29;
local_c = sshbuf_get_cstring(param_3,authctxt + 0x38,0);
if (local_c == 0) {
sshlog("monitor.c","mm_answer_authserv",0x344,1,7,0,"service=%s, style=%s",
*(undefined8 *)(authctxt + 0x28),*(undefined8 *)(authctxt + 0x38),uVar2);
sVar1 = strlen(*(char **)(authctxt + 0x38));
if (sVar1 == 0) {
free(*(void **)(authctxt + 0x38));
*(undefined8 *)(authctxt + 0x38) = 0;
}
return 0;
}
}
uVar3 = 0x102d3c;
uVar2 = ssh_err(local_c);
sshfatal("monitor.c","mm_answer_authserv",0x343,1,1,uVar2,"parse",uVar3);
}
|
static int ipnh_modify(int cmd, unsigned int flags, int argc, char **argv)
{
struct {
struct nlmsghdr n;
struct nhmsg nhm;
char buf[1024];
} req = {
.n.nlmsg_len = ((sizeof(struct nhmsg)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))),
.n.nlmsg_flags = 0x01 | flags,
.n.nlmsg_type = cmd,
.nhm.nh_family = preferred_family,
};
__u32 nh_flags = 0;
while (argc > 0) {
if (!strcmp(*argv, "id")) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
addattr32(&req.n, sizeof(req), NHA_ID,
ipnh_parse_id(*argv));
} else if (!strcmp(*argv, "dev")) {
int ifindex;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
ifindex = ll_name_to_index(*argv);
if (!ifindex)
invarg("Device does not exist\n", *argv);
addattr32(&req.n, sizeof(req), NHA_OIF, ifindex);
if (req.nhm.nh_family ==
0
)
req.nhm.nh_family =
2
;
} else if (strcmp(*argv, "via") == 0) {
inet_prefix addr;
int family;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
family = read_family(*argv);
if (family ==
0
)
family = req.nhm.nh_family;
else
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
get_addr(&addr, *argv, family);
if (req.nhm.nh_family ==
0
)
req.nhm.nh_family = addr.family;
else if (req.nhm.nh_family != addr.family)
invarg("address family mismatch\n", *argv);
addattr_l(&req.n, sizeof(req), NHA_GATEWAY,
&addr.data, addr.bytelen);
} else if (strcmp(*argv, "encap") == 0) {
char buf[1024];
struct rtattr *rta = (void *)buf;
rta->rta_type = NHA_ENCAP;
rta->rta_len = (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0));
lwt_parse_encap(rta, sizeof(buf), &argc, &argv,
NHA_ENCAP, NHA_ENCAP_TYPE);
if (rta->rta_len > (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))) {
addraw_l(&req.n, 1024, ((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
((int)((rta)->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
}
} else if (!strcmp(*argv, "blackhole")) {
addattr_l(&req.n, sizeof(req), NHA_BLACKHOLE,
((void *)0)
, 0);
if (req.nhm.nh_family ==
0
)
req.nhm.nh_family =
2
;
} else if (!strcmp(*argv, "fdb")) {
addattr_l(&req.n, sizeof(req), NHA_FDB,
((void *)0)
, 0);
} else if (!strcmp(*argv, "onlink")) {
nh_flags |= 4;
} else if (!strcmp(*argv, "group")) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (add_nh_group_attr(&req.n, sizeof(req), *argv))
invarg("\"group\" value is invalid\n", *argv);
} else if (!strcmp(*argv, "type")) {
parse_nh_group_type(&req.n, sizeof(req), &argc, &argv);
} else if (matches(*argv, "protocol") == 0) {
__u32 prot;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (rtnl_rtprot_a2n(&prot, *argv))
invarg("\"protocol\" value is invalid\n", *argv);
req.nhm.nh_protocol = prot;
} else if (strcmp(*argv, "help") == 0) {
usage();
} else {
invarg("", *argv);
}
argc--; argv++;
}
req.nhm.nh_flags = nh_flags;
if (rtnl_talk(&rth, &req.n,
((void *)0)
) < 0)
return -2;
return 0;
}
| undefined8 ipnh_modify(undefined4 param_1,undefined4 param_2,int param_3,char **param_4)
{
char cVar1;
undefined4 uVar2;
int iVar3;
undefined8 uVar4;
long lVar5;
undefined8 *puVar6;
long in_FS_OFFSET;
char **local_980;
int local_974;
undefined4 local_970;
undefined4 local_96c;
undefined4 local_960;
uint local_95c;
uint local_958;
int local_954;
ushort *local_950;
undefined local_948 [2];
undefined2 local_946;
ushort local_942;
undefined local_940 [264];
undefined8 local_838;
byte local_828;
undefined local_826;
uint local_824;
ushort local_418;
undefined2 uStack1046;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
puVar6 = &local_838;
for (lVar5 = 0x83; lVar5 != 0; lVar5 = lVar5 + -1) {
*puVar6 = 0;
puVar6 = puVar6 + 1;
}
local_838._0_4_ = 0x18;
local_838._4_2_ = (undefined2)param_1;
local_838._6_2_ = (ushort)param_2 | 1;
local_828 = (byte)preferred_family;
local_95c = 0;
local_980 = param_4;
local_974 = param_3;
local_970 = param_2;
local_96c = param_1;
do {
if (local_974 < 1) {
local_824 = local_95c;
iVar3 = rtnl_talk(&rth,&local_838,0);
if (iVar3 < 0) {
uVar4 = 0xfffffffe;
}
else {
uVar4 = 0;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar4;
}
iVar3 = strcmp(*local_980,"id");
if (iVar3 == 0) {
local_980 = local_980 + 1;
local_974 = local_974 + -1;
if (local_974 < 1) {
incomplete_command();
}
uVar2 = ipnh_parse_id(*local_980);
addattr32(&local_838,0x418,1,uVar2);
}
else {
iVar3 = strcmp(*local_980,"dev");
if (iVar3 == 0) {
local_980 = local_980 + 1;
local_974 = local_974 + -1;
if (local_974 < 1) {
incomplete_command();
}
local_954 = ll_name_to_index(*local_980);
if (local_954 == 0) {
invarg("Device does not exist\n",*local_980);
}
addattr32(&local_838,0x418,5,local_954);
if (local_828 == 0) {
local_828 = 2;
}
}
else {
iVar3 = strcmp(*local_980,"via");
if (iVar3 == 0) {
local_980 = local_980 + 1;
local_974 = local_974 + -1;
if (local_974 < 1) {
incomplete_command();
}
local_958 = read_family(*local_980);
if (local_958 == 0) {
local_958 = (uint)local_828;
}
else {
local_980 = local_980 + 1;
local_974 = local_974 + -1;
if (local_974 < 1) {
incomplete_command();
}
}
get_addr(local_948,*local_980,local_958);
if (local_828 == 0) {
local_828 = (byte)local_942;
}
else if (local_828 != local_942) {
invarg("address family mismatch\n",*local_980);
}
addattr_l(&local_838,0x418,6,local_940,local_946);
}
else {
iVar3 = strcmp(*local_980,"encap");
if (iVar3 == 0) {
local_950 = &local_418;
uStack1046 = 8;
local_418 = 4;
lwt_parse_encap(local_950,0x400,&local_974,&local_980,8,7);
if (4 < *local_950) {
addraw_l(&local_838,0x400,local_950 + 2,*local_950 - 4);
}
}
else {
iVar3 = strcmp(*local_980,"blackhole");
if (iVar3 == 0) {
addattr_l(&local_838,0x418,4,0,0);
if (local_828 == 0) {
local_828 = 2;
}
}
else {
iVar3 = strcmp(*local_980,"fdb");
if (iVar3 == 0) {
addattr_l(&local_838,0x418,0xb,0,0);
}
else {
iVar3 = strcmp(*local_980,"onlink");
if (iVar3 == 0) {
local_95c = local_95c | 4;
}
else {
iVar3 = strcmp(*local_980,"group");
if (iVar3 == 0) {
local_980 = local_980 + 1;
local_974 = local_974 + -1;
if (local_974 < 1) {
incomplete_command();
}
iVar3 = add_nh_group_attr(&local_838,0x418,*local_980);
if (iVar3 == 0) goto LAB_00102a08;
invarg("\"group\" value is invalid\n",*local_980);
}
iVar3 = strcmp(*local_980,"type");
if (iVar3 == 0) {
parse_nh_group_type(&local_838,0x418,&local_974,&local_980);
}
else {
cVar1 = matches(*local_980,"protocol");
if (cVar1 == '\x01') {
iVar3 = strcmp(*local_980,"help");
if (iVar3 == 0) {
usage();
}
invarg(&DAT_00106126,*local_980);
}
else {
local_980 = local_980 + 1;
local_974 = local_974 + -1;
if (local_974 < 1) {
incomplete_command();
}
iVar3 = rtnl_rtprot_a2n(&local_960,*local_980);
if (iVar3 != 0) {
invarg("\"protocol\" value is invalid\n",*local_980);
}
local_826 = (undefined)local_960;
}
}
}
}
}
}
}
}
}
LAB_00102a08:
local_974 = local_974 + -1;
local_980 = local_980 + 1;
} while( true );
}
|
static void
initialize_shell_signals ()
{
if (interactive)
initialize_terminating_signals ();
sigemptyset (&top_level_mask);
sigprocmask (
0
, (sigset_t *)
((void *)0)
, &top_level_mask);
if (sigismember (&top_level_mask,
17
))
{
sigdelset (&top_level_mask,
17
);
sigprocmask (
2
, &top_level_mask, (sigset_t *)
((void *)0)
);
}
set_signal_handler (
3
,
((__sighandler_t) 1)
);
if (interactive)
{
set_signal_handler (
2
, sigint_sighandler);
get_original_signal (
15
);
set_signal_handler (
15
,
((__sighandler_t) 1)
);
set_sigwinch_handler ();
}
}
| void initialize_shell_signals() {
unsigned long long v1;
unsigned long long v2;
if (interactive)
initialize_terminating_signals();
sigemptyset(&top_level_mask);
sigprocmask(0x0, NULL, &top_level_mask);
if (sigismember(&top_level_mask, 0x11)) {
sigdelset(&top_level_mask, 0x11);
sigprocmask(0x2, &top_level_mask, NULL);
}
set_signal_handler(0x3, 0x1);
v1 = interactive;
if (interactive) {
set_signal_handler(0x2, sigint_sighandler);
get_original_signal(0xf);
set_signal_handler(0xf, 0x1);
v2 = set_sigwinch_handler();
}
return;
}
|
int
sshbuf_put(struct sshbuf *buf, const void *v, size_t len)
{
u_char *p;
int r;
if ((r = sshbuf_reserve(buf, len, &p)) < 0)
return r;
if (len != 0)
memcpy(p, v, len);
return 0;
}
| void sshbuf_put(unsigned long long a0, void* a1, unsigned long a2) {
unsigned int v0;
char v1;
unsigned long long v3;
void* v4;
v0 = sshbuf_reserve(a0, a2, &v1, a2);
if (v0 < 0) {
v3 = v0;
return;
}
if (a2)
memcpy(*(&v1), a1, a2);
v4 = 0;
return;
}
|
static
void do_msleep(int msec)
{
struct timeval tv;
tv.tv_sec = msec / 1000;
tv.tv_usec = (msec % 1000) * 1000;
while(select(0,
((void *)0)
,
((void *)0)
,
((void *)0)
, &tv) < 0 &&
(*__errno_location ())
==
4
)
;
}
| void do_msleep(unsigned long a0) {
unsigned long v0;
unsigned long v1;
char v2;
unsigned long long v4;
unsigned long long *v5;
unsigned long long v6;
v0 = (a0 * 274877907 >> 38) - (a0 >> 31);
v1 = (a0 - ((a0 * 274877907 >> 38) - (a0 >> 31)) * 1000) * 1000;
while (true) {
v4 = select(0x0, NULL, NULL, NULL, &v0);
if (v4 >= 0)
break;
*(&v4) = *(__errno_location());
if (v4 != 4)
break;
}
v6 = *(&v2) ^ v5[5];
return;
}
|
static void process_flags (int argc, char *const *argv)
{
int arg;
int flag;
for (arg = 1; arg < argc; arg++) {
if (argv[arg][0] == '-' && strlen (argv[arg]) > 2) {
usage ();
}
if (strcmp(argv[arg], "--") == 0) {
break;
}
}
while ((flag = getopt (argc, argv, "d:fh:pr:")) !=
(-1)
) {
switch (flag) {
case 'd':
break;
case 'f':
fflg =
1
;
break;
case 'h':
hflg =
1
;
hostname = optarg;
reason = 201;
break;
case 'p':
pflg =
1
;
break;
default:
usage ();
}
}
if ((
0
|| fflg || hflg) && !amroot) {
fprintf (
stderr
, gettext ("%s: Permission denied.\n"), Prog);
exit (1);
}
if (optind < argc) {
((void) sizeof ((((void *)0)
== username
) ? 1 : 0), __extension__ ({ if (((void *)0)
== username
) ; else __assert_fail (
"NULL == username"
, "login.c", 335, __extension__ __PRETTY_FUNCTION__); }))
;
username = xstrdup (argv[optind]);
explicit_bzero((argv[optind]), (strlen(argv[optind])));
++optind;
}
if (fflg && (
((void *)0)
== username)) {
usage ();
}
}
| unsigned long process_flags(int a1, char *const *a2)
{
long v2;
char *v3;
size_t v4;
unsigned long result;
int i;
int v7;
for ( i = 1; i < a1; ++i )
{
if ( *a2[i] == 45 && strlen(a2[i]) > 2 )
usage();
if ( !strcmp(a2[i], "--") )
break;
}
while ( 1 )
{
v7 = getopt(a1, a2, "d:fh:pr:");
if ( v7 == -1 )
break;
if ( v7 == 112 )
{
pflg = 1;
}
else
{
if ( v7 > 112 )
goto LABEL_19;
if ( v7 == 104 )
{
hflg = 1;
hostname = optarg;
reason = 201;
}
else
{
if ( v7 > 104 )
goto LABEL_19;
if ( v7 != 100 )
{
if ( v7 != 102 )
LABEL_19:
usage();
fflg = 1;
}
}
}
}
if ( (fflg || hflg) && amroot != 1 )
{
v2 = Prog;
v3 = gettext("%s: Permission denied.\n");
fprintf(stderr, v3, v2);
exit(1);
}
if ( a1 > optind )
{
if ( username )
_assert_fail("NULL == username", "login.c", 0x14Fu, "process_flags");
username = (void *)xstrdup(a2[optind]);
v4 = strlen(a2[optind]);
explicit_bzero(a2[optind], v4);
++optind;
}
result = (unsigned char)fflg;
if ( fflg )
{
result = (unsigned long)username;
if ( !username )
usage();
}
return result;
}
|
int deflate(strm, flush)
z_streamp strm;
int flush;
{
int old_flush;
deflate_state *s;
if (deflateStateCheck(strm) || flush > 5 || flush < 0) {
return (-2);
}
s = strm->state;
if (strm->next_out == 0 ||
(strm->avail_in != 0 && strm->next_in == 0) ||
(s->status == 666 && flush != 4)) {
return (strm->msg = z_errmsg[2 -((-2))], ((-2)));
}
if (strm->avail_out == 0) return (strm->msg = z_errmsg[2 -((-5))], ((-5)));
old_flush = s->last_flush;
s->last_flush = flush;
if (s->pending != 0) {
flush_pending(strm);
if (strm->avail_out == 0) {
s->last_flush = -1;
return 0;
}
} else if (strm->avail_in == 0 && (((flush) * 2) - ((flush) > 4 ? 9 : 0)) <= (((old_flush) * 2) - ((old_flush) > 4 ? 9 : 0)) &&
flush != 4) {
return (strm->msg = z_errmsg[2 -((-5))], ((-5)));
}
if (s->status == 666 && strm->avail_in != 0) {
return (strm->msg = z_errmsg[2 -((-5))], ((-5)));
}
if (s->status == 42 && s->wrap == 0)
s->status = 113;
if (s->status == 42) {
uInt header = (8 + ((s->w_bits - 8) << 4)) << 8;
uInt level_flags;
if (s->strategy >= 2 || s->level < 2)
level_flags = 0;
else if (s->level < 6)
level_flags = 1;
else if (s->level == 6)
level_flags = 2;
else
level_flags = 3;
header |= (level_flags << 6);
if (s->strstart != 0) header |= 0x20;
header += 31 - (header % 31);
putShortMSB(s, header);
if (s->strstart != 0) {
putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff));
}
strm->adler = adler32(0L, 0, 0);
s->status = 113;
flush_pending(strm);
if (s->pending != 0) {
s->last_flush = -1;
return 0;
}
}
if (s->status == 57) {
strm->adler = crc32(0L, 0, 0);
{s->pending_buf[s->pending++] = (Bytef)(31);};
{s->pending_buf[s->pending++] = (Bytef)(139);};
{s->pending_buf[s->pending++] = (Bytef)(8);};
if (s->gzhead == 0) {
{s->pending_buf[s->pending++] = (Bytef)(0);};
{s->pending_buf[s->pending++] = (Bytef)(0);};
{s->pending_buf[s->pending++] = (Bytef)(0);};
{s->pending_buf[s->pending++] = (Bytef)(0);};
{s->pending_buf[s->pending++] = (Bytef)(0);};
{s->pending_buf[s->pending++] = (Bytef)(s->level == 9 ? 2 : (s->strategy >= 2 || s->level < 2 ? 4 : 0));}
;
{s->pending_buf[s->pending++] = (Bytef)(3);};
s->status = 113;
flush_pending(strm);
if (s->pending != 0) {
s->last_flush = -1;
return 0;
}
}
else {
{s->pending_buf[s->pending++] = (Bytef)((s->gzhead->text ? 1 : 0) + (s->gzhead->hcrc ? 2 : 0) + (s->gzhead->extra == 0 ? 0 : 4) + (s->gzhead->name == 0 ? 0 : 8) + (s->gzhead->comment == 0 ? 0 : 16));}
;
{s->pending_buf[s->pending++] = (Bytef)((Byte)(s->gzhead->time & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)((s->gzhead->time >> 8) & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)((s->gzhead->time >> 16) & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)((s->gzhead->time >> 24) & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)(s->level == 9 ? 2 : (s->strategy >= 2 || s->level < 2 ? 4 : 0));}
;
{s->pending_buf[s->pending++] = (Bytef)(s->gzhead->os & 0xff);};
if (s->gzhead->extra != 0) {
{s->pending_buf[s->pending++] = (Bytef)(s->gzhead->extra_len & 0xff);};
{s->pending_buf[s->pending++] = (Bytef)((s->gzhead->extra_len >> 8) & 0xff);};
}
if (s->gzhead->hcrc)
strm->adler = crc32(strm->adler, s->pending_buf,
s->pending);
s->gzindex = 0;
s->status = 69;
}
}
if (s->status == 69) {
if (s->gzhead->extra != 0) {
ulg beg = s->pending;
uInt left = (s->gzhead->extra_len & 0xffff) - s->gzindex;
while (s->pending + left > s->pending_buf_size) {
uInt copy = s->pending_buf_size - s->pending;
memcpy(s->pending_buf + s->pending,
s->gzhead->extra + s->gzindex, copy);
s->pending = s->pending_buf_size;
do { if (s->gzhead->hcrc && s->pending > (beg)) strm->adler = crc32(strm->adler, s->pending_buf + (beg), s->pending - (beg)); } while (0);
s->gzindex += copy;
flush_pending(strm);
if (s->pending != 0) {
s->last_flush = -1;
return 0;
}
beg = 0;
left -= copy;
}
memcpy(s->pending_buf + s->pending,
s->gzhead->extra + s->gzindex, left);
s->pending += left;
do { if (s->gzhead->hcrc && s->pending > (beg)) strm->adler = crc32(strm->adler, s->pending_buf + (beg), s->pending - (beg)); } while (0);
s->gzindex = 0;
}
s->status = 73;
}
if (s->status == 73) {
if (s->gzhead->name != 0) {
ulg beg = s->pending;
int val;
do {
if (s->pending == s->pending_buf_size) {
do { if (s->gzhead->hcrc && s->pending > (beg)) strm->adler = crc32(strm->adler, s->pending_buf + (beg), s->pending - (beg)); } while (0);
flush_pending(strm);
if (s->pending != 0) {
s->last_flush = -1;
return 0;
}
beg = 0;
}
val = s->gzhead->name[s->gzindex++];
{s->pending_buf[s->pending++] = (Bytef)(val);};
} while (val != 0);
do { if (s->gzhead->hcrc && s->pending > (beg)) strm->adler = crc32(strm->adler, s->pending_buf + (beg), s->pending - (beg)); } while (0);
s->gzindex = 0;
}
s->status = 91;
}
if (s->status == 91) {
if (s->gzhead->comment != 0) {
ulg beg = s->pending;
int val;
do {
if (s->pending == s->pending_buf_size) {
do { if (s->gzhead->hcrc && s->pending > (beg)) strm->adler = crc32(strm->adler, s->pending_buf + (beg), s->pending - (beg)); } while (0);
flush_pending(strm);
if (s->pending != 0) {
s->last_flush = -1;
return 0;
}
beg = 0;
}
val = s->gzhead->comment[s->gzindex++];
{s->pending_buf[s->pending++] = (Bytef)(val);};
} while (val != 0);
do { if (s->gzhead->hcrc && s->pending > (beg)) strm->adler = crc32(strm->adler, s->pending_buf + (beg), s->pending - (beg)); } while (0);
}
s->status = 103;
}
if (s->status == 103) {
if (s->gzhead->hcrc) {
if (s->pending + 2 > s->pending_buf_size) {
flush_pending(strm);
if (s->pending != 0) {
s->last_flush = -1;
return 0;
}
}
{s->pending_buf[s->pending++] = (Bytef)((Byte)(strm->adler & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)((strm->adler >> 8) & 0xff));};
strm->adler = crc32(0L, 0, 0);
}
s->status = 113;
flush_pending(strm);
if (s->pending != 0) {
s->last_flush = -1;
return 0;
}
}
if (strm->avail_in != 0 || s->lookahead != 0 ||
(flush != 0 && s->status != 666)) {
block_state bstate;
bstate = s->level == 0 ? deflate_stored(s, flush) :
s->strategy == 2 ? deflate_huff(s, flush) :
s->strategy == 3 ? deflate_rle(s, flush) :
(*(configuration_table[s->level].func))(s, flush);
if (bstate == finish_started || bstate == finish_done) {
s->status = 666;
}
if (bstate == need_more || bstate == finish_started) {
if (strm->avail_out == 0) {
s->last_flush = -1;
}
return 0;
}
if (bstate == block_done) {
if (flush == 1) {
_tr_align(s);
} else if (flush != 5) {
_tr_stored_block(s, (char*)0, 0L, 0);
if (flush == 3) {
do { s->head[s->hash_size - 1] = 0; memset((Bytef *)s->head, 0, (unsigned)(s->hash_size - 1)*sizeof(*s->head)); } while (0);
if (s->lookahead == 0) {
s->strstart = 0;
s->block_start = 0L;
s->insert = 0;
}
}
}
flush_pending(strm);
if (strm->avail_out == 0) {
s->last_flush = -1;
return 0;
}
}
}
if (flush != 4) return 0;
if (s->wrap <= 0) return 1;
if (s->wrap == 2) {
{s->pending_buf[s->pending++] = (Bytef)((Byte)(strm->adler & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)((strm->adler >> 8) & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)((strm->adler >> 16) & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)((strm->adler >> 24) & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)(strm->total_in & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)((strm->total_in >> 8) & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)((strm->total_in >> 16) & 0xff));};
{s->pending_buf[s->pending++] = (Bytef)((Byte)((strm->total_in >> 24) & 0xff));};
}
else
{
putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff));
}
flush_pending(strm);
if (s->wrap > 0) s->wrap = -s->wrap;
return s->pending != 0 ? 0 : 1;
}
| int deflate(unsigned long long a0, unsigned long a1, unsigned long a2, unsigned long long a3) {
unsigned int v0;
int tmp_51;
int tmp_57;
int tmp_71;
int tmp_77;
int tmp_97;
int tmp_99;
int tmp_105;
int tmp_129;
int tmp_135;
int tmp_141;
int tmp_32;
int tmp_178;
int tmp_184;
int tmp_53;
int tmp_221;
int tmp_227;
int tmp_270;
int tmp_36;
int tmp_42;
int tmp_73;
int tmp_43;
int tmp_50;
int tmp_56;
int tmp_81;
int tmp_107;
int tmp_65;
int tmp_85;
int tmp_91;
int tmp_111;
int tmp_125;
int tmp_131;
int tmp_151;
int tmp_38;
int tmp_59;
int tmp_37;
int tmp_40;
int tmp_46;
int tmp_52;
int tmp_18;
int tmp_86;
int tmp_92;
int tmp_147;
int tmp_153;
int tmp_187;
int tmp_193;
int tmp_233;
int tmp_58;
int tmp_267;
int tmp_273;
int tmp_291;
int tmp_297;
int tmp_303;
int tmp_337;
int tmp_343;
int tmp_383;
unsigned long long v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
void* v9;
void* v10;
void* v11;
struct_0 *v12;
unsigned int v14;
unsigned long long v16;
char *v17;
char *v18;
unsigned long long v21;
char v23;
unsigned long v24;
char v25;
char *v26;
unsigned long long v27;
unsigned long long v28;
struct_2 *v29;
unsigned long long v30;
char *v33;
unsigned long long v34;
v1 = a0;
v0 = a1;
if (deflateStateCheck(v1)) {
v14 = -2;
return v14;
} else if (v0 > 5) {
v14 = -2;
return v14;
} else if (v0 < 0) {
v14 = -2;
return v14;
} else {
v12 = *((v1 + 56));
if (*((v1 + 24)) && (!*((v1 + 8)) || *(v1)) && (!(v12->field_8 == 666) || !(v0 != 4))) {
if (!*((v1 + 32))) {
*((v1 + 48)) = *(&_tr_align);
v14 = -5;
return v14;
}
v5 = v12->field_4c;
v16 = v0;
v12->field_4c = v0;
if (v12->field_28) {
flush_pending(v1, a1, v0, a3);
if (!*((v1 + 32))) {
v12->field_4c = -1;
v14 = 0;
return v14;
}
} else if (!*((v1 + 8))) {
v16 = v0 * 2 - (v0 <= 4 ? 9 : 0);
a3 = (v5 <= 4 ? 9 : 0);
if (v16 <= ((v5 << 1) - a3) && v0 != 4) {
*((v1 + 48)) = *(&_tr_align);
v14 = -5;
return v14;
}
}
if (v12->field_8 == 666 && *((v1 + 8))) {
*((v1 + 48)) = *(&_tr_align);
v14 = -5;
return v14;
}
if (v12->field_8 == 42 && !v12->field_30)
v12->field_8 = 113;
if (v12->field_8 == 42) {
v2 = (((v12->field_54 - 8) * 16) + 8) * 0x100;
if (v12->field_c8 > 1 || v12->field_c4 <= 1) {
v3 = 0;
} else if (v12->field_c4 <= 5) {
v3 = 1;
} else if (v12->field_c4 == 6) {
v3 = 2;
} else {
v3 = 3;
}
v2 |= (v3 * 64);
if (v12->field_ac)
v2 |= 32;
v2 = v2 - (v2 - (((v2 * 138547333 >> 32) + (v2 - (v2 * 138547333 >> 32) >> 1) >> 4) * 31)) + 31;
putShortMSB(v12, v2);
if (v12->field_ac) {
putShortMSB(v12, *((v1 + 96)) >> 16);
putShortMSB(v12, *((v1 + 96)));
}
*((v1 + 96)) = adler32(0x0, 0x0, 0x0, a3);
v12->field_8 = 113;
flush_pending(v1, 0x0, v1, a3);
if (v12->field_28) {
v12->field_4c = -1;
v14 = 0;
return v14;
}
}
if (v12->field_8 == 57) {
*((v1 + 96)) = crc32(0x0, 0x0, 0x0);
tmp_51 = v12->field_10;
tmp_57 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*((tmp_57 + tmp_51)) = 31;
tmp_71 = v12->field_10;
tmp_77 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*((tmp_77 + tmp_71)) = 139;
v17 = v12->field_10;
tmp_97 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
v17[tmp_97] = 8;
if (v12->field_38) {
v21 = (!v12->field_38->field_0 ? 1 : 0) + (!v12->field_38->field_44 ? 2 : 0);
v23 = v21 + (!v12->field_38->field_18 ? 4 : 0);
v14 = (!v12->field_38->field_28 ? 8 : 0);
v24 = (!v12->field_38->field_38 ? 16 : 0);
tmp_99 = v12->field_10;
tmp_105 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*((tmp_105 + tmp_99)) = v24 + v14 + v23;
tmp_129 = v12->field_38->field_8;
tmp_135 = v12->field_10;
tmp_141 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
v23 = tmp_129;
*((tmp_141 + tmp_135)) = v23;
tmp_32 = v12->field_38->field_8 >> 8;
tmp_178 = v12->field_10;
tmp_184 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
v23 = tmp_32;
*((tmp_184 + tmp_178)) = v23;
tmp_53 = v12->field_38->field_8 >> 16;
tmp_221 = v12->field_10;
tmp_227 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
v23 = tmp_53;
*((tmp_227 + tmp_221)) = v23;
v25 = v12->field_38->field_8 >> 24;
v26 = v12->field_10;
tmp_270 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
v26[tmp_270] = v25;
if (v12->field_c4 == 9) {
v23 = 2;
} else if (v12->field_c8 > 1 || v12->field_c4 <= 1) {
v23 = 4;
} else {
v23 = 0;
}
tmp_36 = v12->field_10;
tmp_42 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*((tmp_42 + tmp_36)) = v23;
v27 = v12->field_38->field_14;
a1 = v12->field_10;
tmp_73 = v12->field_28;
a3 = v12->field_28 + 1;
v12->field_28 = v12->field_28 + 1;
v16 = v27;
a1[tmp_73] = v16;
if (v12->field_38->field_18) {
tmp_43 = v12->field_38->field_20;
tmp_50 = v12->field_10;
tmp_56 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*(&v16) = tmp_43;
*((tmp_56 + tmp_50)) = v16;
tmp_81 = v12->field_38->field_20;
a1 = v12->field_10;
tmp_107 = v12->field_28;
a3 = v12->field_28 + 1;
v12->field_28 = v12->field_28 + 1;
v16 = tmp_81 >> 8;
a1[tmp_107] = v16;
}
if (v12->field_38->field_44) {
v16 = v1;
*((v1 + 96)) = crc32(*((v1 + 96)), v12->field_10, v12->field_28);
}
v12->field_40 = 0;
v12->field_8 = 69;
} else {
tmp_65 = v12->field_10;
tmp_71 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*((tmp_71 + tmp_65)) = 0;
tmp_85 = v12->field_10;
tmp_91 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*((tmp_91 + tmp_85)) = 0;
tmp_105 = v12->field_10;
tmp_111 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*((tmp_111 + tmp_105)) = 0;
tmp_125 = v12->field_10;
tmp_131 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*((tmp_131 + tmp_125)) = 0;
v18 = v12->field_10;
tmp_151 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
v18[tmp_151] = 0;
if (v12->field_c4 == 9) {
v16 = 2;
} else if (v12->field_c8 > 1 || v12->field_c4 <= 1) {
v16 = 4;
} else {
v16 = 0;
}
tmp_32 = v12->field_10;
tmp_38 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*((tmp_38 + tmp_32)) = v16;
a1 = v12->field_10;
tmp_59 = v12->field_28;
a3 = v12->field_28 + 1;
v12->field_28 = v12->field_28 + 1;
*((tmp_59 + a1)) = 3;
v12->field_8 = 113;
flush_pending(v1, a1, v12, a3);
if (v12->field_28) {
v12->field_4c = -1;
v14 = 0;
return v14;
}
}
}
if (v12->field_8 == 69) {
if (v12->field_38->field_18) {
v9 = v12->field_28;
for (v4 = v12->field_38->field_20 - v12->field_40; v12->field_28 + v4 > v12->field_18; v4 -= v6) {
v6 = v12->field_18 - v12->field_28;
memcpy(v12->field_10 + v12->field_28, v12->field_38->field_18 + v12->field_40, v6);
v12->field_28 = v12->field_18;
if (v12->field_38->field_44 && v9 < v12->field_28)
*((v1 + 96)) = crc32(*((v1 + 96)), v12->field_10 + v9, v12->field_28 - v9);
v28 = v12->field_40 + v6;
v12->field_40 = v12->field_40 + v6;
flush_pending(v1, a1, v28, a3);
if (v12->field_28) {
v12->field_4c = -1;
v14 = 0;
return v14;
}
v9 = 0;
}
memcpy(v12->field_10 + v12->field_28, v12->field_38->field_18 + v12->field_40, v4);
v16 = v12->field_28 + v4;
v12->field_28 = v12->field_28 + v4;
if (v12->field_38->field_44 && v9 < v12->field_28) {
v16 = v1;
*((v1 + 96)) = crc32(*((v1 + 96)), v12->field_10 + v9, v12->field_28 - v9);
}
v12->field_40 = 0;
}
v12->field_8 = 73;
}
if (v12->field_8 == 73) {
if (v12->field_38->field_28) {
v10 = v12->field_28;
do {
v29 = v12->field_28;
if (v12->field_28 == v12->field_18) {
if (v12->field_38->field_44 && v10 < v12->field_28) {
v29 = v1;
*((v1 + 96)) = crc32(*((v1 + 96)), v12->field_10 + v10, v12->field_28 - v10);
}
flush_pending(v1, a1, v29, a3);
if (v12->field_28) {
v12->field_4c = -1;
v14 = 0;
return v14;
}
v10 = 0;
}
} while ((tmp_37 = v12->field_38->field_28, tmp_43 = v12->field_40, v12->field_40 = v12->field_40 + 1, v14 = *((tmp_43 + tmp_37)), v7 = v14, a1 = v12->field_10, tmp_73 = v12->field_28, a3 = v12->field_28 + 1, v12->field_28 = v12->field_28 + 1, v16 = v7, a1[tmp_73] = v7, v7));
if (v12->field_38->field_44 && v10 < v12->field_28) {
v16 = v1;
*((v1 + 96)) = crc32(*((v1 + 96)), v12->field_10 + v10, v12->field_28 - v10);
}
v12->field_40 = 0;
}
v12->field_8 = 91;
}
if (v12->field_8 == 91) {
if (v12->field_38->field_38) {
v11 = v12->field_28;
do {
v30 = v12->field_28;
if (v12->field_28 == v12->field_18) {
if (v12->field_38->field_44 && v11 < v12->field_28) {
v30 = v1;
*((v1 + 96)) = crc32(*((v1 + 96)), v12->field_10 + v11, v12->field_28 - v11);
}
flush_pending(v1, a1, v30, a3);
if (v12->field_28) {
v12->field_4c = -1;
v14 = 0;
return v14;
}
v11 = 0;
}
} while ((tmp_37 = v12->field_38->field_28, tmp_43 = v12->field_40, v12->field_40 = v12->field_40 + 1, v14 = *((tmp_43 + tmp_37)), v7 = v14, a1 = v12->field_10, tmp_73 = v12->field_28, a3 = v12->field_28 + 1, v12->field_28 = v12->field_28 + 1, v16 = v7, a1[tmp_73] = v7, v7));
if (v12->field_38->field_44 && v11 < v12->field_28) {
v16 = v1;
*((v1 + 96)) = crc32(*((v1 + 96)), v12->field_10 + v11, v12->field_28 - v11);
}
}
v12->field_8 = 103;
}
if (v12->field_8 == 103) {
if (v12->field_38->field_44) {
if (v12->field_28 + 2 > v12->field_18) {
flush_pending(v1, a1, v12->field_28 + 2, a3);
if (v12->field_28) {
v12->field_4c = -1;
v14 = 0;
return v14;
}
}
tmp_40 = *((v1 + 96));
tmp_46 = v12->field_10;
tmp_52 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*(&v16) = tmp_40;
*((tmp_52 + tmp_46)) = v16;
tmp_18 = *((v1 + 96)) >> 8;
tmp_86 = v12->field_10;
tmp_92 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*(&v16) = tmp_18;
*((tmp_92 + tmp_86)) = v16;
v16 = v1;
*((v1 + 96)) = crc32(0x0, 0x0, 0x0);
}
v12->field_8 = 113;
flush_pending(v1, a1, v16, a3);
if (v12->field_28) {
v12->field_4c = -1;
v14 = 0;
return v14;
}
}
if (!*((v1 + 8)) && !v12->field_b4) {
if (!v0)
goto LABEL_4024a1;
if (v12->field_8 == 666)
goto LABEL_4024a1;
else
goto LABEL_4022cb;
}
LABEL_4022cb:
if (v12->field_c4) {
switch (v12->field_c8) {
case 2:
v14 = deflate_huff(v12, v0);
break;
case 3:
v14 = deflate_rle(v12, v0);
break;
default:
v14 = (&g_405d08)[2 * v12->field_c4](v12, v0, v0, (&g_405d08)[2 * v12->field_c4]);
}
} else {
v14 = deflate_stored(v12, v0);
}
v14 = v14;
if (v14 == 2 || v14 == 3)
v12->field_8 = 666;
switch (v14) {
case 0: case 2:
if (!*((v1 + 32))) {
v12->field_4c = -1;
break;
}
v14 = 0;
return v14;
case 1:
switch (v0) {
case 1:
_tr_align(v12);
break;
case 5:
break;
default:
_tr_stored_block(v12, 0x0, 0x0, 0x0);
if (v0 == 3) {
*(((v12->field_84 - 1) * 2 + v12->field_78)) = 0;
*(&a1) = 0;
memset(v12->field_78, 0x0, (v12->field_84 - 1) * 2);
if (!v12->field_b4) {
v12->field_ac = 0;
v12->field_98 = 0;
v12->field_172c = 0;
break;
}
}
}
flush_pending(v1, a1, v16, a3);
if (!*((v1 + 32))) {
v12->field_4c = -1;
v14 = 0;
return v14;
}
default:
LABEL_4024a1:
if (v0 != 4) {
v14 = 0;
return v14;
} else if (v12->field_30 > 0) {
if (v12->field_30 != 2) {
putShortMSB(v12, *((v1 + 96)) >> 16);
putShortMSB(v12, *((v1 + 96)));
} else {
tmp_141 = *((v1 + 96));
tmp_147 = v12->field_10;
tmp_153 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*(&v16) = tmp_141;
*((tmp_153 + tmp_147)) = v16;
tmp_18 = *((v1 + 96)) >> 8;
tmp_187 = v12->field_10;
tmp_193 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*(&v16) = tmp_18;
*((tmp_193 + tmp_187)) = v16;
tmp_38 = *((v1 + 96)) >> 16;
tmp_227 = v12->field_10;
tmp_233 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*(&v16) = tmp_38;
*((tmp_233 + tmp_227)) = v16;
tmp_58 = *((v1 + 96)) >> 24;
tmp_267 = v12->field_10;
tmp_273 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*(&v16) = tmp_58;
*((tmp_273 + tmp_267)) = v16;
tmp_291 = *((v1 + 16));
tmp_297 = v12->field_10;
tmp_303 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*(&v16) = tmp_291;
*((tmp_303 + tmp_297)) = v16;
tmp_91 = *((v1 + 16)) >> 8;
tmp_337 = v12->field_10;
tmp_343 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*(&v16) = tmp_91;
*((tmp_343 + tmp_337)) = v16;
tmp_111 = *((v1 + 16)) >> 16;
v33 = v12->field_10;
tmp_383 = v12->field_28;
v12->field_28 = v12->field_28 + 1;
*(&v16) = tmp_111;
v33[tmp_383] = v16;
v34 = *((v1 + 16)) >> 24;
a1 = v12->field_10;
tmp_18 = v12->field_28;
a3 = v12->field_28 + 1;
v12->field_28 = v12->field_28 + 1;
v16 = v34;
*((tmp_18 + a1)) = v16;
}
flush_pending(v1, a1, v16, a3);
if (v12->field_30 > 0)
v12->field_30 = -(v12->field_30);
v14 = !v12->field_28;
return v14;
} else {
v14 = 1;
return v14;
}
}
}
*((v1 + 48)) = crc32;
v14 = -2;
return v14;
}
}
|
static void
mux_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt)
{
struct mux_channel_confirm_ctx *fctx = ctxt;
char *failmsg =
((void *)0)
;
struct Forward *rfwd;
Channel *c;
struct sshbuf *out;
u_int port;
int r;
if ((c = channel_by_id(ssh, fctx->cid)) ==
((void *)0)
) {
sshlog("mux.c", __func__, 607, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "unknown channel");
return;
}
if ((out = sshbuf_new()) ==
((void *)0)
)
sshfatal("mux.c", __func__, 611, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new");
if (fctx->fid >= options.num_remote_forwards ||
(options.remote_forwards[fctx->fid].connect_path ==
((void *)0)
&&
options.remote_forwards[fctx->fid].connect_host ==
((void *)0)
)) {
xasprintf(&failmsg, "unknown forwarding id %d", fctx->fid);
goto fail;
}
rfwd = &options.remote_forwards[fctx->fid];
sshlog("mux.c", __func__, 619, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "%s for: listen %d, connect %s:%d", type == 81 ? "success" : "failure", rfwd->listen_port, rfwd->connect_path ? rfwd->connect_path : rfwd->connect_host, rfwd->connect_port)
;
if (type == 81) {
if (rfwd->listen_port == 0) {
if ((r = sshpkt_get_u32(ssh, &port)) != 0)
sshfatal("mux.c", __func__, 626, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse port");
if (port > 65535) {
sshfatal("mux.c", __func__, 628, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Invalid allocated port %u for " "mux remote forward to %s:%d", port, rfwd->connect_host, rfwd->connect_port)
;
}
rfwd->allocated_port = (int)port;
sshlog("mux.c", __func__, 633, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "Allocated port %u for mux remote forward" " to %s:%d", rfwd->allocated_port, rfwd->connect_host, rfwd->connect_port)
;
if ((r = sshbuf_put_u32(out,
0x80000007)) != 0 ||
(r = sshbuf_put_u32(out, fctx->rid)) != 0 ||
(r = sshbuf_put_u32(out,
rfwd->allocated_port)) != 0)
sshfatal("mux.c", __func__, 641, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "reply");
channel_update_permission(ssh, rfwd->handle,
rfwd->allocated_port);
} else {
reply_ok(out, fctx->rid);
}
goto out;
} else {
if (rfwd->listen_port == 0)
channel_update_permission(ssh, rfwd->handle, -1);
if (rfwd->listen_path !=
((void *)0)
)
xasprintf(&failmsg, "remote port forwarding failed for "
"listen path %s", rfwd->listen_path);
else
xasprintf(&failmsg, "remote port forwarding failed for "
"listen port %d", rfwd->listen_port);
sshlog("mux.c", __func__, 658, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "clearing registered forwarding for listen %d, " "connect %s:%d", rfwd->listen_port, rfwd->connect_path ? rfwd->connect_path : rfwd->connect_host, rfwd->connect_port)
;
free(rfwd->listen_host);
free(rfwd->listen_path);
free(rfwd->connect_host);
free(rfwd->connect_path);
memset(rfwd, 0, sizeof(*rfwd));
}
fail:
sshlog("mux.c", __func__, 670, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "%s", failmsg);
reply_error(out, 0x80000003, fctx->rid, failmsg);
free(failmsg);
out:
if ((r = sshbuf_put_stringb(c->output, out)) != 0)
sshfatal("mux.c", __func__, 675, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "enqueue");
sshbuf_free(out);
if (c->mux_pause <= 0)
sshfatal("mux.c", __func__, 678, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "mux_pause %d", c->mux_pause);
c->mux_pause = 0;
}
| unsigned long mux_confirm_remote_forward(long a1, int a2, long a3, unsigned int *a4)
{
const char *v4;
const char *v5;
long v6;
long v7;
const char *v8;
long v9;
unsigned int v11;
unsigned int u32;
void *ptr;
unsigned int *v14;
long v15;
long v16;
void *s;
unsigned long v18;
v18 = __readfsqword(0x28u);
v14 = a4;
ptr = 0LL;
v15 = channel_by_id(a1, *a4);
if ( !v15 )
{
sshlog("mux.c", "mux_confirm_remote_forward", 607LL, 1LL, 2LL, 0LL, "unknown channel");
return __readfsqword(0x28u) ^ v18;
}
v16 = sshbuf_new();
if ( !v16 )
sshfatal("mux.c", "mux_confirm_remote_forward", 611LL, 1LL, 1LL, 0LL, "sshbuf_new");
if ( (signed int)v14[2] < options[1212]
&& (*(_QWORD *)(*(_QWORD *)&options[1214] + 56LL * (int)v14[2] + 40)
|| *(_QWORD *)(*(_QWORD *)&options[1214] + 56LL * (int)v14[2] + 24)) )
{
s = (void *)(*(_QWORD *)&options[1214] + 56LL * (int)v14[2]);
if ( *((_QWORD *)s + 5) )
v4 = (const char *)*((_QWORD *)s + 5);
else
v4 = (const char *)*((_QWORD *)s + 3);
if ( a2 == 81 )
v5 = "success";
else
v5 = "failure";
sshlog(
"mux.c",
"mux_confirm_remote_forward",
619LL,
1LL,
5LL,
0LL,
"%s for: listen %d, connect %s:%d",
v5,
*((unsigned int *)s + 2),
v4,
*((unsigned int *)s + 8));
if ( a2 == 81 )
{
if ( *((_DWORD *)s + 2) )
{
reply_ok(v16, v14[1]);
}
else
{
u32 = sshpkt_get_u32(a1, &v11);
if ( u32 )
{
v6 = ssh_err(u32);
sshfatal("mux.c", "mux_confirm_remote_forward", 626LL, 1LL, 1LL, v6, "parse port");
}
if ( v11 > 0xFFFF )
sshfatal(
"mux.c",
"mux_confirm_remote_forward",
628LL,
0LL,
1LL,
0LL,
"Invalid allocated port %u for mux remote forward to %s:%d",
v11,
*((const char **)s + 3),
*((unsigned int *)s + 8));
*((_DWORD *)s + 12) = v11;
sshlog(
"mux.c",
"mux_confirm_remote_forward",
633LL,
0LL,
5LL,
0LL,
"Allocated port %u for mux remote forward to %s:%d",
*((unsigned int *)s + 12),
*((const char **)s + 3),
*((unsigned int *)s + 8));
u32 = sshbuf_put_u32(v16, 2147483655LL);
if ( u32
|| (u32 = sshbuf_put_u32(v16, v14[1])) != 0
|| (u32 = sshbuf_put_u32(v16, *((unsigned int *)s + 12))) != 0 )
{
v7 = ssh_err(u32);
sshfatal("mux.c", "mux_confirm_remote_forward", 641LL, 1LL, 1LL, v7, "reply");
}
channel_update_permission(a1, *((unsigned int *)s + 13), *((unsigned int *)s + 12));
}
goto LABEL_37;
}
if ( !*((_DWORD *)s + 2) )
channel_update_permission(a1, *((unsigned int *)s + 13), 0xFFFFFFFFLL);
if ( *((_QWORD *)s + 2) )
xasprintf(&ptr, "remote port forwarding failed for listen path %s", *((const char **)s + 2));
else
xasprintf(&ptr, "remote port forwarding failed for listen port %d", *((unsigned int *)s + 2));
if ( *((_QWORD *)s + 5) )
v8 = (const char *)*((_QWORD *)s + 5);
else
v8 = (const char *)*((_QWORD *)s + 3);
sshlog(
"mux.c",
"mux_confirm_remote_forward",
658LL,
1LL,
6LL,
0LL,
"clearing registered forwarding for listen %d, connect %s:%d",
*((unsigned int *)s + 2),
v8,
*((unsigned int *)s + 8));
free(*(void **)s);
free(*((void **)s + 2));
free(*((void **)s + 3));
free(*((void **)s + 5));
memset(s, 0, 0x38uLL);
}
else
{
xasprintf(&ptr, "unknown forwarding id %d", v14[2]);
}
sshlog("mux.c", "mux_confirm_remote_forward", 670LL, 1LL, 2LL, 0LL, "%s", (const char *)ptr);
reply_error(v16, 0x80000003, v14[1], (long)ptr);
free(ptr);
LABEL_37:
u32 = sshbuf_put_stringb(*(_QWORD *)(v15 + 112), v16);
if ( u32 )
{
v9 = ssh_err(u32);
sshfatal("mux.c", "mux_confirm_remote_forward", 675LL, 1LL, 1LL, v9, "enqueue");
}
sshbuf_free(v16);
if ( *(int *)(v15 + 344) <= 0 )
sshfatal("mux.c", "mux_confirm_remote_forward", 678LL, 1LL, 1LL, 0LL, "mux_pause %d", *(unsigned int *)(v15 + 344));
*(_DWORD *)(v15 + 344) = 0;
return __readfsqword(0x28u) ^ v18;
}
|
static struct argp_option const *
find_argp_option (struct argp *ap, int key)
{
struct argp_option const *p =
((void *)0)
;
struct argp_child const *child;
p = find_argp_option_key (ap->options, key);
if (!p && ap->children)
{
for (child = ap->children; child->argp; child++)
{
p = find_argp_option_key (child->argp->options, key);
if (p)
break;
}
}
return p;
}
| int find_argp_option(unsigned long long a0[5], unsigned long a1) {
unsigned long v0;
unsigned long long **v1;
v0 = 0;
v0 = find_argp_option_key(a0[0], a1);
if (!v0 && a0[4]) {
v1 = a0[4];
while (true) {
if (!*(v1))
break;
v0 = find_argp_option_key(*(*(v1)), a1);
if (v0)
break;
v1 += 4;
}
}
return v0;
}
|
void mark_buffer_dirty(struct buffer_head *bh)
{
bh->b_dirty = 1;
}
| long mark_buffer_dirty(long a1)
{
long result;
result = a1;
*(_BYTE *)(a1 + 24) |= 1u;
return result;
}
|
static int
cmp_btime (struct fileinfo const *a, struct fileinfo const *b,
int (*cmp) (char const *, char const *))
{
int diff = timespec_cmp (get_stat_btime (&b->stat),
get_stat_btime (&a->stat));
return diff ? diff : cmp (a->name, b->name);
}
| ulong cmp_btime(undefined8 *param_1,undefined8 *param_2,code *param_3)
{
uint uVar1;
ulong uVar2;
undefined auVar3 [16];
undefined auVar4 [16];
auVar3 = get_stat_btime(param_1 + 3);
auVar4 = get_stat_btime(param_2 + 3);
uVar1 = timespec_cmp(SUB168(auVar4,0),SUB168(auVar4 >> 0x40,0),SUB168(auVar3,0),
SUB168(auVar3 >> 0x40,0));
if (uVar1 == 0) {
uVar2 = (*param_3)(*param_1,*param_2);
}
else {
uVar2 = (ulong)uVar1;
}
return uVar2;
}
|
static inline void
duinfo_init (struct duinfo *a)
{
a->size = 0;
a->inodes = 0;
a->tmax.tv_sec = ((time_t) ~ ((time_t) (! (! ((time_t) 0 < (time_t) -1)) ? (time_t) -1 : ((((time_t) 1 << ((sizeof (time_t) * 8) - 2)) - 1) * 2 + 1))));
a->tmax.tv_nsec = -1;
}
| void duinfo_init(unsigned long long a0[4]) {
char v0;
unsigned long long v2[4];
unsigned long long v3;
a0[0] = 0;
a0[1] = 0;
a0[2] = 0x8000000000000000;
v2 = a0;
a0[3] = -1;
v3 = *(&v0);
return;
}
|
char *
cond_expand_word (w, special)
WORD_DESC *w;
int special;
{
char *r, *p;
WORD_LIST *l;
int qflags;
if (w->word == 0 || w->word[0] == '\0')
return ((char *)
((void *)0)
);
expand_no_split_dollar_star = 1;
w->flags |= (1 << 6);
qflags = (special == 3) ? 0x100 : 0;
l = call_expand_word_internal (w, qflags, 0, (int *)0, (int *)0);
expand_no_split_dollar_star = 0;
if (l)
{
if (special == 0)
{
if (l->word)
word_list_remove_quoted_nulls (l);
dequote_list (l);
r = string_list (l);
}
else if (special == 3)
{
if (l->word)
word_list_remove_quoted_nulls (l);
dequote_list (l);
r = string_list (l);
}
else
{
qflags = 0x01|0x08;
if (special == 2)
qflags |= 0x04;
word_list_remove_quoted_nulls (l);
p = string_list (l);
r = quote_string_for_globbing (p, qflags);
sh_xfree((p), "subst.c", 4148);
}
dispose_words (l);
}
else
r = (char *)
((void *)0)
;
return r;
}
| long long cond_expand_word(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned long v1;
struct_2 *v2;
unsigned long long v3;
void* v5;
if (!a0->field_0) {
v5 = 0;
return v5;
} else if (!a0->field_0->field_0) {
v5 = 0;
return v5;
} else {
expand_no_split_dollar_star = 1;
a0->field_8 = a0->field_8 | 64;
v0 = (a1 == 3 ? 0 : 0x100);
v2 = call_expand_word_internal(a0, v0, 0x0, 0x0, 0x0);
expand_no_split_dollar_star = 0;
if (!v2) {
v1 = 0;
} else {
if (!a1) {
if (v2->field_8)
word_list_remove_quoted_nulls(v2);
dequote_list(v2);
v1 = string_list(v2);
} else if (a1 != 3) {
v0 = 9;
if (a1 == 2)
v0 |= 4;
word_list_remove_quoted_nulls(v2);
v3 = string_list(v2);
v1 = quote_string_for_globbing(v3, v0, v0);
sh_xfree(v3, "subst.c", 0x1034);
} else {
if (v2->field_8)
word_list_remove_quoted_nulls(v2);
dequote_list(v2);
v1 = string_list(v2);
}
dispose_words(v2);
}
v5 = v1;
return v5;
}
}
|
int
internal_wstrmatch (pattern, string, flags)
wchar_t *pattern;
wchar_t *string;
int flags;
{
wchar_t *se, *pe;
if (string == 0 || pattern == 0)
return 1;
se = string + wcslen((wchar_t *)string);
pe = pattern + wcslen((wchar_t *)pattern);
return (gmatch_wc (string, se, pattern, pe, (struct wcsmat_struct *)
((void *)0)
, flags));
}
| int internal_wstrmatch(unsigned short *a0, unsigned short *a1, unsigned long a2) {
unsigned long long v0;
unsigned long long v1;
unsigned int v3;
if (!a1) {
v3 = 1;
return v3;
} else if (!a0) {
v3 = 1;
return v3;
} else {
v0 = &a1[2 * wcslen(a1)];
v1 = &a0[2 * wcslen(a0)];
v3 = gmatch_wc(a1, v0, a0, v1, 0x0, a2);
return v3;
}
}
|
static int
ipstats_req_add_filters(struct ipstats_req *req, void *data)
{
struct ipstats_stat_dump_filters dump_filters = {};
struct ipstats_stat_enabled *enabled = data;
_Bool
get_filters =
0
;
int i;
for (i = 0; i < enabled->nenabled; i++)
enabled->enabled[i].desc->pack(&dump_filters,
enabled->enabled[i].desc);
for (i = 1; i < (sizeof(dump_filters.mask) / sizeof((dump_filters.mask)[0])); i++) {
if (ipstats_req_should_filter_at(&dump_filters, i)) {
get_filters =
1
;
break;
}
}
req->ifsm.filter_mask = dump_filters.mask[0];
if (get_filters) {
struct rtattr *nest;
nest = addattr_nest(&req->nlh, sizeof(*req),
IFLA_STATS_GET_FILTERS | (1 << 15));
for (i = 1; i < (sizeof(dump_filters.mask) / sizeof((dump_filters.mask)[0])); i++) {
if (ipstats_req_should_filter_at(&dump_filters, i))
addattr32(&req->nlh, sizeof(*req), i,
dump_filters.mask[i]);
}
addattr_nest_end(&req->nlh, nest);
}
return 0;
}
| void ipstats_req_add_filters(struct_1 *a0, unsigned long long a1[2]) {
char v0;
unsigned int v1;
unsigned long long v2;
void* v3;
void* v4;
void* v5;
void* v7;
v3 = 0;
v4 = 0;
v5 = 0;
v0 = 0;
for (v1 = 0; v1 < a1[1]; v1 += 1) {
*((*((a1[0] + v1 * 32)) + 16))(&v3, *((a1[0] + v1 * 32)), *((a1[0] + v1 * 32)), *((*((a1[0] + v1 * 32)) + 16)));
}
v1 = 1;
while (true) {
if (v1 > 5)
break;
if (!ipstats_req_should_filter_at(&v3, v1)) {
v1 += 1;
} else {
v0 = 1;
break;
}
}
a0->field_18 = v3;
if (v0) {
v2 = addattr_nest(a0, 0x9c, 0x8001);
for (v1 = 1; v1 <= 5; v1 += 1) {
if (ipstats_req_should_filter_at(&v3, v1))
addattr32(a0, 0x9c, v1, *((&v3 + 4 * v1)));
}
addattr_nest_end(a0, v2, v2);
}
v7 = 0;
return;
}
|
static
_Bool
contains_encoding_error (char const *pat, idx_t patlen)
{
mbstate_t mbs = { 0 };
ptrdiff_t charlen;
for (idx_t i = 0; i < patlen; i += charlen)
{
charlen = mb_clen (pat + i, patlen - i, &mbs);
if (charlen < 0)
return
1
;
}
return
0
;
}
| undefined8 contains_encoding_error(long param_1,long param_2)
{
long lVar1;
undefined8 uVar2;
long in_FS_OFFSET;
long local_28;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = 0;
local_28 = 0;
do {
if (param_2 <= local_28) {
uVar2 = 0;
LAB_0010386b:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
}
lVar1 = mb_clen(local_28 + param_1,param_2 - local_28,&local_18);
if (lVar1 < 0) {
uVar2 = 1;
goto LAB_0010386b;
}
local_28 = local_28 + lVar1;
} while( true );
}
|
static const char *
idname_lookup(struct idname_tree *tree, u_int id)
{
struct idname idname, *found;
memset(&idname, 0, sizeof(idname));
idname.id = id;
if ((found = idname_tree_RB_FIND(tree, &idname)) !=
((void *)0)
)
return found->name;
return
((void *)0)
;
}
| void idname_lookup(unsigned long long *a0, unsigned long a1) {
struct_0 *v0;
unsigned int v1;
unsigned long v3;
memset(&v1, 0x0, 0x30);
v1 = a1;
v0 = idname_tree_RB_FIND(a0, &v1);
v3 = (!v0 ? v0->field_8 : 0);
return;
}
|
void
usage (int status)
{
if (status !=
0
)
do { fprintf (
stderr
, gettext ("Try '%s --help' for more information.\n"), program_name); } while (0);
else
{
printf (gettext ("Usage: %s [OPTION]... [ FILE | ARG1 ARG2 ]\n"), program_name);
fputs_unlocked (gettext ("Print information about users who are currently logged in.\n"),
stdout
)
;
fputs_unlocked (gettext ("\n -a, --all same as -b -d --login -p -r -t -T -u\n -b, --boot time of last system boot\n -d, --dead print dead processes\n -H, --heading print line of column headings\n"),
stdout
)
;
fputs_unlocked (gettext (" -l, --login print system login processes\n"),
stdout
)
;
fputs_unlocked (gettext (" --lookup attempt to canonicalize hostnames via DNS\n -m only hostname and user associated with stdin\n -p, --process print active processes spawned by init\n"),
stdout
)
;
fputs_unlocked (gettext (" -q, --count all login names and number of users logged on\n -r, --runlevel print current runlevel\n -s, --short print only name, line, and time (default)\n -t, --time print last system clock change\n"),
stdout
)
;
fputs_unlocked (gettext (" -T, -w, --mesg add user's message status as +, - or ?\n -u, --users list users logged in\n --message same as -T\n --writable same as -T\n"),
stdout
)
;
fputs_unlocked (gettext (" --help display this help and exit\n"),
stdout
);
fputs_unlocked (gettext (" --version output version information and exit\n"),
stdout
);
printf (gettext ("\nIf FILE is not specified, use %s. %s as FILE is common.\nIf ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual.\n")
,
"/var/run/utmp"
,
"/var/log/wtmp"
);
emit_ancillary_info ("who");
}
exit (status);
}
| void usage(unsigned long a0) {
unsigned long v0;
unsigned long v2;
v0 = v2;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s [OPTION]... [ FILE | ARG1 ARG2 ]\n"));
fputs_unlocked(gettext("Print information about users who are currently logged in.\n"), stdout);
fputs_unlocked(gettext("\n -a, --all same as -b -d --login -p -r -t -T -u\n -b, --boot time of last system boot\n -d, --dead print dead processes\n -H, --heading print line of column headings\n"), stdout);
fputs_unlocked(gettext(" -l, --login print system login processes\n"), stdout);
fputs_unlocked(gettext(" --lookup attempt to canonicalize hostnames via DNS\n -m only hostname and user associated with stdin\n -p, --process print active processes spawned by init\n"), stdout);
fputs_unlocked(gettext(" -q, --count all login names and number of users logged on\n -r, --runlevel print current runlevel\n -s, --short print only name, line, and time (default)\n -t, --time print last system clock change\n"), stdout);
fputs_unlocked(gettext(" -T, -w, --mesg add user's message status as +, - or ?\n -u, --users list users logged in\n --message same as -T\n --writable same as -T\n"), stdout);
fputs_unlocked(gettext(" --help display this help and exit\n"), stdout);
fputs_unlocked(gettext(" --version output version information and exit\n"), stdout);
printf(gettext("\nIf FILE is not specified, use %s. %s as FILE is common.\nIf ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual.\n"));
emit_ancillary_info("who");
}
exit(a0);
}
|
static CASE_COM *
copy_case_command (com)
CASE_COM *com;
{
CASE_COM *new_case;
new_case = (CASE_COM *)sh_xmalloc((sizeof (CASE_COM)), "copy_cmd.c", 255);
new_case->flags = com->flags;
new_case->line = com->line;
new_case->word = copy_word (com->word);
new_case->clauses = copy_case_clauses (com->clauses);
return (new_case);
}
| int copy_case_command(struct_0 *a0) {
struct_0 *v0;
v0 = sh_xmalloc(0x18, "copy_cmd.c", 0xff);
v0->field_0 = a0->field_0;
v0->field_4 = a0->field_4;
v0->field_8 = copy_word(a0->field_8);
v0->field_10 = copy_case_clauses(a0->field_10);
return v0;
}
|
_Bool
parse_closeparen (const struct parser_table* entry, char **argv, int *arg_ptr)
{
struct predicate *our_pred;
(void) argv;
(void) arg_ptr;
our_pred = get_new_pred_noarg (entry);
our_pred->pred_func = pred_closeparen;
our_pred->p_type = CLOSE_PAREN;
our_pred->p_prec = NO_PREC;
our_pred->need_stat = our_pred->need_type =
0
;
return
1
;
}
| void parse_closeparen(undefined8 param_1)
{
get_new_pred_noarg(param_1);
}
|
void
maybe_add_key_to_agent(const char *authfile, struct sshkey *private,
const char *comment, const char *passphrase)
{
int auth_sock = -1, r;
const char *skprovider =
((void *)0)
;
if (options.add_keys_to_agent == 0)
return;
if ((r = ssh_get_authentication_socket(&auth_sock)) != 0) {
sshlog("sshconnect.c", __func__, 1688, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "no authentication agent, not adding key");
return;
}
if (options.add_keys_to_agent == 2 &&
!ask_permission("Add key %s (%s) to agent?", authfile, comment)) {
sshlog("sshconnect.c", __func__, 1694, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "user denied adding this key");
close(auth_sock);
return;
}
if (sshkey_is_sk(private))
skprovider = options.sk_provider;
if ((r = ssh_add_identity_constrained(auth_sock, private,
comment ==
((void *)0)
? authfile : comment,
options.add_keys_to_agent_lifespan,
(options.add_keys_to_agent == 3), 0, skprovider,
((void *)0)
, 0)) == 0)
sshlog("sshconnect.c", __func__, 1704, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "identity added to agent: %s", authfile);
else
sshlog("sshconnect.c", __func__, 1706, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "could not add identity to agent: %s (%d)", authfile, r);
close(auth_sock);
}
| long long maybe_add_key_to_agent(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long a3) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned int v3;
unsigned int v4;
unsigned long v5;
v2 = a3;
v3 = -1;
v5 = 0;
if (!*(5247696))
return 0;
v4 = ssh_get_authentication_socket(&v3);
if (v4) {
sshlog("sshconnect.c", "maybe_add_key_to_agent", 0x698, 0x0, 0x7, 0x0, "no authentication agent, not adding key");
return 0;
}
if (*(5247696) == 2 && !ask_permission("Add key %s (%s) to agent?", a0, a2)) {
sshlog("sshconnect.c", "maybe_add_key_to_agent", 0x69e, 0x0, 0x7, 0x0, "user denied adding this key");
close(v3);
return 0;
}
if (sshkey_is_sk(a1))
v5 = *(5243672);
v0 = 0;
v4 = ssh_add_identity_constrained(v3, a1, (!a2 ? a2 : a0));
if (v4) {
v0 = a0;
sshlog("sshconnect.c", "maybe_add_key_to_agent", 0x6aa, 0x0, 0x5, 0x0, "could not add identity to agent: %s (%d)");
} else {
v1 = a0;
sshlog("sshconnect.c", "maybe_add_key_to_agent", 0x6a8, 0x0, 0x5, 0x0, "identity added to agent: %s");
}
close(v3);
return 0;
}
|
int
read_config_file(const char *filename, struct passwd *pw, const char *host,
const char *original_host, Options *options, int flags,
int *want_final_pass)
{
int active = 1;
return read_config_file_depth(filename, pw, host, original_host,
options, flags, &active, want_final_pass, 0);
}
| long long read_config_file(unsigned int a0, unsigned long long a1, void* a2, unsigned long long a3, void* a4, unsigned long a5, unsigned int v2) {
unsigned int v0;
unsigned int v1;
*(&v0) = *(&v2);
v1 = 1;
return read_config_file_depth(a0, a1, a2, a3, a4, a5, &v1, *(&v0), 0x0);
}
|
static void
proc_footer (void)
{
current_type = footer_type;
current_regex = &footer_regex;
reset_lineno ();
putchar_unlocked ('\n');
}
| void proc_footer() {
unsigned long long v1;
current_type = footer_type;
current_regex = &footer_regex;
reset_lineno();
v1 = putchar_unlocked(0xa);
return;
}
|
void
exitreset() {
{
if (savestatus >= 0) {
if (exception == 4 || evalskip == (1 << 3))
exitstatus = savestatus;
savestatus = -1;
}
evalskip = 0;
loopnest = 0;
inps4 = 0;
}
{
ifsfree();
}
{
unwindredir(0);
}
}
| long long exitreset() {
if (savestatus >= 0) {
if (exception == 4 || evalskip == 8)
exitstatus = savestatus;
savestatus = -1;
}
evalskip = 0;
loopnest = 0;
inps4 = 0;
ifsfree();
return unwindredir(0x0);
}
|
) { *ppData =
((void *)0)
; return RS_RET_OUT_OF_MEMORY; }
| long long createWrkrInstance(unsigned long long *a0, unsigned long a1) {
unsigned int v0;
unsigned long long *v1;
unsigned long long v3;
v0 = 0;
v1 = calloc(0x1, 0x8);
if (!v1) {
*(a0) = 0;
v3 = 4294967290;
} else {
*(v1) = a1;
*(a0) = v1;
v3 = v0;
}
return v3;
}
|
union node *
parsecmd(int interact)
{
tokpushback = 0;
checkkwd = 0;
heredoclist = 0;
doprompt = interact;
if (doprompt)
setprompt(doprompt);
needprompt = 0;
return list(1);
}
| long long parsecmd(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
quoteflag = 0;
quoteflag = 0;
heredoc = 0;
quoteflag = a0;
setprompt(0xf87d894810ec8348);
quoteflag = 0;
return list(0x1, a1, a2, a3, a4, a5);
}
|
static inline char *scratchbuf_str(struct scratchbuf *buf)
{
return buf->bytes;
}
| undefined8 scratchbuf_str(undefined8 *param_1)
{
return *param_1;
}
|
int inflateSetDictionary(strm, dictionary, dictLength)
z_streamp strm;
const Bytef *dictionary;
uInt dictLength;
{
struct inflate_state *state;
unsigned long dictid;
int ret;
if (inflateStateCheck(strm)) return (-2);
state = (struct inflate_state *)strm->state;
if (state->wrap != 0 && state->mode != DICT)
return (-2);
if (state->mode == DICT) {
dictid = adler32(0L, 0, 0);
dictid = adler32(dictid, dictionary, dictLength);
if (dictid != state->check)
return (-3);
}
ret = updatewindow(strm, dictionary + dictLength, dictLength);
if (ret) {
state->mode = MEM;
return (-4);
}
state->havedict = 1;
;
return 0;
}
| long long inflateSetDictionary(struct_0 *a0, unsigned long long a1, unsigned long a2, unsigned long long a3) {
unsigned int v0;
struct_1 *v1;
unsigned long long v2;
unsigned long long v4;
if (inflateStateCheck(a0)) {
v4 = 4294967294;
return v4;
}
v1 = a0->field_38;
if (v1->field_10 && v1->field_8 != 16190) {
v4 = 4294967294;
return v4;
}
if (v1->field_8 == 16190) {
v2 = adler32(0x0, 0x0, 0x0, a3);
v2 = adler32(v2, a1, a2, a1);
if (v2 != v1->field_20) {
v4 = 4294967293;
return v4;
}
}
v0 = updatewindow(a0, a2 + a1, a2);
if (v0) {
v1->field_8 = 16210;
v4 = 0xfffffffc;
return v4;
}
v1->field_14 = 1;
v4 = 0;
return v4;
}
|
void dh_set_moduli_file(const char *filename)
{
moduli_filename = filename;
}
| long long dh_set_moduli_file(unsigned long long a0) {
moduli_filename = a0;
return a0;
}
|
char *
ansic_quote (str, flags, rlen)
char *str;
int flags, *rlen;
{
char *r, *ret, *s;
int l, rsize;
unsigned char c;
size_t clen;
int b;
wchar_t wc;
if (str == 0 || *str == 0)
return ((char *)0);
l = strlen (str);
rsize = 4 * l + 4;
r = ret = (char *)sh_xmalloc((rsize), "strtrans.c", 248);
*r++ = '$';
*r++ = '\'';
for (s = str; c = *s; s++)
{
b = l = 1;
clen = 1;
switch (c)
{
case '\033': c = 'E'; break;
case '\a': c = 'a'; break;
case '\v': c = 'v'; break;
case '\b': c = 'b'; break;
case '\f': c = 'f'; break;
case '\n': c = 'n'; break;
case '\r': c = 'r'; break;
case '\t': c = 't'; break;
case '\\':
case '\'':
break;
default:
b = is_basic (c);
if ((b == 0 && ((clen = mbrtowc (&wc, s,
(__ctype_get_mb_cur_max ())
, 0)) < 0 || ((clen) == (size_t)-1 || (clen) == (size_t)-2) || iswprint (wc) == 0)) ||
(b == 1 && (1 &&
((*__ctype_b_loc ())[(int) ((
(unsigned char)c
))] & (unsigned short int) _ISprint)
) == 0))
{
*r++ = '\\';
*r++ = (((c >> 6) & 07) + '0');
*r++ = (((c >> 3) & 07) + '0');
*r++ = ((c & 07) + '0');
continue;
}
l = 0;
break;
}
if (b == 0 && clen == 0)
break;
if (l)
*r++ = '\\';
if (clen == 1)
*r++ = c;
else
{
for (b = 0; b < (int)clen; b++)
*r++ = (unsigned char)s[b];
s += clen - 1;
}
}
*r++ = '\'';
*r = '\0';
if (rlen)
*rlen = r - ret;
return ret;
}
| long long ansic_quote(char *a0, unsigned long a1, unsigned int *a2) {
unsigned int v0;
int tmp_24;
int tmp_32;
int tmp_44;
int tmp_72;
int tmp_108;
int tmp_133;
int tmp_12;
char v1;
char v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
char *v6;
char *v7;
unsigned long long v8;
unsigned long long v9;
void* v11;
unsigned long long v12;
char *v13;
char *v14;
char *v15;
v0 = a1;
if (a0 && *(a0)) {
v3 = strlen(a0);
v5 = (v3 + 1) * 4;
v9 = sh_xmalloc(v5, "strtrans.c", 0xf8);
v6 = v9;
tmp_24 = v6;
v6 += 1;
*(tmp_24) = 36;
tmp_32 = v6;
v6 += 1;
*(tmp_32) = 39;
v7 = a0;
while (true) {
v1 = *(v7);
if (!v1)
break;
v3 = 1;
v4 = v3;
v8 = 1;
if (v1 <= 39 && v1 >= 7) {
switch (v1) {
case 7:
v1 = 97;
break;
case 8:
v1 = 98;
break;
case 9:
v1 = 116;
break;
case 10:
v1 = 110;
break;
case 11:
v1 = 118;
break;
case 12:
v1 = 102;
break;
if (v8) {
if (v3) {
v13 = v6;
v6 += 1;
*(v13) = 92;
}
if (v8 == 1) {
v14 = v6;
v6 += 1;
*(v14) = v1;
} else {
for (v4 = 0; v4 < v8; v4 += 1) {
v15 = v6;
v6 += 1;
*(v15) = v7[v4];
}
v7 = &v7[1 + v8];
}
}
case 13:
v1 = 114;
break;
case 27:
v1 = 69;
break;
case 39:
break;
default:
v4 = is_basic(v1);
}
}
if (!v4) {
v8 = mbrtowc(&v2, v7, __ctype_get_mb_cur_max(), 0x0);
if (v8 != -1 && v8 != -2)
v12 = iswprint(*(&v2));
if (v8 == -1 || v8 == -2) {
tmp_44 = v6;
v6 += 1;
*(tmp_44) = 92;
tmp_72 = v6;
v6 += 1;
*(tmp_72) = (v1 >> 6) + 48;
tmp_108 = v6;
v6 += 1;
*(tmp_108) = ((v1 >> 3) & 7) + 48;
tmp_133 = v6;
v6 += 1;
*(tmp_133) = (v1 & 7) + 48;
}
} else if (v4 != 1) {
v3 = 0;
}
if (v4 == 1) {
*(&v12) = *((*(__ctype_b_loc()) + v1 * 2));
*(&v12) = v12 & 0x4000;
}
v7 += 1;
}
tmp_12 = v6;
v6 += 1;
*(tmp_12) = 39;
*(v6) = 0;
if (a2)
*(a2) = &v6[-1 * v9];
v11 = v9;
}
if (!a0 || !*(a0))
v11 = 0;
return v11;
}
|
static intmax_t
parameter_brace_expand_length (name)
char *name;
{
char *t, *newname;
intmax_t number, arg_index;
WORD_LIST *list;
SHELL_VAR *var;
var = (SHELL_VAR *)
((void *)0)
;
if (name[1] == '\0')
number = number_of_args ();
else if (((name[1]) == '@' || (name[1]) == '*') && name[2] == '\0')
number = number_of_args ();
else if ((sh_syntaxtab[(unsigned char) name[1]] & 0x0800) && name[2] == '\0')
{
switch (name[1])
{
case '-':
t = which_set_flags ();
break;
case '?':
t = itos (last_command_exit_value);
break;
case '$':
t = itos (dollar_dollar_pid);
break;
case '!':
if (last_asynchronous_pid == (pid_t)-1)
t = (char *)
((void *)0)
;
else
t = itos (last_asynchronous_pid);
break;
case '#':
t = itos (number_of_args ());
break;
}
number = (((t) && (t)[0]) ? ((t)[1] ? ((t)[2] ? strlen(t) : 2) : 1) : 0);
do { if (t) sh_xfree((t), "subst.c", 8010); } while (0);
}
else if (valid_array_reference (name + 1, 0))
number = array_length_reference (name + 1);
else
{
number = 0;
if (legal_number (name + 1, &arg_index))
{
t = get_dollar_var_value (arg_index);
if (t == 0 && unbound_vars_is_error)
return
(-9223372036854775807L -1)
;
number = ((
(__ctype_get_mb_cur_max ())
> 1) ? (((t) && (t)[0]) ? ((t)[1] ? mbstrlen (t) : 1) : 0) : (((t) && (t)[0]) ? ((t)[1] ? ((t)[2] ? strlen(t) : 2) : 1) : 0));
do { if (t) sh_xfree((t), "subst.c", 8026); } while (0);
}
else if ((var = find_variable (name + 1)) && (((((var)->attributes) & (0x0001000))) == 0) && (((((var)->attributes) & (0x0000004))) || ((((var)->attributes) & (0x0000040)))))
{
if (((((var)->attributes) & (0x0000040))))
t = assoc_reference ((HASH_TABLE *)((var)->value), "0");
else
t = array_reference ((ARRAY *)((var)->value), 0);
if (t == 0 && unbound_vars_is_error)
return
(-9223372036854775807L -1)
;
number = ((
(__ctype_get_mb_cur_max ())
> 1) ? (((t) && (t)[0]) ? ((t)[1] ? mbstrlen (t) : 1) : 0) : (((t) && (t)[0]) ? ((t)[1] ? ((t)[2] ? strlen(t) : 2) : 1) : 0));
}
else if ((var || (var = find_variable (name + 1))) &&
((((var)->attributes) & (0x0001000))) == 0 &&
((((var)->attributes) & (0x0000004))) == 0 && ((((var)->attributes) & (0x0000040))) == 0 &&
var->dynamic_value == 0)
number = ((var)->value) ? ((
(__ctype_get_mb_cur_max ())
> 1) ? (((((var)->value)) && (((var)->value))[0]) ? ((((var)->value))[1] ? mbstrlen (((var)->value)) : 1) : 0) : (((((var)->value)) && (((var)->value))[0]) ? ((((var)->value))[1] ? ((((var)->value))[2] ? strlen(((var)->value)) : 2) : 1) : 0)) : 0;
else if (var == 0 && unbound_vars_is_error == 0)
number = 0;
else
{
newname = (char *)strcpy (sh_xmalloc((1 + strlen (name)), "subst.c", 8051), (name));
newname[0] = '$';
list = expand_string (newname, 0x001);
t = list ? string_list (list) : (char *)
((void *)0)
;
sh_xfree((newname), "subst.c", 8055);
if (list)
dispose_words (list);
number = t ? ((
(__ctype_get_mb_cur_max ())
> 1) ? (((t) && (t)[0]) ? ((t)[1] ? mbstrlen (t) : 1) : 0) : (((t) && (t)[0]) ? ((t)[1] ? ((t)[2] ? strlen(t) : 2) : 1) : 0)) : 0;
do { if (t) sh_xfree((t), "subst.c", 8060); } while (0);
}
}
return (number);
}
| int parameter_brace_expand_length(char a0[3], unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
char v0;
void* v1;
unsigned long long v2;
struct_0 *v3;
char *v4;
void* v5;
char v6;
unsigned long long v7;
char v8;
unsigned long long v9;
void* v13;
v3 = 0;
if (!a0[1]) {
v2 = number_of_args();
} else {
if ((a0[1] == 64 || a0[1] == 42) && !a0[2])
v2 = number_of_args();
if (a0[2] || a0[1] != 64 && a0[1] != 42) {
if ((sh_syntaxtab[a0[1]] & 0x800) && !a0[2]) {
switch (a0[1]) {
case 33:
if (last_asynchronous_pid == -1) {
v1 = 0;
break;
} else {
v1 = itos(last_asynchronous_pid);
break;
}
case 35:
v1 = itos(number_of_args());
break;
case 36:
v1 = itos(dollar_dollar_pid);
break;
case 45:
v1 = which_set_flags();
break;
case 63:
v1 = itos(last_command_exit_value);
break;
}
if (true) {
if (!v1) {
v9 = 0;
} else if (*(v1)) {
if (!v1[1]) {
v9 = 1;
} else if (v1[2]) {
v9 = strlen(v1);
} else {
v9 = 2;
}
}
}
v2 = v9;
if (v1)
sh_xfree(v1, "subst.c", 0x1f4a);
}
if (!(sh_syntaxtab[a0[1]] & 0x800) || a0[2]) {
v9 = valid_array_reference(&a0[1], 0x0);
if (v9) {
v2 = array_length_reference(&a0[1], 0x0, a2, a3, a4, a5);
} else {
v2 = 0;
v9 = legal_number(&a0[1], &v0, &a0[1]);
if (v9) {
*(&v1) = get_dollar_var_value(*(&v0));
if (!v1 && *(&unbound_vars_is_error))
v9 = 0;
} else {
v3 = find_variable(&a0[1]);
}
}
}
}
}
if (!v9 && a0[1] && v9 && (!(sh_syntaxtab[a0[1]] & 0x800) || a0[2]) && (a0[2] || a0[1] != 64) && (a0[2] || a0[1] != 42) && !v1 && !*(&unbound_vars_is_error) || !v9 && a0[1] && v9 && (!(sh_syntaxtab[a0[1]] & 0x800) || a0[2]) && (a0[2] || a0[1] != 64) && (a0[2] || a0[1] != 42) && v1) {
if (__ctype_get_mb_cur_max(a0, &v0, a2, a3, a4, a5, *(&v6), v7, *(&v8)) > 1) {
if (v1 && *(v1)) {
if (v1[1])
v9 = mbstrlen(v1);
else
v9 = 1;
}
if (!v1[0] || !v1)
v9 = 0;
} else {
if (v1 && *(v1)) {
if (!v1[1]) {
v9 = 1;
} else if (v1[2]) {
v9 = strlen(v1);
} else {
v9 = 2;
}
}
if (!v1 || !v1[0])
v9 = 0;
}
v2 = v9;
if (v1)
sh_xfree(v1, "subst.c", 0x1f5a);
}
if (...) {
if ((v3->field_28 & 64))
*(&v1) = assoc_reference(v3->field_8, "0", a2);
else
*(&v1) = array_reference(v3->field_8, 0x0, a2);
if (!v1 && *(&unbound_vars_is_error))
v9 = 0;
}
if (...) {
if (!v3)
v3 = find_variable(&a0[1]);
if ((v3 || v3) && !(v3->field_28 & 0x1000) && !(v3->field_28 & 4) && !(v3->field_28 & 64) && !v3->field_18) {
if (!v3->field_8) {
v9 = 0;
} else if (__ctype_get_mb_cur_max(a0, &v0, a2, a3, a4, a5, *(&v6), v7, *(&v8)) > 1) {
if (v3->field_8 && v3->field_8->field_0) {
if (v3->field_8->field_1)
v9 = mbstrlen(v3->field_8);
else
v9 = 1;
}
if (!v3->field_8->field_0 || !v3->field_8)
v9 = 0;
} else {
if (v3->field_8 && v3->field_8->field_0) {
if (!v3->field_8->field_1) {
v9 = 1;
} else if (v3->field_8->field_2) {
v9 = strlen(v3->field_8);
} else {
v9 = 2;
}
}
if (!v3->field_8 || !v3->field_8->field_0)
v9 = 0;
}
v2 = v9;
}
if (v3->field_18 || (v3->field_28 & 0x1000) || (v3->field_28 & 4) || (v3->field_28 & 64) || !v3 && !v3) {
if (!v3 && !*(&unbound_vars_is_error))
v2 = 0;
if (*(&unbound_vars_is_error) || v3) {
v4 = strcpy(sh_xmalloc(strlen(a0) + 1, "subst.c", 0x1f73), a0);
*(v4) = 36;
v5 = expand_string(v4, 0x1, 0x1f73, a3, a4, a5);
if (v5)
v13 = string_list(v5);
else
v13 = 0;
v1 = v13;
sh_xfree(v4, "subst.c", 0x1f77);
if (v5)
dispose_words(v5);
if (!v1) {
v9 = 0;
} else if (__ctype_get_mb_cur_max(a0, "subst.c", 0x1f77, a3, a4, a5, *(&v6), v7, *(&v8)) > 1) {
if (v1 && *(v1)) {
if (v1[1])
v9 = mbstrlen(v1);
else
v9 = 1;
}
if (!v1[0] || !v1)
v9 = 0;
} else {
if (v1 && *(v1)) {
if (!v1[1]) {
v9 = 1;
} else if (v1[2]) {
v9 = strlen(v1);
} else {
v9 = 2;
}
}
if (!v1[0] || !v1)
v9 = 0;
}
v2 = v9;
if (v1)
sh_xfree(v1, "subst.c", 0x1f7c);
}
}
}
if (...) {
if (__ctype_get_mb_cur_max(a0, a1, a2, a3, a4, a5, *(&v6), v7, *(&v8)) > 1) {
if (v1 && *(v1)) {
if (v1[1])
v9 = mbstrlen(v1);
else
v9 = 1;
}
if (!v1 || !v1[0])
v9 = 0;
} else {
if (v1 && *(v1)) {
if (!v1[1]) {
v9 = 1;
} else if (v1[2]) {
v9 = strlen(v1);
} else {
v9 = 2;
}
}
if (!v1[0] || !v1)
v9 = 0;
}
v2 = v9;
}
if (...)
v9 = v2;
return v9;
}
|
void
tolocal(int argc, char **argv, enum scp_mode_e mode, char *sftp_direct)
{
char *bp, *host =
((void *)0)
, *src =
((void *)0)
, *suser =
((void *)0)
;
arglist alist;
struct sftp_conn *conn =
((void *)0)
;
int i, r, sport = -1;
memset(&alist, '\0', sizeof(alist));
alist.list =
((void *)0)
;
for (i = 0; i < argc - 1; i++) {
free(suser);
free(host);
free(src);
r = parse_scp_uri(argv[i], &suser, &host, &sport, &src);
if (r == -1) {
fmprintf(
stderr
, "%s: invalid uri\n", argv[i]);
++errs;
continue;
}
if (r != 0)
parse_user_host_path(argv[i], &suser, &host, &src);
if (suser !=
((void *)0)
&& !okname(suser)) {
++errs;
continue;
}
if (!host) {
freeargs(&alist);
addargs(&alist, "%s", "cp");
if (iamrecursive)
addargs(&alist, "-r");
if (pflag)
addargs(&alist, "-p");
addargs(&alist, "--");
addargs(&alist, "%s", argv[i]);
addargs(&alist, "%s", argv[argc-1]);
if (do_local_cmd(&alist))
++errs;
continue;
}
if (mode == MODE_SFTP) {
conn = do_sftp_connect(host, suser, sport,
sftp_direct, &remin, &remout, &do_cmd_pid);
if (conn ==
((void *)0)
) {
sshlog("scp.c", __func__, 1215, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "sftp connection failed");
++errs;
continue;
}
sink_sftp(1, argv[argc - 1], src, conn);
free(conn);
(void) close(remin);
(void) close(remout);
remin = remout = -1;
continue;
}
xasprintf(&bp, "%s -f %s%s",
cmd, *src == '-' ? "-- " : "", src);
if (do_cmd(ssh_program, host, suser, sport, 0, bp,
&remin, &remout, &do_cmd_pid) < 0) {
free(bp);
++errs;
continue;
}
free(bp);
sink(1, argv + argc - 1, src);
(void) close(remin);
remin = remout = -1;
}
free(suser);
free(host);
free(src);
}
| void tolocal(unsigned long a0, unsigned long long *a1, unsigned long long a2, unsigned long long a3, unsigned long a4, unsigned long long a5) {
char v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
char v5;
void* v6;
void* v7;
void* v8;
void* v9;
char v10;
char v11;
unsigned long long v13;
unsigned long long *v14;
unsigned long long v15;
v6 = 0;
v7 = 0;
v8 = 0;
v9 = 0;
v2 = -1;
memset(&v10, 0x0, 0x10);
v10 = 0;
v3 = 0;
while (true) {
if (v3 >= __addvsi3(a0, 0xffffffff))
break;
free(v8);
free(v6);
free(v7);
v4 = parse_scp_uri(a1[v3], &v8, &v6, &v2, &v7);
if (v4 == -1) {
fmprintf(stderr, "%s: invalid uri\n", a1[v3]);
targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1);
goto LABEL_40316c;
}
if (v4)
parse_user_host_path(a1[v3], &v8, &v6, &v7);
if (v8 && !okname(v8, a1, a2, a3, &v7, a5)) {
targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1);
goto LABEL_40316c;
}
if (!v6) {
freeargs(&v10);
addargs(&v10, "%s");
addargs(&v10, "-r");
addargs(&v10, "-p");
addargs(&v10, "--");
addargs(&v10, "%s");
__addvsi3(a0, 0xffffffff);
addargs(&v10, "%s");
if (do_local_cmd(&v10))
targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1);
} else if (a2 != 1) {
if (*(v7) == 45)
v13 = "-- ";
else
v13 = &g_406e67;
xasprintf(&v5, "%s -f %s%s", &cmd, v13, v7);
if (do_cmd(ssh_program, v6, v8, v2, 0x0, *(&v5), &targetshouldbedirectory, &targetshouldbedirectory, &do_cmd_pid) >= 0) {
free(*(&v5));
sink(0x1, &a1[1 + a0], v7);
close(0xe5894855);
targetshouldbedirectory = -1;
targetshouldbedirectory = 1219493948222425173;
} else {
free(*(&v5));
targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1);
}
} else {
v9 = do_sftp_connect(v6, v8, v2, a3, &targetshouldbedirectory, &targetshouldbedirectory, &do_cmd_pid);
if (!v9) {
sshlog("scp.c", "tolocal", 0x4bf, 0x0, 0x2, 0x0, "sftp connection failed", *(&v0), *(&v1));
targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1);
} else {
sink_sftp(0x1, a1[__addvsi3(a0, 0xffffffff)], v7, v9);
free(v9);
close(0xe5894855);
close(0xe5894855);
targetshouldbedirectory = -1;
targetshouldbedirectory = 1219493948222425173;
}
}
LABEL_40316c:
v3 = __addvsi3(v3, 0x1);
}
free(v8);
free(v6);
free(v7);
v15 = *(&v11) ^ v14[5];
return;
}
|
static const struct ipstats_stat_desc *
ipstats_stat_desc_find(const struct ipstats_stat_desc *desc,
const char *name)
{
size_t i;
((void) sizeof ((
desc->kind == IPSTATS_STAT_DESC_KIND_GROUP
) ? 1 : 0), __extension__ ({ if (
desc->kind == IPSTATS_STAT_DESC_KIND_GROUP
) ; else __assert_fail (
"desc->kind == IPSTATS_STAT_DESC_KIND_GROUP"
, "ipstats.c", 990, __extension__ __PRETTY_FUNCTION__); }))
;
for (i = 0; i < desc->nsubs; i++) {
const struct ipstats_stat_desc *sub = desc->subs[i];
if (strcmp(sub->name, name) == 0)
return sub;
}
return
((void *)0)
;
}
| int ipstats_stat_desc_find(struct_0 *a0, char *a1) {
void* v0;
unsigned long long *v1;
unsigned int v3;
if (a0->field_8 != 1)
__assert_fail();
v0 = 0;
while (true) {
if (v0 >= a0->field_18) {
v3 = 0;
break;
} else {
v1 = *((a0->field_10 + v0 * 8));
if (strcmp(*(v1), a1)) {
v0 += 1;
} else {
v3 = v1;
break;
}
}
}
return v3;
}
|
static __inline__ void xmemalign(void **memptr, size_t alignment, size_t size)
{
if ((posix_memalign(memptr, alignment, size)) < 0) {
if (sent_sigstop) kill(-1,
18
);
nsyslog(
3
, "out of memory");
exit(1);
}
}
| void xmemalign(void* *a0, unsigned int a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned int a5) {
if (posix_memalign(a0, a1, a2) < 0) {
kill(0xffffffff, 0x12);
nsyslog(0x3, "out of memory", a2, a3, a4, a5);
exit(0x1);
}
return;
}
|
static char **
make_var_export_array (vcxt)
VAR_CONTEXT *vcxt;
{
char **list;
SHELL_VAR **vars;
vars = map_over (export_environment_candidate, vcxt);
if (vars == 0)
return (char **)
((void *)0)
;
list = make_env_array_from_var_list (vars);
sh_xfree((vars), "variables.c", 4976);
return (list);
}
| long make_var_export_array(long a1)
{
long v2;
long env_array_from_var_list;
v2 = map_over((long ( *)(const char **))export_environment_candidate, a1);
if ( !v2 )
return 0LL;
env_array_from_var_list = make_env_array_from_var_list(v2);
sh_xfree(v2, "variables.c", 4976LL);
return env_array_from_var_list;
}
|
static struct trigcyclenode *
trigproc_new_cyclenode(struct pkginfo *processing_now)
{
struct trigcyclenode *tcn;
struct trigcycleperpkg *tcpp;
struct pkginfo *pkg;
struct pkg_hash_iter *iter;
tcn = nfmalloc(sizeof(*tcn));
tcn->pkgs =
((void *)0)
;
tcn->next =
((void *)0)
;
tcn->then_processed = processing_now;
iter = pkg_hash_iter_new();
while ((pkg = pkg_hash_iter_next_pkg(iter))) {
if (!pkg->trigpend_head)
continue;
tcpp = nfmalloc(sizeof(*tcpp));
tcpp->pkg = pkg;
tcpp->then_trigs = pkg->trigpend_head;
tcpp->next = tcn->pkgs;
tcn->pkgs = tcpp;
}
pkg_hash_iter_free(iter);
return tcn;
}
| undefined8 * trigproc_new_cyclenode(undefined8 param_1)
{
undefined8 *puVar1;
undefined8 uVar2;
undefined8 *puVar3;
long lVar4;
puVar1 = (undefined8 *)nfmalloc(0x18);
puVar1[1] = 0;
*puVar1 = 0;
puVar1[2] = param_1;
uVar2 = pkg_hash_iter_new();
while (lVar4 = pkg_hash_iter_next_pkg(uVar2), lVar4 != 0) {
if (*(long *)(lVar4 + 0x160) != 0) {
puVar3 = (undefined8 *)nfmalloc(0x18);
puVar3[1] = lVar4;
puVar3[2] = *(undefined8 *)(lVar4 + 0x160);
*puVar3 = puVar1[1];
puVar1[1] = puVar3;
}
}
pkg_hash_iter_free(uVar2);
return puVar1;
}
|
static inline int
find_special_var (name)
const char *name;
{
register int i, r;
for (i = 0; special_vars[i].name; i++)
{
r = special_vars[i].name[0] - name[0];
if (r == 0)
r = strcmp (special_vars[i].name, name);
if (r == 0)
return i;
else if (r > 0)
break;
}
return -1;
}
| int find_special_var(char *a0) {
void* v1;
unsigned int v2;
unsigned int v3;
v1 = 0;
while (!*((0x10 * v1 + &special_vars[0]))) {
LABEL_40a816:
v3 = -1;
return v3;
}
v2 = *(*((0x10 * v1 + &special_vars[0]))) - *(a0);
if (!*(*((0x10 * v1 + &special_vars[0]))) - *(a0))
v2 = strcmp(*((0x10 * v1 + &special_vars[0])), a0);
if (!v2) {
v3 = v1;
return v3;
}
if (v2 > 0) {
v3 = -1;
return v3;
}
v1 = v1 + 1;
goto LABEL_40a816;
}
|
void
trigproc_populate_deferred(void)
{
struct pkg_hash_iter *iter;
struct pkginfo *pkg;
iter = pkg_hash_iter_new();
while ((pkg = pkg_hash_iter_next_pkg(iter))) {
if (!pkg->trigpend_head)
continue;
if (pkg->status != PKG_STAT_TRIGGERSAWAITED &&
pkg->status != PKG_STAT_TRIGGERSPENDING)
continue;
if (pkg->want != PKG_WANT_INSTALL &&
pkg->want != PKG_WANT_HOLD)
continue;
trigproc_enqueue_deferred(pkg);
}
pkg_hash_iter_free(iter);
}
| long long trigproc_populate_deferred() {
unsigned long long v0;
struct_0 *v1;
v0 = pkg_hash_iter_new();
while (true) {
do {
v1 = pkg_hash_iter_next_pkg(v0);
if (!v1)
return pkg_hash_iter_free(v0);
} while (!v1->field_160);
if (v1->field_18 != 5 && !(v1->field_18 == 6))
continue;
if (v1->field_10 != 1 && !(v1->field_10 == 2))
continue;
trigproc_enqueue_deferred(v1);
}
}
|
static inline
_Bool
is_ENOTSUP (int err)
{
return err ==
95
|| (
95
!=
95
&& err ==
95
);
}
| int is_ENOTSUP(unsigned long a0) {
char v1;
unsigned int v2;
v1 = a0 == 95;
return v2;
}
|
static
void usage(char *s)
{
fprintf(
stderr
, "Usage: %s {-e VAR[=VAL] | [-t SECONDS] {0|1|2|3|4|5|6|S|s|Q|q|A|a|B|b|C|c|U|u}}\n", s);
exit(1);
}
| void usage(unsigned long a0) {
fprintf(stderr, "Usage: %s {-e VAR[=VAL] | [-t SECONDS] {0|1|2|3|4|5|6|S|s|Q|q|A|a|B|b|C|c|U|u}}\n", a0);
exit(0x1);
}
|
keymacro_print(EditLine *el, const wchar_t *key)
{
if (el->el_keymacro.map ==
((void *)0)
&& *key == 0)
return;
el->el_keymacro.buf[0] = '"';
if (node_lookup(el, key, el->el_keymacro.map, (size_t)1) <= -1)
(void) fprintf(el->el_errfile, "Unbound extended key \"%ls"
"\"\n", key);
return;
}
| long long keymacro_print(struct_0 *a0, unsigned int *a1) {
unsigned long long v1;
if (!a0->field_448)
v1 = *(a1);
if (*(a1) || a0->field_448) {
a0->field_440->field_0 = 34;
v1 = node_lookup(a0, a1, a0->field_448, 0x1);
if (v1 < 0)
v1 = fprintf(a0->field_18, "Unbound extended key \"%ls\"\n");
}
return v1;
}
|
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 *param_1)
{
FILE *__stream;
int iVar1;
char *pcVar2;
char *pcVar3;
long in_FS_OFFSET;
char *local_b8;
char **local_b0;
char *local_98;
char *local_90;
char *local_88;
char *local_80;
char *local_78;
char *local_70;
char *local_68;
char *local_60;
char *local_58;
char *local_50;
char *local_48;
char *local_40;
undefined8 local_38;
undefined8 local_30;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_98 = "[";
local_90 = "test invocation";
local_88 = "coreutils";
local_80 = "Multi-call invocation";
local_78 = "sha224sum";
local_70 = "sha2 utilities";
local_68 = "sha256sum";
local_60 = "sha2 utilities";
local_58 = "sha384sum";
local_50 = "sha2 utilities";
local_48 = "sha512sum";
local_40 = "sha2 utilities";
local_38 = 0;
local_30 = 0;
local_b0 = &local_98;
while ((*local_b0 != (char *)0x0 && (iVar1 = strcmp(param_1,*local_b0), iVar1 != 0))) {
local_b0 = local_b0 + 2;
}
local_b8 = param_1;
if (local_b0[1] != (char *)0x0) {
local_b8 = local_b0[1];
}
pcVar2 = (char *)gettext("\n%s online help: <%s>\n");
printf(pcVar2,"GNU coreutils","https:
pcVar2 = setlocale(5,(char *)0x0);
if ((pcVar2 != (char *)0x0) && (iVar1 = strncmp(pcVar2,"en_",3), __stream = stdout, iVar1 != 0)) {
pcVar2 = (char *)gettext(
"Report any translation bugs to <https:
);
fputs_unlocked(pcVar2,__stream);
}
iVar1 = strcmp(param_1,"[");
pcVar2 = param_1;
if (iVar1 == 0) {
pcVar2 = "test";
}
pcVar3 = (char *)gettext("Full documentation <%s%s>\n");
printf(pcVar3,"https:
if (local_b8 == param_1) {
pcVar2 = " invocation";
}
else {
pcVar2 = "";
}
pcVar3 = (char *)gettext("or available locally via: info \'(coreutils) %s%s\'\n");
printf(pcVar3,local_b8,pcVar2);
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
}
|
struct redirtab *pushredir(union node *redir)
{
struct redirtab *sv;
struct redirtab *q;
int i;
q = redirlist;
if (!redir)
goto out;
sv = ckmalloc(sizeof (struct redirtab));
sv->next = q;
redirlist = sv;
for (i = 0; i < 10; i++)
sv->renamed[i] = -2;
out:
return q;
}
| long long pushredir(unsigned long a0) {
unsigned int v0;
unsigned long long v1;
unsigned long long *v2;
v1 = 399668583475215753;
if (a0) {
v2 = ckmalloc(0x30);
*(v2) = v1;
redirlist = v2;
for (v0 = 0; v0 <= 9; v0 += 1) {
*((8 + v2 + 4 * v0)) = -2;
}
}
return v1;
}
|
void e2fsck_read_inode_full(e2fsck_t ctx, unsigned long ino,
struct ext2_inode *inode, int bufsize,
const char *proc)
{
errcode_t retval;
retval = ext2fs_read_inode_full(ctx->fs, ino, inode, bufsize);
if (retval) {
com_err("ext2fs_read_inode_full", retval,
(gettext ("while reading inode %lu in %s")), ino, proc);
fatal_error(ctx, 0);
}
}
| void e2fsck_read_inode_full
(undefined8 *param_1,ulong param_2,undefined8 param_3,undefined4 param_4,
undefined8 param_5)
{
long lVar1;
undefined8 uVar2;
lVar1 = ext2fs_read_inode_full(*param_1,param_2 & 0xffffffff,param_3,param_4);
if (lVar1 != 0) {
uVar2 = gettext("while reading inode %lu in %s");
com_err("ext2fs_read_inode_full",lVar1,uVar2,param_2,param_5);
fatal_error(param_1,0);
}
return;
}
|
static ptrdiff_t
bmexec (kwset_t kwset, char const *text, idx_t size,
struct kwsmatch *kwsmatch,
_Bool
longest)
{
ptrdiff_t ret = (({
kwset->trans ? bmexec_trans (kwset, text, size) : bmexec_trans (kwset, text, size);
})
);
kwsmatch->index = 0;
kwsmatch->offset = ret;
kwsmatch->size = kwset->mind;
return ret;
}
| long long bmexec(unsigned long long a0[305], unsigned long long a1, unsigned long long a2, unsigned long long a3[3], unsigned long a4) {
char v0;
unsigned long v1;
unsigned long long v3;
v0 = a4;
if (!a0[304])
v3 = bmexec_trans(a0, a1, a2);
else
v3 = bmexec_trans(a0, a1, a2);
v1 = v3;
a3[0] = 0;
a3[1] = v1;
a3[2] = a0[13];
return v1;
}
|
static inline char *_STPUTC(int c, char *p) {
if (p == sstrend)
p = growstackstr();
*p++ = c;
return p;
}
| int _STPUTC(unsigned long a0, unsigned long a1) {
char *v0;
int tmp_13;
v0 = a1;
if (v0 == sstrend)
v0 = growstackstr();
tmp_13 = v0;
v0 += 1;
*(tmp_13) = a0;
return v0;
}
|
void *
realloc (mem, nbytes)
void * mem;
size_t nbytes;
{
return internal_realloc (mem, nbytes, (char *)
((void *)0)
, 0, 0);
}
| char * realloc(char *a1, size_t a2)
{
return internal_realloc(a1, a2, 0LL, 0);
}
|
static void treat_file(iname)
char *iname;
{
if ((strcmp((iname),("-")) == 0)) {
int cflag = to_stdout;
treat_stdin();
to_stdout = cflag;
return;
}
ifd = open_input_file (iname, &istat);
if (ifd < 0)
return;
if (
((((
istat.st_mode
)) & 0170000) == (0040000))
) {
if (recursive) {
treat_dir (ifd, iname);
return;
}
close (ifd);
{if (!quiet) fprintf (
stderr
, "%s: %s is a directory -- ignored\n", program_name, ifname) ; if (exit_code == 0) exit_code = 2;}
;
return;
}
if (! to_stdout)
{
if (!
((((
istat.st_mode
)) & 0170000) == (0100000))
)
{
{if (!quiet) fprintf (
stderr
, "%s: %s is not a directory or a regular file - ignored\n", program_name, ifname) ; if (exit_code == 0) exit_code = 2;}
;
close (ifd);
return;
}
if (istat.st_mode &
04000
)
{
{if (!quiet) fprintf (
stderr
, "%s: %s is set-user-ID on execution - ignored\n", program_name, ifname) ; if (exit_code == 0) exit_code = 2;}
;
close (ifd);
return;
}
if (istat.st_mode &
02000
)
{
{if (!quiet) fprintf (
stderr
, "%s: %s is set-group-ID on execution - ignored\n", program_name, ifname) ; if (exit_code == 0) exit_code = 2;}
;
close (ifd);
return;
}
if (! force)
{
if (istat.st_mode &
01000
)
{
{if (!quiet) fprintf (
stderr
, "%s: %s has the sticky bit set - file ignored\n", program_name, ifname) ; if (exit_code == 0) exit_code = 2;}
;
close (ifd);
return;
}
if (2 <= istat.st_nlink)
{
{if (!quiet) fprintf (
stderr
, "%s: %s has %lu other link%s -- file ignored\n", program_name, ifname, (unsigned long int) istat.st_nlink - 1, istat.st_nlink == 2 ? "" : "s") ; if (exit_code == 0) exit_code = 2;}
;
close (ifd);
return;
}
}
}
get_input_size_and_time ();
if (to_stdout && !test) {
strcpy(ofname, "stdout");
} else if (make_ofname() != 0) {
close (ifd);
return;
}
clear_bufs();
part_nb = 0;
if (decompress) {
method = get_method(ifd);
if (method < 0) {
close(ifd);
return;
}
}
if (to_stdout) {
ofd =
1
;
} else {
if (create_outfile() != 0) return;
if (!decompress && save_orig_name && !verbose && !quiet) {
fprintf(
stderr
, "%s: %s compressed to %s\n",
program_name, ifname, ofname);
}
}
if (!save_orig_name) save_orig_name = !no_name;
if (verbose && !list) {
fprintf(
stderr
, "%s:\t", ifname);
}
for (;;) {
if ((*work)(ifd, ofd) != 0) {
method = -1;
break;
}
if (input_eof ())
break;
method = get_method(ifd);
if (method < 0) break;
bytes_out = 0;
}
if (close (ifd) != 0)
read_error ();
if (list)
{
do_list (method);
return;
}
if (!to_stdout)
{
copy_stat (&istat);
if ((synchronous
&& ((0 <= dfd && fdatasync (dfd) != 0 &&
(*__errno_location ())
!=
22
)
|| (fsync (ofd) != 0 &&
(*__errno_location ())
!=
22
)))
|| close (ofd) != 0)
write_error ();
if (!keep)
{
sigset_t oldset;
int unlink_errno;
char *ifbase = last_component (ifname);
int ufd = atdir_eq (ifname, ifbase - ifname) ? dfd : -1;
int res;
sigprocmask (
0
, &caught_signals, &oldset);
remove_ofname_fd = -1;
res = ufd < 0 ? xunlink (ifname) : unlinkat (ufd, ifbase, 0);
unlink_errno = res == 0 ? 0 :
(*__errno_location ())
;
sigprocmask (
2
, &oldset,
((void *)0)
);
if (unlink_errno)
{
{if (!quiet) fprintf (
stderr
, "%s: ", program_name) ; if (exit_code == 0) exit_code = 2;};
if (!quiet)
{
(*__errno_location ())
= unlink_errno;
perror (ifname);
}
}
}
}
if (method == -1) {
if (!to_stdout)
remove_output_file (
0
);
return;
}
if(verbose) {
if (test) {
fprintf(
stderr
, " OK");
} else if (decompress) {
display_ratio(bytes_out-(bytes_in-header_bytes), bytes_out,
stderr
);
} else {
display_ratio(bytes_in-(bytes_out-header_bytes), bytes_in,
stderr
);
}
if (!test)
fprintf(
stderr
, " -- %s %s", keep ? "created" : "replaced with",
ofname);
fprintf(
stderr
, "\n");
}
}
| void treat_file(char *a0, unsigned long long a1, unsigned int a2, unsigned long long a3, unsigned int a4, unsigned long long a5) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
char v4;
char v5;
unsigned int v7;
unsigned int v11;
unsigned long long *v12;
unsigned long long v13;
if (strcmp(a0, "-")) {
outcnt = open_input_file(a0, &istat);
if (-498339038549686187 >= 0) {
if ((g_404778 & 0xf000) != 0x4000) {
if (to_stdout) {
LABEL_40118e:
get_input_size_and_time(a0, &istat, a2);
if (to_stdout && !test) {
strcpy(&ofname, "stdout");
goto LABEL_4011d7;
} else {
if (make_ofname()) {
close(0xe5894855);
} else {
LABEL_4011d7:
clear_bufs(a0, a1, a2, a3, a4, a5);
part_nb = 0;
if (!decompress || (method = get_method(0xf9158b48e5894855), method >= 0)) {
if (to_stdout) {
outcnt = 1;
goto LABEL_40129a;
} else {
if (!create_outfile(a0, a1, a2, a3, a4, a5)) {
if (!decompress && !verbose && !*(&quiet)) {
a2 = -116028600;
a4 = &ofname;
a3 = &ofname;
fprintf(*(&stderr), "%s: %s compressed to %s\n", -116028600, &ofname, &ofname);
}
LABEL_40129a:
if (false)
outcnt = !no_name;
if (verbose && !list) {
a2 = &ofname;
fprintf(*(&stderr), "%s:\t", &ofname);
}
while (true) {
if (zip(0xf9158b48e5894855, 0xf9158b48e5894855)) {
method = -1;
break;
} else {
if (!(!input_eof()) || !((method = get_method(0xf9158b48e5894855), method >= 0)))
break;
bytes_out = 0;
}
}
if (close(0xe5894855))
read_error(-116028600 CONCAT 3850979413, 0xf9158b48e5894855, a2, a3, a4, a5);
if (!list) {
if (!to_stdout) {
copy_stat(&istat, 0xf9158b48e5894855, a2);
if (synchronous && (dfd >= 0 && fdatasync(dfd) && *(__errno_location()) != 22 || fsync(0xe5894855) && *(__errno_location()) != 22) || close(0xe5894855))
write_error();
if (!keep) {
v3 = last_component(&ofname);
v0 = (!atdir_eq(&ofname, v3 + -0x1 * &ofname) ? dfd : -1);
sigprocmask(0x0, &caught_signals, &v4);
remove_ofname_fd = -1;
if (v0 >= 0)
v11 = unlinkat(v0, v3, 0x0, v3);
else
v11 = xunlink(&ofname);
v11 = v11;
v11 = (!v11 ? *(__errno_location()) : 0);
v1 = v11;
sigprocmask(0x2, &v4, NULL);
if (v1) {
if (!*(&quiet))
fprintf(*(&stderr), "%s: ", -116028600);
if (!exit_code)
exit_code = 2;
if (!*(&quiet)) {
*(__errno_location()) = v1;
perror(&ofname);
}
}
}
}
if (method == -1) {
if (!to_stdout)
remove_output_file(0x0);
} else {
if (verbose) {
if (test) {
fprintf(*(&stderr), " OK");
} else {
if (!decompress)
display_ratio(*(&header_bytes), 0x48fffffff9158b48, *(&stderr), *(&header_bytes));
else
display_ratio(*(&header_bytes), 0x48fffffff9158b48, *(&stderr), *(&header_bytes));
}
if (!test) {
if (!keep)
v11 = &g_405147;
else
v11 = "created";
fprintf(*(&stderr), " -- %s %s", v11, &ofname);
}
fprintf(*(&stderr), "\n");
}
}
} else {
do_list(method);
}
}
}
} else {
close(0xe5894855);
}
}
}
} else if ((g_404778 & 0xf000) != 0x8000) {
if (!*(&quiet))
fprintf(*(&stderr), "%s: %s is not a directory or a regular file - ignored\n", -116028600, &ofname);
if (!exit_code)
exit_code = 2;
close(0xe5894855);
} else if ((g_404778 & 0x800)) {
if (!*(&quiet))
fprintf(*(&stderr), "%s: %s is set-user-ID on execution - ignored\n", -116028600, &ofname);
if (!exit_code)
exit_code = 2;
close(0xe5894855);
} else if ((g_404778 & 0x400)) {
if (!*(&quiet))
fprintf(*(&stderr), "%s: %s is set-group-ID on execution - ignored\n", -116028600, &ofname);
if (!exit_code)
exit_code = 2;
close(0xe5894855);
} else {
if (!(!force))
goto LABEL_40118e;
if ((g_404778 & 0x200)) {
if (!*(&quiet))
fprintf(*(&stderr), "%s: %s has the sticky bit set - file ignored\n", -116028600, &ofname);
if (!exit_code)
exit_code = 2;
close(0xe5894855);
} else {
if (g_404770 <= 1)
goto LABEL_40118e;
if (!*(&quiet)) {
if (g_404770 != 2)
v7 = &g_4050ee;
else
v7 = &g_404f6f;
fprintf(*(&stderr), "%s: %s has %lu other link%s -- file ignored\n", -116028600, &ofname, (g_404770 - 1), v7);
}
if (!exit_code)
exit_code = 2;
close(0xe5894855);
}
}
} else {
if (recursive) {
treat_dir(0xf9158b48e5894855, a0);
} else {
close(0xe5894855);
if (!*(&quiet))
fprintf(*(&stderr), "%s: %s is a directory -- ignored\n", -116028600, &ofname);
if (!exit_code)
exit_code = 2;
}
}
}
} else {
v2 = to_stdout;
treat_stdin(a0, "-", a2, a3, a4, a5);
to_stdout = v2;
}
v13 = *(&v5) ^ v12[5];
return;
}
|
static int
compare (struct line const *a, struct line const *b)
{
int diff;
size_t alen, blen;
if (keylist)
{
diff = keycompare (a, b);
if (diff || unique || stable)
return diff;
}
alen = a->length - 1, blen = b->length - 1;
if (alen == 0)
diff = - ((blen) != 0);
else if (blen == 0)
diff = 1;
else if (hard_LC_COLLATE)
{
diff = xmemcoll0 (a->text, alen + 1, b->text, blen + 1);
}
else if (! (diff = memcmp (a->text, b->text,
(((
alen
)<(
blen
))?(
alen
):(
blen
))
)))
diff = alen < blen ? -1 : alen != blen;
return reverse ? -diff : diff;
}
| long compare(unsigned char **a1, unsigned char **a2)
{
unsigned char *v3;
int v4;
unsigned int v5;
unsigned int v6;
unsigned char *v7;
unsigned char *n;
if ( keylist )
{
v5 = keycompare(a1, a2);
if ( v5 || unique || stable )
return v5;
}
v7 = a1[1] - 1;
n = a2[1] - 1;
if ( a1[1] == (unsigned char *)&loc_1 )
{
v6 = -(a2[1] != (unsigned char *)&loc_1);
}
else if ( a2[1] == (unsigned char *)&loc_1 )
{
v6 = 1;
}
else if ( hard_LC_COLLATE )
{
v6 = xmemcoll0(*a1, a1[1], *a2, a2[1]);
}
else
{
v3 = a1[1] - 1;
if ( n <= v7 )
v3 = a2[1] - 1;
v6 = memcmp(*a1, *a2, (size_t)v3);
if ( !v6 )
{
if ( v7 < n )
v4 = -1;
else
v4 = v7 != n;
v6 = v4;
}
}
if ( reverse )
return -v6;
else
return v6;
}
|
static int do_6rd(int argc, char **argv)
{
struct ip_tunnel_6rd ip6rd = {};
int cmd = 0;
const char *medium =
((void *)0)
;
inet_prefix prefix;
while (argc > 0) {
if (strcmp(*argv, "6rd-prefix") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_prefix(&prefix, *argv,
10
))
invarg("invalid 6rd_prefix\n", *argv);
cmd = (
0x89F0
+ 9);
memcpy(&ip6rd.prefix, prefix.data, 16);
ip6rd.prefixlen = prefix.bitlen;
} else if (strcmp(*argv, "6rd-relay_prefix") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_prefix(&prefix, *argv,
2
))
invarg("invalid 6rd-relay_prefix\n", *argv);
cmd = (
0x89F0
+ 9);
memcpy(&ip6rd.relay_prefix, prefix.data, 4);
ip6rd.relay_prefixlen = prefix.bitlen;
} else if (strcmp(*argv, "6rd-reset") == 0) {
cmd = (
0x89F0
+ 10);
} else if (strcmp(*argv, "dev") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (check_ifname(*argv))
invarg("\"dev\" not a valid ifname", *argv);
medium = *argv;
} else {
fprintf(
stderr
,
"Invalid 6RD parameter \"%s\"\n", *argv);
exit(-1);
}
argc--; argv++;
}
if (!medium) {
fprintf(
stderr
, "Must specify device\n");
exit(-1);
}
return tnl_6rd_ioctl(cmd, medium, &ip6rd);
}
| void do_6rd(int param_1,char **param_2)
{
int iVar1;
long in_FS_OFFSET;
char **local_158;
int local_14c;
undefined4 local_144;
char *local_140;
undefined8 local_138;
undefined8 local_130;
ulong local_128 [2];
undefined local_118 [4];
ushort local_114;
undefined local_110 [256];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_138 = 0;
local_130 = 0;
local_128[0] = 0;
local_144 = 0;
local_140 = (char *)0x0;
local_158 = param_2;
for (local_14c = param_1; 0 < local_14c; local_14c = local_14c + -1) {
iVar1 = strcmp(*local_158,"6rd-prefix");
if (iVar1 == 0) {
local_158 = local_158 + 1;
local_14c = local_14c + -1;
if (local_14c < 1) {
incomplete_command();
}
iVar1 = get_prefix(local_118,*local_158,10);
if (iVar1 != 0) {
invarg("invalid 6rd_prefix\n",*local_158);
}
local_144 = 0x89f9;
memcpy(&local_138,local_110,0x10);
local_128[0]._0_6_ = CONCAT24(local_114,(undefined4)local_128[0]);
local_128[0] = local_128[0] & 0xffff000000000000 | (ulong)(uint6)local_128[0];
}
else {
iVar1 = strcmp(*local_158,"6rd-relay_prefix");
if (iVar1 == 0) {
local_158 = local_158 + 1;
local_14c = local_14c + -1;
if (local_14c < 1) {
incomplete_command();
}
iVar1 = get_prefix(local_118,*local_158,2);
if (iVar1 != 0) {
invarg("invalid 6rd-relay_prefix\n",*local_158);
}
local_144 = 0x89f9;
memcpy(local_128,local_110,4);
local_128[0] = local_128[0] & 0xffffffffffff | (ulong)local_114 << 0x30;
}
else {
iVar1 = strcmp(*local_158,"6rd-reset");
if (iVar1 == 0) {
local_144 = 0x89fa;
}
else {
iVar1 = strcmp(*local_158,"dev");
if (iVar1 != 0) {
fprintf(stderr,"Invalid 6RD parameter \"%s\"\n",*local_158);
exit(-1);
}
local_158 = local_158 + 1;
local_14c = local_14c + -1;
if (local_14c < 1) {
incomplete_command();
}
iVar1 = check_ifname(*local_158);
if (iVar1 != 0) {
invarg("\"dev\" not a valid ifname",*local_158);
}
local_140 = *local_158;
}
}
}
local_158 = local_158 + 1;
}
if (local_140 == (char *)0x0) {
fprintf(stderr,"Must specify device\n");
exit(-1);
}
tnl_6rd_ioctl(local_144,local_140,&local_138);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
void
stat_to_attrib(const struct stat *st, Attrib *a)
{
attrib_clear(a);
a->flags = 0;
a->flags |= 0x00000001;
a->size = st->st_size;
a->flags |= 0x00000002;
a->uid = st->st_uid;
a->gid = st->st_gid;
a->flags |= 0x00000004;
a->perm = st->st_mode;
a->flags |= 0x00000008;
a->atime = st->
st_atim.tv_sec
;
a->mtime = st->
st_mtim.tv_sec
;
}
| long long stat_to_attrib(struct_1 *a0, struct_0 *a1) {
struct_0 *v0;
v0 = a1;
attrib_clear(a1);
a1->field_0 = 0;
a1->field_0 = a1->field_0 | 1;
a1->field_8 = a0->field_30;
a1->field_0 = a1->field_0 | 2;
a1->field_10 = a0->field_1c;
a1->field_14 = a0->field_20;
a1->field_0 = a1->field_0 | 4;
a1->field_18 = a0->field_18;
a1->field_0 = a1->field_0 | 8;
a1->field_1c = a0->field_48;
a1->field_20 = a0->field_58;
return a1;
}
|
static void process_flags (int argc, char **argv)
{
int c;
static struct option long_options[] = {
{"help",
0
,
((void *)0)
, 'h'},
{"force",
0
,
((void *)0)
, 'f'},
{"root",
1
,
((void *)0)
, 'R'},
{"prefix",
1
,
((void *)0)
, 'P'},
{
((void *)0)
, 0,
((void *)0)
, '\0'}
};
while ((c = getopt_long (argc, argv, "hfR:P:",
long_options,
((void *)0)
)) != -1) {
switch (c) {
case 'h':
usage (0);
break;
case 'R':
break;
case 'P':
break;
case 'f':
check_group_busy =
0
;
break;
default:
usage (2);
}
}
if (optind != argc - 1) {
usage (2);
}
group_name = argv[optind];
}
| long long process_flags(unsigned long a0, unsigned long long *a1) {
unsigned int v0;
unsigned long long v2;
while (true) {
v0 = getopt_long(a0, a1, "hfR:P:", &long_options.5783, NULL);
if (v0 == -1) {
if (a0 - 1 == optind) {
v2 = a1[optind];
group_name = a1[optind];
return v2;
}
usage(0x2);
}
if (v0 == 104)
usage(0x0);
if (v0 > 104) {
LABEL_4008a5:
usage(0x2);
}
if (v0 == 102) {
check_group_busy = 0;
continue;
}
if (!(v0 <= 102))
goto LABEL_4008a5;
if (v0 == 80)
continue;
if (!(v0 == 82))
goto LABEL_4008a5;
}
}
|
static void
lbuf_flush (void)
{
size_t size = lbuf.end - lbuf.buf;
if (full_write (
1
, lbuf.buf, size) != size)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", gettext (\"write error\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, "%s", gettext ("write error")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, "%s", gettext ("write error")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
lbuf.end = lbuf.buf;
}
| void lbuf_flush(void)
{
char *v0;
int *v1;
signed long v2;
v2 = (_BYTE *)dest - (_BYTE *)lbuf;
if ( v2 != full_write(1LL, lbuf, (_BYTE *)dest - (_BYTE *)lbuf) )
{
v0 = gettext("write error");
v1 = _errno_location();
error(1, *v1, "%s", v0);
}
dest = lbuf;
}
|
static struct tblentry *
cmdlookup(const char *name, int add)
{
unsigned int hashval;
const char *p;
struct tblentry *cmdp;
struct tblentry **pp;
p = name;
hashval = (unsigned char)*p << 4;
while (*p)
hashval += (unsigned char)*p++;
hashval &= 0x7FFF;
pp = &cmdtable[hashval % 31];
for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) {
if ((strcmp(cmdp->cmdname, name) == 0))
break;
pp = &cmdp->next;
}
if (add && cmdp ==
((void *)0)
) {
cmdp = *pp = ckmalloc(sizeof (struct tblentry) - 1
+ strlen(name) + 1);
cmdp->next =
((void *)0)
;
cmdp->cmdtype = -1;
strcpy(cmdp->cmdname, name);
}
lastcmdentry = pp;
return cmdp;
}
| int cmdlookup(char *a0, unsigned long a1) {
unsigned int v0;
int tmp_10;
char *v1;
struct_0 *v2;
unsigned long long *v3;
v1 = a0;
for (v0 = *(v1) * 16; *(v1); v0 += *(tmp_10)) {
tmp_10 = v1;
v1 += 1;
}
v0 &= 32767;
v3 = &(&cmdtable)[v0 + -31 * ((v0 * 138547333 >> 32) + (v0 - (v0 * 138547333 >> 32) >> 1) >> 4)];
v2 = *(v3);
while (true) {
if (!v2)
break;
if (!strcmp(&v2[1].field_0 + 1, a0))
break;
v3 = v2;
v2 = v2->field_0;
}
if (a1 && !v2) {
*(v3) = ckmalloc(strlen(a0) + 24);
v2 = *(v3);
v2->field_0 = 0;
v2->field_10 = 65535;
strcpy(&v2[1].field_0 + 1, a0);
}
lastcmdentry = v3;
return v2;
}
|
static int
cmp_mtime (struct fileinfo const *a, struct fileinfo const *b,
int (*cmp) (char const *, char const *))
{
int diff = timespec_cmp (get_stat_mtime (&b->stat),
get_stat_mtime (&a->stat));
return diff ? diff : cmp (a->name, b->name);
}
| void cmp_mtime(unsigned long long *a0, unsigned long long *a1, unsigned long long a2) {
unsigned int v0;
unsigned long long v2;
unsigned long long v3;
v0 = timespec_cmp(get_stat_mtime(a1 + 3), a2, get_stat_mtime(a0 + 3), a2);
if (v0)
v2 = v0;
else
v3 = (stack_base)[80](*(a0), *(a1), *(a1), a2);
return;
}
|
__inline__
static int
iso_week_days (int yday, int wday)
{
int big_enough_multiple_of_7 = (-(-366) / 7 + 2) * 7;
return (yday
- (yday - wday + 4 + big_enough_multiple_of_7) % 7
+ 4 - 1);
}
| int iso_week_days(unsigned long a0, unsigned long a1) {
unsigned int v0;
v0 = 378;
return a0 - (a0 - a1 + 4 + v0 - (((((a0 - a1 + 4 + v0) * -1840700269 >> 32) + a0 - a1 + 4 + v0 >> 2) - (a0 - a1 + 4 + v0 >> 31)) * 7)) + 3;
}
|
static enum search_type cfg_define_search_type(const char *path)
{
if ((strcmp((path), (CFG_BUILTIN_KEY)) == 0))
return SEARCH_BUILTIN;
if ((strcmp((path), (CFG_EXTERNAL_KEY)) == 0))
return SEARCH_EXTERNAL;
return SEARCH_PATH;
}
| int cfg_define_search_type(char *a0) {
return (!strcmp(a0, "built-in") ? (!strcmp(a0, "external") ? 0 : 2) : 1);
}
|
static union node *
andor(void)
{
union node *n1, *n2, *n3;
int t;
n1 = pipeline();
for (;;) {
if ((t = readtoken()) == 4) {
t = 5;
} else if (t == 5) {
t = 6;
} else {
tokpushback++;
return n1;
}
checkkwd = 0x4 | 0x2 | 0x1;
n2 = pipeline();
n3 = (union node *)stalloc(sizeof (struct nbinary));
n3->type = t;
n3->nbinary.ch1 = n1;
n3->nbinary.ch2 = n2;
n1 = n3;
}
}
| undefined4 * andor(void)
{
int iVar1;
undefined8 uVar2;
undefined4 *puVar3;
undefined4 local_24;
undefined4 *local_20;
local_20 = (undefined4 *)pipeline();
do {
iVar1 = readtoken();
if (iVar1 == 4) {
local_24 = 5;
}
else {
if (iVar1 != 5) {
tokpushback = tokpushback + 1;
return local_20;
}
local_24 = 6;
}
checkkwd = 7;
uVar2 = pipeline();
puVar3 = (undefined4 *)stalloc(0x18);
*puVar3 = local_24;
*(undefined4 **)(puVar3 + 2) = local_20;
*(undefined8 *)(puVar3 + 4) = uVar2;
local_20 = puVar3;
} while( true );
}
|
static const char *
diversion_pkg_name(struct fsys_diversion *d)
{
if (d->pkgset ==
((void *)0)
)
return ":";
else
return d->pkgset->name;
}
| undefined * diversion_pkg_name(long param_1)
{
undefined *puVar1;
if (*(long *)(param_1 + 0x10) == 0) {
puVar1 = &DAT_00102675;
}
else {
puVar1 = *(undefined **)(*(long *)(param_1 + 0x10) + 8);
}
return puVar1;
}
|
int main (int argc, char **argv)
{
_Bool
initflag =
0
;
int i;
_Bool
is_member =
0
;
_Bool
cflag =
0
;
int err = 0;
gid_t gid;
char *cp;
const char *progbase;
const char *name, *prog;
char *group =
((void *)0)
;
char *command =
((void *)0)
;
char **envp = environ;
struct passwd *pwd;
struct group *grp;
struct sgrp *sgrp;
(void) setlocale (
6
, "");
(void) bindtextdomain ("shadow", "/usr/share/locale");
(void) textdomain ("shadow");
Prog = Basename (argv[0]);
log_set_progname(Prog);
log_set_logfd(
stderr
);
is_newgrp = (strcmp (Prog, "newgrp") == 0);
openlog(is_newgrp ? "newgrp" : "sg", (
0x01
),
(10<<3)
);
argc--;
argv++;
initenv ();
pwd = get_my_pwent ();
if (
((void *)0)
== pwd) {
fprintf (
stderr
, gettext ("%s: Cannot determine your user name.\n"),
Prog);
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
4
, "Cannot determine the user name of the caller (UID %lu)", (unsigned long) getuid ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
)
;
closelog ();
exit (
1
);
}
name = pwd->pw_name;
if ( (argc > 0)
&& ( (strcmp (argv[0], "-") == 0)
|| (strcmp (argv[0], "-l") == 0))) {
argc--;
argv++;
initflag =
1
;
}
if (!is_newgrp) {
if ((argc > 0) && (argv[0][0] != '-')) {
group = argv[0];
argc--;
argv++;
} else {
usage ();
closelog ();
exit (
1
);
}
if (argc > 0) {
if ((argc > 1) && (strcmp (argv[0], "-c") == 0)) {
command = argv[1];
} else {
command = argv[0];
}
cflag =
1
;
}
} else {
if ((argc > 0) && (argv[0][0] == '-')) {
usage ();
goto failure;
} else if (argv[0] != (char *) 0) {
group = argv[0];
} else {
grp = xgetgrgid (pwd->pw_gid);
if (
((void *)0)
== grp) {
fprintf (
stderr
,
gettext ("%s: GID '%lu' does not exist\n"),
Prog, (unsigned long) pwd->pw_gid);
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
2
, "GID '%lu' does not exist", (unsigned long) pwd->pw_gid) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
)
;
goto failure;
} else {
group = grp->gr_name;
}
}
}
i = 16;
for (;;) {
grouplist = (gid_t *) xmalloc (i * sizeof (gid_t));
ngroups = getgroups (i, grouplist);
if (i > ngroups && !(ngroups == -1 &&
(*__errno_location ())
==
22
)) {
break;
}
free (grouplist);
i *= 2;
}
if (ngroups < 0) {
perror ("getgroups");
exit (
1
);
}
grp = getgrnam (group);
if (
((void *)0)
== grp) {
fprintf (
stderr
, gettext ("%s: group '%s' does not exist\n"), Prog, group);
goto failure;
}
for (i = 0; i < ngroups; i++) {
if (grp->gr_gid == grouplist[i]) {
is_member =
1
;
break;
}
}
if (!is_member) {
grp = find_matching_group (name, grp);
if (
((void *)0)
== grp) {
grp = xgetgrnam (group);
((void) sizeof ((((void *)0)
!= grp
) ? 1 : 0), __extension__ ({ if (((void *)0)
!= grp
) ; else __assert_fail (
"NULL != grp"
, "newgrp.c", 646, __extension__ __PRETTY_FUNCTION__); }))
;
}
}
sgrp = getsgnam (group);
if (
((void *)0)
!= sgrp) {
grp->gr_passwd = sgrp->sg_passwd;
grp->gr_mem = sgrp->sg_mem;
}
if (!is_member) {
check_perms (grp, pwd, group);
}
if (getdef_bool ("SYSLOG_SG_ENAB")) {
syslog_sg (name, group);
}
gid = grp->gr_gid;
for (i = 0; i < ngroups; i++) {
if (gid == grouplist[i]) {
break;
}
}
if (i == ngroups) {
if (ngroups >= sysconf (
_SC_NGROUPS_MAX
)) {
(void) fputs (gettext ("too many groups\n"),
stderr
);
} else {
grouplist[ngroups++] = gid;
if (setgroups (ngroups, grouplist) != 0) {
perror ("setgroups");
}
}
}
endspent ();
endsgent ();
endpwent ();
endgrent ();
if (setgid (gid) != 0) {
perror ("setgid");
exit (
1
);
}
if (setuid (getuid ()) != 0) {
perror ("setuid");
exit (
1
);
}
if (cflag) {
closelog ();
execl ("/bin/bash", "sh", "-c", command, (char *) 0);
perror ("/bin/bash");
exit ((
(*__errno_location ())
==
2
) ? 127 : 126);
}
cp = getenv ("SHELL");
if (!initflag && (
((void *)0)
!= cp)) {
prog = cp;
} else if ((
((void *)0)
!= pwd->pw_shell) && ('\0' != pwd->pw_shell[0])) {
prog = pwd->pw_shell;
} else {
prog = "/bin/bash";
}
progbase = Basename (prog);
if (initflag) {
if (chdir (pwd->pw_dir) != 0) {
perror ("chdir");
}
while (
((void *)0)
!= *envp) {
if (strncmp (*envp, "PATH=", 5) == 0 ||
strncmp (*envp, "HOME=", 5) == 0 ||
strncmp (*envp, "SHELL=", 6) == 0 ||
strncmp (*envp, "TERM=", 5) == 0)
addenv (*envp,
((void *)0)
);
envp++;
}
} else {
while (
((void *)0)
!= *envp) {
addenv (*envp,
((void *)0)
);
envp++;
}
}
err = shell (prog, initflag ? (char *) 0 : progbase, newenvp);
exit ((err ==
2
) ? 127 : 126);
failure:
closelog ();
exit (
1
);
}
| void main(int param_1,undefined8 *param_2)
{
uint uVar1;
__gid_t __gid;
bool bVar2;
bool bVar3;
bool bVar4;
FILE *__stream;
char cVar5;
int iVar6;
__uid_t _Var7;
char *pcVar8;
undefined8 *puVar9;
char *pcVar10;
char **ppcVar11;
int *piVar12;
long lVar13;
undefined8 uVar14;
long lVar15;
char **local_a8;
int local_9c;
int local_94;
char *local_88;
char *local_80;
char *local_78;
char **local_70;
group *local_68;
char *local_60;
char *local_58;
bVar4 = false;
bVar2 = false;
bVar3 = false;
local_78 = (char *)0x0;
local_70 = environ;
setlocale(6,"");
bindtextdomain("shadow","/usr/share/locale");
textdomain("shadow");
Prog = (char *)Basename(*param_2);
log_set_progname(Prog);
log_set_logfd(stderr);
iVar6 = strcmp(Prog,"newgrp");
is_newgrp = iVar6 == 0;
if ((bool)is_newgrp) {
pcVar8 = "newgrp";
}
else {
pcVar8 = "sg";
}
openlog(pcVar8,1,0x50);
local_9c = param_1 + -1;
local_a8 = (char **)(param_2 + 1);
initenv();
puVar9 = (undefined8 *)get_my_pwent();
pcVar8 = Prog;
if (puVar9 == (undefined8 *)0x0) {
pcVar10 = (char *)gettext("%s: Cannot determine your user name.\n");
fprintf(stderr,pcVar10,pcVar8);
pcVar8 = setlocale(6,(char *)0x0);
local_60 = (char *)0x0;
if (pcVar8 != (char *)0x0) {
local_60 = strdup(pcVar8);
}
if (local_60 != (char *)0x0) {
setlocale(6,"C");
}
_Var7 = getuid();
syslog(4,"Cannot determine the user name of the caller (UID %lu)",(ulong)_Var7);
if (local_60 != (char *)0x0) {
setlocale(6,local_60);
free(local_60);
}
closelog();
exit(1);
}
uVar14 = *puVar9;
if ((0 < local_9c) &&
((iVar6 = strcmp(*local_a8,"-"), iVar6 == 0 || (iVar6 = strcmp(*local_a8,"-l"), iVar6 == 0))))
{
local_9c = param_1 + -2;
local_a8 = (char **)(param_2 + 2);
bVar4 = true;
}
if (is_newgrp == '\x01') {
if ((0 < local_9c) && (**local_a8 == '-')) {
usage();
goto LAB_00100fdb;
}
if (*local_a8 == (char *)0x0) {
ppcVar11 = (char **)xgetgrgid(*(undefined4 *)((long)puVar9 + 0x14));
pcVar8 = Prog;
if (ppcVar11 == (char **)0x0) {
uVar1 = *(uint *)((long)puVar9 + 0x14);
pcVar10 = (char *)gettext("%s: GID \'%lu\' does not exist\n");
fprintf(stderr,pcVar10,pcVar8,(ulong)uVar1);
pcVar8 = setlocale(6,(char *)0x0);
local_58 = (char *)0x0;
if (pcVar8 != (char *)0x0) {
local_58 = strdup(pcVar8);
}
if (local_58 != (char *)0x0) {
setlocale(6,"C");
}
syslog(2,"GID \'%lu\' does not exist",(ulong)*(uint *)((long)puVar9 + 0x14));
if (local_58 != (char *)0x0) {
setlocale(6,local_58);
free(local_58);
}
goto LAB_00100fdb;
}
local_80 = *ppcVar11;
}
else {
local_80 = *local_a8;
}
}
else {
if ((local_9c < 1) || (**local_a8 == '-')) {
usage();
closelog();
exit(1);
}
local_80 = *local_a8;
if (0 < local_9c + -1) {
if ((local_9c + -1 < 2) || (iVar6 = strcmp(local_a8[1],"-c"), iVar6 != 0)) {
local_78 = local_a8[1];
}
else {
local_78 = local_a8[2];
}
bVar3 = true;
}
}
local_94 = 0x10;
while( true ) {
grouplist = (__gid_t *)xmalloc();
ngroups = getgroups(local_94,grouplist);
if ((ngroups < local_94) &&
((ngroups != -1 || (piVar12 = __errno_location(), *piVar12 != 0x16)))) break;
free(grouplist);
local_94 = local_94 << 1;
}
if (ngroups < 0) {
perror("getgroups");
exit(1);
}
local_68 = getgrnam(local_80);
pcVar8 = Prog;
if (local_68 != (group *)0x0) {
local_94 = 0;
do {
if (ngroups <= local_94) {
LAB_00100b83:
if (((!bVar2) &&
(local_68 = (group *)find_matching_group(uVar14,local_68), local_68 == (group *)0x0)) &&
(local_68 = (group *)xgetgrnam(local_80), local_68 == (group *)0x0)) {
__assert_fail("NULL != grp","newgrp.c",0x286,(char *)&__PRETTY_FUNCTION___5557);
}
lVar13 = getsgnam(local_80);
if (lVar13 != 0) {
local_68->gr_passwd = *(char **)(lVar13 + 8);
local_68->gr_mem = *(char ***)(lVar13 + 0x18);
}
if (!bVar2) {
check_perms(local_68,puVar9,local_80);
}
cVar5 = getdef_bool();
if (cVar5 != '\0') {
syslog_sg(uVar14,local_80);
}
__gid = local_68->gr_gid;
for (local_94 = 0; (local_94 < ngroups && (__gid != grouplist[local_94]));
local_94 = local_94 + 1) {
}
if (local_94 == ngroups) {
lVar15 = (long)ngroups;
lVar13 = sysconf(3);
__stream = stderr;
if (lVar15 < lVar13) {
lVar13 = (long)ngroups;
ngroups = ngroups + 1;
grouplist[lVar13] = __gid;
iVar6 = setgroups((long)ngroups,grouplist);
if (iVar6 != 0) {
perror("setgroups");
}
}
else {
pcVar8 = (char *)gettext("too many groups\n");
fputs(pcVar8,__stream);
}
}
endspent();
endsgent();
endpwent();
endgrent();
iVar6 = setgid(__gid);
if (iVar6 == 0) {
_Var7 = getuid();
iVar6 = setuid(_Var7);
if (iVar6 != 0) {
perror("setuid");
exit(1);
}
if (!bVar3) {
local_88 = getenv("SHELL");
if ((bVar4) || (local_88 == (char *)0x0)) {
if ((puVar9[5] == 0) || (*(char *)puVar9[5] == '\0')) {
local_88 = "/bin/bash";
}
else {
local_88 = (char *)puVar9[5];
}
}
uVar14 = Basename(local_88);
if (bVar4) {
iVar6 = chdir((char *)puVar9[4]);
if (iVar6 != 0) {
perror("chdir");
}
for (; *local_70 != (char *)0x0; local_70 = local_70 + 1) {
iVar6 = strncmp(*local_70,"PATH=",5);
if ((((iVar6 == 0) || (iVar6 = strncmp(*local_70,"HOME=",5), iVar6 == 0)) ||
(iVar6 = strncmp(*local_70,"SHELL=",6), iVar6 == 0)) ||
(iVar6 = strncmp(*local_70,"TERM=",5), iVar6 == 0)) {
addenv(*local_70,0);
}
}
}
else {
for (; *local_70 != (char *)0x0; local_70 = local_70 + 1) {
addenv(*local_70,0);
}
}
if (bVar4) {
uVar14 = 0;
}
iVar6 = shell(local_88,uVar14,newenvp);
if (iVar6 == 2) {
iVar6 = 0x7f;
}
else {
iVar6 = 0x7e;
}
exit(iVar6);
}
closelog();
execl("/bin/bash","sh",&DAT_001011d4,local_78,0);
perror("/bin/bash");
piVar12 = __errno_location();
if (*piVar12 == 2) {
iVar6 = 0x7f;
}
else {
iVar6 = 0x7e;
}
exit(iVar6);
}
perror("setgid");
exit(1);
}
if (local_68->gr_gid == grouplist[local_94]) {
bVar2 = true;
goto LAB_00100b83;
}
local_94 = local_94 + 1;
} while( true );
}
pcVar10 = (char *)gettext("%s: group \'%s\' does not exist\n");
fprintf(stderr,pcVar10,pcVar8,local_80);
LAB_00100fdb:
closelog();
exit(1);
}
|
static void
print_compoptions (copts, full)
unsigned long copts;
int full;
{
const struct _compopt *co;
for (co = compopts; co->optname; co++)
if (copts & co->optflag)
printf ("-o %s ", co->optname);
else if (full)
printf ("+o %s ", co->optname);
}
| void print_compoptions(ulong param_1,int param_2)
{
undefined1 *local_10;
for (local_10 = compopts; *(long *)local_10 != 0; local_10 = (undefined1 *)((long)local_10 + 0x10)
) {
if ((*(ulong *)((long)local_10 + 8) & param_1) == 0) {
if (param_2 != 0) {
printf("+o %s ",*(long *)local_10);
}
}
else {
printf("-o %s ",*(long *)local_10);
}
}
return;
}
|
static __inline__ int get_user_hz(void)
{
if (__iproute2_user_hz_internal == 0)
__iproute2_user_hz_internal = __get_user_hz();
return __iproute2_user_hz_internal;
}
| int get_user_hz() {
if (!__iproute2_user_hz_internal)
__iproute2_user_hz_internal = __get_user_hz();
return __iproute2_user_hz_internal;
}
|
ed_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
{
if (el->el_line.cursor > el->el_line.buffer) {
el->el_line.cursor -= el->el_state.argument;
if (el->el_line.cursor < el->el_line.buffer)
el->el_line.cursor = el->el_line.buffer;
if (el->el_map.type == 1)
if (el->el_chared.c_vcmd.action != 0x00) {
cv_delfini(el);
return 4;
}
return 5;
} else
return 6;
}
| long long ed_prev_char(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned long long v2;
v0 = a1;
if (a0->field_58 <= a0->field_50) {
v2 = 6;
return v2;
}
a0->field_58 = a0->field_58 + -(a0->field_78 << 2);
if (a0->field_58 < a0->field_50)
a0->field_58 = a0->field_50;
if (a0->field_420 != 1) {
v2 = 5;
return v2;
} else if (!a0->field_3c0) {
v2 = 5;
return v2;
} else {
cv_delfini(a0);
v2 = 4;
return v2;
}
}
|
static size_t
print_name_with_quoting (const struct fileinfo *f,
_Bool
symlink_target,
struct obstack *stack,
size_t start_col)
{
char const *name = symlink_target ? f->linkname : f->name;
const struct bin_str *color = print_with_color ?
get_color_indicator (f, symlink_target) :
((void *)0)
;
_Bool
used_color_this_time = (print_with_color
&& (color || is_colored (C_NORM)));
size_t len = quote_name (name, filename_quoting_options, f->quoted,
color, !symlink_target, stack, f->absolute_name);
process_signals ();
if (used_color_this_time)
{
prep_non_filename_text ();
if (line_length
&& (start_col / line_length != (start_col + len - 1) / line_length))
put_indicator (&color_indicator[C_CLR_TO_EOL]);
}
return len;
}
| size_t print_name_with_quoting(long a1, char a2, struct obstack *a3, unsigned long a4)
{
char *v4;
long *color_indicator;
bool v6;
bool v10;
char *v11;
long v12;
size_t v13;
if ( a2 )
v4 = *(char **)(a1 + 8);
else
v4 = *(char **)a1;
v11 = v4;
if ( print_with_color )
color_indicator = get_color_indicator(a1, a2);
else
color_indicator = 0LL;
v12 = (long)color_indicator;
v6 = print_with_color && (color_indicator || is_colored(4u));
v10 = v6;
v13 = quote_name(v11, filename_quoting_options, *(_DWORD *)(a1 + 196), v12, a2 == 0, a3, *(char **)(a1 + 16));
process_signals();
if ( v10 )
{
prep_non_filename_text();
if ( line_length )
{
if ( a4 / line_length != (a4 + v13 - 1) / line_length )
put_indicator((long)&unk_10870);
}
}
return v13;
}
|
ifa->ifa_family ==
10
) {
print_bool(PRINT_ANY,
"temporary", "temporary ",
1
);
} else {
| void print_bool(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned long a3) {
unsigned long long v1;
v1 = print_color_bool(a0, 0x6, a1, a2, a3);
return;
}
|
static char *whoami (void)
{
struct group *grp = getgrgid (getgid ());
struct passwd *usr = getpwuid (getuid ());
if ( (
((void *)0)
!= usr)
&& (
((void *)0)
!= grp)
&& (0 == strcmp (usr->pw_name, grp->gr_name))) {
return xstrdup (usr->pw_name);
} else {
return
((void *)0)
;
}
}
| long whoami()
{
__gid_t v0;
__uid_t v1;
struct group *v3;
struct passwd *v4;
v0 = getgid();
v3 = getgrgid(v0);
v1 = getuid();
v4 = getpwuid(v1);
if ( v4 && v3 && !strcmp(v4->pw_name, v3->gr_name) )
return xstrdup(v4->pw_name);
else
return 0LL;
}
|
static void
format_user_or_group (char const *name, uintmax_t id, int width)
{
if (name)
{
int width_gap = width - gnu_mbswidth (name, 0);
int pad =
(((
0
)>(
width_gap
))?(
0
):(
width_gap
))
;
dired_outstring (name);
do
dired_outbyte (' ');
while (pad--);
}
else
dired_pos += printf ("%*"
"l" "u"
" ", width, id);
}
| long format_user_or_group(const char *a1, long a2, int a3)
{
int v3;
long result;
unsigned int v5;
int v6;
if ( a1 )
{
v6 = a3 - gnu_mbswidth(a1, 0LL);
v3 = 0;
if ( v6 >= 0 )
v3 = v6;
v5 = v3;
dired_outstring(a1);
do
{
dired_outbyte(32);
result = v5--;
}
while ( (_DWORD)result );
}
else
{
result = printf("%*lu ", a3, a2) + dired_pos;
dired_pos = result;
}
return result;
}
|
int gzgetc(file)
gzFile file;
{
unsigned char buf[1];
gz_statep state;
if (file ==
((void *)0)
)
return -1;
state = (gz_statep)file;
if (state->mode != 7247 ||
(state->err != 0 && state->err != (-5)))
return -1;
if (state->x.have) {
state->x.have--;
state->x.pos++;
return *(state->x.next)++;
}
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
}
| ulong gzgetc(int *param_1)
{
byte *pbVar1;
ulong uVar2;
long lVar3;
long in_FS_OFFSET;
byte local_11;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (param_1 == (int *)0x0) {
uVar2 = 0xffffffff;
}
else if ((param_1[6] == 0x1c4f) && ((param_1[0x1d] == 0 || (param_1[0x1d] == -5)))) {
if (*param_1 == 0) {
lVar3 = gz_read(param_1,&local_11,1);
if (lVar3 == 0) {
uVar2 = 0xffffffff;
}
else {
uVar2 = (ulong)local_11;
}
}
else {
*param_1 = *param_1 + -1;
*(long *)(param_1 + 4) = *(long *)(param_1 + 4) + 1;
pbVar1 = *(byte **)(param_1 + 2);
*(byte **)(param_1 + 2) = pbVar1 + 1;
uVar2 = (ulong)*pbVar1;
}
}
else {
uVar2 = 0xffffffff;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
}
|
static int
getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data)
{
SHA512_CTX *ctx = data;
SHA512Update
(ctx, (uint8_t *)&info->dlpi_addr, sizeof (info->dlpi_addr));
return (0);
}
| long long getentropy_phdr(unsigned long long a0, unsigned long a1, unsigned long long a2) {
unsigned long v0;
v0 = a1;
SHA512Update(a2, a0, 0x8, a0);
return 0;
}
|
int main(int argn, char *argv[]) {
int opt;
char *include, *exclude, *command;
int flags;
time_t start, next, end = 0;
int endtime, printjobs;
cron_db db;
int installed = 0;
include =
((void *)0)
;
exclude =
((void *)0)
;
command =
((void *)0)
;
flags = 0x04;
endtime = 0;
printjobs = 0;
start = time(
((void *)0)
) / 60 * 60;
while (-1 != (opt = getopt(argn, argv, "i:e:ast:q:j:lcfhV"))) {
switch (opt) {
case 'i':
include = optarg;
break;
case 'e':
exclude = optarg;
break;
case 'a':
installed = 1;
break;
case 's':
flags &= ~0x04;
break;
case 't':
start = atoi(optarg) / 60 * 60;
break;
case 'q':
end = atoi(optarg) / 60 * 60;
endtime = 1;
break;
case 'j':
command = optarg;
break;
case 'l':
printjobs = 1;
break;
case 'c':
flags |= 0x01 | 0x02;
break;
case 'f':
flags |= 0x08 | 0x01;
break;
case 'h':
usage();
return
0
;
case 'V':
puts("cronie 1.6.1");
return
0
;
default:
fprintf(
stderr
, "unrecognized option: %s\n",
argv[optind - 1]);
usage();
exit(
1
);
}
}
if (flags & 0x08 && !endtime) {
fprintf(
stderr
, "no ending time specified: -f requires -q\n");
usage();
exit(
1
);
}
if (!endtime)
end = start + 8 * 12 * 31 * 24 * 60 * 60;
if (flags & 0x02) {
printf("spool: %s\n", "/usr/local/var/spool/cron");
set_debug_flags("");
}
db = database(installed || argv[optind] ==
((void *)0)
, argv + optind);
next = cronnext(db, start, end, include, exclude, command, flags);
if (next == -1)
return
1
;
else
printf("next: %ld\n", (long) next);
if (printjobs) {
printf("nextjobs:\n");
cronnext(db, next, next, include, exclude, command, (flags & 0x04) | 0x01);
}
return
0
;
}
| int main(unsigned long a0, unsigned long long *a1) {
unsigned long long v0;
unsigned long long v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
void* v7;
void* v8;
void* v9;
unsigned int v10;
unsigned long v11;
unsigned int v12;
char v13;
char v14;
char v15;
unsigned int v17;
unsigned long long v18;
unsigned long long v19;
unsigned long long v20;
v11 = 0;
v5 = 0;
v7 = 0;
v8 = 0;
v9 = 0;
v2 = 4;
v3 = 0;
v4 = 0;
v17 = time(NULL);
*(&v10) = (((v17 * 9838263505978427529 >> 64) + v17 >> 5) - (v17 >> 63)) * 60;
while (true) {
v6 = getopt(a0, a1, "i:e:ast:q:j:lcfhV");
if (v6 != -1) {
switch (v6) {
case 86:
puts("cronie 1.6.1");
v17 = 0;
case 97:
v5 = 1;
break;
case 99:
v2 |= 3;
break;
case 101:
v8 = *(&optarg);
break;
case 102:
v2 |= 9;
break;
case 104:
usage();
v17 = 0;
case 105:
v7 = *(&optarg);
break;
case 106:
v9 = *(&optarg);
break;
case 108:
v4 = 1;
break;
case 113:
v18 = atoi(*(&optarg));
v17 = (((v18 * -2004318071 >> 32) + v18 >> 5) - (v18 >> 31)) * 60;
v11 = v17;
v3 = 1;
break;
case 115:
v2 &= -5;
break;
case 116:
v19 = atoi(*(&optarg));
v17 = (((v19 * -2004318071 >> 32) + v19 >> 5) - (v19 >> 31)) * 60;
v10 = v17;
break;
default:
fprintf(*(&stderr), "unrecognized option: %s\n", a1[1 + *(&optind)]);
usage();
exit(0x1);
}
} else {
if ((v2 & 8) && !v3) {
fprintf(*(&stderr), "no ending time specified: -f requires -q\n");
usage();
exit(0x1);
}
if (!(v2 & 8) || v3) {
if (!v3)
v11 = *(&v10) + 0xf537000;
if ((v2 & 2)) {
printf("spool: %s\n", &g_4015ca);
set_debug_flags(&g_401244);
}
if (!v5 && a1[*(&optind)])
v20 = 0;
if (!a1[*(&optind)] || v5)
v20 = 1;
database(&v13, v20, &a1[*(&optind)]);
v1 = *(&v15);
v0 = *(&v14);
*(&v12) = cronnext(*(&v10), v11, v7, v8, v9, v2, *(&v13));
if (*(&v12) == -1) {
v17 = 1;
break;
} else {
printf("next: %ld\n", *(&v12));
if (v4) {
printf("nextjobs:\n");
v1 = *(&v15);
v0 = *(&v14);
cronnext(*(&v12), *(&v12), v7, v8, v9, v2 & 4 | 1, *(&v13));
}
v17 = 0;
break;
}
}
}
}
return v17;
}
|
void write_buf(fd, buf, cnt)
int fd;
voidp buf;
unsigned cnt;
{
unsigned n;
bytes_out += cnt;
if (test)
return;
while ((n = write_buffer (fd, buf, cnt)) != cnt) {
if (n == (unsigned)(-1)) {
write_error();
}
cnt -= n;
buf = (voidp)((char*)buf+n);
}
}
| long write_buf(int a1, char *a2, int a3)
{
long result;
int v5;
unsigned int v6;
v5 = a3;
bytes_out += (unsigned int)a3;
result = test;
if ( !test )
{
while ( 1 )
{
v6 = write_buffer(a1, a2, v5);
result = v6;
if ( v6 == v5 )
break;
if ( v6 == -1 )
write_error();
v5 -= v6;
a2 += v6;
}
}
return result;
}
|
static
_Bool
append_equiv_class (struct Spec_list *list,
char const *equiv_class_str, size_t len)
{
if (len != 1)
return
0
;
struct List_element *new = xmalloc (sizeof *new);
new->next =
((void *)0)
;
new->type = RE_EQUIV_CLASS;
new->u.equiv_code = *equiv_class_str;
((void) sizeof ((
list->tail
) ? 1 : 0), __extension__ ({ if (
list->tail
) ; else __assert_fail (
"list->tail"
, "src/tr.c", 743, __extension__ __PRETTY_FUNCTION__); }))
;
list->tail->next = new;
list->tail = new;
return
1
;
}
| undefined8 append_equiv_class(long param_1,undefined *param_2,long param_3)
{
undefined8 uVar1;
undefined4 *puVar2;
if (param_3 == 1) {
puVar2 = (undefined4 *)xmalloc(0x20);
*(undefined8 *)(puVar2 + 2) = 0;
*puVar2 = 3;
*(undefined *)(puVar2 + 4) = *param_2;
if (*(long *)(param_1 + 8) == 0) {
__assert_fail("list->tail","src/tr.c",0x2e7,"append_equiv_class");
}
*(undefined4 **)(*(long *)(param_1 + 8) + 8) = puVar2;
*(undefined4 **)(param_1 + 8) = puVar2;
uVar1 = 1;
}
else {
uVar1 = 0;
}
return uVar1;
}
|
SHELL_VAR **
all_shell_variables ()
{
return (vapply ((sh_var_map_func_t *)
((void *)0)
));
}
| void *all_shell_variables()
{
return vapply(0LL);
}
|
char *
lookupvar(const char *name)
{
struct var *v;
if ((v = *findvar(hashvar(name), name)) && !(v->flags & 0x20)) {
if (v == &(&(&(&(&(&(&(&(&varinit[0])[1])[1])[1])[1])[1])[1])[1])[1] && v->text == linenovar) {
fmtstr(linenovar+7, sizeof(linenovar)-7, "%d", lineno);
}
return strchrnul(v->text, '=') + 1;
}
return
((void *)0)
;
}
| int lookupvar(unsigned long long a0) {
unsigned long v0;
unsigned int v2;
v2 = *(findvar(hashvar(a0), a0));
*(&v0) = v2;
if (!v0) {
v2 = 0;
return v2;
} else if (!(*((v0 + 8)) & 32)) {
if (v0 == 0x401400 && *((v0 + 16)) == "LINENO=")
fmtstr(&g_4010b7, 0xc, "%d", 0xe0c1fc458bfc7d89);
v2 = (strchrnul(*((v0 + 16)), 0x3d) + 1);
return v2;
} else {
v2 = 0;
return v2;
}
}
|
int
sshkey_check_rsa_length(const struct sshkey *k, int min_size)
{
const BIGNUM *rsa_n;
int nbits;
if (k ==
((void *)0)
|| k->rsa ==
((void *)0)
||
(k->type != KEY_RSA && k->type != KEY_RSA_CERT))
return 0;
RSA_get0_key(k->rsa, &rsa_n,
((void *)0)
,
((void *)0)
);
nbits = BN_num_bits(rsa_n);
if (nbits < 1024 ||
(min_size > 0 && nbits < min_size))
return -56;
return 0;
}
| int sshkey_check_rsa_length(struct_0 *a0, unsigned long a1) {
unsigned int v0;
char v1;
unsigned int v3;
if (!a0) {
v3 = 0;
return v3;
} else if (!a0->field_8) {
v3 = 0;
return v3;
} else {
switch (a0->field_0) {
case 0: case 4:
RSA_get0_key(a0->field_8, &v1, 0x0, 0x0);
v0 = BN_num_bits(*(&v1));
if (v0 <= 1023) {
v3 = -56;
return v3;
} else if (a1 <= 0) {
v3 = 0;
return v3;
} else if (v0 >= a1) {
v3 = 0;
return v3;
} else {
v3 = -56;
return v3;
}
default:
v3 = 0;
return v3;
}
}
}
|
ssize_t
acl_copy_ext(void *buf_p, acl_t acl, ssize_t size)
{
struct __acl *acl_ext = (struct __acl *)buf_p;
struct __acl_entry *ent_p = acl_ext->x_entries;
acl_obj *acl_obj_p = ((acl_obj *)__ext2int_and_check(acl, (0x712C)));
acl_entry_obj *entry_obj_p;
ssize_t size_required;
if (!acl_obj_p)
return -1;
size_required = sizeof(struct __acl) +
acl_obj_p->i.a_used * sizeof(struct __acl_entry);
if (size < size_required) {
(*__errno_location ())
=
34
;
return -1;
}
acl_ext->x_size = size_required;
for( (entry_obj_p) = (acl_obj_p)->i.a_next; (entry_obj_p) != (acl_entry_obj *)(acl_obj_p); (entry_obj_p) = (entry_obj_p)->i.e_next ) {
*ent_p++ = entry_obj_p->i.e_entry;
}
return 0;
}
| long acl_copy_ext(long *a1, long a2, long a3)
{
long *v4;
long v5;
long v6;
long *v8;
_QWORD *i;
long v10;
long v11;
v8 = a1 + 1;
v10 = _ext2int_and_check(a2, 28972LL);
if ( !v10 )
return -1LL;
v11 = 40LL * *(_QWORD *)(v10 + 48) + 8;
if ( a3 >= v11 )
{
*a1 = v11;
for ( i = *(_QWORD **)(v10 + 16); i != (_QWORD *)v10; i = (_QWORD *)i[2] )
{
v4 = v8;
v8 += 5;
v5 = i[5];
*v4 = i[4];
v4[1] = v5;
v6 = i[7];
v4[2] = i[6];
v4[3] = v6;
v4[4] = i[8];
}
return 0LL;
}
else
{
*_errno_location() = 34;
return -1LL;
}
}
|
static void
bind_arrow_keys (void)
{
bind_arrow_keys_internal (emacs_standard_keymap);
bind_arrow_keys_internal (vi_movement_keymap);
if (vi_movement_keymap[(('[') & 0x1f)].type == 1)
rl_bind_keyseq_in_map ("\033", (rl_command_func_t *)
((void *)0)
, vi_movement_keymap);
bind_arrow_keys_internal (vi_insertion_keymap);
}
| void bind_arrow_keys(void)
{
bind_arrow_keys_internal(&emacs_standard_keymap);
bind_arrow_keys_internal(&vi_movement_keymap);
if (rl_bind_keyseq_if_unbound == (code)0x1) {
rl_bind_keyseq_in_map(&DAT_001022b8,0,&vi_movement_keymap);
}
bind_arrow_keys_internal(&vi_insertion_keymap);
return;
}
|
int
all_digits (string)
const char *string;
{
register const char *s;
for (s = string; *s; s++)
if (((*s) >= '0' && (*s) <= '9') == 0)
return (0);
return (1);
}
| undefined8 all_digits(char *param_1)
{
bool bVar1;
while( true ) {
if (*param_1 == '\0') {
return 1;
}
if ((*param_1 < '0') || ('9' < *param_1)) {
bVar1 = false;
}
else {
bVar1 = true;
}
if (!bVar1) break;
param_1 = param_1 + 1;
}
return 0;
}
|
int
sshbuf_put_ec(struct sshbuf *buf, const EC_POINT *v, const EC_GROUP *g)
{
u_char d[((528 * 2 / 8) + 1)];
size_t len;
int ret;
if ((len = EC_POINT_point2oct(g, v, POINT_CONVERSION_UNCOMPRESSED,
((void *)0)
, 0,
((void *)0)
)) > ((528 * 2 / 8) + 1)) {
return -10;
}
if (EC_POINT_point2oct(g, v, POINT_CONVERSION_UNCOMPRESSED,
d, len,
((void *)0)
) != len) {
return -1;
}
ret = sshbuf_put_string(buf, d, len);
explicit_bzero(d, len);
return ret;
}
| long sshbuf_put_ec(long a1, long a2, long a3)
{
unsigned int v5;
unsigned long v6;
char v7[136];
unsigned long v8;
v8 = __readfsqword(0x28u);
v6 = EC_POINT_point2oct(a3, a2, 4LL, 0LL, 0LL, 0LL);
if ( v6 > 0x85 )
return 4294967286LL;
if ( v6 != EC_POINT_point2oct(a3, a2, 4LL, v7, v6, 0LL) )
return 0xFFFFFFFFLL;
v5 = sshbuf_put_string(a1, v7, v6);
explicit_bzero(v7, v6);
return v5;
}
|
static int
key_type_is_ecdsa_variant(int type)
{
switch (type) {
case KEY_ECDSA:
case KEY_ECDSA_CERT:
case KEY_ECDSA_SK:
case KEY_ECDSA_SK_CERT:
return 1;
}
return 0;
}
| int key_type_is_ecdsa_variant(unsigned long a0) {
unsigned int v1;
if (11 >= a0 && ((1 << (a0 & 63)) & 3140))
v1 = 1;
if (11 < a0 || !((1 << (a0 & 63)) & 3140))
v1 = 0;
return v1;
}
|
static int netns_list(int argc, char **argv)
{
struct dirent *entry;
DIR *dir;
int id;
dir = opendir("/var/run/netns");
if (!dir)
return 0;
new_json_obj(json);
while ((entry = readdir(dir)) !=
((void *)0)
) {
if (strcmp(entry->d_name, ".") == 0)
continue;
if (strcmp(entry->d_name, "..") == 0)
continue;
open_json_object(
((void *)0)
);
print_string(PRINT_ANY, "name",
"%s", entry->d_name);
if (ipnetns_have_nsid()) {
id = get_netnsid_from_name(entry->d_name);
if (id >= 0)
print_int(PRINT_ANY, "id", " (id: %d)", id);
}
print_string(PRINT_FP,
((void *)0)
, "\n",
((void *)0)
);
close_json_object();
}
closedir(dir);
delete_json_obj();
return 0;
}
| void netns_list(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
unsigned long v4;
void* v6;
void* v7;
v1 = a0;
v0 = a1;
v3 = opendir("/var/run/netns");
if (!v3) {
v6 = 0;
return;
}
new_json_obj(json);
while (true) {
do {
do {
v4 = readdir64(v3);
if (!v4) {
closedir(v3);
delete_json_obj(a0, a1, "\n", 0x0, a4, a5);
v7 = 0;
return;
}
} while (!strcmp(v4 + 19, "."));
} while (!strcmp(v4 + 19, ".."));
open_json_object(0x0);
print_string(0x4, "name", "%s", v4 + 19);
if (ipnetns_have_nsid()) {
v2 = get_netnsid_from_name(v4 + 19);
if (v2 >= 0)
print_int(0x4, "id", " (id: %d)", v2);
}
print_string(0x1, 0x0, "\n", 0x0);
close_json_object(0x1, 0x0, "\n", 0x0, a4, a5);
}
}
|
static int
vi_edit_and_execute_command (count, c)
int count, c;
{
if (posixly_correct)
return (edit_and_execute_command (count, c, 0, "fc -e vi"));
else
return (edit_and_execute_command (count, c, 0, "fc -e \"${VISUAL:-${EDITOR:-vi}}\""));
}
| long long vi_edit_and_execute_command(unsigned long a0, unsigned long a1) {
unsigned long long v1;
if (posixly_correct)
v1 = edit_and_execute_command(a0, a1, 0, "fc -e vi");
else
v1 = edit_and_execute_command(a0, a1, 0, "fc -e \"${VISUAL:-${EDITOR:-vi}}\"");
return v1;
}
|
const char *
ssh_local_ipaddr(struct ssh *ssh)
{
(void)ssh_remote_ipaddr(ssh);
return ssh->local_ipaddr;
}
| undefined8 ssh_local_ipaddr(long param_1)
{
ssh_remote_ipaddr(param_1);
return *(undefined8 *)(param_1 + 0x20);
}
|
static inline SHELL_VAR *
set_int_value (SHELL_VAR *var, intmax_t value, int flags)
{
char *p;
p = itos (value);
do { if (((var)->value)) sh_xfree((((var)->value)), "variables.c", 1319); } while (0);
((var)->value = (p));
if (flags & 1)
((var)->attributes |= (0x0000010));
return (var);
}
| void set_int_value(struct_0 *a0, unsigned long long a1, unsigned long a2) {
unsigned long v0;
struct_0 *v2;
v0 = itos(a1);
if (a0->field_8)
sh_xfree(a0->field_8, "variables.c", 0x527);
a0->field_8 = v0;
if ((a2 & 1))
a0->field_28 = a0->field_28 | 16;
v2 = a0;
return;
}
|
static int
bash_filename_stat_hook (dirname)
char **dirname;
{
char *local_dirname, *new_dirname, *t;
int should_expand_dirname, return_value;
int global_nounset;
WORD_LIST *wl;
local_dirname = *dirname;
should_expand_dirname = return_value = 0;
if (t = mbschr (local_dirname, '$'))
should_expand_dirname = '$';
else if (t = mbschr (local_dirname, '`'))
should_expand_dirname = '`';
if (should_expand_dirname && directory_exists (local_dirname, 0))
should_expand_dirname = 0;
if (should_expand_dirname)
{
new_dirname = (char *)strcpy (sh_xmalloc((1 + strlen (local_dirname)), "bashline.c", 3395), (local_dirname));
global_nounset = unbound_vars_is_error;
unbound_vars_is_error = 0;
wl = expand_prompt_string (new_dirname, 0, (1 << 10)|(1 << 20)|(1 << 27));
unbound_vars_is_error = global_nounset;
if (wl)
{
sh_xfree((new_dirname), "bashline.c", 3404);
new_dirname = string_list (wl);
if (new_dirname && *new_dirname)
{
sh_xfree((local_dirname), "bashline.c", 3411);
local_dirname = *dirname = new_dirname;
return_value = ((local_dirname)[0] == (*dirname)[0] && strcmp(local_dirname, *dirname) == 0) == 0;
}
else
sh_xfree((new_dirname), "bashline.c", 3416);
dispose_words (wl);
}
else
sh_xfree((new_dirname), "bashline.c", 3420);
}
if (no_symbolic_links == 0 && (local_dirname[0] != '.' || local_dirname[1]))
{
char *temp1, *temp2;
t = get_working_directory ("symlink-hook");
temp1 = make_absolute (local_dirname, t);
sh_xfree((t), "bashline.c", 3432);
temp2 = sh_canonpath (temp1, 0x0001|0x0002);
if (temp2 == 0)
{
sh_xfree((temp1), "bashline.c", 3438);
return return_value;
}
sh_xfree((local_dirname), "bashline.c", 3442);
*dirname = temp2;
sh_xfree((temp1), "bashline.c", 3444);
}
return (return_value);
}
| _BOOL8 bash_filename_stat_hook(char **a1)
{
size_t v1;
char *v2;
int v4;
_BOOL4 v5;
int v6;
char *s;
long working_directory;
char *v9;
const char *v10;
long v11;
long absolute;
const char *v13;
s = *a1;
v5 = 0;
v4 = 0;
if ( mbschr(*a1, 36LL) )
{
v4 = 36;
}
else if ( mbschr(s, 96LL) )
{
v4 = 96;
}
if ( v4 && directory_exists(s, 0) )
v4 = 0;
if ( v4 )
{
v1 = strlen(s);
v2 = (char *)sh_xmalloc(v1 + 1, "bashline.c", 3395LL);
v9 = strcpy(v2, s);
v6 = unbound_vars_is_error;
unbound_vars_is_error = 0;
v11 = expand_prompt_string(v9, 0LL, 135267328LL);
unbound_vars_is_error = v6;
if ( v11 )
{
sh_xfree(v9, "bashline.c", 3404LL);
v10 = (const char *)string_list(v11);
if ( v10 && *v10 )
{
sh_xfree(s, "bashline.c", 3411LL);
*a1 = (char *)v10;
s = *a1;
v5 = strcmp(*a1, *a1) != 0;
}
else
{
sh_xfree(v10, "bashline.c", 3416LL);
}
dispose_words(v11);
}
else
{
sh_xfree(v9, "bashline.c", 3420LL);
}
}
if ( !no_symbolic_links && (*s != 46 || s[1]) )
{
working_directory = get_working_directory("symlink-hook");
absolute = make_absolute(s, working_directory);
sh_xfree(working_directory, "bashline.c", 3432LL);
v13 = (const char *)sh_canonpath(absolute, 3LL);
if ( !v13 )
{
sh_xfree(absolute, "bashline.c", 3438LL);
return v5;
}
sh_xfree(s, "bashline.c", 3442LL);
*a1 = (char *)v13;
sh_xfree(absolute, "bashline.c", 3444LL);
}
return v5;
}
|
static struct sftp_conn *
do_sftp_connect(char *host, char *user, int port, char *sftp_direct,
int *reminp, int *remoutp, int *pidp)
{
if (sftp_direct ==
((void *)0)
) {
if (do_cmd(ssh_program, host, user, port, 1, "sftp",
reminp, remoutp, pidp) < 0)
return
((void *)0)
;
} else {
freeargs(&args);
addargs(&args, "sftp-server");
if (do_cmd(sftp_direct, host,
((void *)0)
, -1, 0, "sftp",
reminp, remoutp, pidp) < 0)
return
((void *)0)
;
}
return do_init(*reminp, *remoutp, 32768, 64, limit_kbps);
}
| long do_sftp_connect(
const char *a1,
const char *a2,
int a3,
const char *a4,
_DWORD *a5,
_DWORD *a6,
__pid_t *a7)
{
if ( a4 )
{
freeargs(&args);
addargs(&args, "sftp-server");
if ( (int)do_cmd(a4, a1, 0LL, -1, 0, "sftp", a5, a6, a7) < 0 )
return 0LL;
}
else if ( (int)do_cmd(ssh_program, a1, a2, a3, 1, "sftp", a5, a6, a7) < 0 )
{
return 0LL;
}
return do_init((unsigned int)*a5, (unsigned int)*a6, 0x8000LL, 64LL, limit_kbps);
}
|
static void nh_final(nh_ctx *hc, UINT8 *result)
{
int nh_len, nbits;
if (hc->next_data_empty != 0) {
nh_len = ((hc->next_data_empty + (32 - 1)) &
~(32 - 1));
zero_pad(hc->data + hc->next_data_empty,
nh_len - hc->next_data_empty);
nh_transform(hc, hc->data, nh_len);
hc->bytes_hashed += hc->next_data_empty;
} else if (hc->bytes_hashed == 0) {
nh_len = 32;
zero_pad(hc->data, 32);
nh_transform(hc, hc->data, nh_len);
}
nbits = (hc->bytes_hashed << 3);
((UINT64 *)result)[0] = ((UINT64 *)hc->state)[0] + nbits;
((UINT64 *)result)[1] = ((UINT64 *)hc->state)[1] + nbits;
((UINT64 *)result)[2] = ((UINT64 *)hc->state)[2] + nbits;
((UINT64 *)result)[3] = ((UINT64 *)hc->state)[3] + nbits;
nh_reset(hc);
}
| void nh_final(struct_0 *a0, unsigned long long a1[4]) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
if (a0->field_470) {
v0 = __addvsi3(a0->field_470, 0x1f) & -32;
zero_pad(&a0->padding_0[1072 + a0->field_470], __subvsi3(v0, a0->field_470));
nh_transform(a0, &a0->padding_0[1072], v0);
a0->field_474 = __addvsi3(a0->field_474, a0->field_470);
} else if (!a0->field_474) {
v0 = 32;
zero_pad(&a0->padding_0[1072], 0x20);
nh_transform(a0, &a0->padding_0[1072], v0);
}
v1 = a0->field_474 * 8;
a1[0] = a0->field_478 + v1;
a1[1] = v1 + a0->field_480;
a1[2] = v1 + a0->field_488;
a1[3] = v1 + a0->field_490;
v3 = nh_reset(a0);
return;
}
|
static int
auth2_challenge_start(struct ssh *ssh)
{
Authctxt *authctxt = ssh->authctxt;
KbdintAuthctxt *kbdintctxt = authctxt->kbdintctxt;
sshlog("auth2-chall.c", __func__, 227, 0, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "auth2_challenge_start: devices %s", kbdintctxt->devices ? kbdintctxt->devices : "<empty>")
;
if (kbdint_next_device(authctxt, kbdintctxt) == 0) {
auth2_challenge_stop(ssh);
return 0;
}
sshlog("auth2-chall.c", __func__, 234, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "auth2_challenge_start: trying authentication method '%s'", kbdintctxt->device->name)
;
if ((kbdintctxt->ctxt = kbdintctxt->device->init_ctx(authctxt)) ==
((void *)0)
) {
auth2_challenge_stop(ssh);
return 0;
}
if (send_userauth_info_request(ssh) == 0) {
auth2_challenge_stop(ssh);
return 0;
}
ssh_dispatch_set(ssh, 61,
&input_userauth_info_response);
authctxt->postponed = 1;
return 0;
}
| void auth2_challenge_start(struct_0 *a0) {
unsigned long long v0;
struct_1 *v1;
struct_2 *v2;
unsigned long long v4;
void* v5;
void* v6;
void* v7;
void* v8;
v1 = a0->field_860;
v2 = v1->field_58;
if (!v2->field_0)
v4 = "<empty>";
else
v4 = v2->field_0;
v0 = v4;
sshlog("auth2-c", "auth2_challenge_start", 0xe3, 0x0, 0x6, 0x0, "auth2_challenge_start: devices %s");
if (!kbdint_next_device(v1, v2)) {
auth2_challenge_stop(a0);
v5 = 0;
} else {
v0 = v2->field_10->field_0;
sshlog("auth2-c", "auth2_challenge_start", 0xea, 0x0, 0x5, 0x0, "auth2_challenge_start: trying authentication method '%s'");
v2->field_8 = *((*(((stack_base)[16] + 16)) + 8))(v1);
if (!v2->field_8) {
auth2_challenge_stop(a0);
v6 = 0;
} else if (!send_userauth_info_request(a0)) {
auth2_challenge_stop(a0);
v7 = 0;
} else {
ssh_dispatch_set(a0, 0x3d, input_userauth_info_response);
v1->field_8 = 1;
v8 = 0;
}
}
return;
}
|
static
void fallbackSort ( UInt32* fmap,
UInt32* eclass,
UInt32* bhtab,
Int32 nblock,
Int32 verb )
{
Int32 ftab[257];
Int32 ftabCopy[256];
Int32 H, i, j, k, l, r, cc, cc1;
Int32 nNotDone;
Int32 nBhtab;
UChar* eclass8 = (UChar*)eclass;
if (verb >= 4)
fprintf(
stderr
," bucket sorting ...\n");
for (i = 0; i < 257; i++) ftab[i] = 0;
for (i = 0; i < nblock; i++) ftab[eclass8[i]]++;
for (i = 0; i < 256; i++) ftabCopy[i] = ftab[i];
for (i = 1; i < 257; i++) ftab[i] += ftab[i-1];
for (i = 0; i < nblock; i++) {
j = eclass8[i];
k = ftab[j] - 1;
ftab[j] = k;
fmap[k] = i;
}
nBhtab = 2 + (nblock / 32);
for (i = 0; i < nBhtab; i++) bhtab[i] = 0;
for (i = 0; i < 256; i++) bhtab[(ftab[i]) >> 5] |= ((UInt32)1 << ((ftab[i]) & 31));
for (i = 0; i < 32; i++) {
bhtab[(nblock + 2*i) >> 5] |= ((UInt32)1 << ((nblock + 2*i) & 31));
bhtab[(nblock + 2*i + 1) >> 5] &= ~((UInt32)1 << ((nblock + 2*i + 1) & 31));
}
H = 1;
while (1) {
if (verb >= 4)
fprintf(
stderr
," depth %6d has ",H);
j = 0;
for (i = 0; i < nblock; i++) {
if ((bhtab[(i) >> 5] & ((UInt32)1 << ((i) & 31)))) j = i;
k = fmap[i] - H; if (k < 0) k += nblock;
eclass[k] = j;
}
nNotDone = 0;
r = -1;
while (1) {
k = r + 1;
while ((bhtab[(k) >> 5] & ((UInt32)1 << ((k) & 31))) && ((k) & 0x01f)) k++;
if ((bhtab[(k) >> 5] & ((UInt32)1 << ((k) & 31)))) {
while (bhtab[(k) >> 5] == 0xffffffff) k += 32;
while ((bhtab[(k) >> 5] & ((UInt32)1 << ((k) & 31)))) k++;
}
l = k - 1;
if (l >= nblock) break;
while (!(bhtab[(k) >> 5] & ((UInt32)1 << ((k) & 31))) && ((k) & 0x01f)) k++;
if (!(bhtab[(k) >> 5] & ((UInt32)1 << ((k) & 31)))) {
while (bhtab[(k) >> 5] == 0x00000000) k += 32;
while (!(bhtab[(k) >> 5] & ((UInt32)1 << ((k) & 31)))) k++;
}
r = k - 1;
if (r >= nblock) break;
if (r > l) {
nNotDone += (r - l + 1);
fallbackQSort3 ( fmap, eclass, l, r );
cc = -1;
for (i = l; i <= r; i++) {
cc1 = eclass[fmap[i]];
if (cc != cc1) { bhtab[(i) >> 5] |= ((UInt32)1 << ((i) & 31)); cc = cc1; };
}
}
}
if (verb >= 4)
fprintf(
stderr
,"%6d unresolved strings\n",nNotDone);
H *= 2;
if (H > nblock || nNotDone == 0) break;
}
if (verb >= 4)
fprintf(
stderr
," reconstructing block ...\n");
j = 0;
for (i = 0; i < nblock; i++) {
while (ftabCopy[j] == 0) j++;
ftabCopy[j]--;
eclass8[fmap[i]] = (UChar)j;
}
{ if (!(j < 256)) BZ2_bz__AssertH__fail ( 1005 ); };
}
| void fallbackSort(unsigned int *a0, void* a1, unsigned int *a2, unsigned long a3, unsigned long a4) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
char v10;
char v11;
char v12;
unsigned long long *v14;
unsigned long long v15;
if (a4 > 3)
fprintf(stderr, " bucket sorting ...\n");
for (v1 = 0; v1 <= 0x100; v1 += 1) {
*(&(&v11)[4 * v1]) = 0;
}
for (v1 = 0; v1 < a3; v1 += 1) {
*(&(&v11)[4 * *(a1 + v1)]) = *(&(&v11)[4 * *(a1 + v1)]) + 1;
}
for (v1 = 0; v1 <= 255; v1 += 1) {
*(&(&v10)[4 * v1]) = *(&(&v11)[4 * v1]);
}
for (v1 = 1; v1 <= 0x100; v1 += 1) {
*(&(&v11)[4 * v1]) = *(&(&v11)[4 * v1]) + *(&(&v11)[4 + 4 * v1]);
}
for (v1 = 0; v1 < a3; v1 += 1) {
v2 = *(a1 + v1);
v3 = *(&(&v11)[4 * v2]) - 1;
*(&(&v11)[4 * v2]) = v3;
a0[v3] = v1;
}
v7 = ((a3 < 0 ? a3 + 31 : a3) >> 5) + 2;
for (v1 = 0; v1 < v7; v1 += 1) {
a2[v1] = 0;
}
for (v1 = 0; v1 <= 255; v1 += 1) {
a2[*(&(&v11)[4 * v1]) >> 5] = a2[*(&(&v11)[4 * v1]) >> 5] | (1 << ((*(&(&v11)[4 * v1]) & 31) & 31));
}
for (v1 = 0; v1 <= 31; v1 += 1) {
a2[a3 + (v1 * 2) >> 5] = a2[a3 + (v1 * 2) >> 5] | (1 << ((a3 + (v1 * 2) & 31) & 31));
a2[a3 + (v1 * 2) + 1 >> 5] = a2[a3 + (v1 * 2) + 1 >> 5] & !((1 << ((a3 + (v1 * 2) + 1 & 31) & 31)));
}
v0 = 1;
while (true) {
if (a4 > 3)
fprintf(stderr, " depth %6d has ", v0);
v2 = 0;
for (v1 = 0; v1 < a3; v1 += 1) {
if (((1 << ((v1 & 31) & 31)) & a2[v1 >> 5]))
v2 = v1;
v3 = a0[v1] - v0;
if (v3 < 0)
v3 += a3;
*((4 * v3 + a1)) = v2;
}
v6 = 0;
v4 = -1;
while (true) {
v3 = v4 + 1;
while (true) {
if (!((1 << ((v3 & 31) & 31)) & a2[v3 >> 5]))
break;
if (!(v3 & 31))
break;
v3 += 1;
}
if (((1 << ((v3 & 31) & 31)) & a2[v3 >> 5])) {
for (; a2[v3 >> 5] == -1; v3 += 32);
for (; ((1 << ((v3 & 31) & 31)) & a2[v3 >> 5]); v3 += 1);
}
v8 = v3 - 1;
if (v8 >= a3)
break;
while (true) {
if (((1 << ((v3 & 31) & 31)) & a2[v3 >> 5]))
break;
if (!(v3 & 31))
break;
v3 += 1;
}
if (!((1 << ((v3 & 31) & 31)) & a2[v3 >> 5])) {
for (; !a2[v3 >> 5]; v3 += 32);
for (; !((1 << ((v3 & 31) & 31)) & a2[v3 >> 5]); v3 += 1);
}
v4 = v3 - 1;
if (v4 >= a3)
break;
if (v4 <= v8)
continue;
v6 += v4 - v8 + 1;
fallbackQSort3(a0, a1, v8, v4);
v5 = -1;
for (v1 = v8; v1 <= v4; v1 += 1) {
v9 = *((a1 + 4 * a0[v1]));
if (v5 != v9) {
a2[v1 >> 5] = a2[v1 >> 5] | (1 << ((v1 & 31) & 31));
v5 = v9;
}
}
}
if (a4 > 3)
fprintf(stderr, "%6d unresolved strings\n", v6);
v0 *= 2;
if (v0 > a3)
break;
if (!v6)
break;
}
if (a4 > 3)
fprintf(stderr, " reconstructing block ...\n");
for (v2 = 0; v1 < a3; v1 += 1) {
for (v1 = 0; !*(&(&v10)[4 * v2]); v2 += 1);
*(&(&v10)[4 * v2]) = *(&(&v10)[4 * v2]) - 1;
*(a1 + a0[v1]) = v2;
}
if (v2 > 255)
BZ2_bz__AssertH__fail(0x3ed);
v15 = *(&v12) - v14[5];
return;
}
|
)
{
error (0,
(*__errno_location ())
, "%s", quote (s));
exit_status =
1
;
}
| void error(void)
{
halt_baddata();
}
|
char *
ifs_firstchar (lenp)
int *lenp;
{
char *ret;
int len;
ret = sh_xmalloc((
16
+ 1), "subst.c", 2864);
if (ifs_firstc_len == 1)
{
ret[0] = ifs_firstc[0];
ret[1] = '\0';
len = ret[0] ? 1 : 0;
}
else
{
memcpy (ret, ifs_firstc, ifs_firstc_len);
ret[len = ifs_firstc_len] = '\0';
}
if (lenp)
*lenp = len;
return ret;
}
| _BYTE * ifs_firstchar(_DWORD *a1)
{
int v2;
_BYTE *dest;
dest = (_BYTE *)sh_xmalloc(17LL, "subst.c", 2864LL);
if ( ifs_firstc_len == 1 )
{
*dest = ifs_firstc[0];
dest[1] = 0;
v2 = *dest != 0;
}
else
{
memcpy(dest, ifs_firstc, ifs_firstc_len);
v2 = ifs_firstc_len;
dest[(int)ifs_firstc_len] = 0;
}
if ( a1 )
*a1 = v2;
return dest;
}
|
static FILE *hdopen(const char* const format, const char* const name)
{
char buf[
255
+1];
FILE *fp = (FILE*)-1;
int fd, ret;
ret = snprintf(buf, sizeof(buf), format, name);
if ((ret >= (int)sizeof(buf)) || (ret < 0))
goto error;
fd = open(buf,
00
|
0400
);
if (fd < 0) {
if (
(*__errno_location ())
!=
2
)
goto error;
fp = (FILE*)0;
goto error;
}
fp = fdopen(fd, "r");
if (fp == (FILE*)0)
close(fd);
error:
return fp;
}
| int hdopen(char *a0, unsigned long a1) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
char v4;
v0 = a1;
v3 = -1;
v1 = snprintf(&v4, 0x100, a0);
if (v1 <= 255 && v1 >= 0) {
v2 = open(&v4, 0x100, a0);
if (v2 >= 0) {
v3 = fdopen(v2, "r");
if (!v3)
close(v2);
} else if (*(__errno_location()) == 2) {
v3 = 0;
}
}
return v3;
}
|
static void
ensure_slash (char **pstr)
{
size_t len = strlen (*pstr);
while (len >= 1 &&
((
(*pstr)[len - 1]
) == '/')
)
len--;
if (!
((
(*pstr)[len]
) == '/')
)
*pstr = xrealloc (*pstr, len + 2);
(*pstr)[len++] = '/';
(*pstr)[len] = '\0';
}
| void ensure_slash(unsigned long long *a0) {
char *v0;
int tmp_27;
unsigned long long v2;
for (v0 = strlen(*(a0)); v0 && v0[1 + *(a0)] == 47; v0 += 1);
if (v0[*(a0)] != 47)
*(a0) = xrealloc(*(a0), v0 + 2, v0 + 2);
tmp_27 = v0;
v0 += 1;
*((tmp_27 + *(a0))) = 47;
v2 = &v0[*(a0)];
v0[*(a0)] = 0;
return;
}
|
void
coproc_fdrestore (cp)
struct coproc *cp;
{
cp->c_rfd = cp->c_rsave;
cp->c_wfd = cp->c_wsave;
}
| long long coproc_fdrestore(unsigned int a0[7]) {
a0[3] = a0[5];
a0[4] = a0[6];
return a0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.