input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
int print_linkinfo(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE *)arg;
struct ifinfomsg *ifi = ((void *)(((char *)n) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))));
struct rtattr *tb[(__IFLA_MAX - 1)+1];
int len = n->nlmsg_len;
const char *name;
unsigned int m_flag = 0;
char b1[64];
_Bool
truncated_vfs =
0
;
if (n->nlmsg_type != RTM_NEWLINK && n->nlmsg_type != RTM_DELLINK)
return 0;
len -= ((sizeof(*ifi)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) )));
if (len < 0)
return -1;
if (filter.ifindex && ifi->ifi_index != filter.ifindex)
return -1;
if (filter.up && !(ifi->ifi_flags&IFF_UP))
return -1;
parse_rtattr_flags(tb, (__IFLA_MAX - 1), ((struct rtattr*)(((char*)(ifi)) + ( ((sizeof(struct ifinfomsg))+4U -1) & ~(4U -1) ))), len, (1 << 15));
name = get_ifname_rta(ifi->ifi_index, tb[IFLA_IFNAME]);
if (!name)
return -1;
if (filter.label)
return 0;
if (tb[IFLA_GROUP]) {
int group = rta_getattr_u32(tb[IFLA_GROUP]);
if (filter.group != -1 && group != filter.group)
return -1;
}
if (tb[IFLA_MASTER]) {
int master = rta_getattr_u32(tb[IFLA_MASTER]);
if (filter.master > 0 && master != filter.master)
return -1;
} else if (filter.master > 0)
return -1;
if (filter.kind && match_link_kind(tb, filter.kind, 0))
return -1;
if (filter.slave_kind && match_link_kind(tb, filter.slave_kind, 1))
return -1;
if (n->nlmsg_type == RTM_DELLINK)
print_bool(PRINT_ANY, "deleted", "Deleted ",
1
);
if (brief)
return print_linkinfo_brief(fp, name, ifi, tb);
print_int(PRINT_ANY, "ifindex", "%d: ", ifi->ifi_index);
m_flag = print_name_and_link("%s: ", name, tb);
print_link_flags(fp, ifi->ifi_flags, m_flag);
if (tb[IFLA_MTU])
print_int(PRINT_ANY,
"mtu", "mtu %u ",
rta_getattr_u32(tb[IFLA_MTU]));
if (tb[IFLA_XDP])
xdp_dump(fp, tb[IFLA_XDP], do_link,
0
);
if (tb[IFLA_QDISC])
print_string(PRINT_ANY,
"qdisc",
"qdisc %s ",
rta_getattr_str(tb[IFLA_QDISC]));
if (tb[IFLA_MASTER]) {
int master = rta_getattr_u32(tb[IFLA_MASTER]);
print_string(PRINT_ANY,
"master", "master %s ",
ll_index_to_name(master));
}
if (tb[IFLA_OPERSTATE])
print_operstate(fp, rta_getattr_u8(tb[IFLA_OPERSTATE]));
if (do_link && tb[IFLA_LINKMODE])
print_linkmode(fp, tb[IFLA_LINKMODE]);
if (tb[IFLA_GROUP]) {
int group = rta_getattr_u32(tb[IFLA_GROUP]);
print_string(PRINT_ANY,
"group",
"group %s ",
rtnl_group_n2a(group, b1, sizeof(b1)));
}
if (filter.showqueue)
print_queuelen(fp, tb);
if (tb[IFLA_EVENT])
print_link_event(fp, rta_getattr_u32(tb[IFLA_EVENT]));
if (!filter.family || filter.family ==
17
|| show_details) {
print_nl();
print_string(PRINT_ANY,
"link_type",
" link/%s ",
ll_type_n2a(ifi->ifi_type, b1, sizeof(b1)));
if (tb[IFLA_ADDRESS]) {
print_color_string(PRINT_ANY,
COLOR_MAC,
"address",
"%s",
ll_addr_n2a(((void*)(((char*)(tb[IFLA_ADDRESS])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
((int)((tb[IFLA_ADDRESS])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))),
ifi->ifi_type,
b1, sizeof(b1)));
}
if (tb[IFLA_BROADCAST]) {
if (ifi->ifi_flags&IFF_POINTOPOINT) {
print_string(PRINT_FP,
((void *)0)
, " peer ",
((void *)0)
);
print_bool(PRINT_JSON,
"link_pointtopoint",
((void *)0)
,
1
);
} else {
print_string(PRINT_FP,
((void *)0)
, " brd ",
((void *)0)
);
}
print_color_string(PRINT_ANY,
COLOR_MAC,
"broadcast",
"%s",
ll_addr_n2a(((void*)(((char*)(tb[IFLA_BROADCAST])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
((int)((tb[IFLA_BROADCAST])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))),
ifi->ifi_type,
b1, sizeof(b1)));
}
if (tb[IFLA_PERM_ADDRESS]) {
unsigned int len = ((int)((tb[IFLA_PERM_ADDRESS])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)));
if (!tb[IFLA_ADDRESS] ||
((int)((tb[IFLA_ADDRESS])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))) != len ||
memcmp(((void*)(((char*)(tb[IFLA_PERM_ADDRESS])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
((void*)(((char*)(tb[IFLA_ADDRESS])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), len)) {
print_string(PRINT_FP,
((void *)0)
, " permaddr ",
((void *)0)
);
print_color_string(PRINT_ANY,
COLOR_MAC,
"permaddr",
"%s",
ll_addr_n2a(((void*)(((char*)(tb[IFLA_PERM_ADDRESS])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
((int)((tb[IFLA_PERM_ADDRESS])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))),
ifi->ifi_type,
b1, sizeof(b1)));
}
}
}
if (tb[IFLA_LINK_NETNSID]) {
int id = rta_getattr_u32(tb[IFLA_LINK_NETNSID]);
if (is_json_context()) {
print_int(PRINT_JSON, "link_netnsid",
((void *)0)
, id);
} else {
if (id >= 0) {
char *name = get_name_from_nsid(id);
if (name)
print_string(PRINT_FP,
((void *)0)
,
" link-netns %s", name);
else
print_int(PRINT_FP,
((void *)0)
,
" link-netnsid %d", id);
} else
print_string(PRINT_FP,
((void *)0)
,
" link-netnsid %s", "unknown");
}
}
if (tb[IFLA_NEW_NETNSID]) {
int id = rta_getattr_u32(tb[IFLA_NEW_NETNSID]);
char *name = get_name_from_nsid(id);
if (name)
print_string(PRINT_FP,
((void *)0)
, " new-netns %s", name);
else
print_int(PRINT_FP,
((void *)0)
, " new-netnsid %d", id);
}
if (tb[IFLA_NEW_IFINDEX]) {
int id = rta_getattr_u32(tb[IFLA_NEW_IFINDEX]);
print_int(PRINT_FP,
((void *)0)
, " new-ifindex %d", id);
}
if (tb[IFLA_PROTO_DOWN])
print_proto_down(fp, tb);
if (show_details) {
if (tb[IFLA_PROMISCUITY])
print_uint(PRINT_ANY,
"promiscuity",
" promiscuity %u ",
rta_getattr_u32(tb[IFLA_PROMISCUITY]));
if (tb[IFLA_MIN_MTU])
print_uint(PRINT_ANY,
"min_mtu", "minmtu %u ",
rta_getattr_u32(tb[IFLA_MIN_MTU]));
if (tb[IFLA_MAX_MTU])
print_uint(PRINT_ANY,
"max_mtu", "maxmtu %u ",
rta_getattr_u32(tb[IFLA_MAX_MTU]));
if (tb[IFLA_LINKINFO])
print_linktype(fp, tb[IFLA_LINKINFO]);
if (do_link && tb[IFLA_AF_SPEC])
print_af_spec(fp, tb[IFLA_AF_SPEC]);
if (tb[IFLA_NUM_TX_QUEUES])
print_uint(PRINT_ANY,
"num_tx_queues",
"numtxqueues %u ",
rta_getattr_u32(tb[IFLA_NUM_TX_QUEUES]));
if (tb[IFLA_NUM_RX_QUEUES])
print_uint(PRINT_ANY,
"num_rx_queues",
"numrxqueues %u ",
rta_getattr_u32(tb[IFLA_NUM_RX_QUEUES]));
if (tb[IFLA_GSO_MAX_SIZE])
print_uint(PRINT_ANY,
"gso_max_size",
"gso_max_size %u ",
rta_getattr_u32(tb[IFLA_GSO_MAX_SIZE]));
if (tb[IFLA_GSO_MAX_SEGS])
print_uint(PRINT_ANY,
"gso_max_segs",
"gso_max_segs %u ",
rta_getattr_u32(tb[IFLA_GSO_MAX_SEGS]));
if (tb[IFLA_TSO_MAX_SIZE])
print_uint(PRINT_ANY,
"tso_max_size",
"tso_max_size %u ",
rta_getattr_u32(tb[IFLA_TSO_MAX_SIZE]));
if (tb[IFLA_TSO_MAX_SEGS])
print_uint(PRINT_ANY,
"tso_max_segs",
"tso_max_segs %u ",
rta_getattr_u32(tb[IFLA_TSO_MAX_SEGS]));
if (tb[IFLA_GRO_MAX_SIZE])
print_uint(PRINT_ANY,
"gro_max_size",
"gro_max_size %u ",
rta_getattr_u32(tb[IFLA_GRO_MAX_SIZE]));
if (tb[IFLA_PHYS_PORT_NAME])
print_string(PRINT_ANY,
"phys_port_name",
"portname %s ",
rta_getattr_str(tb[IFLA_PHYS_PORT_NAME]));
if (tb[IFLA_PHYS_PORT_ID]) {
print_string(PRINT_ANY,
"phys_port_id",
"portid %s ",
hexstring_n2a(
((void*)(((char*)(tb[IFLA_PHYS_PORT_ID])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
((int)((tb[IFLA_PHYS_PORT_ID])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))),
b1, sizeof(b1)));
}
if (tb[IFLA_PHYS_SWITCH_ID]) {
print_string(PRINT_ANY,
"phys_switch_id",
"switchid %s ",
hexstring_n2a(((void*)(((char*)(tb[IFLA_PHYS_SWITCH_ID])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
((int)((tb[IFLA_PHYS_SWITCH_ID])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))),
b1, sizeof(b1)));
}
if (tb[IFLA_PARENT_DEV_BUS_NAME]) {
print_string(PRINT_ANY,
"parentbus",
"parentbus %s ",
rta_getattr_str(tb[IFLA_PARENT_DEV_BUS_NAME]));
}
if (tb[IFLA_PARENT_DEV_NAME]) {
print_string(PRINT_ANY,
"parentdev",
"parentdev %s ",
rta_getattr_str(tb[IFLA_PARENT_DEV_NAME]));
}
}
if ((do_link || show_details) && tb[IFLA_IFALIAS]) {
print_string(PRINT_FP,
((void *)0)
, "%s ", _SL_);
print_string(PRINT_ANY,
"ifalias",
"alias %s",
rta_getattr_str(tb[IFLA_IFALIAS]));
}
if ((do_link || show_details) && tb[IFLA_XDP])
xdp_dump(fp, tb[IFLA_XDP],
1
,
1
);
if (do_link && show_stats) {
print_nl();
__print_link_stats(fp, tb);
}
if ((do_link || show_details) && tb[IFLA_VFINFO_LIST] && tb[IFLA_NUM_VF]) {
struct rtattr *i, *vflist = tb[IFLA_VFINFO_LIST];
int rem = ((int)((vflist)->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), count = 0;
open_json_array(PRINT_JSON, "vfinfo_list");
for (i = ((void*)(((char*)(vflist)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))); ((rem) >= (int)sizeof(struct rtattr) && (i)->rta_len >= sizeof(struct rtattr) && (i)->rta_len <= (rem)); i = ((rem) -= ( (((i)->rta_len)+4U -1) & ~(4U -1) ), (struct rtattr*)(((char*)(i)) + ( (((i)->rta_len)+4U -1) & ~(4U -1) )))) {
open_json_object(
((void *)0)
);
print_vfinfo(fp, ifi, i);
close_json_object();
count++;
}
close_json_array(PRINT_JSON,
((void *)0)
);
if (count != rta_getattr_u32(tb[IFLA_NUM_VF]))
truncated_vfs =
1
;
}
if (tb[IFLA_PROP_LIST]) {
struct rtattr *i, *proplist = tb[IFLA_PROP_LIST];
int rem = ((int)((proplist)->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)));
open_json_array(PRINT_JSON, "altnames");
for (i = ((void*)(((char*)(proplist)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))); ((rem) >= (int)sizeof(struct rtattr) && (i)->rta_len >= sizeof(struct rtattr) && (i)->rta_len <= (rem));
i = ((rem) -= ( (((i)->rta_len)+4U -1) & ~(4U -1) ), (struct rtattr*)(((char*)(i)) + ( (((i)->rta_len)+4U -1) & ~(4U -1) )))) {
if (i->rta_type != IFLA_ALT_IFNAME)
continue;
print_string(PRINT_FP,
((void *)0)
, "%s altname ", _SL_);
print_string(PRINT_ANY,
((void *)0)
,
"%s", rta_getattr_str(i));
}
close_json_array(PRINT_JSON,
((void *)0)
);
}
print_string(PRINT_FP,
((void *)0)
, "%s", "\n");
fflush(fp);
if (truncated_vfs)
fprintf(
stderr
, "Truncated VF list: %s\n", name);
return 1;
}
| undefined8 print_linkinfo(int *param_1,FILE *param_2)
{
bool bVar1;
undefined uVar2;
char cVar3;
int iVar4;
undefined4 uVar5;
undefined8 uVar6;
long lVar7;
long lVar8;
long in_FS_OFFSET;
int local_2c4;
int local_2c0;
int local_2bc;
ushort *local_290;
ushort *local_288;
undefined local_248 [8];
ushort *local_240;
ushort *local_238;
undefined8 local_230;
long local_228;
long local_218;
long local_1f8;
long local_1c8;
long local_1c0;
long local_1b8;
long local_1a8;
long local_1a0;
ushort *local_198;
long local_178;
long local_170;
long local_158;
long local_150;
long local_148;
ushort *local_138;
ushort *local_128;
long local_120;
long local_118;
long local_110;
long local_108;
long local_100;
long local_f0;
long local_e8;
long local_e0;
long local_c0;
long local_b8;
long local_b0;
ushort *local_a8;
ushort *local_98;
long local_88;
long local_80;
long local_78;
long local_70;
long local_68;
undefined local_58 [72];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
bVar1 = false;
if ((*(short *)(param_1 + 1) != 0x10) && (*(short *)(param_1 + 1) != 0x11)) {
uVar6 = 0;
goto LAB_00104895;
}
if (*param_1 + -0x20 < 0) {
uVar6 = 0xffffffff;
goto LAB_00104895;
}
if ((filter._0_4_ != 0) && (param_1[5] != filter._0_4_)) {
uVar6 = 0xffffffff;
goto LAB_00104895;
}
if ((filter._296_4_ != 0) && ((param_1[6] & 1U) == 0)) {
uVar6 = 0xffffffff;
goto LAB_00104895;
}
parse_rtattr_flags(local_248,0x3c,param_1 + 8,*param_1 + -0x20,0x8000);
lVar7 = get_ifname_rta(param_1[5],local_230);
if (lVar7 == 0) {
uVar6 = 0xffffffff;
goto LAB_00104895;
}
if (filter._304_8_ != 0) {
uVar6 = 0;
goto LAB_00104895;
}
if (local_170 != 0) {
iVar4 = rta_getattr_u32(local_170);
if ((filter._336_4_ != -1) && (iVar4 != filter._336_4_)) {
uVar6 = 0xffffffff;
goto LAB_00104895;
}
}
if (local_1f8 == 0) {
if (0 < filter._340_4_) {
uVar6 = 0xffffffff;
goto LAB_00104895;
}
}
else {
iVar4 = rta_getattr_u32(local_1f8);
if ((0 < filter._340_4_) && (iVar4 != filter._340_4_)) {
uVar6 = 0xffffffff;
goto LAB_00104895;
}
}
if (filter._344_8_ != 0) {
iVar4 = match_link_kind(local_248,filter._344_8_,0);
if (iVar4 != 0) {
uVar6 = 0xffffffff;
goto LAB_00104895;
}
}
if (filter._352_8_ != 0) {
iVar4 = match_link_kind(local_248,filter._352_8_,1);
if (iVar4 != 0) {
uVar6 = 0xffffffff;
goto LAB_00104895;
}
}
if (*(short *)(param_1 + 1) == 0x11) {
print_bool(4,"deleted","Deleted ",1);
}
if (brief != 0) {
uVar6 = print_linkinfo_brief(param_2,lVar7,param_1 + 4,local_248);
goto LAB_00104895;
}
print_int(4,"ifindex",&DAT_001092b8,param_1[5]);
uVar5 = print_name_and_link(&DAT_001092c5,lVar7,local_248);
print_link_flags(param_2,param_1[6],uVar5);
if (local_228 != 0) {
uVar5 = rta_getattr_u32(local_228);
print_int(4,&DAT_001092d2,"mtu %u ",uVar5);
}
if (local_f0 != 0) {
xdp_dump(param_2,local_f0,do_link != 0,0);
}
if (local_218 != 0) {
uVar6 = rta_getattr_str(local_218);
print_string(4,"qdisc","qdisc %s ",uVar6);
}
if (local_1f8 != 0) {
uVar5 = rta_getattr_u32(local_1f8);
uVar6 = ll_index_to_name(uVar5);
print_string(4,"master","master %s ",uVar6);
}
if (local_1c8 != 0) {
uVar2 = rta_getattr_u8(local_1c8);
print_operstate(param_2,uVar2);
}
if ((do_link != 0) && (local_1c0 != 0)) {
print_linkmode(param_2,local_1c0);
}
if (local_170 != 0) {
uVar5 = rta_getattr_u32(local_170);
uVar6 = rtnl_group_n2a(uVar5,local_58,0x40);
print_string(4,"group","group %s ",uVar6);
}
if (filter._12_4_ != 0) {
print_queuelen(param_2,local_248);
}
if (local_e8 != 0) {
uVar5 = rta_getattr_u32(local_e8);
print_link_event(param_2,uVar5);
}
if (((filter._4_4_ == 0) || (filter._4_4_ == 0x11)) || (show_details != 0)) {
print_nl();
uVar6 = ll_type_n2a(*(undefined2 *)((long)param_1 + 0x12),local_58,0x40);
print_string(4,"link_type"," link/%s ",uVar6);
if (local_240 != (ushort *)0x0) {
uVar6 = ll_addr_n2a(local_240 + 2,*local_240 - 4,*(undefined2 *)((long)param_1 + 0x12),
local_58,0x40);
print_color_string(4,1,"address",&DAT_00108b24,uVar6);
}
if (local_238 != (ushort *)0x0) {
if ((param_1[6] & 0x10U) == 0) {
print_string(1,0," brd ",0);
}
else {
print_string(1,0," peer ",0);
print_bool(2,"link_pointtopoint",0,1);
}
uVar6 = ll_addr_n2a(local_238 + 2,*local_238 - 4,*(undefined2 *)((long)param_1 + 0x12),
local_58,0x40);
print_color_string(4,1,"broadcast",&DAT_00108b24,uVar6);
}
if (local_98 != (ushort *)0x0) {
if ((local_240 != (ushort *)0x0) && ((ulong)*local_240 - 4 == (ulong)(*local_98 - 4))) {
iVar4 = memcmp(local_98 + 2,local_240 + 2,(ulong)(*local_98 - 4));
if (iVar4 == 0) goto LAB_00103f68;
}
print_string(1,0," permaddr ",0);
uVar6 = ll_addr_n2a(local_98 + 2,*local_98 - 4,*(undefined2 *)((long)param_1 + 0x12),local_58,
0x40);
print_color_string(4,1,"permaddr",&DAT_00108b24,uVar6);
}
}
LAB_00103f68:
if (local_120 != 0) {
iVar4 = rta_getattr_u32(local_120);
cVar3 = is_json_context();
if (cVar3 == '\0') {
if (iVar4 < 0) {
print_string(1,0," link-netnsid %s","unknown");
}
else {
lVar8 = get_name_from_nsid(iVar4);
if (lVar8 == 0) {
print_int(1,0," link-netnsid %d",iVar4);
}
else {
print_string(1,0," link-netns %s",lVar8);
}
}
}
else {
print_int(2,"link_netnsid",0,iVar4);
}
}
if (local_e0 != 0) {
uVar5 = rta_getattr_u32(local_e0);
lVar8 = get_name_from_nsid(uVar5);
if (lVar8 == 0) {
print_int(1,0," new-netnsid %d",uVar5);
}
else {
print_string(1,0," new-netns %s",lVar8);
}
}
if (local_c0 != 0) {
uVar5 = rta_getattr_u32(local_c0);
print_int(1,0," new-ifindex %d",uVar5);
}
if (local_110 != 0) {
print_proto_down(param_2,local_248);
}
if (show_details != 0) {
if (local_158 != 0) {
uVar5 = rta_getattr_u32(local_158);
print_uint(4,"promiscuity"," promiscuity %u ",uVar5);
}
if (local_b8 != 0) {
uVar5 = rta_getattr_u32(local_b8);
print_uint(4,"min_mtu","minmtu %u ",uVar5);
}
if (local_b0 != 0) {
uVar5 = rta_getattr_u32(local_b0);
print_uint(4,"max_mtu","maxmtu %u ",uVar5);
}
if (local_1b8 != 0) {
print_linktype(param_2,local_1b8);
}
if ((do_link != 0) && (local_178 != 0)) {
print_af_spec(param_2,local_178);
}
if (local_150 != 0) {
uVar5 = rta_getattr_u32(local_150);
print_uint(4,"num_tx_queues","numtxqueues %u ",uVar5);
}
if (local_148 != 0) {
uVar5 = rta_getattr_u32(local_148);
print_uint(4,"num_rx_queues","numrxqueues %u ",uVar5);
}
if (local_100 != 0) {
uVar5 = rta_getattr_u32(local_100);
print_uint(4,"gso_max_size","gso_max_size %u ",uVar5);
}
if (local_108 != 0) {
uVar5 = rta_getattr_u32(local_108);
print_uint(4,"gso_max_segs","gso_max_segs %u ",uVar5);
}
if (local_70 != 0) {
uVar5 = rta_getattr_u32(local_70);
print_uint(4,"tso_max_size","tso_max_size %u ",uVar5);
}
if (local_68 != 0) {
uVar5 = rta_getattr_u32(local_68);
print_uint(4,"tso_max_segs","tso_max_segs %u ",uVar5);
}
if (local_78 != 0) {
uVar5 = rta_getattr_u32(local_78);
print_uint(4,"gro_max_size","gro_max_size %u ",uVar5);
}
if (local_118 != 0) {
uVar6 = rta_getattr_str(local_118);
print_string(4,"phys_port_name","portname %s ",uVar6);
}
if (local_138 != (ushort *)0x0) {
uVar6 = hexstring_n2a(local_138 + 2,*local_138 - 4,local_58,0x40);
print_string(4,"phys_port_id","portid %s ",uVar6);
}
if (local_128 != (ushort *)0x0) {
uVar6 = hexstring_n2a(local_128 + 2,*local_128 - 4,local_58,0x40);
print_string(4,"phys_switch_id","switchid %s ",uVar6);
}
if (local_80 != 0) {
uVar6 = rta_getattr_str(local_80);
print_string(4,"parentbus","parentbus %s ",uVar6);
}
if (local_88 != 0) {
uVar6 = rta_getattr_str(local_88);
print_string(4,"parentdev","parentdev %s ",uVar6);
}
}
if (((do_link != 0) || (show_details != 0)) && (local_1a8 != 0)) {
print_string(1,0,"%s ",_SL_);
uVar6 = rta_getattr_str(local_1a8);
print_string(4,"ifalias","alias %s",uVar6);
}
if (((do_link != 0) || (show_details != 0)) && (local_f0 != 0)) {
xdp_dump(param_2,local_f0,1,1);
}
if ((do_link != 0) && (show_stats != 0)) {
print_nl();
__print_link_stats(param_2,local_248);
}
if ((((do_link != 0) || (show_details != 0)) && (local_198 != (ushort *)0x0)) && (local_1a0 != 0))
{
local_2c4 = *local_198 - 4;
local_2c0 = 0;
open_json_array(2,"vfinfo_list");
for (local_290 = local_198 + 2;
((3 < local_2c4 && (3 < *local_290)) && ((int)(uint)*local_290 <= local_2c4));
local_290 = (ushort *)((long)local_290 + (ulong)(*local_290 + 3 & 0xfffffffc))) {
open_json_object(0);
print_vfinfo(param_2,param_1 + 4,local_290);
close_json_object();
local_2c0 = local_2c0 + 1;
local_2c4 = local_2c4 - (*local_290 + 3 & 0xfffffffc);
}
close_json_array(2,0);
iVar4 = rta_getattr_u32(local_1a0);
if (iVar4 != local_2c0) {
bVar1 = true;
}
}
if (local_a8 != (ushort *)0x0) {
local_2bc = *local_a8 - 4;
open_json_array(2,"altnames");
for (local_288 = local_a8 + 2;
((3 < local_2bc && (3 < *local_288)) && ((int)(uint)*local_288 <= local_2bc));
local_288 = (ushort *)((long)local_288 + (ulong)(*local_288 + 3 & 0xfffffffc))) {
if (local_288[1] == 0x35) {
print_string(1,0,"%s altname ",_SL_);
uVar6 = rta_getattr_str(local_288);
print_string(4,0,&DAT_00108b24,uVar6);
}
local_2bc = local_2bc - (*local_288 + 3 & 0xfffffffc);
}
close_json_array(2,0);
}
print_string(1,0,&DAT_00108b24,&DAT_001091f6);
fflush(param_2);
if (bVar1) {
fprintf(stderr,"Truncated VF list: %s\n",lVar7);
}
uVar6 = 1;
LAB_00104895:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar6;
}
|
static void bsClose ( BitStream* bs )
{
Int32 retVal;
if ( bs->mode == 'w' ) {
while ( bs->buffLive < 8 ) {
bs->buffLive++;
bs->buffer <<= 1;
};
retVal = putc ( (UChar) (bs->buffer), bs->handle );
if (retVal ==
(-1)
) writeError();
bytesOut++;
retVal = fflush ( bs->handle );
if (retVal ==
(-1)
) writeError();
}
retVal = fclose ( bs->handle );
if (retVal ==
(-1)
) {
if (bs->mode == 'w') writeError(); else readError();
}
free ( bs );
}
| void bsClose(long a1)
{
if ( *(_BYTE *)(a1 + 16) == 119 )
{
while ( *(int *)(a1 + 12) <= 7 )
{
++*(_DWORD *)(a1 + 12);
*(_DWORD *)(a1 + 8) *= 2;
}
if ( putc((unsigned char)*(_DWORD *)(a1 + 8), *(FILE **)a1) == -1 )
writeError();
++bytesOut;
if ( fflush(*(FILE **)a1) == -1 )
writeError();
}
if ( fclose(*(FILE **)a1) == -1 )
{
if ( *(_BYTE *)(a1 + 16) == 119 )
writeError();
readError();
}
free((void *)a1);
}
|
static inline randint
randint_choose (struct randint_source *s, randint choices)
{
return randint_genmax (s, choices - 1);
}
| long randint_choose(long a1, long a2)
{
return randint_genmax(a1, a2 - 1);
}
|
static
_Bool
process_files (char **files, int bit_flags)
{
_Bool
ok =
1
;
FTS *fts = xfts_open (files, bit_flags,
((void *)0)
);
while (
1
)
{
FTSENT *ent;
ent = rpl_fts_read (fts);
if (ent ==
((void *)0)
)
{
if (
(*__errno_location ())
!= 0)
{
error (0,
(*__errno_location ())
, gettext ("fts_read failed"));
ok =
0
;
}
break;
}
ok &= process_file (fts, ent);
}
if (rpl_fts_close (fts) != 0)
{
error (0,
(*__errno_location ())
, gettext ("fts_close failed"));
ok =
0
;
}
return ok;
}
| bool process_files(undefined8 param_1,undefined4 param_2)
{
byte bVar1;
int iVar2;
undefined8 uVar3;
long lVar4;
int *piVar5;
undefined8 uVar6;
bool local_29;
local_29 = true;
uVar3 = xfts_open(param_1,param_2,0);
while( true ) {
lVar4 = rpl_fts_read(uVar3);
if (lVar4 == 0) break;
bVar1 = process_file(uVar3,lVar4);
local_29 = (bVar1 & local_29) != 0;
}
piVar5 = __errno_location();
if (*piVar5 != 0) {
uVar6 = gettext("fts_read failed");
piVar5 = __errno_location();
error(0,*piVar5,uVar6);
local_29 = false;
}
iVar2 = rpl_fts_close(uVar3);
if (iVar2 != 0) {
uVar3 = gettext("fts_close failed");
piVar5 = __errno_location();
error(0,*piVar5,uVar3);
local_29 = false;
}
return local_29;
}
|
static
_Bool
check_sorted (void *base, size_t members, size_t membersize,
int (*cmpfn)(const void*, const void*))
{
const char *p = base;
size_t i;
for (i=1u; i<members; ++i)
{
int result = cmpfn (p+i*membersize, p+(i-1)*membersize);
if (result < 0)
return
0
;
result = cmpfn (p+(i-1)*membersize, p+i*membersize);
((void) sizeof ((
result <= 0
) ? 1 : 0), __extension__ ({ if (
result <= 0
) ; else __assert_fail (
"result <= 0"
, "tree.c", 1013, __extension__ __PRETTY_FUNCTION__); }))
;
}
return
1
;
}
| long check_sorted(
long a1,
unsigned long a2,
long a3,
int ( *a4)(unsigned long, unsigned long))
{
unsigned long i;
for ( i = 1LL; i < a2; ++i )
{
if ( a4(a1 + a3 * i, a3 * (i - 1) + a1) < 0 )
return 0LL;
if ( a4(a1 + a3 * (i - 1), a3 * i + a1) > 0 )
_assert_fail("result <= 0", "tree.c", 0x3F5u, "check_sorted");
}
return 1LL;
}
|
static const char *host_from_url(const char *url, unsigned int *port, const char **path)
{
static char hostname[512];
char *p;
*port = 0;
*path = "";
if ((p = strstr(url, "http:
((void *)0)
) {
snprintf(hostname, sizeof(hostname), "%s", p + 7);
p = strchr(hostname, '/');
if (p !=
((void *)0)
) {
*p = 0;
*path = p+1;
}
p = strchr(hostname, ':');
if (p !=
((void *)0)
) {
*p = 0;
*port = atoi(p + 1);
}
return hostname;
} else {
return url;
}
}
| int host_from_url(char *a0, unsigned int *a1, unsigned long long *a2) {
char *v0;
unsigned int v2;
*(a1) = 0;
*(a2) = &g_402240;
v0 = strstr(a0, "http:
if (!v0) {
v2 = a0;
return v2;
}
snprintf(&hostname.12197, 0x200, "%s", (v0 + 7));
v0 = strchr(&hostname.12197, 0x2f);
if (v0) {
*(v0) = 0;
*(a2) = v0 + 1;
}
v0 = strchr(&hostname.12197, 0x3a);
if (v0) {
*(v0) = 0;
*(a1) = atoi(v0 + 1);
v2 = &hostname.12197;
return v2;
}
v2 = &hostname.12197;
return v2;
}
|
int
main (int argc, char *argv[])
{
size_t i;
if (argc < 2) {
fprintf(
stderr
, "Usage: fstab-decode command [arguments]\n");
return
1
;
}
for (i = 2; i < (size_t)argc; i++)
decode(argv[i]);
execvp(argv[1], argv + 1);
fprintf(
stderr
, "fstab-decode: %s: %s\n", argv[1], strerror(
(*__errno_location ())
));
return 127;
}
| int main(unsigned long a0, unsigned long long a1) {
unsigned long long v0;
unsigned int v2;
if (a0 <= 1) {
fprintf(*(&stderr), "Usage: fstab-decode command [arguments]\n");
v2 = 1;
return v2;
}
for (v0 = 2; v0 < a0; v0 += 1) {
decode(*((a1 + v0 * 8)));
}
execvp(*((a1 + 8)), a1 + 8);
fprintf(*(&stderr), "fstab-decode: %s: %s\n", *((a1 + 8)), strerror(*(__errno_location())));
v2 = 127;
return v2;
}
|
static void
read_and_process (struct tar_stat_info *st, int (*processor) (size_t, char *))
{
union block *data_block;
size_t data_size;
off_t size = st->stat.st_size;
mv_begin_read (st);
while (size)
{
data_block = find_next_block ();
if (! data_block)
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Unexpected EOF in archive")); exit_status = 2; } while (0);
return;
}
data_size = available_space_after (data_block);
if (data_size > size)
data_size = size;
if (!(*processor) (data_size, data_block->buffer))
processor = process_noop;
set_next_block_after ((union block *)
(data_block->buffer + data_size - 1));
size -= data_size;
mv_size_left (size);
}
mv_end ();
}
| void read_and_process(struct_0 *a0, unsigned long long a1) {
unsigned long long v0;
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v5;
unsigned long long v6;
v0 = a1;
v2 = a0->field_88;
mv_begin_read(a0);
while (true) {
if (!v2) {
v5 = mv_end();
break;
} else {
v3 = find_next_block();
if (v3) {
v1 = available_space_after(v3);
if (v1 > v2)
v1 = v2;
if (!(stack_base)[56](v1, v3, v3, (stack_base)[56]))
v0 = process_noop;
set_next_block_after(v3 + v1 - 1);
v2 -= v1;
mv_size_left(v2);
} else {
if (error_hook)
*(5243024)();
v6 = error(0x0, 0x0, gettext("Unexpected EOF in archive"));
exit_status = 2;
break;
}
}
}
return;
}
|
static char *
scan_troff_mandoc(char *c, int san, char **result)
{
char *ret, *end = c;
int oldval = mandoc_line;
mandoc_line = 1;
while (*end && *end != '\n') {
end++;
}
if (end > c + 2
&&
((*__ctype_b_loc ())[(int) ((
*(end - 1)
))] & (unsigned short int) _ISpunct)
&&
((*__ctype_b_loc ())[(int) ((
*(end - 2)
))] & (unsigned short int) _ISspace)
&& *(end - 2) != '\n') {
*(end - 2) = '\n';
ret = scan_troff(c, san, result);
*(end - 2) = *(end - 1);
*(end - 1) = ' ';
} else {
ret = scan_troff(c, san, result);
}
mandoc_line = oldval;
return ret;
}
| char * scan_troff_mandoc(char *a1, int a2, char **a3)
{
int v5;
char *v6;
char *v7;
v7 = a1;
v5 = mandoc_line;
mandoc_line = 1;
while ( *v7 && *v7 != 10 )
++v7;
if ( v7 > a1 + 2
&& ((*_ctype_b_loc())[*(v7 - 1)] & 4) != 0
&& ((*_ctype_b_loc())[*(v7 - 2)] & 0x2000) != 0
&& *(v7 - 2) != 10 )
{
*(v7 - 2) = 10;
v6 = scan_troff(a1, a2, a3);
*(v7 - 2) = *(v7 - 1);
*(v7 - 1) = 32;
}
else
{
v6 = scan_troff(a1, a2, a3);
}
mandoc_line = v5;
return v6;
}
|
test_code_t test_anonymous(gnutls_session_t session)
{
int ret;
sprintf(prio_str,
"NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:"
"+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":+ANON-DH:+ANON-ECDH:+CURVE-ALL:%s",
protocol_str, rest);
{ int _ret; if ((_ret=__gnutls_priority_set_direct(session, prio_str, 1466)) != TEST_SUCCEED) { return _ret; } };
gnutls_credentials_set(session, GNUTLS_CRD_ANON, anon_cred);
ret = test_do_handshake(session);
if (ret == TEST_SUCCEED)
gnutls_dh_get_pubkey(session, &pubkey);
return ret;
}
| long long test_anonymous(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
sprintf(&prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+ANON-DH:+ANON-ECDH:+CURVE-ALL:%s", &protocol_str, &rest);
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x5ba);
if (v0) {
v3 = v0;
} else {
gnutls_credentials_set(a0, 0x2, anon_cred);
v1 = test_do_handshake(a0);
if (!v1)
gnutls_dh_get_pubkey(a0, &pubkey);
v3 = v1;
}
return v3;
}
|
void *
xmalloc (size_t n)
{
void *p = malloc (n);
if (!p)
xalloc_die ();
return p;
}
| int xmalloc(unsigned int a0) {
unsigned long v0;
v0 = malloc(a0);
if (!v0)
xalloc_die();
return v0;
}
|
void *
GEAcompile (char *pattern, idx_t size, reg_syntax_t syntax_bits,
_Bool
exact)
{
char *motif;
struct dfa_comp *dc = xcalloc (1, sizeof (*dc));
dc->dfa = dfaalloc ();
if (match_icase)
syntax_bits |= ((((((((((((((((((((((((unsigned long int) 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1);
int dfaopts = (DFA_CONFUSING_BRACKETS_ERROR | DFA_STRAY_BACKSLASH_WARN
| DFA_PLUS_WARN
| (syntax_bits & ((((((unsigned long int) 1) << 1) << 1) << 1) << 1) ? DFA_STAR_WARN : 0)
| (eolbyte ? 0 : DFA_EOL_NUL));
dfasyntax (dc->dfa, &localeinfo, syntax_bits, dfaopts);
_Bool
bs_safe = !localeinfo.multibyte | localeinfo.using_utf8;
char const *p = pattern;
char const *patlim = pattern + size;
_Bool
compilation_failed =
0
;
dc->patterns = xmalloc (sizeof *dc->patterns);
dc->patterns++;
dc->pcount = 0;
idx_t palloc = 1;
char const *prev = pattern;
char *buf =
((void *)0)
;
idx_t buflen = 0;
idx_t bufalloc = 0;
idx_t lineno = 0;
do
{
char const *sep = rawmemchr (p, '\n');
idx_t len = sep - p;
_Bool
backref = possible_backrefs_in_pattern (p, len, bs_safe);
if (backref && prev < p)
{
idx_t prevlen = p - prev;
ptrdiff_t bufshortage = buflen - bufalloc + prevlen;
if (0 < bufshortage)
buf = xpalloc (buf, &bufalloc, bufshortage, -1, 1);
memcpy (buf + buflen, prev, prevlen);
buflen += prevlen;
}
ptrdiff_t shortage = dc->pcount - palloc + 2;
if (0 < shortage)
{
dc->patterns = xpalloc (dc->patterns - 1, &palloc, shortage, -1,
sizeof *dc->patterns);
dc->patterns++;
}
re_set_syntax (syntax_bits);
if (!regex_compile (dc, p, len, dc->pcount, lineno, syntax_bits,
!backref))
compilation_failed =
1
;
p = sep + 1;
lineno++;
if (backref)
{
dc->pcount++;
prev = p;
}
}
while (p <= patlim);
if (compilation_failed)
exit (EXIT_TROUBLE);
if (prev <= patlim)
{
if (pattern < prev)
{
idx_t prevlen = patlim - prev;
buf = xirealloc (buf, buflen + prevlen);
memcpy (buf + buflen, prev, prevlen);
buflen += prevlen;
}
else
{
buf = pattern;
buflen = size;
}
}
if (match_words || match_lines)
{
static char const line_beg_no_bk[] = "^(";
static char const line_end_no_bk[] = ")$";
static char const word_beg_no_bk[] = "(^|[^[:alnum:]_])(";
static char const word_end_no_bk[] = ")([^[:alnum:]_]|$)";
static char const line_beg_bk[] = "^\\(";
static char const line_end_bk[] = "\\)$";
static char const word_beg_bk[] = "\\(^\\|[^[:alnum:]_]\\)\\(";
static char const word_end_bk[] = "\\)\\([^[:alnum:]_]\\|$\\)";
int bk = !(syntax_bits & (((((((((((((((unsigned long int) 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1));
idx_t bracket_bytes = sizeof word_beg_bk - 1 + sizeof word_end_bk;
char *n = ximalloc (size + bracket_bytes);
strcpy (n, match_lines ? (bk ? line_beg_bk : line_beg_no_bk)
: (bk ? word_beg_bk : word_beg_no_bk));
idx_t total = strlen (n);
memcpy (n + total, pattern, size);
total += size;
strcpy (n + total, match_lines ? (bk ? line_end_bk : line_end_no_bk)
: (bk ? word_end_bk : word_end_no_bk));
total += strlen (n + total);
pattern = motif = n;
size = total;
}
else
motif =
((void *)0)
;
dfaparse (pattern, size, dc->dfa);
kwsmusts (dc);
dfacomp (
((void *)0)
, 0, dc->dfa, 1);
if (buf !=
((void *)0)
)
{
if (exact || !dfasupported (dc->dfa))
{
dc->patterns--;
dc->pcount++;
if (!regex_compile (dc, buf, buflen, 0, -1, syntax_bits,
0
))
abort ();
}
if (buf != pattern)
free (buf);
}
free (motif);
return dc;
}
| long GEAcompile(char *param_1,size_t param_2,ulong param_3,char param_4)
{
char *pcVar1;
size_t sVar2;
byte bVar3;
char cVar4;
char cVar5;
uint uVar6;
undefined8 uVar7;
undefined1 *puVar8;
long in_FS_OFFSET;
bool bVar9;
ulong local_d0;
size_t local_c8;
char *local_c0;
long local_a8;
long local_a0;
char *local_98;
char *local_90;
char *local_88;
char *local_80;
size_t local_78;
long local_70;
long local_68;
char *local_60;
void *local_58;
long local_50;
size_t local_48;
long local_40;
long local_38;
size_t local_30;
undefined8 local_28;
char *local_20;
size_t local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_68 = xcalloc(1,0x48);
uVar7 = dfaalloc();
*(undefined8 *)(local_68 + 8) = uVar7;
local_d0 = param_3;
if (match_icase != '\0') {
local_d0 = param_3 | 0x400000;
}
if (eolbyte == '\0') {
uVar6 = 2;
}
else {
uVar6 = 0;
}
dfasyntax(*(undefined8 *)(local_68 + 8),&localeinfo,local_d0,uVar6 | (uint)local_d0 & 0x10 | 0x2c)
;
bVar3 = DAT_001020aa | localeinfo ^ 1;
local_60 = param_1 + param_2;
bVar9 = false;
local_90 = param_1;
uVar7 = xmalloc(0x40);
*(undefined8 *)(local_68 + 0x10) = uVar7;
*(long *)(local_68 + 0x10) = *(long *)(local_68 + 0x10) + 0x40;
*(undefined8 *)(local_68 + 0x18) = 0;
local_a8 = 1;
local_80 = (char *)0x0;
local_78 = 0;
local_a0 = 0;
local_70 = 0;
local_88 = param_1;
do {
local_58 = rawmemchr(local_90,10);
local_50 = (long)local_58 - (long)local_90;
cVar4 = possible_backrefs_in_pattern(local_90,local_50,bVar3 != 0);
if ((cVar4 != '\0') && (local_88 < local_90)) {
local_48 = (long)local_90 - (long)local_88;
local_40 = local_48 + (local_78 - local_a0);
if (0 < local_40) {
local_80 = (char *)xpalloc(local_80,&local_a0,local_40,0xffffffffffffffff,1);
}
memcpy(local_80 + local_78,local_88,local_48);
local_78 = local_78 + local_48;
}
local_38 = (*(long *)(local_68 + 0x18) - local_a8) + 2;
if (0 < local_38) {
uVar7 = xpalloc(*(long *)(local_68 + 0x10) + -0x40,&local_a8,local_38,0xffffffffffffffff,0x40)
;
*(undefined8 *)(local_68 + 0x10) = uVar7;
*(long *)(local_68 + 0x10) = *(long *)(local_68 + 0x10) + 0x40;
}
uVar7 = 0x10081d;
re_set_syntax(local_d0);
cVar5 = regex_compile(local_68,local_90,local_50,*(undefined8 *)(local_68 + 0x18),local_70,
local_d0,cVar4 == '\0',uVar7);
if (cVar5 != '\x01') {
bVar9 = true;
}
local_90 = (char *)((long)local_58 + 1);
local_70 = local_70 + 1;
if (cVar4 != '\0') {
*(long *)(local_68 + 0x18) = *(long *)(local_68 + 0x18) + 1;
local_88 = local_90;
}
} while (local_90 <= local_60);
if (bVar9) {
exit(2);
}
pcVar1 = local_80;
sVar2 = local_78;
if ((local_88 <= local_60) && (pcVar1 = param_1, sVar2 = param_2, param_1 < local_88)) {
local_30 = (long)local_60 - (long)local_88;
local_80 = (char *)xirealloc(local_80,local_78 + local_30);
memcpy(local_80 + local_78,local_88,local_30);
pcVar1 = local_80;
sVar2 = local_78 + local_30;
}
local_78 = sVar2;
local_80 = pcVar1;
if ((match_words == '\0') && (match_lines == '\0')) {
local_98 = (char *)0x0;
local_c8 = param_2;
local_c0 = param_1;
}
else {
bVar9 = (local_d0 & 0x2000) != 0;
local_28 = 0x2d;
local_20 = (char *)ximalloc(param_2 + 0x2d);
if (match_lines == '\0') {
if (bVar9) {
puVar8 = word_beg_no_bk_5560;
}
else {
puVar8 = word_beg_bk_5564;
}
}
else if (bVar9) {
puVar8 = (undefined1 *)&line_beg_no_bk_5558;
}
else {
puVar8 = (undefined1 *)&line_beg_bk_5562;
}
strcpy(local_20,puVar8);
local_18 = strlen(local_20);
memcpy(local_20 + local_18,param_1,param_2);
local_18 = local_18 + param_2;
if (match_lines == '\0') {
if (bVar9) {
puVar8 = word_end_no_bk_5561;
}
else {
puVar8 = word_end_bk_5565;
}
}
else if (bVar9) {
puVar8 = (undefined1 *)&line_end_no_bk_5559;
}
else {
puVar8 = (undefined1 *)&line_end_bk_5563;
}
strcpy(local_20 + local_18,puVar8);
local_c8 = strlen(local_20 + local_18);
local_c8 = local_c8 + local_18;
local_98 = local_20;
local_c0 = local_20;
local_18 = local_c8;
}
dfaparse(local_c0,local_c8,*(undefined8 *)(local_68 + 8));
kwsmusts(local_68);
uVar7 = 0x100b29;
dfacomp(0,0,*(undefined8 *)(local_68 + 8),1);
if (local_80 == (char *)0x0) goto LAB_00100bd5;
if (param_4 == '\0') {
uVar7 = 0x100b4d;
cVar4 = dfasupported(*(undefined8 *)(local_68 + 8));
if (cVar4 != '\x01') goto LAB_00100b54;
}
else {
LAB_00100b54:
*(long *)(local_68 + 0x10) = *(long *)(local_68 + 0x10) + -0x40;
*(long *)(local_68 + 0x18) = *(long *)(local_68 + 0x18) + 1;
cVar4 = regex_compile(local_68,local_80,local_78,0,0xffffffffffffffff,local_d0,0,uVar7);
if (cVar4 != '\x01') {
abort();
}
}
if (local_80 != local_c0) {
free(local_80);
}
LAB_00100bd5:
free(local_98);
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_68;
}
__stack_chk_fail();
}
|
int
rl_restore_state (struct readline_state *sp)
{
if (sp == 0)
return -1;
rl_point = sp->point;
rl_end = sp->end;
rl_mark = sp->mark;
the_line = rl_line_buffer = sp->buffer;
rl_line_buffer_len = sp->buflen;
rl_undo_list = sp->ul;
rl_prompt = sp->prompt;
rl_readline_state = sp->rlstate;
rl_done = sp->done;
_rl_keymap = sp->kmap;
rl_last_func = sp->lastfunc;
rl_insert_mode = sp->insmode;
rl_editing_mode = sp->edmode;
rl_executing_keyseq = sp->kseq;
rl_key_sequence_length = sp->kseqlen;
rl_instream = sp->inf;
rl_outstream = sp->outf;
rl_pending_input = sp->pendingin;
rl_executing_macro = sp->macro;
rl_catch_signals = sp->catchsigs;
rl_catch_sigwinch = sp->catchsigwinch;
rl_completion_entry_function = sp->entryfunc;
rl_menu_completion_entry_function = sp->menuentryfunc;
rl_ignore_some_completions_function = sp->ignorefunc;
rl_attempted_completion_function = sp->attemptfunc;
rl_completer_word_break_characters = sp->wordbreakchars;
rl_deactivate_mark ();
return (0);
}
| long long rl_restore_state(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned long long v1;
if (!a0) {
v1 = 4294967295;
return v1;
}
rl_executing_key = a0->field_0;
rl_executing_key = a0->field_4;
rl_executing_key = a0->field_8;
rl_line_buffer = a0->field_10;
the_line = rl_line_buffer;
rl_line_buffer_len = a0->field_c;
rl_undo_list = a0->field_18;
rl_prompt = a0->field_20;
rl_readline_state = a0->field_28;
rl_executing_key = a0->field_2c;
_rl_keymap = a0->field_30;
rl_last_func = a0->field_38;
rl_insert_mode = a0->field_40;
rl_editing_mode = a0->field_44;
rl_executing_keyseq = a0->field_48;
rl_key_sequence_length = a0->field_50;
rl_instream = a0->field_58;
rl_outstream = a0->field_60;
rl_pending_input = a0->field_54;
rl_executing_macro = a0->field_68;
rl_catch_signals = a0->field_70;
rl_catch_sigwinch = a0->field_74;
rl_completion_entry_function = a0->field_78;
rl_menu_completion_entry_function = a0->field_80;
rl_ignore_some_completions_function = a0->field_88;
rl_attempted_completion_function = a0->field_90;
rl_completer_word_break_characters = a0->field_98;
rl_deactivate_mark(a0, a1, a2, a3, a4, a5);
v1 = 0;
return v1;
}
|
static void
queue_check_insert_parent (struct merge_node_queue *queue,
struct merge_node *node)
{
if (node->level > MERGE_ROOT)
{
lock_node (node->parent);
queue_check_insert (queue, node->parent);
unlock_node (node->parent);
}
else if (node->nlo + node->nhi == 0)
{
queue_insert (queue, node->parent);
}
}
| int queue_check_insert_parent(long a1, long a2)
{
long v2;
if ( *(_DWORD *)(a2 + 80) <= 1u )
{
v2 = *(_QWORD *)(a2 + 40) + *(_QWORD *)(a2 + 48);
if ( !v2 )
LODWORD(v2) = queue_insert(a1, *(_QWORD *)(a2 + 56));
}
else
{
lock_node(*(_QWORD *)(a2 + 56));
queue_check_insert(a1, *(_QWORD *)(a2 + 56));
LODWORD(v2) = unlock_node(*(_QWORD *)(a2 + 56));
}
return v2;
}
|
static void
ssh_init_forward_permissions(struct ssh *ssh, const char *what, char **opens,
u_int num_opens)
{
u_int i;
int port;
char *addr, *arg, *oarg;
int where = (1<<1);
channel_clear_permission(ssh, 0x100, where);
if (num_opens == 0)
return;
if (num_opens == 1 && strcmp(opens[0], "any") == 0)
return;
if (num_opens == 1 && strcmp(opens[0], "none") == 0) {
channel_disable_admin(ssh, where);
return;
}
for (i = 0; i < num_opens; i++) {
oarg = arg = xstrdup(opens[i]);
addr = hpdelim(&arg);
if (addr ==
((void *)0)
)
sshfatal("ssh.c", __func__, 1919, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "missing host in %s", what);
addr = cleanhostname(addr);
if (arg ==
((void *)0)
|| ((port = permitopen_port(arg)) < 0))
sshfatal("ssh.c", __func__, 1922, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "bad port number in %s", what);
channel_add_permission(ssh, 0x100,
where, addr, port);
free(oarg);
}
}
| void ssh_init_forward_permissions(undefined8 param_1,undefined8 param_2,char **param_3,uint param_4)
{
char *pcVar1;
int iVar2;
undefined *puVar3;
undefined *puVar4;
long in_FS_OFFSET;
undefined auStack88 [4];
uint local_54;
char **local_50;
undefined8 local_48;
undefined8 local_40;
uint local_34;
undefined4 local_30;
int local_2c;
void *local_28;
void *local_20;
long local_18;
long local_10;
puVar4 = auStack88;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_30 = 2;
local_54 = param_4;
local_50 = param_3;
local_48 = param_2;
local_40 = param_1;
channel_clear_permission(param_1,0x100,2);
puVar3 = auStack88;
if ((local_54 != 0) &&
((local_54 != 1 || (iVar2 = strcmp(*local_50,"any"), puVar3 = auStack88, iVar2 != 0)))) {
if ((local_54 == 1) && (iVar2 = strcmp(*local_50,"none"), iVar2 == 0)) {
channel_disable_admin(local_40,local_30);
puVar3 = auStack88;
}
else {
for (local_34 = 0; puVar3 = puVar4, local_34 < local_54; local_34 = local_34 + 1) {
pcVar1 = local_50[local_34];
*(undefined8 *)(puVar4 + -8) = 0x1068ad;
local_28 = (void *)xstrdup(pcVar1);
local_20 = local_28;
*(undefined8 *)(puVar4 + -8) = 0x1068c5;
local_18 = hpdelim(&local_28);
if (local_18 == 0) {
*(undefined8 *)(puVar4 + -8) = local_48;
puVar3 = puVar4 + -0x10;
*(char **)(puVar4 + -0x10) = "missing host in %s";
*(undefined8 *)(puVar4 + -0x18) = 0x106909;
sshfatal("ssh.c","ssh_init_forward_permissions",0x77f,1,1,0);
}
*(undefined8 *)(puVar3 + -8) = 0x106915;
local_18 = cleanhostname(local_18);
if (local_28 == (void *)0x0) {
LAB_00106937:
*(undefined8 *)(puVar3 + -8) = local_48;
puVar4 = puVar3 + -0x10;
*(char **)(puVar3 + -0x10) = "bad port number in %s";
*(undefined8 *)(puVar3 + -0x18) = 0x106970;
sshfatal("ssh.c","ssh_init_forward_permissions",0x782,1,1,0);
}
else {
*(undefined8 *)(puVar3 + -8) = 0x10692e;
local_2c = permitopen_port(local_28);
puVar4 = puVar3;
if (local_2c < 0) goto LAB_00106937;
}
*(undefined8 *)(puVar4 + -8) = 0x10698e;
channel_add_permission(local_40,0x100,local_30,local_18,local_2c);
*(undefined8 *)(puVar4 + -8) = 0x10699a;
free(local_20);
}
}
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
*(undefined8 *)(puVar3 + -8) = 0x1069c4;
__stack_chk_fail();
}
|
static void
_write_volume_label (const char *str)
{
if (archive_format == POSIX_FORMAT)
xheader_store ("GNU.volume.label", &dummy, str);
else
{
union block *label = find_next_block ();
memset (label, 0, 512);
strcpy (label->header.name, str);
assign_string (¤t_stat_info.file_name, label->header.name);
current_stat_info.had_trailing_slash =
strip_trailing_slashes (current_stat_info.file_name);
label->header.typeflag = 'V';
time_to_chars (start_time.tv_sec, label->header.mtime, sizeof (label->header.mtime));
finish_header (¤t_stat_info, label, -1);
set_next_block_after (label);
}
}
| void _write_volume_label(char *a0) {
struct_0 *v0;
unsigned long long v2;
unsigned long long v3;
if (archive_format == 4) {
v2 = xheader_store("GNU.volume.label", &dummy, a0);
return;
}
v0 = find_next_block();
memset(v0, 0x0, 0x200);
strcpy(v0, a0);
assign_string(tar_stat_destroy, v0);
read_full_records_option = strip_trailing_slashes(tar_stat_destroy);
v0->field_9c = 86;
time_to_chars(start_time, &v0->padding_0[136], 0xc, &v0->padding_0[136]);
finish_header(0x500188, v0, 0xffffffffffffffff);
v3 = set_next_block_after(v0);
return;
}
|
static void
send_msg(struct sshbuf *m)
{
int r;
if ((r = sshbuf_put_stringb(oqueue, m)) != 0)
sshfatal("ssh-pkcs11-helper.c", __func__, 115, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "enqueue");
}
| void send_msg(undefined8 param_1)
{
int iVar1;
undefined8 uVar2;
undefined8 uVar3;
iVar1 = sshbuf_put_stringb(oqueue,param_1);
if (iVar1 != 0) {
uVar3 = 0x10027c;
uVar2 = ssh_err(iVar1);
sshfatal("ssh-pkcs11-helper.c","send_msg",0x73,1,1,uVar2,"enqueue",uVar3);
}
return;
}
|
STRINGLIST *
strlist_append (m1, m2)
STRINGLIST *m1, *m2;
{
register int i, n, len1, len2;
if (m1 == 0)
return (m2 ? strlist_copy (m2) : (STRINGLIST *)0);
len1 = m1->list_len;
len2 = m2 ? m2->list_len : 0;
if (len2)
{
m1 = strlist_resize (m1, len1 + len2 + 1);
for (i = 0, n = len1; i < len2; i++, n++)
m1->list[n] = ((m2->list[i]) ? (char *)strcpy (sh_xmalloc((1 + strlen (m2->list[i])), "stringlist.c", 183), (m2->list[i])) : (char *)
((void *)0)
);
m1->list[n] = (char *)
((void *)0)
;
m1->list_len = n;
}
return m1;
}
| long strlist_append(long a1, long a2)
{
int v3;
int v4;
int v5;
int i;
const char *v7;
size_t v8;
char *v9;
char *v10;
long v11;
v11 = a1;
if ( a1 )
{
v3 = *(_DWORD *)(a1 + 12);
if ( a2 )
v4 = *(_DWORD *)(a2 + 12);
else
v4 = 0;
v5 = v4;
if ( v4 )
{
v11 = strlist_resize(a1, v3 + v4 + 1);
for ( i = 0; i < v5; ++i )
{
if ( *(_QWORD *)(8LL * i + *(_QWORD *)a2) )
{
v7 = *(const char **)(8LL * i + *(_QWORD *)a2);
v8 = strlen(v7);
v9 = (char *)sh_xmalloc(v8 + 1, "stringlist.c", 183LL);
v10 = strcpy(v9, v7);
}
else
{
v10 = 0LL;
}
*(_QWORD *)(8LL * v3++ + *(_QWORD *)v11) = v10;
}
*(_QWORD *)(8LL * v3 + *(_QWORD *)v11) = 0LL;
*(_DWORD *)(v11 + 12) = v3;
}
return v11;
}
else if ( a2 )
{
return strlist_copy(a2);
}
else
{
return 0LL;
}
}
|
static void
tar_pool_free(void *ptr)
{
__extension__ ({ struct obstack *__o = (
&tar_pool
); void *__obj = (
ptr
); if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) __o->next_free = __o->object_base = (char *) __obj; else (obstack_free) (__o, __obj); })
;
}
| void tar_pool_free(void* a0) {
unsigned long long v0;
unsigned long long v2;
unsigned long long v3;
v0 = &tar_pool;
if (a0 > *((v0 + 8)) && a0 < *((v0 + 32))) {
*((v0 + 16)) = a0;
v2 = v0;
*((v0 + 24)) = *((v0 + 16));
goto LABEL_4001e2;
}
v3 = obstack_free(v0, a0);
LABEL_4001e2:
return;
}
|
static void salvage_directory(ext2_filsys fs,
struct ext2_dir_entry *dirent,
struct ext2_dir_entry *prev,
unsigned int *offset,
unsigned int block_len,
int hash_in_dirent)
{
char *cp = (char *) dirent;
int left;
unsigned int rec_len, prev_rec_len;
unsigned int name_len;
if (block_len - *offset < 8) {
name_len = 0;
rec_len = block_len - *offset;
} else {
name_len = ext2fs_dirent_name_len(dirent);
(void) ext2fs_get_rec_len(fs, dirent, &rec_len);
}
left = block_len - *offset - rec_len;
if ((left >= (int) ext2fs_dir_rec_len(1, hash_in_dirent)) &&
(rec_len == 8)) {
memmove(cp, cp+8, left);
memset(cp + left, 0, 8);
return;
}
if ((left < 0) &&
((int) rec_len + left > 8) &&
((int) ext2fs_dir_rec_len(name_len, hash_in_dirent) <= (int) rec_len + left) &&
dirent->inode <= fs->super->s_inodes_count &&
strnlen(dirent->name, name_len) == name_len) {
(void) ext2fs_set_rec_len(fs, (int) rec_len + left, dirent);
return;
}
if (prev && rec_len && (rec_len % 4) == 0 &&
(*offset + rec_len <= block_len)) {
(void) ext2fs_get_rec_len(fs, prev, &prev_rec_len);
prev_rec_len += rec_len;
(void) ext2fs_set_rec_len(fs, prev_rec_len, prev);
*offset += rec_len;
return;
}
if (prev) {
(void) ext2fs_get_rec_len(fs, prev, &prev_rec_len);
prev_rec_len += block_len - *offset;
(void) ext2fs_set_rec_len(fs, prev_rec_len, prev);
*offset = fs->blocksize;
} else {
rec_len = block_len - *offset;
(void) ext2fs_set_rec_len(fs, rec_len, dirent);
ext2fs_dirent_set_name_len(dirent, 0);
ext2fs_dirent_set_file_type(dirent, 0);
dirent->inode = 0;
}
}
| void salvage_directory(long param_1,uint *param_2,long param_3,int *param_4,uint param_5,
undefined4 param_6)
{
int iVar1;
size_t sVar2;
long in_FS_OFFSET;
uint local_28;
int local_24;
uint local_20;
int local_1c;
uint *local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = param_2;
if (param_5 - *param_4 < 8) {
local_20 = 0;
local_28 = param_5 - *param_4;
}
else {
local_20 = ext2fs_dirent_name_len(param_2);
ext2fs_get_rec_len(param_1,param_2,&local_28);
}
local_1c = (param_5 - *param_4) - local_28;
iVar1 = ext2fs_dir_rec_len(1,param_6);
if ((local_1c < iVar1) || (local_28 != 8)) {
if ((local_1c < 0) && (8 < (int)(local_1c + local_28))) {
iVar1 = ext2fs_dir_rec_len(local_20 & 0xff,param_6);
if ((iVar1 <= (int)(local_1c + local_28)) && (*param_2 <= **(uint **)(param_1 + 0x20))) {
sVar2 = strnlen((char *)(param_2 + 2),(ulong)local_20);
if (sVar2 == local_20) {
ext2fs_set_rec_len(param_1,local_1c + local_28,param_2);
goto LAB_00101e19;
}
}
}
if ((((param_3 == 0) || (local_28 == 0)) || ((local_28 & 3) != 0)) ||
(param_5 < local_28 + *param_4)) {
if (param_3 == 0) {
local_28 = param_5 - *param_4;
ext2fs_set_rec_len(param_1,local_28,param_2);
ext2fs_dirent_set_name_len(param_2,0);
ext2fs_dirent_set_file_type(param_2,0);
*param_2 = 0;
}
else {
ext2fs_get_rec_len(param_1,param_3,&local_24);
local_24 = local_24 + (param_5 - *param_4);
ext2fs_set_rec_len(param_1,local_24,param_3);
*param_4 = *(int *)(param_1 + 0x28);
}
}
else {
ext2fs_get_rec_len(param_1,param_3,&local_24);
local_24 = local_28 + local_24;
ext2fs_set_rec_len(param_1,local_24,param_3);
*param_4 = *param_4 + local_28;
}
}
else {
memmove(local_18,local_18 + 2,(long)local_1c);
memset((void *)((long)local_18 + (long)local_1c),0,8);
}
LAB_00101e19:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
char *
tilde_expand_filename(const char *filename, uid_t uid)
{
char *ret;
if (tilde_expand(filename, uid, &ret) != 0)
cleanup_exit(255);
return ret;
}
| long long tilde_expand_filename(char *a0, unsigned long a1) {
char v0;
if (tilde_expand(a0, a1, &v0))
cleanup_exit(0xff);
return *(&v0);
}
|
void get_serial(unsigned char *serial, size_t *size)
{
get_serial_value(serial, size, cfg.serial, cfg.serial_size,
default_serial, "certificate's serial number", "4.1.2.2");
}
| long long get_serial(char *a0, unsigned long long *a1) {
return get_serial_value(a0, a1, *((got.cfg + 520)), *((got.cfg + 528)), default_serial, 0x40b249, 0x40b265);
}
|
enum dump_status
sparse_extract_file (int fd, struct tar_stat_info *st, off_t *size)
{
_Bool
rc =
1
;
struct tar_sparse_file file;
size_t i;
if (!tar_sparse_init (&file))
return dump_status_not_implemented;
file.stat_info = st;
file.fd = fd;
file.seekable = lseek (fd, 0,
0
) == 0;
file.offset = 0;
rc = tar_sparse_decode_header (&file);
for (i = 0; rc && i < file.stat_info->sparse_map_avail; i++)
rc = tar_sparse_extract_region (&file, i);
*size = file.stat_info->archive_file_size - file.dumped_size;
return (tar_sparse_done (&file) && rc) ? dump_status_ok : dump_status_short;
}
| long sparse_extract_file(int a1, long a2, _QWORD *a3)
{
char region;
unsigned long i;
long ( **v7[3])(_QWORD);
long v8;
unsigned long v9;
v9 = __readfsqword(0x28u);
if ( (unsigned char)tar_sparse_init(v7) != 1 )
return 3LL;
v8 = a2;
LODWORD(v7[0]) = a1;
BYTE4(v7[0]) = lseek(a1, 0LL, 0) == 0;
v7[1] = 0LL;
region = tar_sparse_decode_header((long)v7);
for ( i = 0LL; region && i < *(_QWORD *)(v8 + 304); ++i )
region = tar_sparse_extract_region((long)v7, i);
*a3 = *(_QWORD *)(v8 + 280) - (unsigned long)v7[2];
return !(unsigned char)tar_sparse_done((long)v7) || !region;
}
|
void
xheader_xattr_copy (const struct tar_stat_info *st,
struct xattr_array **xattr_map, size_t *xattr_map_size)
{
size_t scan = 0;
*xattr_map =
((void *)0)
;
*xattr_map_size = 0;
while (scan < st->xattr_map_size)
{
char *key = st->xattr_map[scan].xkey;
char *val = st->xattr_map[scan].xval_ptr;
size_t len = st->xattr_map[scan].xval_len;
xheader_xattr__add(xattr_map, xattr_map_size, key, val, len);
++scan;
}
}
| void xheader_xattr_copy(long param_1,undefined8 *param_2,undefined8 *param_3)
{
ulong local_28;
local_28 = 0;
*param_2 = 0;
*param_3 = 0;
for (; local_28 < *(ulong *)(param_1 + 0x158); local_28 = local_28 + 1) {
xheader_xattr__add(param_2,param_3,*(undefined8 *)(local_28 * 0x18 + *(long *)(param_1 + 0x160))
,*(undefined8 *)(local_28 * 0x18 + *(long *)(param_1 + 0x160) + 8),
*(undefined8 *)(local_28 * 0x18 + *(long *)(param_1 + 0x160) + 0x10));
}
return;
}
|
static void
write_gnu_long_link (struct tar_stat_info *st, const char *p, char type)
{
size_t size = strlen (p) + 1;
size_t bufsize;
union block *header;
header = start_private_header ("././@LongLink", size, 0);
if (! numeric_owner_option)
{
static char *uname, *gname;
if (!uname)
{
uid_to_uname (0, &uname);
gid_to_gname (0, &gname);
}
string_to_chars (uname, header->header.uname, sizeof (header->header.uname));
string_to_chars (gname, header->header.gname, sizeof (header->header.gname));
}
strcpy (header->buffer +
__builtin_offsetof (
struct posix_header
,
magic
)
,
"ustar ");
header->header.typeflag = type;
finish_header (st, header, -1);
header = find_next_block ();
bufsize = available_space_after (header);
while (bufsize < size)
{
memcpy (header->buffer, p, bufsize);
p += bufsize;
size -= bufsize;
set_next_block_after (header + (bufsize - 1) / 512);
header = find_next_block ();
bufsize = available_space_after (header);
}
memcpy (header->buffer, p, size);
memset (header->buffer + size, 0, bufsize - size);
set_next_block_after (header + (size - 1) / 512);
}
| void write_gnu_long_link(undefined8 param_1,char *param_2,undefined param_3)
{
size_t sVar1;
long lVar2;
char *local_38;
ulong local_20;
ulong local_18;
void *local_10;
sVar1 = strlen(param_2);
local_20 = sVar1 + 1;
lVar2 = start_private_header("././@LongLink",local_20,0);
if (numeric_owner_option != '\x01') {
if (uname_7197 == 0) {
uid_to_uname(0,&uname_7197);
gid_to_gname(0,&gname_7198);
}
string_to_chars(uname_7197,lVar2 + 0x109,0x20);
string_to_chars(gname_7198,lVar2 + 0x129,0x20);
}
strcpy((char *)(lVar2 + 0x101),"ustar ");
*(undefined *)(lVar2 + 0x9c) = param_3;
finish_header(param_1,lVar2,0xffffffffffffffff);
local_10 = (void *)find_next_block();
local_18 = available_space_after(local_10);
local_38 = param_2;
while (local_18 < local_20) {
memcpy(local_10,local_38,local_18);
local_38 = local_38 + local_18;
local_20 = local_20 - local_18;
set_next_block_after((long)local_10 + (local_18 - 1 & 0xfffffffffffffe00));
local_10 = (void *)find_next_block();
local_18 = available_space_after(local_10);
}
memcpy(local_10,local_38,local_20);
memset((void *)((long)local_10 + local_20),0,local_18 - local_20);
set_next_block_after((long)local_10 + (local_20 - 1 & 0xfffffffffffffe00));
return;
}
|
static void
channel_pre_open(struct ssh *ssh, Channel *c)
{
c->io_want = 0;
if (c->istate == 0 &&
c->remote_window > 0 &&
sshbuf_len(c->input) < c->remote_window &&
sshbuf_check_reserve(c->input, (16*1024)) == 0)
c->io_want |= 0x01;
if (c->ostate == 0 ||
c->ostate == 1) {
if (sshbuf_len(c->output) > 0) {
c->io_want |= 0x02;
} else if (c->ostate == 1) {
if ((c->extended_usage == 2 && c->efd != -1 && (!(c->flags & (0x08|0x02)) || sshbuf_len(c->extended) > 0)))
sshlog("channels.c", __func__, 1127, 0, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "channel %d: " "obuf_empty delayed efd %d/(%zu)", c->self, c->efd, sshbuf_len(c->extended))
;
else
chan_obuf_empty(ssh, c);
}
}
if (c->efd != -1 && !(c->istate == 3 &&
c->ostate == 3)) {
if (c->extended_usage == 2 &&
sshbuf_len(c->extended) > 0)
c->io_want |= 0x08;
else if (c->efd != -1 && !(c->flags & 0x04) &&
(c->extended_usage == 1 ||
c->extended_usage == 0) &&
sshbuf_len(c->extended) < c->remote_window)
c->io_want |= 0x04;
}
}
| void channel_pre_open(undefined8 param_1,long param_2)
{
int iVar1;
ulong uVar2;
long lVar3;
undefined8 uVar4;
*(undefined4 *)(param_2 + 0x2c) = 0;
if ((((*(int *)(param_2 + 0x10) == 0) && (*(int *)(param_2 + 0xa8) != 0)) &&
(uVar2 = sshbuf_len(*(undefined8 *)(param_2 + 0x68)), uVar2 < *(uint *)(param_2 + 0xa8))) &&
(iVar1 = sshbuf_check_reserve(*(undefined8 *)(param_2 + 0x68),0x4000), iVar1 == 0)) {
*(uint *)(param_2 + 0x2c) = *(uint *)(param_2 + 0x2c) | 1;
}
if ((*(int *)(param_2 + 0x14) == 0) || (*(int *)(param_2 + 0x14) == 1)) {
lVar3 = sshbuf_len(*(undefined8 *)(param_2 + 0x70));
if (lVar3 == 0) {
if (*(int *)(param_2 + 0x14) == 1) {
if (((*(int *)(param_2 + 0xc0) == 2) && (*(int *)(param_2 + 0x24) != -1)) &&
(((*(uint *)(param_2 + 0x18) & 10) == 0 ||
(lVar3 = sshbuf_len(*(undefined8 *)(param_2 + 0x78)), lVar3 != 0)))) {
uVar4 = sshbuf_len(*(undefined8 *)(param_2 + 0x78));
sshlog("channels.c","channel_pre_open",0x467,0,6,0,
"channel %d: obuf_empty delayed efd %d/(%zu)",*(undefined4 *)(param_2 + 4),
*(undefined4 *)(param_2 + 0x24),uVar4);
}
else {
chan_obuf_empty(param_1,param_2);
}
}
}
else {
*(uint *)(param_2 + 0x2c) = *(uint *)(param_2 + 0x2c) | 2;
}
}
if ((*(int *)(param_2 + 0x24) != -1) &&
((*(int *)(param_2 + 0x10) != 3 || (*(int *)(param_2 + 0x14) != 3)))) {
if ((*(int *)(param_2 + 0xc0) == 2) &&
(lVar3 = sshbuf_len(*(undefined8 *)(param_2 + 0x78)), lVar3 != 0)) {
*(uint *)(param_2 + 0x2c) = *(uint *)(param_2 + 0x2c) | 8;
return;
}
if (((*(int *)(param_2 + 0x24) != -1) && ((*(uint *)(param_2 + 0x18) & 4) == 0)) &&
(((*(int *)(param_2 + 0xc0) == 1 || (*(int *)(param_2 + 0xc0) == 0)) &&
(uVar2 = sshbuf_len(*(undefined8 *)(param_2 + 0x78)), uVar2 < *(uint *)(param_2 + 0xa8)))))
{
*(uint *)(param_2 + 0x2c) = *(uint *)(param_2 + 0x2c) | 4;
}
}
return;
}
|
static int
check_key_not_revoked(struct hostkeys *hostkeys, struct sshkey *k)
{
int is_cert = sshkey_is_cert(k);
u_int i;
for (i = 0; i < hostkeys->num_entries; i++) {
if (hostkeys->entries[i].marker != MRK_REVOKE)
continue;
if (sshkey_equal_public(k, hostkeys->entries[i].key))
return -1;
if (is_cert && k !=
((void *)0)
&&
sshkey_equal_public(k->cert->signature_key,
hostkeys->entries[i].key))
return -1;
}
return 0;
}
| int check_key_not_revoked(struct_1 *a0, struct_2 *a1) {
unsigned int v0;
unsigned int v1;
unsigned int v3;
v1 = sshkey_is_cert(a1);
v0 = 0;
while (true) {
if (v0 < a0->field_8) {
if (*((((v0 << 2) + v0 << 3) + a0->field_0 + 32)) == 2) {
v3 = sshkey_equal_public(a1, *((v0 * 40 + a0->field_0 + 24)), *((v0 * 40 + a0->field_0 + 24)), a0->field_0);
if (v3) {
v3 = -1;
break;
} else if (v1 && a1) {
v3 = sshkey_equal_public(a1->field_80->field_50, *((v0 * 40 + a0->field_0 + 24)), *((v0 * 40 + a0->field_0 + 24)), a0->field_0);
if (v3) {
v3 = -1;
break;
}
}
}
if (*((((v0 << 2) + v0 << 3) + a0->field_0 + 32)) != 2 || !v1 && !v3 || !v3 && !a1 || !v3 && !v3)
v0 += 1;
} else {
v3 = 0;
break;
}
}
return v3;
}
|
static
_Bool
open_failure_recover (struct tar_stat_info const *dir)
{
if (
(*__errno_location ())
==
24
&& dir && dir->parent)
{
struct tar_stat_info *p;
for (p = dir->parent->parent; p; p = p->parent)
if (0 < p->fd && (! p->parent || p->parent->fd <= 0))
{
tar_stat_close (p);
return
1
;
}
(*__errno_location ())
=
24
;
}
return
0
;
}
| int open_failure_recover(struct_0 *a0) {
struct_2 *v0;
unsigned int v3;
if (*(__errno_location()) != 24) {
v3 = 0;
return v3;
} else if (!a0) {
v3 = 0;
return v3;
} else if (!a0->field_198) {
v3 = 0;
return v3;
} else {
v0 = a0->field_198->field_198;
while (true) {
if (!v0) {
*(__errno_location()) = 24;
v3 = 0;
return v3;
}
if (!(v0->field_1a8 <= 0) && (!(v0->field_198) || !(v0->field_198->field_1a8 > 0)))
break;
v0 = &v0->field_198->padding_0;
}
tar_stat_close(v0);
v3 = 1;
return v3;
}
}
|
SHELL_VAR *
find_function (name)
const char *name;
{
return (hash_lookup (name, shell_functions));
}
| int find_function(unsigned long long a0) {
return hash_lookup(a0, shell_functions);
}
|
ch_aliasfun(EditLine *el, el_afunc_t f, void *a)
{
el->el_chared.c_aliasfun = f;
el->el_chared.c_aliasarg = a;
return 0;
}
| undefined8 ch_aliasfun(long param_1,undefined8 param_2,undefined8 param_3)
{
*(undefined8 *)(param_1 + 0x3d8) = param_2;
*(undefined8 *)(param_1 + 1000) = param_3;
return 0;
}
|
static int iplink_filter_req(struct nlmsghdr *nlh, int reqlen)
{
int err;
err = addattr32(nlh, reqlen, IFLA_EXT_MASK, (1 << 0));
if (err)
return err;
if (filter.master) {
err = addattr32(nlh, reqlen, IFLA_MASTER, filter.master);
if (err)
return err;
}
if (filter.kind) {
struct rtattr *linkinfo;
linkinfo = addattr_nest(nlh, reqlen, IFLA_LINKINFO);
err = addattr_l(nlh, reqlen, IFLA_INFO_KIND, filter.kind,
strlen(filter.kind));
if (err)
return err;
addattr_nest_end(nlh, linkinfo);
}
return 0;
}
| long long iplink_filter_req(unsigned long long a0, unsigned long a1) {
unsigned int v0;
unsigned long long v1;
void* v3;
v0 = addattr32(a0, a1, 0x1d, 0x1);
if (v0) {
v3 = v0;
} else {
if (g_408654) {
v0 = addattr32(a0, a1, 0xa, g_408654);
if (v0) {
v3 = v0;
goto LABEL_4062ad;
}
}
if (g_408658) {
v1 = addattr_nest(a0, a1, 0x12, a1);
v0 = addattr_l(a0, a1, 0x1, g_408658, strlen(g_408658));
if (v0) {
v3 = v0;
goto LABEL_4062ad;
} else {
addattr_nest_end(a0, v1, v1);
}
}
v3 = 0;
}
LABEL_4062ad:
return v3;
}
|
_Bool
excluded_name (char const *name, struct tar_stat_info *st)
{
struct exclist *ep;
const char *rname =
((void *)0)
;
char *bname =
((void *)0)
;
_Bool
result;
int nr = 0;
name +=
((void) (
name
), 0)
;
if (excluded_file_name (excluded, name))
return
1
;
if (!st)
return
0
;
for (result =
0
; st && !result; st = st->parent, nr = 0x02)
{
for (ep = st->exclude_list; ep; ep = ep->next)
{
if (ep->flags & nr)
continue;
if ((result = excluded_file_name (ep->excluded, name)))
break;
if (!rname)
{
rname = name;
while (*rname == '.' &&
((
rname[1]
) == '/')
)
rname += 2;
}
if ((result = excluded_file_name (ep->excluded, rname)))
break;
if (!bname)
bname = base_name (name);
if ((result = excluded_file_name (ep->excluded, bname)))
break;
}
}
free (bname);
return result;
}
| long long excluded_name(unsigned long long a0, unsigned long a1) {
unsigned long long v0[55];
char v1;
unsigned int v2;
struct_0 *v3;
void* v4;
void* v5;
unsigned long long v8;
v0[0] = a1;
v4 = 0;
v5 = 0;
v2 = 0;
if (excluded_file_name(excluded, a0, a0)) {
v8 = 1;
} else if (!v0) {
v8 = 0;
} else {
for (v1 = 0; v0; v2 = 2) {
if (!(v1 ^ 1))
break;
if ((v1 ^ 1)) {
for (v3 = v0[54]; v3; v3 = v3->field_0) {
if (!(v3->field_10 & v2)) {
v1 = excluded_file_name(v3->field_18, a0, a0);
if (v1)
break;
if (!v1) {
if (!v4) {
for (v4 = a0; *(v4) == 46; v4 += 2) {
if (v4[1] != 47)
break;
}
}
v1 = excluded_file_name(v3->field_18, v4, v4);
if (v1)
break;
if (!v1) {
if (!v5)
v5 = base_name(a0);
v1 = excluded_file_name(v3->field_18, v5, v5);
if (v1)
break;
}
}
}
}
}
v0[0] = v0[51];
}
free(v5);
v8 = v1;
}
return v8;
}
|
void crypto_sign_ed25519_ref_sc25519_from_shortsc(crypto_sign_ed25519_ref_sc25519 *r, const crypto_sign_ed25519_ref_shortsc25519 *x)
{
int i;
for(i=0;i<16;i++)
r->v[i] = x->v[i];
for(i=0;i<16;i++)
r->v[16+i] = 0;
}
| void crypto_sign_ed25519_ref_sc25519_from_shortsc(unsigned int *a0, unsigned int *a1) {
unsigned int v0;
unsigned long long v3;
unsigned int *v4;
for (v0 = 0; v0 <= 15; v0 = __addvsi3(v0, 0x1, v0)) {
a0[v0] = a1[v0];
}
for (v0 = 0; v0 <= 15; v0 = __addvsi3(v0, 0x1, v4)) {
v4 = __addvsi3(v0, 0x10, v3);
*((a0 + 0x4 * v4)) = 0;
}
return;
}
|
static void build_tree(desc)
tree_desc *desc;
{
ct_data *tree = desc->dyn_tree;
ct_data *stree = desc->static_tree;
int elems = desc->elems;
int n, m;
int max_code = -1;
int node = elems;
heap_len = 0, heap_max = (2*(256 +1+29)+1);
for (n = 0; n < elems; n++) {
if (tree[n].fc.freq != 0) {
heap[++heap_len] = max_code = n;
depth[n] = 0;
} else {
tree[n].dl.len = 0;
}
}
while (heap_len < 2) {
int new = heap[++heap_len] = (max_code < 2 ? ++max_code : 0);
tree[new].fc.freq = 1;
depth[new] = 0;
opt_len--; if (stree) static_len -= stree[new].dl.len;
}
desc->max_code = max_code;
for (n = heap_len/2; n >= 1; n--) pqdownheap(tree, n);
do {
{ n = heap[1]; heap[1] = heap[heap_len--]; pqdownheap(tree, 1); };
m = heap[1];
heap[--heap_max] = n;
heap[--heap_max] = m;
tree[node].fc.freq = tree[n].fc.freq + tree[m].fc.freq;
depth[node] = (uch) ((depth[n] >= depth[m] ? depth[n] : depth[m]) + 1);
tree[n].dl.dad = tree[m].dl.dad = (ush)node;
heap[1] = node++;
pqdownheap(tree, 1);
} while (heap_len >= 2);
heap[--heap_max] = heap[1];
gen_bitlen((tree_desc *)desc);
gen_codes ((ct_data *)tree, max_code);
}
| void build_tree(struct_0 *a0) {
unsigned int v0;
int tmp_18;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned short *v6;
unsigned long v7;
unsigned int v9;
char v10;
unsigned int v11;
unsigned long long v12;
v6 = a0->field_0;
v7 = a0->field_8;
v3 = a0->field_1c;
v1 = -1;
v2 = v3;
heap_len = 0;
heap_max = 573;
for (v0 = 0; v0 < v3; v0 += 1) {
if (!v6[2 * v0]) {
v6[1 + 2 * v0] = 0;
} else {
v1 = v0;
heap_len = heap_len + 1;
*((4 * heap_len + &heap)) = v1;
*(v0 + &depth) = 0;
}
}
while (true) {
if (heap_len <= 1) {
if (v1 > 1) {
v9 = 0;
} else {
v1 += 1;
v9 = v1;
}
heap_len = heap_len + 1;
*((4 * heap_len + &heap)) = v9;
v5 = *((4 * heap_len + &heap));
v6[2 * v5] = 1;
*(v5 + &depth) = 0;
opt_len = opt_len - 1;
if (v7)
static_len = static_len - *((v7 + v5 * 4 + 2));
} else {
a0->field_24 = v1;
for (v0 = heap_len + (heap_len >> 31) >> 1; v0 > 0; v0 -= 1) {
pqdownheap(v6, v0);
}
do {
v0 = g_402f04;
tmp_18 = heap_len;
heap_len = heap_len - 1;
g_402f04 = *((4 * tmp_18 + &heap));
pqdownheap(v6, 0x1);
v4 = g_402f04;
heap_max = heap_max - 1;
*((4 * heap_max + &heap)) = v0;
heap_max = heap_max - 1;
*((4 * heap_max + &heap)) = v4;
v6[2 * v2] = v6[2 * v4] + v6[2 * v0];
if (*(v0 + &depth) < *(v4 + &depth))
v10 = *(v4 + &depth) + 1;
else
v10 = *(v0 + &depth) + 1;
*(v2 + &depth) = v10;
v11 = v2;
v6[1 + 2 * v4] = v2;
v6[1 + 2 * v0] = v6[1 + 2 * v4];
v2 += 1;
g_402f04 = v11;
pqdownheap(v6, 0x1);
} while (heap_len > 1);
heap_max = heap_max - 1;
*((4 * heap_max + &heap)) = g_402f04;
gen_bitlen(a0);
v12 = gen_codes(v6, v1);
return;
}
}
}
|
print_cookie(const char *name, const char *fmt,
const uint8_t *cookie, int len)
{
char abuf[32];
size_t n;
n = snprintf(abuf, sizeof(abuf),
"%02x%02x%02x%02x",
cookie[0], cookie[1], cookie[2], cookie[3]);
if (len == 8)
snprintf(abuf + n, sizeof(abuf) - n,
"%02x%02x%02x%02x",
cookie[4], cookie[5],
cookie[6], cookie[7]);
print_string(PRINT_ANY, name, fmt, abuf);
}
| unsigned long print_cookie(long a1, const char *a2, unsigned char *a3, int a4)
{
long v7;
char s[40];
unsigned long v9;
v9 = __readfsqword(0x28u);
v7 = snprintf(s, 0x20uLL, "%02x%02x%02x%02x", *a3, a3[1], a3[2], a3[3]);
if ( a4 == 8 )
snprintf(&s[v7], 32 - v7, "%02x%02x%02x%02x", a3[4], a3[5], a3[6], a3[7]);
print_string(4u, a1, a2, (long)s);
return __readfsqword(0x28u) ^ v9;
}
|
empty_buf, byte_len)) {
print_string(PRINT_ANY, "local", " local %s",
format_host(family, ((int)((tb[local_attr_type])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), ((void*)(((char*)(tb[local_attr_type])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))))));
}
| void print_string(undefined4 param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4)
{
print_color_string(param_1,6,param_2,param_3,param_4);
return;
}
|
static
_Bool
get_sa(int *argcp, char ***argvp, __u8 *an)
{
int argc = *argcp;
char **argv = *argvp;
int ret;
if (argc <= 0 || strcmp(*argv, "sa") != 0)
return
0
;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
ret = get_an(an, *argv);
if (ret)
invarg("expected an { 0..3 }", *argv);
argc--; argv++;
*argvp = argv;
*argcp = argc;
return
1
;
}
| int get_sa(unsigned int *a0, unsigned long long *a1, char *a2) {
unsigned int v0;
unsigned int v1;
unsigned long long *v2;
unsigned int v4;
v0 = *(a0);
v2 = *(a1);
if (v0 <= 0) {
v4 = 0;
return v4;
} else if (!strcmp(*(v2), "sa")) {
v2 += 1;
v0 -= 1;
if (v0 <= 0)
incomplete_command();
v1 = get_an(a2, *(v2));
if (v1)
invarg("expected an { 0..3 }", *(v2));
v0 -= 1;
v2 += 1;
*(a1) = v2;
*(a0) = v0;
v4 = 1;
return v4;
} else {
v4 = 0;
return v4;
}
}
|
static inline void
emit_ancillary_info (char const *program)
{
struct infomap { char const *program; char const *node; } const infomap[] = {
{ "[", "test invocation" },
{ "coreutils", "Multi-call invocation" },
{ "sha224sum", "sha2 utilities" },
{ "sha256sum", "sha2 utilities" },
{ "sha384sum", "sha2 utilities" },
{ "sha512sum", "sha2 utilities" },
{
((void *)0)
,
((void *)0)
}
};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && ! (strcmp (program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
}
| void emit_ancillary_info(char *a0) {
unsigned long v0;
unsigned long long v1[2];
char *v2;
unsigned long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void* v16;
void* v17;
char v18;
unsigned long long *v21;
unsigned long long v22;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
for (v1[0] = &v4; v1[0] && strcmp(a0, v1[0]); v1[0] = v1 + 1);
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
*(&v3) = (!strcmp(a0, "[") ? a0 : "test");
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v22 = *(&v18) ^ v21[5];
return;
}
|
static
void tcfinal(struct console *con)
{
struct termios *tio = &con->tio;
int fd = con->fd;
(*__errno_location ())
= 0;
if ((con->flags & 0x0001) == 0) {
setenv("TERM", "linux", 1);
return;
}
if (con->flags & 0x0002)
return;
setenv("TERM", "vt100", 1);
tio->c_iflag |= (
0002000
|
0010000
);
tio->c_lflag |= (
0000002
|
0000001
|
0000010
|
0000020
|
0000040
|
0004000
);
tio->c_oflag |=
0000001
;
tio->c_cc[
0
] =
('c'&037)
;
tio->c_cc[
1
] =
034
;
tio->c_cc[
2
] = con->cp.erase;
tio->c_cc[
3
] = con->cp.kill;
tio->c_cc[
4
] =
('d'&037)
;
tio->c_cc[
7
] =
'\0'
;
tio->c_cc[
8
] =
('q'&037)
;
tio->c_cc[
9
] =
('s'&037)
;
tio->c_cc[
10
] =
('z'&037)
;
tio->c_cc[
11
] =
'\0'
;
if (con->cp.eol ==
(
'm'
&037)
) {
tio->c_iflag |=
0000400
;
tio->c_iflag &= ~(
0000100
|
0000200
);
tio->c_oflag |=
0000004
;
tio->c_oflag &= ~(
0000010
|
0000040
);
}
switch (con->cp.parity) {
default:
case 0:
tio->c_cflag &= ~(
0001000
|
0000400
);
tio->c_iflag &= ~(
0000020
|
0000040
);
break;
case 1:
tio->c_cflag |=
0001000
;
case 2:
tio->c_cflag |=
0000400
;
tio->c_iflag |= (
0000020
|
0000040
);
case (1 | 2):
tio->c_cflag &= ~
0000060
;
tio->c_cflag |=
0000040
;
break;
}
(void)tcsetattr(fd,
0
, tio);
}
| void tcfinal(struct_0 *a0) {
unsigned int v0;
int tmp_58;
int tmp_36;
int tmp_17;
int tmp_24;
struct_1 *v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
v1 = &a0[1].padding_0;
v0 = a0->field_14;
*(__errno_location()) = 0;
if (!(a0->field_10 & 1)) {
v3 = setenv("TERM", "linux", 0x1);
} else {
v4 = a0->field_10 & 2;
if (!(a0->field_10 & 2)) {
setenv("TERM", "vt100", 0x1);
v5 = v1->field_0;
*(&v5) = (v1->field_0 >> 8) | 20;
tmp_58 = v5;
v1->field_0 = tmp_58;
v1->field_c = v1->field_c | 2107;
v1->field_4 = v1->field_4 | 1;
v1->field_11 = 3;
v1->field_12 = 28;
v1->field_13 = a0->field_20;
v1->field_14 = a0->field_21;
v1->field_15 = 4;
v1->field_18 = 0;
v1->field_19 = 17;
v1->field_1a = 19;
v1->field_1b = 26;
v1->field_1c = 0;
if (a0->field_22 == 13) {
v6 = v1->field_0;
*(&v6) = (v1->field_0 >> 8) | 1;
tmp_36 = v6;
v1->field_0 = tmp_36;
*(&v6) = v1->field_0;
*(&v6) = v1->field_0 & 63;
v1->field_0 = v6;
v1->field_4 = v1->field_4 | 4;
v1->field_4 = v1->field_4 & -41;
}
if (a0->field_23 == 3) {
LABEL_40047e:
v1->field_8 = v1->field_8 & -49;
v1->field_8 = v1->field_8 | 32;
} else {
if (a0->field_23 <= 3) {
if (a0->field_23 == 1) {
v7 = v1->field_8;
*(&v7) = (v1->field_8 >> 8) | 2;
tmp_17 = v7;
v1->field_8 = tmp_17;
LABEL_400456:
v9 = v1->field_8;
*(&v9) = (v1->field_8 >> 8) | 1;
tmp_24 = v9;
v1->field_8 = tmp_24;
v1->field_0 = v1->field_0 | 48;
goto LABEL_40047e;
} else if (a0->field_23 == 2) {
goto LABEL_400456;
}
}
v8 = v1->field_8;
*(&v8) = (v1->field_8 >> 8) & 252;
tmp_24 = v8;
v1->field_8 = tmp_24;
v1->field_0 = v1->field_0 & -49;
}
v10 = tcsetattr(v0, 0x0, v1);
}
}
return;
}
|
int
main (int argc, char **argv)
{
int optc;
;
set_program_name (argv[0]);
setlocale (
6
, "");
bindtextdomain ("coreutils", "/usr/local/share/locale");
textdomain ("coreutils");
initialize_exit_failure (TTY_WRITE_ERROR);
atexit (close_stdout);
silent =
0
;
while ((optc = getopt_long (argc, argv, "s", longopts,
((void *)0)
)) != -1)
{
switch (optc)
{
case 's':
silent =
1
;
break;
case GETOPT_HELP_CHAR: usage (
0
); break;;
case GETOPT_VERSION_CHAR: version_etc (
stdout
, "tty", "GNU coreutils", Version, ("David MacKenzie"), (char *)
((void *)0)
); exit (
0
); break;;
default:
usage (TTY_FAILURE);
}
}
if (optind < argc)
{
error (0, 0, gettext ("extra operand %s"), quote (argv[optind]));
usage (TTY_FAILURE);
}
(*__errno_location ())
=
2
;
if (silent)
return isatty (
0
) ?
0
: TTY_STDIN_NOTTY;
int status =
0
;
char const *tty = ttyname (
0
);
if (! tty)
{
tty = gettext ("not a tty");
status = TTY_STDIN_NOTTY;
}
puts (tty);
return status;
}
| int main(unsigned long a0, unsigned long long *a1) {
unsigned int v0;
unsigned int v1;
char *v2;
unsigned long long v4;
unsigned int v5;
set_program_name(*(a1));
setlocale(0x6, &g_4006a3);
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
initialize_exit_failure(0x3);
atexit(got.close_stdout);
silent = 0;
while (true) {
v1 = getopt_long(a0, a1, "s", &longopts, NULL);
if (v1 == -1)
break;
switch (v1) {
case 115:
silent = 1;
break;
case 4294967165:
version_etc(stdout, "tty", "GNU coreutils", Version, "David MacKenzie", 0x0);
exit(0x0);
case 4294967166:
usage(0x0);
default:
usage(0x2);
}
}
if (a0 > optind) {
v4 = quote(a1[optind]);
error(0x0, 0x0, gettext("extra operand %s"));
usage(0x2);
}
*(__errno_location()) = 2;
if (silent) {
v5 = !isatty(0x0);
return v5;
}
v0 = 0;
v2 = ttyname(0x0);
if (!v2) {
v2 = gettext("not a tty");
v0 = 1;
}
puts(v2);
v5 = v0;
return v5;
}
|
static int ext4_fc_handle_unlink(e2fsck_t ctx, struct ext4_fc_tl *tl, __u8 *val)
{
struct dentry_info_args darg;
int ret;
ret = tl_to_darg(&darg, tl, val);
if (ret)
return ret;
ext4_fc_flush_extents(ctx, darg.ino);
ret = __errcode_to_errno(ext2fs_unlink(ctx->fs, darg.parent_ino, darg.dname, darg.ino, 0), __func__, 655)
;
free(darg.dname);
return ret;
}
| int ext4_fc_handle_unlink(undefined8 *param_1,undefined8 param_2,undefined8 param_3)
{
int iVar1;
undefined8 uVar2;
long in_FS_OFFSET;
ulong local_38 [2];
ulong local_28;
void *local_20;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = tl_to_darg(local_38,param_2,param_3);
if (iVar1 == 0) {
ext4_fc_flush_extents(param_1,local_28);
uVar2 = ext2fs_unlink(*param_1,local_38[0] & 0xffffffff,local_20,local_28 & 0xffffffff,0);
iVar1 = __errcode_to_errno(uVar2,"ext4_fc_handle_unlink",0x28f);
free(local_20);
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return iVar1;
}
__stack_chk_fail();
}
|
void
usage (FILE *out, int status)
{
const char str[] =
"ocsptool - GnuTLS OCSP tool\n"
"Usage: ocsptool [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \n"
"\n"
"None:\n"
"\n"
" -d, --debug=num Enable debugging\n"
" - it must be in the range:\n"
" 0 to 9999\n"
" -V, --verbose More verbose output\n"
" --infile=file Input file\n"
" - file must pre-exist\n"
" --outfile=str Output file\n"
" --ask[=str] Ask an OCSP/HTTP server on a certificate validity\n"
" -e, --verify-response Verify response\n"
" -i, --request-info Print information on a OCSP request\n"
" -j, --response-info Print information on a OCSP response\n"
" -q, --generate-request Generates an OCSP request\n"
" --nonce Use (or not) a nonce to OCSP request\n"
" --load-chain=file Reads a set of certificates forming a chain from file\n"
" - file must pre-exist\n"
" --load-issuer=file Reads issuer's certificate from file\n"
" - file must pre-exist\n"
" --load-cert=file Reads the certificate to check from file\n"
" - file must pre-exist\n"
" --load-trust=file Read OCSP trust anchors from file\n"
" - prohibits the option 'load-signer'\n"
" - file must pre-exist\n"
" --load-signer=file Reads the OCSP response signer from file\n"
" - prohibits the option 'load-trust'\n"
" - file must pre-exist\n"
" --inder Use DER format for input certificates and private keys\n"
" --outder Use DER format for output of responses (this is the default)\n"
" --outpem Use PEM format for output of responses\n"
" -Q, --load-request=file Reads the DER encoded OCSP request from file\n"
" - file must pre-exist\n"
" -S, --load-response=file Reads the DER encoded OCSP response from file\n"
" - file must pre-exist\n"
" --ignore-errors Ignore any verification errors\n"
" --verify-allow-broken Allow broken algorithms, such as MD5 for verification\n"
"\n"
"Version, usage and configuration options:\n"
"\n"
" -v, --version[=arg] output version information and exit\n"
" -h, --help display extended usage information and exit\n"
" -!, --more-help extended usage information passed thru pager\n"
"\n"
"Options are specified by doubled hyphens and their name or by a single\n"
"hyphen and the flag character.\n"
"\n"
"ocsptool is a program that can parse and print information about\n"
"OCSP requests/responses, generate requests and verify responses. Unlike\n"
"other GnuTLS applications it outputs DER encoded structures by default\n"
"unless the '--outpem' option is specified.\n"
"\n"
"Please send bug reports to: <bugs@gnutls.org>\n"
"\n";
fprintf (out, "%s", str);
exit (status);
}
| void usage(FILE *param_1,int param_2)
{
long lVar1;
undefined8 *puVar2;
undefined8 *puVar3;
long in_FS_OFFSET;
undefined8 local_a18 [321];
undefined8 local_10;
local_10 = *(undefined8 *)(in_FS_OFFSET + 0x28);
puVar2 = (undefined8 *)
"ocsptool - GnuTLS OCSP tool\nUsage: ocsptool [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \n\nNone:\n\n -d, --debug=num Enable debugging\n\t\t\t\t- it must be in the range:\n\t\t\t\t 0 to 9999\n -V, --verbose More verbose output\n --infile=file Input file\n\t\t\t\t- file must pre-exist\n --outfile=str Output file\n --ask[=str] Ask an OCSP/HTTP server on a certificate validity\n -e, --verify-response Verify response\n -i, --request-info Print information on a OCSP request\n -j, --response-info Print information on a OCSP response\n -q, --generate-request Generates an OCSP request\n --nonce Use (or not) a nonce to OCSP request\n --load-chain=file Reads a set of certificates forming a chain from file\n\t\t\t\t- file must pre-exist\n --load-issuer=file Reads issuer\'s certificate from file\n\t\t\t\t- file must pre-exist\n --load-cert=file Reads the certificate to check from file\n\t\t\t\t- file must pre-exist\n --load-trust=file Read OCSP trust anchors from file\n\t\t\t\t- prohibits the option \'load-signer\'\n\t\t\t\t- file must pre-exist\n --load-signer=file Reads the OCSP response signer from file\n\t\t\t\t- prohibits the option \'load-trust\'\n\t\t\t\t- file must pre-exist\n --inder Use DER format for input certificates and private keys\n --outder Use DER format for output of responses (this is the default)\n --outpem Use PEM format for output of responses\n -Q, --load-request=file Reads the DER encoded OCSP request from file\n\t\t\t\t- file must pre-exist\n -S, --load-response=file Reads the DER encoded OCSP response from file\n\t\t\t\t- file must pre-exist\n --ignore-errors Ignore any verification errors\n --verify-allow-broken Allow broken algorithms, such as MD5 for verification\n\nVersion, usage and configuration options:\n\n -v, --version[=arg] output version information and exit\n -h, --help display exte..."
;
puVar3 = local_a18;
for (lVar1 = 0x140; lVar1 != 0; lVar1 = lVar1 + -1) {
*puVar3 = *puVar2;
puVar2 = puVar2 + 1;
puVar3 = puVar3 + 1;
}
fprintf(param_1,"%s",local_a18);
exit(param_2);
}
|
static void fill_window()
{
register unsigned n, m;
unsigned more = (unsigned)(window_size - (ulg)lookahead - (ulg)strstart);
if (more == (unsigned)
(-1)
) {
more--;
} else if (strstart >= 0x8000 +(0x8000 -(258 +3 +1))) {
;
memcpy((char*)window, (char*)window+0x8000, (unsigned)0x8000);
match_start -= 0x8000;
strstart -= 0x8000;
if (rsync_chunk_end != 0xFFFFFFFFUL)
rsync_chunk_end -= 0x8000;
block_start -= (long) 0x8000;
for (n = 0; n < (unsigned)(1<<15); n++) {
m = (prev+0x8000)[n];
(prev+0x8000)[n] = (Pos)(m >= 0x8000 ? m-0x8000 : 0);
}
for (n = 0; n < 0x8000; n++) {
m = prev[n];
prev[n] = (Pos)(m >= 0x8000 ? m-0x8000 : 0);
}
more += 0x8000;
}
if (!eofile) {
n = read_buf((char*)window+strstart+lookahead, more);
if (n == 0 || n == (unsigned)
(-1)
) {
eofile = 1;
memset ((voidp)(window + strstart + lookahead), 0, (3 - 1));
} else {
lookahead += n;
}
}
}
| void fill_window() {
unsigned int v0;
void* v2;
unsigned short v3;
unsigned short v4;
void* v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v9;
v0 = window_size - lookahead - 17042544940070553685;
if (v0 == -1) {
v0 -= 1;
} else {
memcpy(&window, 0x508020, 0x8000);
good_match = 3850946645;
good_match = 3850946645;
if (rsync_chunk_end != 4294967295)
rsync_chunk_end = rsync_chunk_end - 0x8000;
block_start = 17040927305180039251;
for (v2 = 0; v2 <= 32767; v2 = v2 + 1) {
if (*((0x10000 + &prev[0] + 0x2 * v2)) <= 32767)
v3 = 0;
else
v3 = *((0x10000 + &prev[0] + 0x2 * v2)) - 0x8000;
*((0x10000 + &prev[0] + 0x2 * v2)) = v3;
}
for (v5 = 0; v5 <= 32767; v5 = v5 + 1) {
if (*((0x2 * v5 + &prev[0])) <= 32767)
v4 = 0;
else
v4 = *((0x2 * v5 + &prev[0])) - 0x8000;
*((0x2 * v5 + &prev[0])) = v4;
}
v0 += 0x8000;
}
v6 = eofile;
if (!eofile) {
v7 = read_buf(17042544940070553685 + lookahead + &window, v0, read_buf, 17042544940070553685 + lookahead + &window);
if (!v7) {
LABEL_4005bf:
eofile = 1;
v9 = memset(17042544940070553685 + &window + lookahead, 0x0, 0x2);
} else {
if (v7 == -1)
goto LABEL_4005bf;
lookahead = lookahead + v7;
}
}
return;
}
|
static SHELL_VAR *
get_random (var)
SHELL_VAR *var;
{
int rv;
rv = get_random_number ();
return (set_int_value (var, rv, 1));
}
| long long get_random(void* a0) {
unsigned int v0;
v0 = get_random_number();
return set_int_value(a0, v0, 0x1);
}
|
static void process_flags (int argc, char **argv)
{
int c;
static struct option long_options[] = {
{"lastday",
1
,
((void *)0)
, 'd'},
{"expiredate",
1
,
((void *)0)
, 'E'},
{"help",
0
,
((void *)0)
, 'h'},
{"inactive",
1
,
((void *)0)
, 'I'},
{"list",
0
,
((void *)0)
, 'l'},
{"mindays",
1
,
((void *)0)
, 'm'},
{"maxdays",
1
,
((void *)0)
, 'M'},
{"root",
1
,
((void *)0)
, 'R'},
{"warndays",
1
,
((void *)0)
, 'W'},
{"iso8601",
0
,
((void *)0)
, 'i'},
{
((void *)0)
, 0,
((void *)0)
, '\0'}
};
while ((c = getopt_long (argc, argv, "d:E:hiI:lm:M:R:W:",
long_options,
((void *)0)
)) != -1) {
switch (c) {
case 'd':
dflg =
1
;
lstchgdate = strtoday (optarg);
if (lstchgdate < -1) {
fprintf (
stderr
,
gettext ("%s: invalid date '%s'\n"),
Prog, optarg);
usage (2);
}
break;
case 'E':
Eflg =
1
;
expdate = strtoday (optarg);
if (expdate < -1) {
fprintf (
stderr
,
gettext ("%s: invalid date '%s'\n"),
Prog, optarg);
usage (2);
}
break;
case 'h':
usage (
0
);
break;
case 'i':
iflg =
1
;
break;
case 'I':
Iflg =
1
;
if ( (getlong (optarg, &inactdays) == 0)
|| (inactdays < -1)) {
fprintf (
stderr
,
gettext ("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
usage (2);
}
break;
case 'l':
lflg =
1
;
break;
case 'm':
mflg =
1
;
if ( (getlong (optarg, &mindays) == 0)
|| (mindays < -1)) {
fprintf (
stderr
,
gettext ("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
usage (2);
}
break;
case 'M':
Mflg =
1
;
if ( (getlong (optarg, &maxdays) == 0)
|| (maxdays < -1)) {
fprintf (
stderr
,
gettext ("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
usage (2);
}
break;
case 'R':
break;
case 'W':
Wflg =
1
;
if ( (getlong (optarg, &warndays) == 0)
|| (warndays < -1)) {
fprintf (
stderr
,
gettext ("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
usage (2);
}
break;
default:
usage (2);
}
}
check_flags (argc, optind);
}
| void process_flags(unsigned long a0, char **a1) {
unsigned int v0;
unsigned long long v2;
while (true) {
v0 = getopt_long(a0, a1, "d:E:hiI:lm:M:R:W:", &long_options.5797, NULL);
if (v0 == -1) {
v2 = check_flags(a0, optind);
return;
}
switch (v0) {
case 69:
Eflg = 1;
expdate = strtoday(*(&optarg));
if (expdate < -1) {
fprintf(*(&stderr), gettext("%s: invalid date '%s'\n"));
usage(0x2);
}
continue;
case 73:
Iflg = 1;
if (getlong(*(&optarg), &inactdays) && !(inactdays < -1))
continue;
fprintf(*(&stderr), gettext("%s: invalid numeric argument '%s'\n"));
usage(0x2);
case 77:
Mflg = 1;
if (!getlong(*(&optarg), &maxdays)) {
LABEL_400e34:
fprintf(*(&stderr), gettext("%s: invalid numeric argument '%s'\n"));
usage(0x2);
}
if (maxdays < -1)
goto LABEL_400e34;
break;
case 82:
break;
case 87:
Wflg = 1;
if (getlong(*(&optarg), &warndays) && !(warndays < -1))
continue;
fprintf(*(&stderr), gettext("%s: invalid numeric argument '%s'\n"));
usage(0x2);
case 100:
dflg = 1;
lstchgdate = strtoday(*(&optarg));
if (lstchgdate < -1) {
fprintf(*(&stderr), gettext("%s: invalid date '%s'\n"));
usage(0x2);
}
continue;
case 104:
usage(0x0);
case 105:
iflg = 1;
continue;
case 108:
lflg = 1;
continue;
case 109:
mflg = 1;
if (getlong(*(&optarg), &mindays) && !(mindays < -1))
continue;
fprintf(*(&stderr), gettext("%s: invalid numeric argument '%s'\n"));
usage(0x2);
default:
usage(0x2);
}
}
}
|
static int
getenv_quoting_style (void)
{
char const *q_style = getenv ("QUOTING_STYLE");
if (!q_style)
return -1;
int i = argmatch (q_style, quoting_style_args, (void const *) (quoting_style_vals), sizeof *(quoting_style_vals));
if (i < 0)
{
error (0, 0,
gettext ("ignoring invalid value" " of environment variable QUOTING_STYLE: %s")
,
quote (q_style));
return -1;
}
return quoting_style_vals[i];
}
| int getenv_quoting_style() {
unsigned int v0;
unsigned long long v1;
unsigned int v3;
unsigned long long v4;
v1 = getenv("QUOTING_STYLE");
if (!v1) {
v3 = -1;
} else {
v0 = argmatch(v1, 0x5001c8, 0x500228, 0x4);
if (v0 < 0) {
v4 = quote(v1);
error(0x0, 0x0, gettext("ignoring invalid value of environment variable QUOTING_STYLE: %s"));
v3 = -1;
} else {
v3 = *((4 * v0 + "ing_style_vals));
}
}
return v3;
}
|
static int
monitor_allowed_key(const u_char *blob, u_int bloblen)
{
if (key_blob ==
((void *)0)
|| key_bloblen != bloblen ||
timingsafe_bcmp(key_blob, blob, key_bloblen))
return (0);
return (1);
}
| int monitor_allowed_key(unsigned long long a0, unsigned long a1) {
unsigned int v1;
if (!key_blob) {
v1 = 0;
return v1;
} else if (a1 != key_bloblen) {
v1 = 0;
return v1;
} else if (timingsafe_bcmp(key_blob, a0, key_bloblen, a0)) {
v1 = 0;
return v1;
} else {
v1 = 1;
return v1;
}
}
|
static inline __u64 rta_getattr_u64(const struct rtattr *rta)
{
__u64 tmp;
memcpy(&tmp, ((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), sizeof(__u64));
return tmp;
}
| int rta_getattr_u64(unsigned long a0) {
char v0;
memcpy(&v0, a0 + 4, 0x8);
return *(&v0);
}
|
void
srclimit_init(int max, int persource, int ipv4len, int ipv6len)
{
int i;
max_children = max;
ipv4_masklen = ipv4len;
ipv6_masklen = ipv6len;
max_persource = persource;
if (max_persource == 0x7fffffff)
return;
sshlog("srclimit.c", __func__, 53, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "%s: max connections %d, per source %d, masks %d,%d", __func__, max, persource, ipv4len, ipv6len)
;
if (max <= 0)
sshfatal("srclimit.c", __func__, 56, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: invalid number of sockets: %d", __func__, max);
child = xcalloc(max_children, sizeof(*child));
for (i = 0; i < max_children; i++)
child[i].id = -1;
}
| long srclimit_init(unsigned int a1, int a2, int a3, int a4)
{
long result;
int i;
max_children = a1;
ipv4_masklen = a3;
ipv6_masklen = a4;
max_persource = a2;
result = (unsigned int)a2;
if ( a2 != 0x7FFFFFFF )
{
sshlog(
"srclimit.c",
"srclimit_init",
53LL,
0LL,
5LL,
0LL,
"%s: max connections %d, per source %d, masks %d,%d",
"srclimit_init",
a1,
(unsigned int)a2,
(unsigned int)a3,
(unsigned int)a4);
if ( (int)a1 <= 0 )
sshfatal(
"srclimit.c",
"srclimit_init",
56LL,
0LL,
1LL,
0LL,
"%s: invalid number of sockets: %d",
"srclimit_init",
a1);
child = xcalloc(max_children, 28LL);
for ( i = 0; ; ++i )
{
result = (unsigned int)max_children;
if ( i >= max_children )
break;
*(_DWORD *)(child + 28LL * i) = -1;
}
}
return result;
}
|
static void
do_change_comment(struct passwd *pw, const char *identity_comment)
{
char new_comment[1024], *comment, *passphrase;
struct sshkey *private;
struct sshkey *public;
struct stat st;
int r;
if (!have_identity)
ask_filename(pw, "Enter file in which the key is");
if (stat(identity_file, &st) == -1)
sshfatal("ssh-keygen.c", __func__, 1519, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: %s", identity_file, strerror(
(*__errno_location ())
));
if ((r = sshkey_load_private(identity_file, "",
&private, &comment)) == 0)
passphrase = xstrdup("");
else if (r != -43)
sshfatal("ssh-keygen.c", __func__, 1524, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Cannot load private key \"%s\"", identity_file);
else {
if (identity_passphrase)
passphrase = xstrdup(identity_passphrase);
else if (identity_new_passphrase)
passphrase = xstrdup(identity_new_passphrase);
else
passphrase = read_passphrase("Enter passphrase: ",
0x0002);
if ((r = sshkey_load_private(identity_file, passphrase,
&private, &comment)) != 0) {
freezero(passphrase, strlen(passphrase));
sshfatal("ssh-keygen.c", __func__, 1537, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Cannot load private key \"%s\"", identity_file)
;
}
}
if (private->type != KEY_ED25519 && private->type != KEY_XMSS &&
private_key_format != SSHKEY_PRIVATE_OPENSSH) {
sshlog("ssh-keygen.c", __func__, 1544, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Comments are only supported for keys stored in " "the new format (-o).")
;
explicit_bzero(passphrase, strlen(passphrase));
sshkey_free(private);
exit(1);
}
if (comment)
printf("Old comment: %s\n", comment);
else
printf("No existing comment\n");
if (identity_comment) {
strlcpy(new_comment, identity_comment, sizeof(new_comment));
} else {
printf("New comment: ");
fflush(
stdout
);
if (!fgets(new_comment, sizeof(new_comment),
stdin
)) {
explicit_bzero(passphrase, strlen(passphrase));
sshkey_free(private);
exit(1);
}
new_comment[strcspn(new_comment, "\n")] = '\0';
}
if (comment !=
((void *)0)
&& strcmp(comment, new_comment) == 0) {
printf("No change to comment\n");
free(passphrase);
sshkey_free(private);
free(comment);
exit(0);
}
if ((r = sshkey_save_private(private, identity_file, passphrase,
new_comment, private_key_format, openssh_format_cipher,
rounds)) != 0) {
sshlog("ssh-keygen.c", __func__, 1579, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Saving key \"%s\" failed", identity_file);
freezero(passphrase, strlen(passphrase));
sshkey_free(private);
free(comment);
exit(1);
}
freezero(passphrase, strlen(passphrase));
if ((r = sshkey_from_private(private, &public)) != 0)
sshfatal("ssh-keygen.c", __func__, 1587, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshkey_from_private");
sshkey_free(private);
strlcat(identity_file, ".pub", sizeof(identity_file));
if ((r = sshkey_save_public(public, identity_file, new_comment)) != 0)
sshfatal("ssh-keygen.c", __func__, 1592, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Unable to save public key to %s", identity_file);
sshkey_free(public);
free(comment);
if (strlen(new_comment) > 0)
printf("Comment '%s' applied\n", new_comment);
else
printf("Comment removed\n");
exit(0);
}
| void do_change_comment(void* a0, unsigned long long a1, unsigned long a2) {
unsigned long long v0;
unsigned long v1;
unsigned int v2;
char v3;
char v4;
char v5;
void* v6;
char v7;
char v8;
unsigned long long v9;
unsigned long long v10;
char v11;
unsigned long long v12;
unsigned long long *v13;
unsigned long long v14;
unsigned long long v15;
unsigned long long v16;
unsigned long long v17;
v9 = v13[5];
if (!have_identity)
ask_filename(a0, "Enter file in which the key is");
if (stat(&identity_file, &v7) == -1) {
v1 = strerror(*(__errno_location()));
v0 = &identity_file;
sshfatal("ssh-keygen.c", "do_change_comment", 0x5ef, 0x0, 0x1, 0x0, "%s: %s");
}
v2 = sshkey_load_private(&identity_file, &g_410d75, &v4, &v3);
if (!v2) {
v6 = xstrdup(&g_410d75);
} else {
if (v2 != -43) {
v10 = &identity_file;
v9 = "Cannot load private key \"%s\"";
sshfatal("ssh-keygen.c", "do_change_comment", 0x5f4, 0x0, 0x1, ssh_err(v2), *(&v11));
}
if (identity_passphrase) {
v6 = xstrdup(identity_passphrase);
} else if (!identity_new_passphrase) {
v6 = read_passphrase("Enter passphrase: ", 0x2);
} else {
v6 = xstrdup(identity_new_passphrase);
}
v2 = sshkey_load_private(&identity_file, v6, &v4, &v3);
if (v2) {
v14 = strlen(v6);
freezero(v6, v14, v14);
v10 = &identity_file;
v9 = "Cannot load private key \"%s\"";
sshfatal("ssh-keygen.c", "do_change_comment", 0x601, 0x0, 0x1, ssh_err(v2), *(&v11));
}
}
if (*(*(&v4)) != 3 && *(*(&v4)) != 8 && private_key_format) {
v9 = "Comments are only supported for keys stored in the new format (-o).";
sshlog("ssh-keygen.c", "do_change_comment", 0x608, 0x0, 0x2, 0x0, *(&v11), v12);
explicit_bzero(v6, strlen(v6));
sshkey_free(*(&v4));
exit(0x1);
}
if (!*(&v3))
printf("No existing comment\n");
else
printf("Old comment: %s\n", *(&v3));
if (a1) {
strlcpy(&v8, a1, 0x400);
} else {
printf("New comment: ");
fflush(stdout);
if (!fgets(&v8, 0x400, stdin)) {
explicit_bzero(v6, strlen(v6));
sshkey_free(*(&v4));
exit(0x1);
}
(&v8)[strcspn(&v8, "\n")] = 0;
}
if (*(&v3) && !strcmp(*(&v3), &v8)) {
printf("No change to comment\n");
free(v6);
sshkey_free(*(&v4));
free(*(&v3));
exit(0x0);
}
v9 = rounds;
v2 = sshkey_save_private(*(&v4), &identity_file, v6, &v8, private_key_format, openssh_format_cipher);
if (v2) {
v10 = &identity_file;
v9 = "Saving key \"%s\" failed";
sshlog("ssh-keygen.c", "do_change_comment", 0x62b, 0x0, 0x2, ssh_err(v2), *(&v11), v12);
v16 = strlen(v6);
freezero(v6, v16, v16);
sshkey_free(*(&v4));
free(*(&v3));
exit(0x1);
}
v15 = strlen(v6);
freezero(v6, v15, v15);
v2 = sshkey_from_private(*(&v4), &v5, &v5);
if (v2) {
v9 = "sshkey_from_private";
sshfatal("ssh-keygen.c", "do_change_comment", 0x633, 0x1, 0x1, ssh_err(v2), *(&v11));
}
sshkey_free(*(&v4));
strlcat(&identity_file, ".pub", 0x1000, v17);
v2 = sshkey_save_public(*(&v5), &identity_file, &v8, v17);
if (v2) {
v10 = &identity_file;
v9 = "Unable to save public key to %s";
sshfatal("ssh-keygen.c", "do_change_comment", 0x638, 0x0, 0x1, ssh_err(v2), *(&v11));
}
sshkey_free(*(&v5));
free(*(&v3));
if (!strlen(&v8))
printf("Comment removed\n");
else
printf("Comment '%s' applied\n", &v8);
exit(0x0);
}
|
cron_db database(int installed, char **additional) {
cron_db db = {
((void *)0)
,
((void *)0)
, (time_t) 0};
struct passwd pw;
int fd;
struct stat ss;
user *u;
if (installed)
load_database(&db);
for ( ; *additional !=
((void *)0)
; additional++) {
fd = open(*additional,
00
);
if (fd == -1) {
perror(*additional);
continue;
}
fstat(fd, &ss);
if (
((((
ss.st_mode
)) & 0170000) == (0040000))
) {
fprintf(
stderr
, "%s is a directory - skipping\n", *additional);
close(fd);
continue;
}
memset(&pw, 0, sizeof(pw));
pw.pw_name = *additional;
pw.pw_passwd = "";
pw.pw_dir = ".";
u = load_user(fd, &pw, *additional, *additional, *additional);
if (u ==
((void *)0)
) {
printf("cannot load crontab %s\n", *additional);
continue;
}
link_user(&db, u);
}
return db;
}
| void database(unsigned long long a0[3], unsigned long a1, unsigned long a2) {
unsigned long long *v0;
unsigned int v1;
unsigned long long v2;
void* v3;
void* v4;
void* v5;
unsigned long v6;
unsigned long long v7;
unsigned long long v8;
char v9;
char v10;
unsigned long long v12[3];
v0 = a2;
v3 = 0;
v4 = 0;
v5 = 0;
if (a1)
load_database(&v3);
for (; *(v0); v0 += 1) {
v1 = open(*(v0), 0x0, *(v0));
if (v1 == -1) {
perror(*(v0));
} else {
fstat(v1, &v9);
if ((*(&v10) & 0xf000) == 0x4000) {
fprintf(stderr, "%s is a directory - skipping\n", *(v0));
close(v1);
} else {
memset(&v6, 0x0, 0x30);
v6 = *(v0);
v7 = &g_401244;
v8 = ".";
v2 = load_user(v1, &v6, *(v0), *(v0), *(v0));
if (!v2)
printf("cannot load crontab %s\n", *(v0));
else
link_user(&v3, v2, v2);
}
}
}
a0[0] = v3;
a0[1] = v4;
a0[2] = v5;
v12 = a0;
return;
}
|
static char
traverse_raw_number (char const **number)
{
char const *p = *number;
char ch;
char max_digit = '\0';
_Bool
ends_with_thousands_sep =
0
;
while (((unsigned int) (ch = *p++) - '0' <= 9))
{
if (max_digit < ch)
max_digit = ch;
ends_with_thousands_sep = (*p == thousands_sep);
if (ends_with_thousands_sep)
++p;
}
if (ends_with_thousands_sep)
{
*number = p - 2;
return max_digit;
}
if (ch == decimal_point)
while (((unsigned int) (ch = *p++) - '0' <= 9))
if (max_digit < ch)
max_digit = ch;
*number = p - 1;
return max_digit;
}
| int traverse_raw_number(unsigned long long *a0) {
char v0;
int tmp_14;
char v1;
char v2;
char *v3;
unsigned int v6;
v3 = *(a0);
v0 = 0;
v1 = 0;
while (true) {
tmp_14 = v3;
v3 += 1;
v2 = *(tmp_14);
if (v2 - 48 > 9)
break;
if (v0 < v2)
v0 = v2;
v1 = *(v3) == thousands_sep;
if (!v1)
continue;
v3 += 1;
}
if (v1) {
*(a0) = v3 + 2;
v6 = v0;
return v6;
}
if (v2 == decimal_point) {
while (true) {
tmp_14 = v3;
v3 += 1;
v2 = *(tmp_14);
if (v2 - 48 > 9)
break;
if (!(v0 < v2))
continue;
v0 = v2;
}
}
*(a0) = v3 + 1;
v6 = v0;
return v6;
}
|
static void
idname_free(struct idname *idname)
{
if (idname ==
((void *)0)
)
return;
free(idname->name);
free(idname);
}
| void idname_free(void *param_1)
{
if (param_1 != (void *)0x0) {
free(*(void **)((long)param_1 + 8));
free(param_1);
}
return;
}
|
static void crypto_sort_int32(void *array,long long n)
{
long long top,p,q,r,i,j;
crypto_int32 *x = array;
if (n < 2) return;
top = 1;
while (top < n - top) top += top;
for (p = top;p >= 1;p >>= 1) {
i = 0;
while (i + 2 * p <= n) {
for (j = i;j < i + p;++j)
do { int64_t ab = (int64_t)x[j+p] ^ (int64_t)x[j]; int64_t c = (int64_t)x[j+p] - (int64_t)x[j]; c ^= ab & (c ^ x[j+p]); c >>= 31; c &= ab; x[j] ^= c; x[j+p] ^= c; } while(0);
i += 2 * p;
}
for (j = i;j < n - p;++j)
do { int64_t ab = (int64_t)x[j+p] ^ (int64_t)x[j]; int64_t c = (int64_t)x[j+p] - (int64_t)x[j]; c ^= ab & (c ^ x[j+p]); c >>= 31; c &= ab; x[j] ^= c; x[j+p] ^= c; } while(0);
i = 0;
j = 0;
for (q = top;q > p;q >>= 1) {
if (j != i) for (;;) {
if (j == n - q) goto done;
crypto_int32 a = x[j + p];
for (r = q;r > p;r >>= 1)
do { int64_t ab = (int64_t)x[j + r] ^ (int64_t)a; int64_t c = (int64_t)x[j + r] - (int64_t)a; c ^= ab & (c ^ x[j + r]); c >>= 31; c &= ab; a ^= c; x[j + r] ^= c; } while(0);
x[j + p] = a;
++j;
if (j == i + p) {
i += 2 * p;
break;
}
}
while (i + p <= n - q) {
for (j = i;j < i + p;++j) {
crypto_int32 a = x[j + p];
for (r = q;r > p;r >>= 1)
do { int64_t ab = (int64_t)x[j+r] ^ (int64_t)a; int64_t c = (int64_t)x[j+r] - (int64_t)a; c ^= ab & (c ^ x[j+r]); c >>= 31; c &= ab; a ^= c; x[j+r] ^= c; } while(0);
x[j + p] = a;
}
i += 2 * p;
}
j = i;
while (j < n - q) {
crypto_int32 a = x[j + p];
for (r = q;r > p;r >>= 1)
do { int64_t ab = (int64_t)x[j+r] ^ (int64_t)a; int64_t c = (int64_t)x[j+r] - (int64_t)a; c ^= ab & (c ^ x[j+r]); c >>= 31; c &= ab; a ^= c; x[j+r] ^= c; } while(0);
x[j + p] = a;
++j;
}
done: ;
}
}
}
| void crypto_sort_int32(unsigned long long a0, unsigned long long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
void* v7;
void* v8;
void* v9;
unsigned long v10;
unsigned long v11;
unsigned long v12;
unsigned long v13;
unsigned long v14;
unsigned long long v15;
unsigned long v16;
unsigned long v17;
unsigned long v18;
unsigned long v19;
unsigned long long v21;
unsigned long long v22;
unsigned int v26;
unsigned int v28;
unsigned long long v29;
unsigned int v33;
unsigned int v37;
unsigned int v40;
v21 = a0;
v9 = a0;
if (a1 > 1) {
for (v3 = 1; v3 < __subvdi3(a1, v3); v3 = __mulvdi3(v3, 0x2));
v22 = v3;
for (v4 = v3; v4 > 0; v4 >>= 1) {
v7 = 0;
while (true) {
if (a1 < __addvdi3(__mulvdi3(v4, 0x2), v7))
break;
v8 = v7;
while (true) {
if (v8 >= __addvdi3(v7, v4))
break;
v18 = *((v9 + 0x4 * v8)) ^ *((v9 + 4 * __addvdi3(v8, v4)));
v19 = __subvdi3(*((v9 + 4 * __addvdi3(v8, v4))), *((v9 + 0x4 * v8)));
v19 ^= (*((v9 + 4 * __addvdi3(v8, v4))) ^ v19) & v18;
v19 >>= 31;
v19 &= v18;
*((v9 + 0x4 * v8)) = *((v9 + 0x4 * v8)) ^ v19;
v26 = *((v9 + 4 * __addvdi3(v8, v4))) ^ v19;
*((v9 + 4 * __addvdi3(v8, v4))) = v26;
v8 = __addvdi3(v8, 0x1);
}
v7 = __addvdi3(v7, __mulvdi3(v4, 0x2));
}
for (v8 = v7; v8 < __subvdi3(a1, v4); v8 = __addvdi3(v8, 0x1)) {
v16 = *((v9 + 0x4 * v8)) ^ *((v9 + 4 * __addvdi3(v8, v4)));
v17 = __subvdi3(*((v9 + 4 * __addvdi3(v8, v4))), *((v9 + 0x4 * v8)));
v17 ^= (*((v9 + 4 * __addvdi3(v8, v4))) ^ v17) & v16;
v17 >>= 31;
v17 &= v16;
*((v9 + 0x4 * v8)) = *((v9 + 0x4 * v8)) ^ v17;
v28 = *((v9 + 4 * __addvdi3(v8, v4))) ^ v17;
*((v9 + 4 * __addvdi3(v8, v4))) = v28;
}
v7 = 0;
v8 = 0;
v5 = v3;
while (true) {
v29 = v5;
if (v5 <= v4)
break;
if (v8 != v7) {
do {
if (v8 == __subvdi3(a1, v5))
goto LABEL_40096b;
v0 = *((v9 + 4 * __addvdi3(v8, v4)));
for (v6 = v5; v6 > v4; v6 >>= 1) {
v10 = *((v9 + 4 * __addvdi3(v8, v6))) ^ v0;
v11 = __subvdi3(*((v9 + 4 * __addvdi3(v8, v6))), v0);
v11 ^= (*((v9 + 4 * __addvdi3(v8, v6))) ^ v11) & v10;
v11 >>= 31;
v11 &= v10;
v0 ^= v11;
v33 = *((v9 + 4 * __addvdi3(v8, v6))) ^ v11;
*((v9 + 4 * __addvdi3(v8, v6))) = v33;
}
*((4 * __addvdi3(v8, v4) + v9)) = v0;
v8 = __addvdi3(v8, 0x1);
} while (v8 != __addvdi3(v7, v4));
v7 = __addvdi3(v7, __mulvdi3(v4, 0x2));
}
for (; __addvdi3(v7, v4) <= __subvdi3(a1, v5); v7 = __addvdi3(v7, __mulvdi3(v4, 0x2))) {
v8 = v7;
while (true) {
if (v8 >= __addvdi3(v7, v4))
break;
v1 = *((v9 + 4 * __addvdi3(v8, v4)));
for (v6 = v5; v6 > v4; v6 >>= 1) {
v14 = *((v9 + 4 * __addvdi3(v8, v6))) ^ v1;
v15 = __subvdi3(*((v9 + 4 * __addvdi3(v8, v6))), v1);
v15 ^= (*((v9 + 4 * __addvdi3(v8, v6))) ^ v15) & v14;
v15 >>= 31;
v15 &= v14;
v1 ^= v15;
v37 = *((v9 + 4 * __addvdi3(v8, v6))) ^ v15;
*((v9 + 4 * __addvdi3(v8, v6))) = v37;
}
*((4 * __addvdi3(v8, v4) + v9)) = v1;
v8 = __addvdi3(v8, 0x1);
}
}
for (v8 = v7; v8 < __subvdi3(a1, v5); v8 = __addvdi3(v8, 0x1)) {
v2 = *((v9 + 4 * __addvdi3(v8, v4)));
for (v6 = v5; v6 > v4; v6 >>= 1) {
v12 = *((v9 + 4 * __addvdi3(v8, v6))) ^ v2;
v13 = __subvdi3(*((v9 + 4 * __addvdi3(v8, v6))), v2);
v13 ^= (*((v9 + 4 * __addvdi3(v8, v6))) ^ v13) & v12;
v13 >>= 31;
v13 &= v12;
v2 ^= v13;
v40 = *((v9 + 4 * __addvdi3(v8, v6))) ^ v13;
*((v9 + 4 * __addvdi3(v8, v6))) = v40;
}
*((4 * __addvdi3(v8, v4) + v9)) = v2;
}
LABEL_40096b:
v5 >>= 1;
}
}
}
return;
}
|
static void Short_random(small *out)
{
crypto_uint32 L[761];
int i;
for (i = 0;i < 761;++i) L[i] = urandom32();
Short_fromlist(out,L);
}
| void Short_random(char *a0) {
unsigned int v0;
char v1;
char v2;
unsigned long long *v4;
unsigned long long v5;
for (v0 = 0; v0 <= 760; v0 = __addvsi3(v0, 0x1, v0)) {
*(&(&v1)[4 * v0]) = urandom32();
}
Short_fromlist(a0, &v1);
v5 = *(&v2) ^ v4[5];
return;
}
|
void
coproc_rclose (cp, fd)
struct coproc *cp;
int fd;
{
if (cp->c_rfd >= 0 && cp->c_rfd == fd)
{
close (cp->c_rfd);
cp->c_rfd = -1;
}
}
| long long coproc_rclose(struct_0 *a0, unsigned long a1) {
struct_0 *v1;
v1 = a0->field_c;
if (a0->field_c >= 0) {
v1 = a0->field_c;
if (a1 == a0->field_c) {
close(a0->field_c);
v1 = a0;
a0->field_c = -1;
}
}
return v1;
}
|
static char *
decode_xform (char *file_name, void *data)
{
int type = *(int*)data;
switch (type)
{
case 0x04:
return file_name;
case 0x02:
file_name = safer_name_suffix (file_name,
1
, absolute_names_option);
break;
case 0x01:
file_name = safer_name_suffix (file_name,
0
, absolute_names_option);
break;
}
if (strip_name_components)
{
size_t prefix_len = stripped_prefix_len (file_name,
strip_name_components);
if (prefix_len == (size_t) -1)
prefix_len = strlen (file_name);
file_name += prefix_len;
}
return file_name;
}
| char * decode_xform(char *param_1,int *param_2)
{
int iVar1;
char *local_20;
size_t local_10;
iVar1 = *param_2;
if (iVar1 != 4) {
local_20 = param_1;
if (iVar1 < 5) {
if (iVar1 == 1) {
local_20 = (char *)safer_name_suffix(param_1,0,absolute_names_option);
}
else if (iVar1 == 2) {
local_20 = (char *)safer_name_suffix(param_1,1,absolute_names_option);
}
}
param_1 = local_20;
if (strip_name_components != 0) {
local_10 = stripped_prefix_len(local_20,strip_name_components);
if (local_10 == 0xffffffffffffffff) {
local_10 = strlen(local_20);
}
param_1 = local_20 + local_10;
}
}
return param_1;
}
|
static inline int
goodname(const char *p)
{
return !*endofname(p);
}
| int goodname(unsigned int a0) {
unsigned int v2;
v2 = !*(endofname(a0));
return v2;
}
|
static void nh(nh_ctx *hc, const UINT8 *buf, UINT32 padded_len,
UINT32 unpadded_len, UINT8 *result)
{
UINT32 nbits;
nbits = (unpadded_len << 3);
((UINT64 *)result)[0] = nbits;
((UINT64 *)result)[1] = nbits;
((UINT64 *)result)[2] = nbits;
((UINT64 *)result)[3] = nbits;
nh_aux(hc->nh_key, buf, result, padded_len);
}
| void nh(unsigned int a0, unsigned long long a1, unsigned long a2, unsigned long a3, unsigned long long a4[4]) {
unsigned int v0;
unsigned long long v2;
v0 = a3 * 8;
a4[0] = v0;
a4[1] = v0;
a4[2] = v0;
a4[3] = v0;
v2 = nh_aux(a0, a1, a4, a2);
return;
}
|
int
sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
const char *passphrase, const char *comment,
int format, const char *openssh_format_cipher, int openssh_format_rounds)
{
switch (key->type) {
case KEY_DSA:
case KEY_ECDSA:
case KEY_RSA:
break;
case KEY_ED25519:
case KEY_ED25519_SK:
case KEY_ECDSA_SK:
return sshkey_private_to_blob2(key, blob, passphrase,
comment, openssh_format_cipher, openssh_format_rounds);
default:
return -14;
}
switch (format) {
case SSHKEY_PRIVATE_OPENSSH:
return sshkey_private_to_blob2(key, blob, passphrase,
comment, openssh_format_cipher, openssh_format_rounds);
case SSHKEY_PRIVATE_PEM:
case SSHKEY_PRIVATE_PKCS8:
return sshkey_private_to_blob_pem_pkcs8(key, blob,
format, passphrase, comment);
default:
return -10;
}
}
| long long sshkey_private_to_fileblob(unsigned int *a0, unsigned long long a1, char *a2, unsigned long long a3, unsigned long a4, unsigned long long a5, unsigned int v0) {
unsigned long long v1;
if (*(a0) == 12) {
LABEL_40b4b6:
v1 = sshkey_private_to_blob2(a0, a1, a2, a3, a5, v0);
} else {
if (*(a0) > 12) {
LABEL_40b4db:
v1 = 4294967282;
goto LABEL_40b546;
}
if (*(a0) == 10)
goto LABEL_40b4b6;
if (!(*(a0) <= 10))
goto LABEL_40b4db;
if (*(a0) > 2) {
if (*(a0) == 3)
goto LABEL_40b4b6;
goto LABEL_40b4db;
} else {
if (*(a0) < 0)
goto LABEL_40b4db;
if (!a4) {
v1 = sshkey_private_to_blob2(a0, a1, a2, a3, a5, v0);
} else {
if (a4 >= 0 && a4 - 1 <= 1) {
v1 = sshkey_private_to_blob_pem_pkcs8(a0, a1, a4, a2, a3);
goto LABEL_40b546;
}
v1 = 4294967286;
}
}
}
LABEL_40b546:
return v1;
}
|
static void
tar_pool_free(void *ptr)
{
__extension__ ({ struct obstack *__o = (
&tar_pool
); void *__obj = (
ptr
); if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) __o->next_free = __o->object_base = (char *) __obj; else (obstack_free) (__o, __obj); })
;
}
| void tar_pool_free(void* a0) {
unsigned long long v0;
unsigned long long v2;
unsigned long long v3;
v0 = &tar_pool;
if (a0 > *((v0 + 8)) && a0 < *((v0 + 32))) {
*((v0 + 16)) = a0;
v2 = v0;
*((v0 + 24)) = *((v0 + 16));
}
if (a0 <= *((v0 + 8)) || a0 >= *((v0 + 32)))
v3 = obstack_free(v0, a0);
return;
}
|
STRINGLIST *
strlist_create (n)
int n;
{
STRINGLIST *ret;
register int i;
ret = (STRINGLIST *)sh_xmalloc((sizeof (STRINGLIST)), "stringlist.c", 46);
if (n)
{
ret->list = strvec_create (n+1);
ret->list_size = n;
for (i = 0; i < n; i++)
ret->list[i] = (char *)
((void *)0)
;
}
else
{
ret->list = (char **)
((void *)0)
;
ret->list_size = 0;
}
ret->list_len = 0;
return ret;
}
| long * strlist_create(int param_1)
{
long *plVar1;
long lVar2;
int iVar3;
plVar1 = (long *)sh_xmalloc(0x10,"stringlist.c",0x2e);
if (param_1 == 0) {
*plVar1 = 0;
*(undefined4 *)(plVar1 + 1) = 0;
}
else {
lVar2 = strvec_create(param_1 + 1);
*plVar1 = lVar2;
*(int *)(plVar1 + 1) = param_1;
for (iVar3 = 0; iVar3 < param_1; iVar3 = iVar3 + 1) {
*(undefined8 *)(*plVar1 + (long)iVar3 * 8) = 0;
}
}
*(undefined4 *)((long)plVar1 + 0xc) = 0;
return plVar1;
}
|
static int match_link_kind(struct rtattr **tb, const char *kind,
_Bool
slave)
{
if (!tb[IFLA_LINKINFO])
return -1;
return strcmp(parse_link_kind(tb[IFLA_LINKINFO], slave), kind);
}
| int match_link_kind(struct_0 *a0, char *a1, unsigned long a2) {
unsigned int v1;
if (!a0->field_90)
v1 = -1;
else
v1 = strcmp(parse_link_kind(a0->field_90, a2), a1);
return v1;
}
|
(!iswspace(c) && (c < 33 || (c > 60 && c < 62) || c > 126)) ||
wcschr(L"#$@[\\]^`{|}~", c) !=
| int iswspace(wint_t __wc)
{
halt_baddata();
}
|
int
_rl_dispatch_callback (_rl_keyseq_cxt *cxt)
{
int nkey, r;
if ((cxt->flags & 0x01) == 0)
{
nkey = _rl_subseq_getchar (cxt->okey);
if (nkey < 0)
{
_rl_abort_internal ();
return -1;
}
r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg);
cxt->flags |= 0x01;
}
else
r = cxt->childval;
if (r != -3)
r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & 0x02));
do { if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); } while (0);
if (r >= 0 || (r == -1 && (cxt->flags & 0x02) == 0))
{
_rl_keyseq_chain_dispose ();
(rl_readline_state &= ~(0x0200000));
return r;
}
if (r != -3)
_rl_kscxt = cxt->ocxt;
if (_rl_kscxt)
_rl_kscxt->childval = r;
if (r != -3)
_rl_keyseq_cxt_dispose (cxt);
return r;
}
| long long _rl_dispatch_callback(struct_0 *a0) {
struct_0 *v0;
unsigned int v1;
unsigned int v2;
unsigned long long v4;
v0 = a0;
if ((a0->field_0 & 1)) {
v1 = a0->field_28;
} else {
v2 = _rl_subseq_getchar(a0->field_c);
if (v2 < 0) {
_rl_abort_internal();
v4 = 4294967295;
goto LABEL_400b76;
} else {
v1 = _rl_dispatch_subseq(v2, a0->field_10, a0->field_4);
a0->field_0 = a0->field_0 | 1;
}
}
if (v1 != -3)
v1 = _rl_subseq_result(v1, a0->field_18, a0->field_c, a0->field_0 & 2);
if (_rl_caught_signal)
_rl_signal_handler(_rl_caught_signal);
if (v1 >= 0) {
LABEL_400b15:
_rl_keyseq_chain_dispose();
rl_readline_state = rl_readline_state & -2097153;
v4 = v1;
} else if (v1 != -1) {
LABEL_400b33:
if (v1 != -3)
_rl_kscxt = a0->field_20;
if (_rl_kscxt)
*((_rl_kscxt + 40)) = v1;
if (v1 != -3)
_rl_keyseq_cxt_dispose(a0);
v4 = v1;
} else {
if (!(!(a0->field_0 & 2)))
goto LABEL_400b33;
goto LABEL_400b15;
}
LABEL_400b76:
return v4;
}
|
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();
}
|
static char *
component_start (char *f)
{
while (*f == '/')
f++;
return f;
}
| int component_start(unsigned long a0) {
char *v0;
for (v0 = a0; *(v0) == 47; v0 += 1);
return v0;
}
|
int
should_suppress_fork (command)
COMMAND *command;
{
int subshell;
subshell = subshell_environment & 0x20;
return (startup_state == 2 && parse_and_execute_level == 1 &&
*bash_input.location.string == '\0' &&
parser_expanding_alias () == 0 &&
should_optimize_fork (command, subshell));
}
| _BOOL8 should_suppress_fork(long a1)
{
int v2;
v2 = subshell_environment & 0x20;
return startup_state == 2
&& parse_and_execute_level == 1
&& !**((_BYTE **)&bash_input + 2)
&& !(unsigned int)parser_expanding_alias()
&& should_optimize_fork(a1, v2);
}
|
static int isoperand(char **tp)
{
struct t_op const *op;
char *s;
if (!(s = tp[1]))
return 1;
if (!tp[2])
return 0;
op = getop(s);
return op && op->op_type == BINOP;
}
| int isoperand(unsigned long long a0[3]) {
char *v0;
struct_0 *v1;
unsigned int v3;
v0 = a0[1];
if (!v0) {
v3 = 1;
return v3;
} else if (a0[2]) {
v1 = getop(v0);
if (!v1) {
v3 = 0;
return v3;
} else if (v1->field_a != 1) {
v3 = 0;
return v3;
} else {
v3 = 1;
return v3;
}
} else {
v3 = 0;
return v3;
}
}
|
static void
list_format_print(struct list_format *fmt,
int c_want, int c_status, int c_eflag,
const char *name, const char *version, const char *arch,
const char *desc, int desc_len)
{
struct str_crop_info ns, vs, as, ds;
str_gen_crop(name, fmt->nw, &ns);
str_gen_crop(version, fmt->vw, &vs);
str_gen_crop(arch, fmt->aw, &as);
str_gen_crop(desc, desc_len, &ds);
printf("%c%c%c %-*.*s %-*.*s %-*.*s %.*s\n", c_want, c_status, c_eflag,
ns.max_bytes, ns.str_bytes, name,
vs.max_bytes, vs.str_bytes, version,
as.max_bytes, as.str_bytes, arch,
ds.str_bytes, desc);
}
| unsigned long list_format_print(
unsigned int *a1,
unsigned int a2,
unsigned int a3,
unsigned int a4,
const char *a5,
const char *a6,
const char *a7,
const char *a8,
unsigned int a9)
{
int v14[2];
int v15[2];
int v16[2];
int v17;
unsigned long v18;
v18 = __readfsqword(0x28u);
str_gen_crop(a5, a1[1], v14);
str_gen_crop(a6, a1[2], v15);
str_gen_crop(a7, a1[3], v16);
str_gen_crop(a8, a9, &v17);
printf(
"%c%c%c %-*.*s %-*.*s %-*.*s %.*s\n",
a2,
a3,
a4,
v14[1],
v14[0],
a5,
v15[1],
v15[0],
a6,
v16[1],
v16[0],
a7,
v17,
a8);
return __readfsqword(0x28u) ^ v18;
}
|
int
rl_print_last_kbd_macro (int count, int ignore)
{
char *m;
if (current_macro == 0)
{
rl_ding ();
return 0;
}
m = _rl_untranslate_macro_value (current_macro, 1);
rl_crlf ();
printf ("%s", m);
fflush (
stdout
);
rl_crlf ();
if (m) free (m);
rl_forced_update_display ();
rl_display_fixed = 1;
return 0;
}
| long long rl_print_last_kbd_macro(unsigned long long a0, unsigned long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
unsigned int v1;
void* v2;
v1 = a0;
v0 = a1;
if (!current_macro) {
rl_ding();
return 0;
}
v2 = _rl_untranslate_macro_value(current_macro, 0x1);
rl_crlf(a0, 0x1, a2, a3, a4, a5);
printf("%s", v2);
fflush(stdout);
rl_crlf(a0, v2, a2, a3, a4, a5);
if (v2)
free(v2);
rl_forced_update_display();
rl_display_fixed = 1;
return 0;
}
|
static
_Bool
paste_parallel (size_t nfiles, char **fnamptr)
{
_Bool
ok =
1
;
char *delbuf = xmalloc (nfiles + 2);
FILE **fileptr = xnmalloc (nfiles + 1, sizeof *fileptr);
size_t files_open;
_Bool
opened_stdin =
0
;
for (files_open = 0; files_open < nfiles; ++files_open)
{
if ((strcmp (fnamptr[files_open], "-") == 0))
{
have_read_stdin =
1
;
fileptr[files_open] =
stdin
;
}
else
{
fileptr[files_open] = fopen (fnamptr[files_open], "r");
if (fileptr[files_open] ==
((void *)0)
)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, fnamptr[files_open])), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, fnamptr[files_open])), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, fnamptr[files_open])), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
else if (fileno (fileptr[files_open]) ==
0
)
opened_stdin =
1
;
fadvise (fileptr[files_open], FADVISE_SEQUENTIAL);
}
}
if (opened_stdin && have_read_stdin)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"standard input is closed\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("standard input is closed")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("standard input is closed")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
while (files_open)
{
_Bool
somedone =
0
;
char const *delimptr = delims;
size_t delims_saved = 0;
for (size_t i = 0; i < nfiles && files_open; i++)
{
int chr;
int err;
_Bool
sometodo =
0
;
if (fileptr[i])
{
chr = getc_unlocked (fileptr[i]);
err =
(*__errno_location ())
;
if (chr !=
(-1)
&& delims_saved)
{
if (fwrite_unlocked (delbuf,1,delims_saved,
stdout
) != delims_saved)
write_error ();
delims_saved = 0;
}
while (chr !=
(-1)
)
{
sometodo =
1
;
if (chr == line_delim)
break;
xputchar (chr);
chr = getc_unlocked (fileptr[i]);
err =
(*__errno_location ())
;
}
}
if (! sometodo)
{
if (fileptr[i])
{
if (!ferror_unlocked (fileptr[i]))
err = 0;
if (fileptr[i] ==
stdin
)
clearerr_unlocked (fileptr[i]);
else if (
rpl_fclose
(fileptr[i]) ==
(-1)
&& !err)
err =
(*__errno_location ())
;
if (err)
{
error (0, err, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, fnamptr[i]));
ok =
0
;
}
fileptr[i] =
((void *)0)
;
files_open--;
}
if (i + 1 == nfiles)
{
if (somedone)
{
if (delims_saved)
{
if (fwrite_unlocked (delbuf,1,delims_saved,
stdout
)
!= delims_saved)
write_error ();
delims_saved = 0;
}
xputchar (line_delim);
}
continue;
}
else
{
if (*delimptr != '\0')
delbuf[delims_saved++] = *delimptr;
if (++delimptr == delim_end)
delimptr = delims;
}
}
else
{
somedone =
1
;
if (i + 1 != nfiles)
{
if (chr != line_delim && chr !=
(-1)
)
xputchar (chr);
if (*delimptr != '\0')
xputchar (*delimptr);
if (++delimptr == delim_end)
delimptr = delims;
}
else
{
char c = (chr ==
(-1)
? line_delim : chr);
xputchar (c);
}
}
}
}
free (fileptr);
free (delbuf);
return ok;
}
| int paste_parallel(unsigned long a0, void* a1) {
char v0;
int tmp_12;
char v1;
char v2;
char v3;
char v4;
unsigned int v5;
unsigned int v6;
void* v7;
char *v8;
void* v9;
void* v10;
void* v11;
void* v12;
unsigned long long v14;
unsigned int v15;
v0 = 1;
v11 = xmalloc(a0 + 2);
v12 = xnmalloc(a0 + 1, 0x8);
v1 = 0;
for (v7 = 0; v7 < a0; v7 += 1) {
if (!strcmp(*((a1 + 0x8 * v7)), "-")) {
have_read_stdin = 1;
*((0x8 * v7 + v12)) = stdin;
} else {
*((0x8 * v7 + v12)) = fopen(*((a1 + 0x8 * v7)), "r");
if (!*((v12 + 0x8 * v7))) {
v14 = quotearg_n_style_colon(0x0, 0x3, *((a1 + 0x8 * v7)));
error(0x1, *(__errno_location()), "%s");
}
if (!fileno(*((v12 + 0x8 * v7))))
v1 = 1;
fadvise(*((v12 + 0x8 * v7)), 0x2, v7 * 8);
}
}
if (v1 && have_read_stdin)
error(0x1, 0x0, gettext("standard input is closed"));
while (v7) {
v2 = 0;
v8 = delims;
v9 = 0;
v10 = 0;
while (true) {
if (v10 >= a0)
break;
if (!v7)
break;
v3 = 0;
if (*((v12 + 0x8 * v10))) {
v5 = getc_unlocked(*((v12 + 0x8 * v10)));
v15 = *(__errno_location());
v6 = v15;
if (v5 != -1 && v9) {
if (v9 != fwrite_unlocked(v11, 0x1, v9, stdout))
write_error();
v9 = 0;
}
while (true) {
if (v5 == -1)
break;
v3 = 1;
if (v5 == line_delim)
break;
xputchar(v5);
v5 = getc_unlocked(*((v12 + 0x8 * v10)));
v15 = *(__errno_location());
v6 = v15;
}
}
if (!(v3 ^ 1)) {
v2 = 1;
if (a0 != v10 + 1) {
if (v5 != line_delim && v5 != -1)
xputchar(v5);
if (*(v8))
xputchar(*(v8));
v8 += 1;
if (v8 == *(&delim_end))
v8 = delims;
} else {
if (v5 == -1)
*(&v15) = line_delim;
else
*(&v15) = v5;
v4 = v15;
xputchar(v4);
}
} else {
if (*((v12 + 0x8 * v10))) {
if (!ferror_unlocked(*((v12 + 0x8 * v10))))
v6 = 0;
if (*((v12 + 0x8 * v10)) == stdin) {
clearerr_unlocked(*((v12 + 0x8 * v10)));
} else if (rpl_fclose(*((v12 + 0x8 * v10))) == -1 && !v6) {
v6 = *(__errno_location());
}
if (v6) {
quotearg_n_style_colon(0x0, 0x3, *((a1 + 0x8 * v10)));
error(0x0, v6, "%s");
v0 = 0;
}
*((v12 + 0x8 * v10)) = 0;
v7 -= 1;
}
if (a0 != v10 + 1) {
if (*(v8)) {
tmp_12 = v9;
v9 += 1;
*(v11 + tmp_12) = *(v8);
}
v8 += 1;
if (v8 == *(&delim_end))
v8 = delims;
} else if (v2) {
if (v9) {
if (v9 != fwrite_unlocked(v11, 0x1, v9, stdout))
write_error();
v9 = 0;
}
xputchar(line_delim);
}
}
v10 += 1;
}
}
free(v12);
free(v11);
return v0;
}
|
static inline
_Bool
is_addrtype_inet_not_unspec(const inet_prefix *p)
{
return (p->flags & ADDRTYPE_INET_UNSPEC) == ADDRTYPE_INET;
}
| int is_addrtype_inet_not_unspec(unsigned short *a0) {
unsigned int v1;
v1 = *(a0) & 6;
*(&v1) = (*(a0) & 6) == 2;
return v1;
}
|
int
group_member (gid_t gid)
{
register int i;
if (gid == current_user.gid || gid == current_user.egid)
return (1);
if (ngroups == 0)
initialize_group_array ();
if (ngroups <= 0)
return (0);
for (i = 0; i < ngroups; i++)
if (gid == (gid_t)group_array[i])
return (1);
return (0);
}
| long long group_member(unsigned long a0) {
unsigned long long v1;
void* v2;
if (a0 == itos) {
v1 = 1;
return v1;
} else if (a0 != g_500204) {
if (!ngroups)
initialize_group_array();
if (ngroups <= 0) {
v1 = 0;
return v1;
}
for (v2 = 0; v2 < ngroups; v2 = v2 + 1) {
if (a0 == *((group_array + (v2 << 2)))) {
v1 = 1;
return v1;
}
}
v1 = 0;
return v1;
} else {
v1 = 1;
return v1;
}
}
|
char *
array_reference(a, i)
ARRAY *a;
arrayind_t i;
{
register ARRAY_ELEMENT *ae, *start;
arrayind_t startind;
int direction;
if (a == 0 || ((a)->num_elements == 0))
return((char *)
((void *)0)
);
if (i > ((a)->max_index) || i < ((a)->head->next->ind))
return((char *)
((void *)0)
);
start = (a->lastref ? a->lastref : ((a->head)->next));
startind = ((start)->ind);
if (i < startind/2) {
start = ((a->head)->next);
startind = ((start)->ind);
direction = 1;
} else if (i >= startind) {
direction = 1;
} else {
direction = -1;
}
for (ae = start; ae != a->head; ) {
if (((ae)->ind) == i) {
a->lastref = (ae);
return(((ae)->value));
}
ae = (direction == 1) ? ((ae)->next) : ((ae)->prev);
if (direction == 1 && ((ae)->ind) > i) {
start = ae;
break;
} else if (direction == -1 && ((ae)->ind) < i) {
start = ae;
break;
}
}
a->lastref = (start);
return((char *)
((void *)0)
);
}
| long array_reference(long *param_1,long param_2)
{
long *plVar1;
long *plVar2;
long *plVar3;
int local_24;
if ((((param_1 != (long *)0x0) && (param_1[1] != 0)) && (param_2 <= *param_1)) &&
(**(long **)(param_1[2] + 0x10) <= param_2)) {
if (param_1[3] == 0) {
plVar1 = *(long **)(param_1[2] + 0x10);
}
else {
plVar1 = (long *)param_1[3];
}
if (param_2 < *plVar1 / 2) {
plVar1 = *(long **)(param_1[2] + 0x10);
local_24 = 1;
plVar2 = plVar1;
}
else {
plVar2 = plVar1;
if (param_2 < *plVar1) {
local_24 = -1;
}
else {
local_24 = 1;
}
}
do {
plVar3 = plVar2;
if (plVar1 == (long *)param_1[2]) break;
if (param_2 == *plVar1) {
param_1[3] = (long)plVar1;
return plVar1[1];
}
if (local_24 == 1) {
plVar1 = (long *)plVar1[2];
plVar3 = plVar1;
if (param_2 < *plVar1) break;
}
else {
plVar1 = (long *)plVar1[3];
}
} while ((local_24 != -1) || (plVar3 = plVar1, param_2 <= *plVar1));
param_1[3] = (long)plVar3;
}
return 0;
}
|
static void print_nh_group(const struct nh_entry *nhe)
{
int i;
open_json_array(PRINT_JSON, "group");
print_string(PRINT_FP,
((void *)0)
, "%s", "group ");
for (i = 0; i < nhe->nh_groups_cnt; ++i) {
open_json_object(
((void *)0)
);
if (i)
print_string(PRINT_FP,
((void *)0)
, "%s", "/");
print_uint(PRINT_ANY, "id", "%u", nhe->nh_groups[i].id);
if (nhe->nh_groups[i].weight)
print_uint(PRINT_ANY, "weight", ",%u",
nhe->nh_groups[i].weight + 1);
close_json_object();
}
print_string(PRINT_FP,
((void *)0)
, "%s", " ");
close_json_array(PRINT_JSON,
((void *)0)
);
}
| void print_nh_group(struct_0 *a0) {
unsigned int v0;
unsigned long long v2;
open_json_array(0x2, "group");
print_string(0x1, 0x0, "%s", "group ");
for (v0 = 0; v0 < a0->field_60; v0 += 1) {
open_json_object(0x0);
if (v0)
print_string(0x1, 0x0, "%s", "/");
print_uint(0x4, "id", "%u", *((a0->field_68 + v0 * 8)));
if (*((a0->field_68 + (v0 << 3) + 4)))
print_uint(0x4, "weight", ",%u", *((a0->field_68 + v0 * 8 + 4)) + 1);
close_json_object();
}
print_string(0x1, 0x0, "%s", " ");
v2 = close_json_array(0x2, 0x0);
return;
}
|
static
_Bool
check_sa_args(enum cmd c, struct sa_desc *sa)
{
if (c == CMD_ADD) {
if (!sa->key_len) {
fprintf(
stderr
, "cannot create SA without key\n");
return -1;
}
if (sa->pn == 0) {
fprintf(
stderr
, "must specify a packet number != 0\n");
return -1;
}
} else if (c == CMD_UPD) {
if (sa->key_len) {
fprintf(
stderr
, "cannot change key on SA\n");
return -1;
}
}
return 0;
}
| long check_sa_args(int a1, long a2)
{
if ( a1 )
{
if ( a1 == 2 && *(_DWORD *)(a2 + 24) )
{
fprintf(stderr, "cannot change key on SA\n");
return 1LL;
}
}
else
{
if ( !*(_DWORD *)(a2 + 24) )
{
fprintf(stderr, "cannot create SA without key\n");
return 1LL;
}
if ( !*(_DWORD *)(a2 + 4) )
{
fprintf(stderr, "must specify a packet number != 0\n");
return 1LL;
}
}
return 0LL;
}
|
int
pkcs11_add_provider(char *name, char *pin, struct sshkey ***keysp,
char ***labelsp)
{
struct sshkey *k;
int r, type;
u_char *blob;
char *label;
size_t blen;
u_int nkeys, i;
struct sshbuf *msg;
if (fd < 0 && pkcs11_start_helper() < 0)
return (-1);
if ((msg = sshbuf_new()) ==
((void *)0)
)
sshfatal("ssh-pkcs11-client.c", __func__, 330, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
if ((r = sshbuf_put_u8(msg, 20)) != 0 ||
(r = sshbuf_put_cstring(msg, name)) != 0 ||
(r = sshbuf_put_cstring(msg, pin)) != 0)
sshfatal("ssh-pkcs11-client.c", __func__, 334, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose");
send_msg(msg);
sshbuf_reset(msg);
type = recv_msg(msg);
if (type == 12) {
if ((r = sshbuf_get_u32(msg, &nkeys)) != 0)
sshfatal("ssh-pkcs11-client.c", __func__, 341, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse nkeys");
*keysp = xcalloc(nkeys, sizeof(struct sshkey *));
if (labelsp)
*labelsp = xcalloc(nkeys, sizeof(char *));
for (i = 0; i < nkeys; i++) {
if ((r = sshbuf_get_string(msg, &blob, &blen)) != 0 ||
(r = sshbuf_get_cstring(msg, &label,
((void *)0)
)) != 0)
sshfatal("ssh-pkcs11-client.c", __func__, 349, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse key");
if ((r = sshkey_from_blob(blob, blen, &k)) != 0)
sshfatal("ssh-pkcs11-client.c", __func__, 351, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "decode key");
wrap_key(k);
(*keysp)[i] = k;
if (labelsp)
(*labelsp)[i] = label;
else
free(label);
free(blob);
}
} else if (type == 30) {
if ((r = sshbuf_get_u32(msg, &nkeys)) != 0)
nkeys = -1;
} else {
nkeys = -1;
}
sshbuf_free(msg);
return (nkeys);
}
| long long pkcs11_add_provider(unsigned long long a0, unsigned long long a1, unsigned long long *a2, unsigned long long *a3, unsigned long long a4, unsigned long long a5) {
unsigned long long v0;
unsigned long long v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
char v6;
char v7;
char v8;
char v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v13;
unsigned long long v14;
v1 = a0;
if (fd < 0) {
v13 = pkcs11_start_helper(a0, a1, a2, a3, a4, a5);
if (v13 < 0)
v14 = 4294967295;
}
if (fd >= 0 || v13 >= 0) {
v10 = sshbuf_new();
if (!v10) {
v0 = "sshbuf_new failed";
sshfatal("ssh-pkcs11-client.c", "pkcs11_add_provider", 0x14a, 0x1, 0x1, 0x0);
}
v3 = sshbuf_put_u8(v10, 0x14);
if (!v3) {
v3 = sshbuf_put_cstring(v10, v1, v1);
if (!v3)
v3 = sshbuf_put_cstring(v10, a1, a1);
}
if (v3 || v3 || v3) {
v11 = "compose";
sshfatal("ssh-pkcs11-client.c", "pkcs11_add_provider", 0x14e, 0x1, 0x1, ssh_err(v3));
}
send_msg(v10);
sshbuf_reset(v10);
v5 = recv_msg(v10);
if (v5 == 12) {
v3 = sshbuf_get_u32(v10, &v2, &v2);
if (v3) {
v11 = "parse nkeys";
sshfatal("ssh-pkcs11-client.c", "pkcs11_add_provider", 0x155, 0x1, 0x1, ssh_err(v3));
}
*(a2) = xcalloc(v2, 0x8);
if (a3)
*(a3) = xcalloc(v2, 0x8);
for (v4 = 0; v4 < v2; v4 += 1) {
v3 = sshbuf_get_string(v10, &v7, &v9, &v7);
if (!v3)
v3 = sshbuf_get_cstring(v10, &v8, 0x0, &v8);
if (v3 || v3) {
v11 = "parse key";
sshfatal("ssh-pkcs11-client.c", "pkcs11_add_provider", 0x15d, 0x1, 0x1, ssh_err(v3));
}
v3 = sshkey_from_blob(*(&v7), *(&v9), &v6, *(&v9));
if (v3) {
v11 = "decode key";
sshfatal("ssh-pkcs11-client.c", "pkcs11_add_provider", 0x15f, 0x1, 0x1, ssh_err(v3));
}
wrap_key(*(&v6));
*((v4 * 8 + *(a2))) = *(&v6);
if (a3)
*((v4 * 8 + *(a3))) = *(&v8);
else
free(*(&v8));
free(*(&v7));
}
} else if (v5 == 30) {
v3 = sshbuf_get_u32(v10, &v2, &v2);
if (v3)
v2 = -1;
} else {
v2 = -1;
}
sshbuf_free(v10);
v14 = v2;
}
return v14;
}
|
int
rl_history_search_forward (int count, int ignore)
{
if (count == 0)
return (0);
if (rl_last_func != rl_history_search_forward &&
rl_last_func != rl_history_search_backward)
rl_history_search_reinit (0x01);
if (_rl_history_search_len == 0)
return (rl_get_next_history (count, ignore));
return (rl_history_search_internal ((((count) >= 0) ? (count) : -(count)), (count > 0) ? 1 : -1));
}
| long rl_history_search_forward(int a1, unsigned int a2)
{
unsigned int v3;
if ( !a1 )
return 0LL;
if ( (long ( *)(int, unsigned int))rl_last_func != rl_history_search_forward
&& (long ( *)(int, unsigned int))rl_last_func != rl_history_search_backward )
{
rl_history_search_reinit(1);
}
if ( !rl_history_search_len )
return rl_get_next_history((unsigned int)a1, a2);
if ( a1 <= 0 )
v3 = -1;
else
v3 = 1;
return rl_history_search_internal(abs32(a1), v3);
}
|
static int rmmod_do_modlist(struct kmod_list *list,
_Bool
stop_on_errors)
{
struct kmod_list *l;
for (l = kmod_list_last(list); l !=
((void *)0)
; l = kmod_list_prev(list, l)) {
struct kmod_module *m = kmod_module_get_module(l);
int r = rmmod_do_module(m, 0x2);
kmod_module_unref(m);
if (r < 0 && stop_on_errors)
return r;
}
return 0;
}
| long rmmod_do_modlist(long a1, char a2)
{
int v3;
long i;
long module;
for ( i = kmod_list_last(a1); i; i = kmod_list_prev(a1, i) )
{
module = kmod_module_get_module(i);
v3 = rmmod_do_module(module, 2);
kmod_module_unref(module);
if ( v3 < 0 && a2 )
return (unsigned int)v3;
}
return 0LL;
}
|
static char const *
format_group (register FILE *out, char const *format, char endchar,
struct group const *groups)
{
register char c;
register char const *f = format;
while ((c = *f) != endchar && c != 0)
{
char const *f1 = ++f;
if (c == '%')
switch ((c = *f++))
{
case '%':
break;
case '(':
{
int i;
intmax_t value[2];
FILE *thenout, *elseout;
for (i = 0; i < 2; i++)
{
if (((unsigned int) (*f) - '0' <= 9))
{
char *fend;
(*__errno_location ())
= 0;
value[i] = strtoimax (f, &fend, 10);
if (
(*__errno_location ())
)
goto bad_format;
f = fend;
}
else
{
value[i] = groups_letter_value (groups, *f);
if (value[i] < 0)
goto bad_format;
f++;
}
if (*f++ != "=?"[i])
goto bad_format;
}
if (value[0] == value[1])
thenout = out, elseout = 0;
else
thenout = 0, elseout = out;
f = format_group (thenout, f, ':', groups);
if (*f)
{
f = format_group (elseout, f + 1, ')', groups);
if (*f)
f++;
}
}
continue;
case '<':
print_ifdef_lines (out, line_format[OLD], &groups[0]);
continue;
case '=':
print_ifdef_lines (out, line_format[UNCHANGED], &groups[0]);
continue;
case '>':
print_ifdef_lines (out, line_format[NEW], &groups[1]);
continue;
default:
f = do_printf_spec (out, f - 2, 0, 0, groups);
if (f)
continue;
bad_format:
c = '%';
f = f1;
break;
}
if (out)
putc_unlocked (c,out);
}
return f;
}
| int format_group(unsigned long long a0, char *a1, unsigned long a2, unsigned long long a3) {
int tmp_8;
unsigned int v0;
char v1;
void* v2;
void* v3;
unsigned long long v4;
char v5;
char v6;
char *v8;
unsigned long long v9;
unsigned long long v10;
v8 = a1;
while (true) {
v9 = *(v8);
if (!(*(v8) != a2) || !(*(v8)))
break;
v8 += 1;
v4 = v8;
if (v9 == 37) {
tmp_8 = v8;
v8 += 1;
*(&v9) = *(tmp_8);
switch (v9) {
case 37:
break;
case 40:
v0 = 0;
while (true) {
if (v0 > 1) {
if (*(&v5) == *(&v6)) {
v2 = a0;
v3 = 0;
} else {
v2 = 0;
v3 = a0;
}
v8 = format_group(v2, v8, 0x3a, a3);
if (*(v8)) {
v8 = format_group(v3, v8 + 1, 0x29, a3);
if (*(v8))
v8 += 1;
}
} else {
if (*(v8) - 48 > 9) {
*(&(&v5)[8 * v0]) = groups_letter_value(a3, *(v8));
if (*(&(&v5)[8 * v0]) >= 0) {
v10 = v8 + 1;
} else {
*(&v9) = 37;
v8 = v4;
break;
}
} else {
*(__errno_location()) = 0;
*(&(&v5)[8 * v0]) = strtoimax(v8, &v1, 0xa);
if (!*(__errno_location())) {
v10 = *(&v1);
} else {
*(&v9) = 37;
v8 = v4;
break;
}
}
tmp_8 = v10;
v8 = v10 + 1;
a2 = *(tmp_8);
if (a2 == *(v0 + &g_400de0)) {
v0 += 1;
} else {
*(&v9) = 37;
v8 = v4;
break;
}
}
}
continue;
case 60:
print_ifdef_lines(a0, putc_unlocked, a3);
continue;
case 61:
print_ifdef_lines(a0, line_format, a3);
continue;
case 62:
print_ifdef_lines(a0, translate_line_number, a3 + 24);
continue;
default:
v8 = do_printf_spec(a0, v8 + 2, 0x0, 0x0, a3);
if (!(!v8))
continue;
*(&v9) = 37;
v8 = v4;
break;
}
}
if (a0)
putc_unlocked(v9, a0);
}
return v8;
}
|
static void gen_codes (tree, max_code)
ct_data *tree;
int max_code;
{
ush next_code[15 +1];
ush code = 0;
int bits;
int n;
for (bits = 1; bits <= 15; bits++) {
next_code[bits] = code = (code + bl_count[bits-1]) << 1;
}
;
;
for (n = 0; n <= max_code; n++) {
int len = tree[n].dl.len;
if (len == 0) continue;
tree[n].fc.code = bi_reverse(next_code[len]++, len);
;
}
}
| unsigned long gen_codes(long a1, int a2)
{
long v2;
unsigned short v3;
short v5;
int i;
int j;
unsigned int v8;
short v9[20];
unsigned long v10;
v10 = __readfsqword(0x28u);
v5 = 0;
for ( i = 1; i <= 15; ++i )
{
v5 = 2 * (bl_count[i - 1] + v5);
v9[i] = v5;
}
for ( j = 0; j <= a2; ++j )
{
v2 = 4LL * j;
v8 = *(unsigned short *)(v2 + a1 + 2);
if ( *(_WORD *)(v2 + a1 + 2) )
{
v3 = v9[*(unsigned short *)(v2 + a1 + 2)];
v9[*(unsigned short *)(v2 + a1 + 2)] = v3 + 1;
*(_WORD *)(4LL * j + a1) = bi_reverse(v3, v8);
}
}
return __readfsqword(0x28u) ^ v10;
}
|
static void
add_field (int file, size_t field)
{
struct outlist *o;
((void) sizeof ((
file == 0 || file == 1 || file == 2
) ? 1 : 0), __extension__ ({ if (
file == 0 || file == 1 || file == 2
) ; else __assert_fail (
"file == 0 || file == 1 || file == 2"
, "src/join.c", 823, __extension__ __PRETTY_FUNCTION__); }))
;
((void) sizeof ((
file != 0 || field == 0
) ? 1 : 0), __extension__ ({ if (
file != 0 || field == 0
) ; else __assert_fail (
"file != 0 || field == 0"
, "src/join.c", 824, __extension__ __PRETTY_FUNCTION__); }))
;
o = xmalloc (sizeof *o);
o->file = file;
o->field = field;
o->next =
((void *)0)
;
outlist_end->next = o;
outlist_end = o;
}
| void add_field(unsigned long a0, unsigned long a1) {
struct_0 *v0;
struct_0 *v3;
switch (a0) {
case 0: case 1: case 2:
if (!a0 && a1)
__assert_fail();
*(&v0) = xmalloc(0x18);
v0->field_0 = a0;
v0->field_8 = a1;
v0->field_10 = 0;
outlist_end->field_10 = v0;
v3 = v0;
outlist_end = v0;
return;
default:
__assert_fail();
}
}
|
int
channel_input_data(int type, u_int32_t seq, struct ssh *ssh)
{
const u_char *data;
size_t data_len, win_len;
Channel *c = channel_from_packet_id(ssh, __func__, "data");
int r;
if (channel_proxy_upstream(c, type, seq, ssh))
return 0;
if (c->type != 4 &&
c->type != 21 &&
c->type != 22 &&
c->type != 7)
return 0;
if ((r = sshpkt_get_string_direct(ssh, &data, &data_len)) != 0 ||
(r = sshpkt_get_end(ssh)) != 0)
sshfatal("channels.c", __func__, 3224, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i: get data", c->self);
win_len = data_len;
if (c->datagram)
win_len += 4;
if (c->ostate != 0) {
c->local_window -= win_len;
c->local_consumed += win_len;
return 0;
}
if (win_len > c->local_maxpacket) {
sshlog("channels.c", __func__, 3242, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "channel %d: rcvd big packet %zu, maxpack %u", c->self, win_len, c->local_maxpacket)
;
return 0;
}
if (win_len > c->local_window) {
sshlog("channels.c", __func__, 3247, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "channel %d: rcvd too much data %zu, win %u", c->self, win_len, c->local_window)
;
return 0;
}
c->local_window -= win_len;
if (c->datagram) {
if ((r = sshbuf_put_string(c->output, data, data_len)) != 0)
sshfatal("channels.c", __func__, 3255, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i: append datagram", c->self);
} else if ((r = sshbuf_put(c->output, data, data_len)) != 0)
sshfatal("channels.c", __func__, 3257, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i: append data", c->self);
return 0;
}
| long long channel_input_data(unsigned long a0, unsigned long a1, void* a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned long long v0;
unsigned long v1;
unsigned int v2;
char v3;
char v4;
unsigned long long v5;
struct_0 *v6;
unsigned long long v7;
unsigned long v8;
unsigned long long v9;
unsigned long v10;
char v11;
v6 = channel_from_packet_id(a2, 0x413ad0, "data");
if (!channel_proxy_upstream(v6, a0, a1, a2, a4, a5) && (v6->field_0 == 21 || v6->field_0 == 22 || v6->field_0 == 7 || v6->field_0 == 4)) {
v2 = sshpkt_get_string_direct(a2, &v3, &v4, &v3);
if (!v2)
v2 = sshpkt_get_end(a2);
if (v2 || v2) {
v1 = v6->field_4;
v0 = "channel %i: get data";
sshfatal("channels.c", "channel_input_data", 0xc98, 0x1, 0x1, ssh_err(v2));
}
v5 = *(&v4);
if (v6->field_120)
v5 += 4;
if (v6->field_14) {
v6->field_b0 = v6->field_b0 - v5;
v6->field_b8 = v5 + v6->field_b8;
} else if (v5 > v6->field_bc) {
v10 = v6->field_bc;
v9 = v5;
v8 = v6->field_4;
v7 = "channel %d: rcvd big packet %zu, maxpack %u";
sshlog("channels.c", "channel_input_data", 0xcaa, 0x0, 0x3, 0x0, *(&v11));
} else if (v5 > v6->field_b0) {
v10 = v6->field_b0;
v9 = v5;
v8 = v6->field_4;
v7 = "channel %d: rcvd too much data %zu, win %u";
sshlog("channels.c", "channel_input_data", 0xcaf, 0x0, 0x3, 0x0, *(&v11));
} else {
v6->field_b0 = v6->field_b0 - v5;
if (v6->field_120) {
v2 = sshbuf_put_string(v6->field_70, *(&v3), *(&v4), *(&v3));
if (v2) {
v10 = v6->field_4;
v9 = "channel %i: append datagram";
sshfatal("channels.c", "channel_input_data", 0xcb7, 0x1, 0x1, ssh_err(v2));
}
}
if (!v6->field_120 || v2) {
v2 = sshbuf_put(v6->field_70, *(&v3), *(&v4), *(&v3));
if (v2) {
v10 = v6->field_4;
v9 = "channel %i: append data";
sshfatal("channels.c", "channel_input_data", 0xcb9, 0x1, 0x1, ssh_err(v2));
}
}
}
}
return 0;
}
|
void get_tlsfeatures_set(int type, void *crt)
{
int ret, i;
unsigned int feature;
if (batch) {
if (!cfg.tls_features)
return;
gnutls_x509_tlsfeatures_t features;
ret = gnutls_x509_tlsfeatures_init(&features);
if (ret < 0) {
fprintf(
stderr
, "gnutls_x509_tlsfeatures_init: %s\n",
gnutls_strerror(ret));
exit(1);
}
for (i = 0; cfg.tls_features[i]; ++i) {
feature = strtoul(cfg.tls_features[i], 0, 10);
ret = gnutls_x509_tlsfeatures_add(features, feature);
if (ret < 0) {
fprintf(
stderr
, "gnutls_x509_tlsfeatures_add: %s\n",
gnutls_strerror(ret));
exit(1);
}
}
if (type == 1) {
ret = gnutls_x509_crt_set_tlsfeatures(crt, features);
if (ret < 0) {
fprintf(
stderr
, "gnutls_x509_crt_set_tlsfeatures: %s\n",
gnutls_strerror(ret));
exit(1);
}
}
else {
ret = gnutls_x509_crq_set_tlsfeatures(crt, features);
if (ret < 0) {
fprintf(
stderr
, "gnutls_x509_crq_set_tlsfeatures: %s\n",
gnutls_strerror(ret));
exit(1);
}
}
gnutls_x509_tlsfeatures_deinit(features);
}
}
| long long get_tlsfeatures_set(unsigned long a0, unsigned long long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
char v3;
if (*(got.batch) && *((got.cfg + 672))) {
v1 = gnutls_x509_tlsfeatures_init(&v3);
if (v1 < 0) {
fprintf(*(*(&got.stderr)), "gnutls_x509_tlsfeatures_init: %s\n", gnutls_strerror(v1));
exit(0x1);
}
for (v0 = 0; *((*((got.cfg + 672)) + (v0 << 3))); v0 += 1) {
v2 = strtoul(*((*((got.cfg + 672)) + v0 * 8)), 0x0, 0xa);
v1 = gnutls_x509_tlsfeatures_add(*(&v3), v2, v2);
if (v1 < 0) {
fprintf(*(*(&got.stderr)), "gnutls_x509_tlsfeatures_add: %s\n", gnutls_strerror(v1));
exit(0x1);
}
}
if (a0 != 1) {
v1 = gnutls_x509_crq_set_tlsfeatures(a1, *(&v3), *(&v3));
if (v1 < 0) {
fprintf(*(*(&got.stderr)), "gnutls_x509_crq_set_tlsfeatures: %s\n", gnutls_strerror(v1));
exit(0x1);
}
} else {
v1 = gnutls_x509_crt_set_tlsfeatures(a1, *(&v3), *(&v3));
if (v1 < 0) {
fprintf(*(*(&got.stderr)), "gnutls_x509_crt_set_tlsfeatures: %s\n", gnutls_strerror(v1));
exit(0x1);
}
}
gnutls_x509_tlsfeatures_deinit(*(&v3));
}
return 0;
}
|
static int
delete_file(int agent_fd, const char *filename, int key_only, int qflag)
{
struct sshkey *public, *cert =
((void *)0)
;
char *certpath =
((void *)0)
, *comment =
((void *)0)
;
int r, ret = -1;
if (strcmp(filename, "-") == 0)
return delete_stdin(agent_fd, qflag);
if ((r = sshkey_load_public(filename, &public, &comment)) != 0) {
printf("Bad key file %s: %s\n", filename, ssh_err(r));
return -1;
}
if (delete_one(agent_fd, public, comment, filename, qflag) == 0)
ret = 0;
if (key_only)
goto out;
free(comment);
comment =
((void *)0)
;
xasprintf(&certpath, "%s-cert.pub", filename);
if ((r = sshkey_load_public(certpath, &cert, &comment)) != 0) {
if (r != -24 ||
(*__errno_location ())
!=
2
)
sshlog("ssh-add.c", __func__, 189, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Failed to load certificate \"%s\"", certpath);
goto out;
}
if (!sshkey_equal_public(cert, public))
sshfatal("ssh-add.c", __func__, 194, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Certificate %s does not match private key %s", certpath, filename)
;
if (delete_one(agent_fd, cert, comment, certpath, qflag) == 0)
ret = 0;
out:
sshkey_free(cert);
sshkey_free(public);
free(certpath);
free(comment);
return ret;
}
| ulong delete_file(undefined4 param_1,char *param_2,int param_3,undefined4 param_4)
{
undefined4 uVar1;
void *pvVar2;
int iVar3;
ulong uVar4;
undefined8 uVar5;
int *piVar6;
char **ppcVar7;
undefined *puVar8;
long in_FS_OFFSET;
char *pcStack136;
void *pvStack128;
char *pcStack120;
void *pvStack112;
undefined auStack104 [12];
undefined4 local_5c;
char *local_58;
int local_50;
undefined4 local_4c;
uint local_48;
int local_44;
undefined8 local_40;
undefined8 local_38;
void *local_30;
void *local_28;
long local_20;
ppcVar7 = (char **)auStack104;
puVar8 = auStack104;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_38 = 0;
local_30 = (void *)0x0;
local_28 = (void *)0x0;
local_48 = 0xffffffff;
pvStack112 = (void *)0x100366;
local_5c = param_4;
local_58 = param_2;
local_50 = param_3;
local_4c = param_1;
iVar3 = strcmp(param_2,"-");
if (iVar3 == 0) {
pvStack112 = (void *)0x100379;
uVar4 = delete_stdin(local_4c,local_5c);
puVar8 = auStack104;
goto LAB_0010056b;
}
pvStack112 = (void *)0x100395;
local_44 = sshkey_load_public(local_58,&local_40,&local_28);
if (local_44 != 0) {
pvStack112 = (void *)0x1003a8;
uVar5 = ssh_err(local_44);
pvStack112 = (void *)0x1003c3;
printf("Bad key file %s: %s\n",local_58,uVar5);
uVar4 = 0xffffffff;
goto LAB_0010056b;
}
pvStack112 = (void *)0x1003e9;
iVar3 = delete_one(local_4c,local_40,local_28,local_58,local_5c);
if (iVar3 == 0) {
local_48 = 0;
}
puVar8 = auStack104;
if (local_50 == 0) {
pvStack112 = (void *)0x10040a;
free(local_28);
local_28 = (void *)0x0;
pvStack112 = (void *)0x10042e;
xasprintf(&local_30,"%s-cert.pub",local_58);
pvStack112 = (void *)0x100445;
local_44 = sshkey_load_public(local_30,&local_38,&local_28);
if (local_44 == 0) {
pvStack112 = (void *)0x1004c2;
iVar3 = sshkey_equal_public(local_38,local_40);
if (iVar3 == 0) {
pcStack120 = local_58;
pvStack128 = local_30;
ppcVar7 = &pcStack136;
pcStack136 = "Certificate %s does not match private key %s";
sshfatal("ssh-add.c","delete_file",0xc2,0,1,0);
}
uVar1 = local_5c;
*(undefined8 *)((long)ppcVar7 + -8) = 0x100524;
iVar3 = delete_one(local_4c,local_38,local_28,local_30,uVar1);
puVar8 = (undefined *)ppcVar7;
if (iVar3 == 0) {
local_48 = 0;
}
}
else {
if (local_44 == -0x18) {
pvStack112 = (void *)0x100459;
piVar6 = __errno_location();
puVar8 = auStack104;
if (*piVar6 == 2) goto LAB_00100538;
}
pvVar2 = local_30;
pvStack112 = (void *)0x100472;
uVar5 = ssh_err(local_44);
pvStack112 = pvVar2;
pcStack120 = "Failed to load certificate \"%s\"";
pvStack128 = (void *)0x1004a6;
sshlog("ssh-add.c","delete_file",0xbd,0,2,uVar5);
puVar8 = auStack104;
}
}
LAB_00100538:
*(undefined8 *)(puVar8 + -8) = 0x100544;
sshkey_free(local_38);
*(undefined8 *)(puVar8 + -8) = 0x100550;
sshkey_free(local_40);
*(undefined8 *)(puVar8 + -8) = 0x10055c;
free(local_30);
*(undefined8 *)(puVar8 + -8) = 0x100568;
free(local_28);
uVar4 = (ulong)local_48;
LAB_0010056b:
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar4;
}
*(undefined8 *)(puVar8 + -8) = 0x10057f;
__stack_chk_fail();
}
|
int
auth_rhosts2(struct passwd *pw, const char *client_user, const char *hostname,
const char *ipaddr)
{
char *path =
((void *)0)
;
struct stat st;
static const char * const rhosts_files[] = {".shosts", ".rhosts",
((void *)0)
};
u_int rhosts_file_index;
int r;
sshlog("auth-rhosts.c", __func__, 200, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "clientuser %s hostname %s ipaddr %s", client_user, hostname, ipaddr)
;
temporarily_use_uid(pw);
for (rhosts_file_index = 0; rhosts_files[rhosts_file_index];
rhosts_file_index++) {
xasprintf(&path, "%s/%s",
pw->pw_dir, rhosts_files[rhosts_file_index]);
r = stat(path, &st);
free(path);
if (r >= 0)
break;
}
restore_uid();
if (!rhosts_files[rhosts_file_index] &&
stat("/etc/hosts.equiv", &st) == -1 &&
stat("/usr/local/etc" "/shosts.equiv", &st) == -1) {
sshlog("auth-rhosts.c", __func__, 231, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "no hosts access files exist");
return 0;
}
if (pw->pw_uid == 0)
sshlog("auth-rhosts.c", __func__, 240, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "root user, ignoring system hosts files");
else {
if (check_rhosts_file("/etc/hosts.equiv", hostname, ipaddr,
client_user, pw->pw_name)) {
auth_debug_add("Accepted for %.100s [%.100s] by "
"/etc/hosts.equiv.", hostname, ipaddr);
return 1;
}
if (check_rhosts_file("/usr/local/etc" "/shosts.equiv", hostname, ipaddr,
client_user, pw->pw_name)) {
auth_debug_add("Accepted for %.100s [%.100s] by "
"%.100s.", hostname, ipaddr, "/usr/local/etc" "/shosts.equiv");
return 1;
}
}
if (stat(pw->pw_dir, &st) == -1) {
sshlog("auth-rhosts.c", __func__, 261, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Rhosts authentication refused for %.100s: " "no home directory %.200s", pw->pw_name, pw->pw_dir)
;
auth_debug_add("Rhosts authentication refused for %.100s: "
"no home directory %.200s", pw->pw_name, pw->pw_dir);
return 0;
}
if (options.strict_modes &&
((st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
(st.st_mode & 022) != 0)) {
sshlog("auth-rhosts.c", __func__, 270, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Rhosts authentication refused for %.100s: " "bad ownership or modes for home directory.", pw->pw_name)
;
auth_debug_add("Rhosts authentication refused for %.100s: "
"bad ownership or modes for home directory.", pw->pw_name);
return 0;
}
temporarily_use_uid(pw);
for (rhosts_file_index = 0; rhosts_files[rhosts_file_index];
rhosts_file_index++) {
xasprintf(&path, "%s/%s",
pw->pw_dir, rhosts_files[rhosts_file_index]);
if (stat(path, &st) == -1) {
free(path);
continue;
}
if (options.strict_modes &&
((st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
(st.st_mode & 022) != 0)) {
sshlog("auth-rhosts.c", __func__, 299, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Rhosts authentication refused for %.100s: " "bad modes for %.200s", pw->pw_name, path)
;
auth_debug_add("Bad file modes for %.200s", path);
free(path);
continue;
}
if (options.ignore_rhosts == 1 ||
(options.ignore_rhosts == 2 &&
strcmp(rhosts_files[rhosts_file_index], ".shosts") != 0)) {
auth_debug_add("Server has been configured to "
"ignore %.100s.", rhosts_files[rhosts_file_index]);
free(path);
continue;
}
if (check_rhosts_file(path, hostname, ipaddr,
client_user, pw->pw_name)) {
auth_debug_add("Accepted by %.100s.",
rhosts_files[rhosts_file_index]);
restore_uid();
auth_debug_add("Accepted host %s ip %s client_user "
"%s server_user %s", hostname, ipaddr,
client_user, pw->pw_name);
free(path);
return 1;
}
free(path);
}
restore_uid();
return 0;
}
| undefined8
auth_rhosts2(undefined8 *param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4)
{
int iVar1;
long in_FS_OFFSET;
undefined8 uVar2;
uint local_b8;
char *local_b0;
stat local_a8;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_b0 = (char *)0x0;
sshlog("auth-rhosts.c","auth_rhosts2",200,1,6,0,"clientuser %s hostname %s ipaddr %s",param_2,
param_3,param_4);
temporarily_use_uid(param_1);
local_b8 = 0;
while (*(long *)(rhosts_files_15040 + (ulong)local_b8 * 8) != 0) {
xasprintf(&local_b0,"%s/%s",param_1[4],*(undefined8 *)(rhosts_files_15040 + (ulong)local_b8 * 8)
);
iVar1 = stat(local_b0,&local_a8);
free(local_b0);
if (-1 < iVar1) break;
local_b8 = local_b8 + 1;
}
uVar2 = 0x100674;
restore_uid();
if (*(long *)(rhosts_files_15040 + (ulong)local_b8 * 8) == 0) {
uVar2 = 0x1006a8;
iVar1 = stat("/etc/hosts.equiv",&local_a8);
if (iVar1 == -1) {
uVar2 = 0x1006c3;
iVar1 = stat("/usr/local/etc/shosts.equiv",&local_a8);
if (iVar1 == -1) {
sshlog("auth-rhosts.c","auth_rhosts2",0xe7,1,7,0,"no hosts access files exist",uVar2);
uVar2 = 0;
goto LAB_00100c42;
}
}
}
if (*(int *)(param_1 + 2) == 0) {
sshlog("auth-rhosts.c","auth_rhosts2",0xf0,1,7,0,"root user, ignoring system hosts files",uVar2)
;
}
else {
iVar1 = check_rhosts_file("/etc/hosts.equiv",param_3,param_4,param_2,*param_1);
if (iVar1 != 0) {
auth_debug_add("Accepted for %.100s [%.100s] by /etc/hosts.equiv.",param_3,param_4);
uVar2 = 1;
goto LAB_00100c42;
}
iVar1 = check_rhosts_file("/usr/local/etc/shosts.equiv",param_3,param_4,param_2,*param_1);
if (iVar1 != 0) {
auth_debug_add("Accepted for %.100s [%.100s] by %.100s.",param_3,param_4,
"/usr/local/etc/shosts.equiv");
uVar2 = 1;
goto LAB_00100c42;
}
}
uVar2 = 0x100847;
iVar1 = stat((char *)param_1[4],&local_a8);
if (iVar1 == -1) {
sshlog("auth-rhosts.c","auth_rhosts2",0x105,0,3,0,
"Rhosts authentication refused for %.100s: no home directory %.200s",*param_1,param_1[4],
uVar2);
auth_debug_add("Rhosts authentication refused for %.100s: no home directory %.200s",*param_1,
param_1[4]);
uVar2 = 0;
}
else if ((_DAT_00102550 == 0) ||
(((local_a8.st_uid == 0 || (local_a8.st_uid == *(__uid_t *)(param_1 + 2))) &&
((local_a8.st_mode & 0x12) == 0)))) {
temporarily_use_uid(param_1);
local_b8 = 0;
while (*(long *)(rhosts_files_15040 + (ulong)local_b8 * 8) != 0) {
xasprintf(&local_b0,"%s/%s",param_1[4],
*(undefined8 *)(rhosts_files_15040 + (ulong)local_b8 * 8));
uVar2 = 0x1009f4;
iVar1 = stat(local_b0,&local_a8);
if (iVar1 == -1) {
free(local_b0);
}
else if ((_DAT_00102550 == 0) ||
(((local_a8.st_uid == 0 || (local_a8.st_uid == *(__uid_t *)(param_1 + 2))) &&
((local_a8.st_mode & 0x12) == 0)))) {
if ((_DAT_00102520 == 1) ||
((_DAT_00102520 == 2 &&
(iVar1 = strcmp(*(char **)(rhosts_files_15040 + (ulong)local_b8 * 8),".shosts"),
iVar1 != 0)))) {
auth_debug_add("Server has been configured to ignore %.100s.",
*(undefined8 *)(rhosts_files_15040 + (ulong)local_b8 * 8));
free(local_b0);
}
else {
iVar1 = check_rhosts_file(local_b0,param_3,param_4,param_2,*param_1);
if (iVar1 != 0) {
auth_debug_add("Accepted by %.100s.",
*(undefined8 *)(rhosts_files_15040 + (ulong)local_b8 * 8));
restore_uid();
auth_debug_add("Accepted host %s ip %s client_user %s server_user %s",param_3,param_4,
param_2,*param_1);
free(local_b0);
uVar2 = 1;
goto LAB_00100c42;
}
free(local_b0);
}
}
else {
sshlog("auth-rhosts.c","auth_rhosts2",299,0,3,0,
"Rhosts authentication refused for %.100s: bad modes for %.200s",*param_1,local_b0,
uVar2);
auth_debug_add("Bad file modes for %.200s",local_b0);
free(local_b0);
}
local_b8 = local_b8 + 1;
}
restore_uid();
uVar2 = 0;
}
else {
sshlog("auth-rhosts.c","auth_rhosts2",0x10e,0,3,0,
"Rhosts authentication refused for %.100s: bad ownership or modes for home directory.",
*param_1);
auth_debug_add("Rhosts authentication refused for %.100s: bad ownership or modes for home directory."
,*param_1);
uVar2 = 0;
}
LAB_00100c42:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar2;
}
__stack_chk_fail();
}
|
int
sshsig_armor(const struct sshbuf *blob, struct sshbuf **out)
{
struct sshbuf *buf =
((void *)0)
;
int r = -1;
*out =
((void *)0)
;
if ((buf = sshbuf_new()) ==
((void *)0)
) {
sshlog("sshsig.c", __func__, 57, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "sshbuf_new failed");
r = -2;
goto out;
}
if ((r = sshbuf_put(buf, "-----BEGIN SSH SIGNATURE-----\n",
sizeof("-----BEGIN SSH SIGNATURE-----\n")-1)) != 0) {
sshlog("sshsig.c", __func__, 64, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "sshbuf_putf");
goto out;
}
if ((r = sshbuf_dtob64(blob, buf, 1)) != 0) {
sshlog("sshsig.c", __func__, 69, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "base64 encode signature");
goto out;
}
if ((r = sshbuf_put(buf, "-----END SSH SIGNATURE-----",
sizeof("-----END SSH SIGNATURE-----")-1)) != 0 ||
(r = sshbuf_put_u8(buf, '\n')) != 0) {
sshlog("sshsig.c", __func__, 76, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "sshbuf_put");
goto out;
}
*out = buf;
buf =
((void *)0)
;
r = 0;
out:
sshbuf_free(buf);
return r;
}
| int sshsig_armor(undefined8 param_1,long *param_2)
{
undefined8 uVar1;
undefined8 uVar2;
int local_14;
long local_10;
*param_2 = 0;
uVar1 = 0x100033;
local_10 = sshbuf_new();
if (local_10 == 0) {
sshlog("sshsig.c","sshsig_armor",0x39,1,2,0,"sshbuf_new failed",uVar1);
local_14 = -2;
}
else {
local_14 = sshbuf_put(local_10,"-----BEGIN SSH SIGNATURE-----\n",0x1e);
if (local_14 == 0) {
local_14 = sshbuf_dtob64(param_1,local_10,1);
if (local_14 == 0) {
local_14 = sshbuf_put(local_10,"-----END SSH SIGNATURE-----",0x1b);
if (local_14 == 0) {
local_14 = sshbuf_put_u8(local_10,10);
if (local_14 == 0) {
*param_2 = local_10;
local_10 = 0;
local_14 = 0;
goto LAB_001001fa;
}
}
uVar2 = 0x1001a3;
uVar1 = ssh_err(local_14);
sshlog("sshsig.c","sshsig_armor",0x4c,1,2,uVar1,"sshbuf_put",uVar2);
}
else {
uVar2 = 0x10011e;
uVar1 = ssh_err(local_14);
sshlog("sshsig.c","sshsig_armor",0x45,1,2,uVar1,"base64 encode signature",uVar2);
}
}
else {
uVar2 = 0x1000b3;
uVar1 = ssh_err(local_14);
sshlog("sshsig.c","sshsig_armor",0x40,1,2,uVar1,"sshbuf_putf",uVar2);
}
}
LAB_001001fa:
sshbuf_free(local_10);
return local_14;
}
|
static int
sv_compare (sv1, sv2)
struct name_and_function *sv1, *sv2;
{
int r;
if ((r = sv1->name[0] - sv2->name[0]) == 0)
r = strcmp (sv1->name, sv2->name);
return r;
}
| int sv_compare(char **param_1,char **param_2)
{
int local_c;
local_c = (int)**param_1 - (int)**param_2;
if (local_c == 0) {
local_c = strcmp(*param_1,*param_2);
}
return local_c;
}
|
static void tls_log_func(int level, const char *str)
{
fprintf(
stderr
, "|<%d>| %s", level, str);
}
| long long tls_log_func(unsigned long a0, unsigned long a1) {
return fprintf(stderr, "|<%d>| %s", a0, a1);
}
|
static void
sparse_add_map (struct tar_stat_info *st, struct sp_array const *sp)
{
struct sp_array *sparse_map = st->sparse_map;
size_t avail = st->sparse_map_avail;
if (avail == st->sparse_map_size)
st->sparse_map = sparse_map =
x2nrealloc (sparse_map, &st->sparse_map_size, sizeof *sparse_map);
sparse_map[avail] = *sp;
st->sparse_map_avail = avail + 1;
}
| void sparse_add_map(long param_1,undefined8 *param_2)
{
undefined8 *puVar1;
long lVar2;
undefined8 uVar3;
long local_18;
local_18 = *(long *)(param_1 + 0x140);
lVar2 = *(long *)(param_1 + 0x130);
if (lVar2 == *(long *)(param_1 + 0x138)) {
local_18 = x2nrealloc(local_18,param_1 + 0x138,0x10);
*(long *)(param_1 + 0x140) = local_18;
}
puVar1 = (undefined8 *)(lVar2 * 0x10 + local_18);
uVar3 = param_2[1];
*puVar1 = *param_2;
puVar1[1] = uVar3;
*(long *)(param_1 + 0x130) = lVar2 + 1;
return;
}
|
int
kex_dh_keygen(struct kex *kex)
{
switch (kex->kex_type) {
case KEX_DH_GRP1_SHA1:
kex->dh = dh_new_group1();
break;
case KEX_DH_GRP14_SHA1:
case KEX_DH_GRP14_SHA256:
kex->dh = dh_new_group14();
break;
case KEX_DH_GRP16_SHA512:
kex->dh = dh_new_group16();
break;
case KEX_DH_GRP18_SHA512:
kex->dh = dh_new_group18();
break;
default:
return -10;
}
if (kex->dh ==
((void *)0)
)
return -2;
return (dh_gen_key(kex->dh, kex->we_need * 8));
}
| undefined8 kex_dh_keygen(long param_1)
{
uint uVar1;
undefined8 uVar2;
uVar1 = *(uint *)(param_1 + 0x38);
if (uVar1 == 4) {
uVar2 = dh_new_group18();
*(undefined8 *)(param_1 + 0x118) = uVar2;
}
else {
if (4 < uVar1) {
return 0xfffffff6;
}
if (uVar1 == 3) {
uVar2 = dh_new_group16();
*(undefined8 *)(param_1 + 0x118) = uVar2;
}
else {
if (3 < uVar1) {
return 0xfffffff6;
}
if (uVar1 == 0) {
uVar2 = dh_new_group1();
*(undefined8 *)(param_1 + 0x118) = uVar2;
}
else {
if (1 < uVar1 - 1) {
return 0xfffffff6;
}
uVar2 = dh_new_group14();
*(undefined8 *)(param_1 + 0x118) = uVar2;
}
}
}
if (*(long *)(param_1 + 0x118) == 0) {
uVar2 = 0xfffffffe;
}
else {
uVar2 = dh_gen_key(*(undefined8 *)(param_1 + 0x118),*(int *)(param_1 + 0x10) << 3);
}
return uVar2;
}
|
rsRetVal
submitMsg(smsg_t *pMsg)
{
return submitMsgWithDfltRatelimiter(pMsg);
}
| void submitMsg(undefined8 param_1)
{
submitMsgWithDfltRatelimiter(param_1);
return;
}
|
static errcode_t e2fsck_read_all_quotas(e2fsck_t ctx)
{
ext2_ino_t qf_ino;
enum quota_type qtype;
errcode_t retval = 0;
if (!ext2fs_has_feature_quota(ctx->fs->super))
return retval;
retval = quota_init_context(&ctx->qctx, ctx->fs, 0);
if (retval)
return retval;
for (qtype = 0 ; qtype < MAXQUOTAS; qtype++) {
qf_ino = *quota_sb_inump(ctx->fs->super, qtype);
if (qf_ino == 0)
continue;
retval = quota_read_all_dquots(ctx->qctx, qf_ino, qtype,
0x01 | 0x02);
if (retval)
break;
}
if (retval)
quota_release_context(&ctx->qctx);
return retval;
}
| long e2fsck_read_all_quotas(_QWORD *a1)
{
unsigned int i;
unsigned int v3;
long inited;
if ( !ext2fs_has_feature_quota(*(_QWORD *)(*a1 + 32LL)) )
return 0LL;
inited = quota_init_context(a1 + 79, *a1, 0LL);
if ( inited )
return inited;
for ( i = 0; i <= 2; ++i )
{
v3 = *(_DWORD *)quota_sb_inump(*(_QWORD *)(*a1 + 32LL), i);
if ( v3 )
{
inited = quota_read_all_dquots(a1[79], v3, i, 3LL);
if ( inited )
break;
}
}
if ( inited )
quota_release_context(a1 + 79);
return inited;
}
|
int
num_fifos ()
{
return nfds;
}
| undefined4 num_fifos(void)
{
return nfds;
}
|
static void
initialize_signals (void)
{
signals = xmalloc ((sizeof *signals) * ((
(64 + 1)
- 1) + 1));
for (int i = 0 ; i <= (
(64 + 1)
- 1); i++)
signals[i] = UNCHANGED;
return;
}
| void initialize_signals() {
unsigned int v0;
unsigned long long v3;
*(&signals) = xmalloc(0x104);
for (v0 = 0; v0 <= 64; v0 += 1) {
v3 = signals + v0 * 4;
*((signals + v0 * 4)) = 0;
}
return;
}
|
static void
process_request_identities(SocketEntry *e)
{
Identity *id;
struct sshbuf *msg, *keys;
int r;
u_int nentries = 0;
sshlog("ssh-agent.c", __func__, 519, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "entering");
if ((msg = sshbuf_new()) ==
((void *)0)
|| (keys = sshbuf_new()) ==
((void *)0)
)
sshfatal("ssh-agent.c", __func__, 522, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
for((id) = ((&idtab->idlist)->tqh_first); (id) !=
((void *)0)
; (id) = ((id)->next.tqe_next)) {
if (identity_permitted(id, e,
((void *)0)
,
((void *)0)
,
((void *)0)
) != 0)
continue;
if ((r = sshkey_puts_opts(id->key, keys,
SSHKEY_SERIALIZE_INFO)) != 0 ||
(r = sshbuf_put_cstring(keys, id->comment)) != 0) {
sshlog("ssh-agent.c", __func__, 530, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "compose key/comment");
continue;
}
nentries++;
}
sshlog("ssh-agent.c", __func__, 535, 1, SYSLOG_LEVEL_DEBUG2,
((void *)0)
, "replying with %u allowed of %u available keys", nentries, idtab->nentries)
;
if ((r = sshbuf_put_u8(msg, 12)) != 0 ||
(r = sshbuf_put_u32(msg, nentries)) != 0 ||
(r = sshbuf_putb(msg, keys)) != 0)
sshfatal("ssh-agent.c", __func__, 540, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose");
if ((r = sshbuf_put_stringb(e->output, msg)) != 0)
sshfatal("ssh-agent.c", __func__, 542, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "enqueue");
sshbuf_free(msg);
sshbuf_free(keys);
}
| long process_request_identities(long a1)
{
long v1;
long v2;
long v3;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
_QWORD *i;
long v10;
long v11;
v8 = 0;
sshlog("ssh-agent.c", "process_request_identities", 519LL, 1LL, 6LL, 0LL, "entering");
v10 = sshbuf_new();
if ( !v10 || (v11 = sshbuf_new()) == 0 )
sshfatal("ssh-agent.c", "process_request_identities", 522LL, 1LL, 1LL, 0LL, "sshbuf_new failed");
for ( i = *(_QWORD **)(idtab + 8); i; i = (_QWORD *)*i )
{
if ( !(unsigned int)identity_permitted(i, (unsigned int *)a1, 0LL, 0LL, 0LL) )
{
v5 = sshkey_puts_opts(i[2], v11, 254LL);
if ( v5 || (v5 = sshbuf_put_cstring(v11, i[3])) != 0 )
{
v1 = ssh_err(v5);
sshlog("ssh-agent.c", "process_request_identities", 530LL, 1LL, 2LL, v1, "compose key/comment");
}
else
{
++v8;
}
}
}
sshlog(
"ssh-agent.c",
"process_request_identities",
535LL,
1LL,
6LL,
0LL,
"replying with %u allowed of %u available keys",
v8,
*(unsigned int *)idtab);
v6 = sshbuf_put_u8(v10, 12LL);
if ( v6 || (v6 = sshbuf_put_u32(v10, v8)) != 0 || (v6 = sshbuf_putb(v10, v11)) != 0 )
{
v2 = ssh_err(v6);
sshfatal("ssh-agent.c", "process_request_identities", 540LL, 1LL, 1LL, v2, "compose");
}
v7 = sshbuf_put_stringb(*(_QWORD *)(a1 + 16), v10);
if ( v7 )
{
v3 = ssh_err(v7);
sshfatal("ssh-agent.c", "process_request_identities", 542LL, 1LL, 1LL, v3, "enqueue");
}
sshbuf_free(v10);
return sshbuf_free(v11);
}
|
static
_Bool
elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
off_t current_pos)
{
size_t n_elide = n_elide_0;
uintmax_t desired_pos = current_pos;
_Bool
ok =
1
;
if (
(18446744073709551615UL)
< n_elide_0 +
8192
)
{
char umax_buf[((((((sizeof (n_elide_0) * 8) - (! ((__typeof__ (n_elide_0)) 0 < (__typeof__ (n_elide_0)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (n_elide_0)) 0 < (__typeof__ (n_elide_0)) -1))) + 1)];
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"%s: number of bytes is too large\"), umaxtostr (n_elide_0, umax_buf)), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
, 0, gettext ("%s: number of bytes is too large"), umaxtostr (n_elide_0, umax_buf)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
, 0, gettext ("%s: number of bytes is too large"), umaxtostr (n_elide_0, umax_buf)), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
if (n_elide <= 1024 * 1024)
{
_Bool
first =
1
;
_Bool
eof =
0
;
size_t n_to_read =
8192
+ n_elide;
_Bool
i;
char *b[2];
b[0] = xnmalloc (2, n_to_read);
b[1] = b[0] + n_to_read;
for (i =
0
; ! eof ; i = !i)
{
size_t n_read = full_read (fd, b[i], n_to_read);
size_t delta = 0;
if (n_read < n_to_read)
{
if (
(*__errno_location ())
!= 0)
{
error (0,
(*__errno_location ())
, gettext ("error reading %s"), quotearg_style (shell_escape_always_quoting_style, filename));
ok =
0
;
break;
}
if (n_read <= n_elide)
{
if (first)
{
}
else
{
delta = n_elide - n_read;
}
}
eof =
1
;
}
if (! first)
{
desired_pos += n_elide - delta;
xwrite_stdout (b[!i] +
8192
, n_elide - delta);
}
first =
0
;
if (n_elide < n_read)
{
desired_pos += n_read - n_elide;
xwrite_stdout (b[i], n_read - n_elide);
}
}
free (b[0]);
}
else
{
_Bool
eof =
0
;
size_t n_read;
_Bool
buffered_enough;
size_t i, i_next;
char **b =
((void *)0)
;
size_t rem =
8192
- (n_elide %
8192
);
size_t n_elide_round = n_elide + rem;
size_t n_bufs = n_elide_round /
8192
+ 1;
size_t n_alloc = 0;
size_t n_array_alloc = 0;
buffered_enough =
0
;
for (i = 0, i_next = 1; !eof; i = i_next, i_next = (i_next + 1) % n_bufs)
{
if (n_array_alloc == i)
{
if (n_array_alloc == 0)
n_array_alloc =
(((
n_bufs
)<(
16
))?(
n_bufs
):(
16
))
;
else if (n_array_alloc <= n_bufs / 2)
n_array_alloc *= 2;
else
n_array_alloc = n_bufs;
b = xnrealloc (b, n_array_alloc, sizeof *b);
}
if (! buffered_enough)
{
b[i] = xmalloc (
8192
);
n_alloc = i + 1;
}
n_read = full_read (fd, b[i],
8192
);
if (n_read <
8192
)
{
if (
(*__errno_location ())
!= 0)
{
error (0,
(*__errno_location ())
, gettext ("error reading %s"), quotearg_style (shell_escape_always_quoting_style, filename));
ok =
0
;
goto free_mem;
}
eof =
1
;
}
if (i + 1 == n_bufs)
buffered_enough =
1
;
if (buffered_enough)
{
desired_pos += n_read;
xwrite_stdout (b[i_next], n_read);
}
}
if (rem)
{
if (buffered_enough)
{
size_t n_bytes_left_in_b_i =
8192
- n_read;
desired_pos += rem;
if (rem < n_bytes_left_in_b_i)
{
xwrite_stdout (b[i] + n_read, rem);
}
else
{
xwrite_stdout (b[i] + n_read, n_bytes_left_in_b_i);
xwrite_stdout (b[i_next], rem - n_bytes_left_in_b_i);
}
}
else if (i + 1 == n_bufs)
{
size_t y =
8192
- rem;
size_t x = n_read - y;
desired_pos += x;
xwrite_stdout (b[i_next], x);
}
}
free_mem:
for (i = 0; i < n_alloc; i++)
free (b[i]);
free (b);
}
if (0 <= current_pos && elseek (fd, desired_pos,
0
, filename) < 0)
ok =
0
;
return ok;
}
| long elide_tail_bytes_pipe(long a1, int a2, unsigned long a3, __off_t a4)
{
long v4;
char *v5;
int *v6;
long v7;
long v8;
long v9;
char *v10;
int *v11;
unsigned char v14;
char v15;
char v16;
bool v17;
char v18;
char v19;
__off_t v20;
long v21;
size_t v22;
unsigned long v23;
unsigned long i;
unsigned long v25;
_QWORD *v26;
unsigned long v27;
unsigned long v28;
size_t v30;
unsigned long v31;
size_t v32;
unsigned long v33;
unsigned long v34;
void *ptr[8];
ptr[5] = (void *)__readfsqword(0x28u);
v20 = a4;
v14 = 1;
if ( a3 > 0x100000 )
{
v18 = 0;
v26 = 0LL;
v30 = 0x2000 - (a3 & 0x1FFF);
v31 = ((a3 + v30) >> 13) + 1;
v27 = 0LL;
v28 = 0LL;
v19 = 0;
v23 = 0LL;
v25 = 1LL;
while ( v18 != 1 )
{
if ( v28 == v23 )
{
if ( v28 )
{
if ( v28 > v31 >> 1 )
v28 = v31;
else
v28 *= 2LL;
v8 = xnrealloc(v26, v28, 8LL);
}
else
{
v7 = 16LL;
if ( v31 <= 0x10 )
v7 = v31;
v28 = v7;
v8 = xnrealloc(v26, v7, 8LL);
}
v26 = (_QWORD *)v8;
}
if ( v19 != 1 )
{
v26[v23] = xmalloc(0x2000LL);
v27 = v23 + 1;
}
v22 = full_read((unsigned int)a2, v26[v23], 0x2000LL);
if ( v22 <= 0x1FFF )
{
if ( *_errno_location() )
{
v9 = quotearg_style(4LL, a1);
v10 = gettext("error reading %s");
v11 = _errno_location();
error(0, *v11, v10, v9);
v14 = 0;
goto LABEL_47;
}
v18 = 1;
}
if ( v31 == v23 + 1 )
v19 = 1;
if ( v19 )
{
v20 += v22;
xwrite_stdout((const void *)v26[v25], v22);
}
v23 = v25;
v25 = (v25 + 1) % v31;
}
if ( v30 )
{
if ( v19 )
{
v32 = 0x2000 - v22;
v20 += v30;
if ( v30 >= 0x2000 - v22 )
{
xwrite_stdout((const void *)(v22 + v26[v23]), v32);
xwrite_stdout((const void *)v26[v25], v30 - v32);
}
else
{
xwrite_stdout((const void *)(v22 + v26[v23]), v30);
}
}
else if ( v31 == v23 + 1 )
{
v20 += v22 - (0x2000 - v30);
xwrite_stdout((const void *)v26[v25], v22 - (0x2000 - v30));
}
}
LABEL_47:
for ( i = 0LL; i < v27; ++i )
free((void *)v26[i]);
free(v26);
}
else
{
v15 = 1;
v16 = 0;
v33 = a3 + 0x2000;
ptr[0] = (void *)xnmalloc(2LL, a3 + 0x2000);
ptr[1] = (char *)ptr[0] + a3 + 0x2000;
v17 = 0;
while ( v16 != 1 )
{
v34 = full_read((unsigned int)a2, ptr[v17], v33);
v21 = 0LL;
if ( v34 < v33 )
{
if ( *_errno_location() )
{
v4 = quotearg_style(4LL, a1);
v5 = gettext("error reading %s");
v6 = _errno_location();
error(0, *v6, v5, v4);
v14 = 0;
break;
}
if ( v34 <= a3 && !v15 )
v21 = a3 - v34;
v16 = 1;
}
if ( v15 != 1 )
{
v20 += a3 - v21;
xwrite_stdout((char *)ptr[!v17] + 0x2000, a3 - v21);
}
v15 = 0;
if ( a3 < v34 )
{
v20 += v34 - a3;
xwrite_stdout(ptr[v17], v34 - a3);
}
v17 = !v17;
}
free(ptr[0]);
}
if ( a4 >= 0 && elseek(a2, v20, 0, a1) < 0 )
return 0;
return v14;
}
|
static void index__checkstring(const char *str)
{
int i;
for (i = 0; str[i]; i++) {
int ch = str[i];
if (ch >= 128)
log_printf(
2
, "Module index: bad character '%c'=0x%x - only 7-bit ASCII is supported:" "\n%s\n", (char) ch, (int) ch, str)
;
}
}
| long index__checkstring(long a1)
{
long result;
int i;
for ( i = 0; ; ++i )
{
result = *(unsigned char *)(i + a1);
if ( !(_BYTE)result )
break;
}
return result;
}
|
char *
match_list(const char *client, const char *server, u_int *next)
{
char *sproposals[40];
char *c, *s, *p, *ret, *cp, *sp;
int i, j, nproposals;
c = cp = xstrdup(client);
s = sp = xstrdup(server);
for ((p = strsep(&sp, ",")), i=0; p && *p != '\0';
(p = strsep(&sp, ",")), i++) {
if (i < 40)
sproposals[i] = p;
else
break;
}
nproposals = i;
for ((p = strsep(&cp, ",")), i=0; p && *p != '\0';
(p = strsep(&cp, ",")), i++) {
for (j = 0; j < nproposals; j++) {
if (strcmp(p, sproposals[j]) == 0) {
ret = xstrdup(p);
if (next !=
((void *)0)
)
*next = (cp ==
((void *)0)
) ?
strlen(c) : (u_int)(cp - c);
free(c);
free(s);
return ret;
}
}
}
if (next !=
((void *)0)
)
*next = strlen(c);
free(c);
free(s);
return
((void *)0)
;
}
| long long match_list(unsigned long long a0, unsigned long long a1, unsigned int *a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
void* v3;
void* v4;
char *v5;
void* v6;
void* v7;
unsigned long long v8;
char v9;
void* v12;
v3 = xstrdup(a0);
v6 = v3;
v4 = xstrdup(a1);
v7 = v4;
v5 = strsep(&v4, ",");
for (v0 = 0; v5 && *(v5) && v0 <= 39; v0 = __addvsi3(v0, 0x1)) {
*(&(&v9)[8 * v0]) = v5;
v5 = strsep(&v4, ",");
}
v2 = v0;
v5 = strsep(&v3, ",");
for (v0 = 0; v5 && *(v5); v0 = __addvsi3(v0, 0x1)) {
for (v1 = 0; v1 < v2; v1 = __addvsi3(v1, 0x1)) {
if (!strcmp(v5, *(&(&v9)[8 * v1]))) {
v8 = xstrdup(v5);
if (a2)
*(a2) = (!v3 ? __subvdi3(v3, v6) : strlen(v6));
free(v6);
free(v7);
v12 = v8;
return v12;
}
}
v5 = strsep(&v3, ",");
}
if (a2)
*(a2) = strlen(v6);
free(v6);
free(v7);
v12 = 0;
return v12;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.