input stringlengths 28 169k | output stringlengths 20 317k |
|---|---|
int
rl_read_key (void)
{
int c, r;
if (rl_pending_input)
{
c = rl_pending_input;
rl_clear_pending_input ();
}
else
{
if (c = _rl_next_macro_key ())
return ((unsigned char)c);
if (rl_event_hook)
{
while (rl_event_hook)
{
if (rl_get_char (&c) != 0)
break;
if ((r = rl_gather_tyi ()) < 0)
{
rl_done = 1;
(rl_readline_state |= (0x2000000));
return (
(*__errno_location ())
==
5
? ((rl_readline_state & (0x0000008)) ? (-2) :
(-1)
) : '\n');
}
else if (r > 0)
continue;
do { if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); } while (0);
if (rl_done)
return ('\n');
(*rl_event_hook) ();
}
}
else
{
if (rl_get_char (&c) == 0)
c = (*rl_getc_function) (rl_instream);
do { if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); } while (0);
}
}
return (c);
}
| int rl_read_key() {
unsigned int v0;
unsigned int v1;
unsigned int v3;
if (rl_pending_input) {
v0 = rl_pending_input;
rl_clear_pending_input();
} else {
v0 = _rl_next_macro_key();
if (v0) {
v3 = v0;
goto LABEL_401013;
} else if (!rl_event_hook) {
if (!rl_get_char(&v0))
v0 = rl_getc(rl_instream);
if (*(&_rl_caught_signal))
_rl_signal_handler(*(&_rl_caught_signal));
} else {
while (true) {
if (!rl_event_hook)
break;
if (rl_get_char(&v0))
break;
v1 = rl_gather_tyi();
if (v1 < 0) {
rl_done = 1;
rl_readline_state = rl_readline_state | 0x2000000;
if (*(__errno_location()) != 5) {
v3 = 10;
goto LABEL_401013;
} else if (!(rl_readline_state & 8)) {
v3 = -1;
goto LABEL_401013;
} else {
v3 = -2;
goto LABEL_401013;
}
} else {
if (!(v1 <= 0))
continue;
if (*(&_rl_caught_signal))
_rl_signal_handler(*(&_rl_caught_signal));
if (rl_done) {
v3 = 10;
goto LABEL_401013;
} else {
*(4199744)();
}
}
}
}
}
v3 = v0;
LABEL_401013:
return v3;
}
|
int Write_Runlevel_Log(int new_runlevel)
{
FILE *log_file;
int status;
log_file = fopen("/var/run/runlevel", "w");
if (! log_file)
return 0;
status = fprintf(log_file, "%c", new_runlevel);
fclose(log_file);
if (status < 1)
return 0;
return 1;
}
| _BOOL8 Write_Runlevel_Log(unsigned int a1)
{
int v2;
FILE *stream;
stream = fopen("/var/run/runlevel", "w");
if ( !stream )
return 0LL;
v2 = fprintf(stream, "%c", a1);
fclose(stream);
return v2 > 0;
}
|
int print_nsid(struct nlmsghdr *n, void *arg)
{
struct rtgenmsg *rthdr = ((void *)(((char *)n) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))));
struct rtattr *tb[(__NETNSA_MAX - 1)+1];
int len = n->nlmsg_len;
FILE *fp = (FILE *)arg;
struct nsid_cache *c;
char name[
255
];
int nsid, current;
if (n->nlmsg_type != RTM_NEWNSID && n->nlmsg_type != RTM_DELNSID)
return 0;
len -= ( ((((sizeof(*rthdr)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))))+4U -1) & ~(4U -1) );
if (len < 0) {
fprintf(
stderr
, "BUG: wrong nlmsg len %d in %s\n", len,
__func__);
return -1;
}
parse_rtattr(tb, (__NETNSA_MAX - 1), ((struct rtattr *)(((char *)(rthdr)) + ( ((sizeof(struct rtgenmsg))+4U -1) & ~(4U -1) ))), len);
if (tb[NETNSA_NSID] ==
((void *)0)
) {
fprintf(
stderr
, "BUG: NETNSA_NSID is missing %s\n", __func__);
return -1;
}
open_json_object(
((void *)0)
);
if (n->nlmsg_type == RTM_DELNSID)
print_bool(PRINT_ANY, "deleted", "Deleted ",
1
);
nsid = rta_getattr_s32(tb[NETNSA_NSID]);
if (nsid < 0)
print_string(PRINT_FP,
((void *)0)
, "nsid unassigned ",
((void *)0)
);
else
print_int(PRINT_ANY, "nsid", "nsid %d ", nsid);
if (tb[NETNSA_CURRENT_NSID]) {
current = rta_getattr_s32(tb[NETNSA_CURRENT_NSID]);
if (current < 0)
print_string(PRINT_FP,
((void *)0)
,
"current-nsid unassigned ",
((void *)0)
);
else
print_int(PRINT_ANY, "current-nsid",
"current-nsid %d ", current);
}
c = netns_map_get_by_nsid(tb[NETNSA_CURRENT_NSID] ? current : nsid);
if (c !=
((void *)0)
) {
print_string(PRINT_ANY, "name",
"(iproute2 netns name: %s)", c->name);
netns_map_del(c);
}
if (c ==
((void *)0)
&& n->nlmsg_type == RTM_NEWNSID)
if (netns_get_name(nsid, name) == 0) {
print_string(PRINT_ANY, "name",
"(iproute2 netns name: %s)", name);
netns_map_add(nsid, name);
}
print_string(PRINT_FP,
((void *)0)
, "\n",
((void *)0)
);
close_json_object();
fflush(fp);
return 0;
}
| int print_nsid(struct_0 *a0, void* a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long v3;
unsigned long long v4;
char v5;
char v6;
char v7;
char v8;
unsigned int v10;
v3 = &a0[2].field_4;
v1 = a0->field_0;
if (a0->field_4 != 88 && a0->field_4 != 89)
v10 = 0;
if (a0->field_4 == 88 || a0->field_4 == 89) {
v1 -= 20;
if (v1 < 0) {
fprintf(*(&stderr), "BUG: wrong nlmsg len %d in %s\n", v1, &__func__.9062);
v10 = -1;
} else {
parse_rtattr(&v5, 0x5, v3 + 4, v1);
if (!*(&v6)) {
fprintf(*(&stderr), "BUG: NETNSA_NSID is missing %s\n", &__func__.9062);
v10 = -1;
} else {
open_json_object(0x0);
if (a0->field_4 == 89)
print_bool(0x4, "deleted", "Deleted ", 0x1);
v2 = rta_getattr_s32(*(&v6));
if (v2 < 0)
print_string(0x1, 0x0, "nsid unassigned ", 0x0);
else
print_int(0x4, "nsid", "nsid %d ", v2);
if (*(&v7)) {
v0 = rta_getattr_s32(*(&v7));
if (v0 < 0)
print_string(0x1, 0x0, "current-nsid unassigned ", 0x0);
else
print_int(0x4, "current-nsid", "current-nsid %d ", v0);
}
if (*(&v7))
v10 = v0;
else
v10 = v2;
v4 = netns_map_get_by_nsid(v10);
if (v4) {
print_string(0x4, "name", "(iproute2 netns name: %s)", v4 + 36);
netns_map_del(v4);
}
if (!v4 && a0->field_4 == 88) {
v10 = netns_get_name(v2, &v8);
if (!v10) {
print_string(0x4, "name", "(iproute2 netns name: %s)", &v8);
netns_map_add(v2, &v8);
}
}
print_string(0x1, 0x0, "\n", 0x0);
close_json_object(0x1, 0x0, "\n", 0x0, a4, a5);
fflush(a1);
v10 = 0;
}
}
}
return v10;
}
|
void crypto_sign_ed25519_ref_sc25519_from32bytes(crypto_sign_ed25519_ref_sc25519 *r, const unsigned char x[32])
{
int i;
crypto_uint32 t[64];
for(i=0;i<32;i++) t[i] = x[i];
for(i=32;i<64;++i) t[i] = 0;
barrett_reduce(r, t);
}
| void crypto_sign_ed25519_ref_sc25519_from32bytes(undefined8 param_1,long param_2)
{
long in_FS_OFFSET;
int local_11c;
uint local_118 [66];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
for (local_11c = 0; local_11c < 0x20; local_11c = __addvsi3(local_11c,1)) {
local_118[local_11c] = (uint)*(byte *)(param_2 + local_11c);
}
for (local_11c = 0x20; local_11c < 0x40; local_11c = __addvsi3(local_11c,1)) {
local_118[local_11c] = 0;
}
barrett_reduce(param_1,local_118);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
|
stderr
, gettext ("%s: cannot open %s\n"), Prog,
grp_file);
if (use_system_grp_file) {
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
4
, "cannot open %s", grp_file) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
| (**(char **)ppcVar2[3] == '\0')) {
*(undefined8 *)ppcVar2[3] = 0;
}
|
static void pass1b(e2fsck_t ctx, char *block_buf)
{
ext2_filsys fs = ctx->fs;
ext2_ino_t ino = 0;
struct ext2_inode_large inode;
ext2_inode_scan scan;
struct process_block_struct pb;
struct problem_context pctx;
problem_t op;
clear_problem_context(&pctx);
if (!(ctx->options & 0x0002))
fix_problem(ctx, 0x011000, &pctx);
pctx.errcode = ext2fs_open_inode_scan(fs, ctx->inode_buffer_blocks,
&scan);
if (pctx.errcode) {
fix_problem(ctx, 0x011004, &pctx);
ctx->flags |= 0x0001;
return;
}
ctx->stashed_inode = EXT2_INODE(&inode);
pb.ctx = ctx;
pb.pctx = &pctx;
pctx.str = "pass1b";
while (1) {
if (ino % (fs->super->s_inodes_per_group * 4) == 1) {
if (e2fsck_mmp_update(fs))
fatal_error(ctx, 0);
}
pctx.errcode = ext2fs_get_next_inode_full(scan, &ino,
EXT2_INODE(&inode), sizeof(inode));
if (pctx.errcode == (2133571394L))
continue;
if (pctx.errcode) {
pctx.ino = ino;
fix_problem(ctx, 0x011004, &pctx);
ctx->flags |= 0x0001;
return;
}
if (!ino)
break;
pctx.ino = ctx->stashed_ino = ino;
if ((ino != 1) &&
!ext2fs_test_inode_bitmap2(ctx->inode_used_map, ino))
continue;
pb.ino = ino;
pb.dup_blocks = 0;
pb.inode = &inode;
pb.cur_cluster = ~0;
pb.phys_cluster = ~0;
pb.last_blk = 0;
pb.pctx->blk = pb.pctx->blk2 = 0;
if (ext2fs_inode_has_valid_blocks2(fs, EXT2_INODE(&inode)) ||
(ino == 1))
pctx.errcode = ext2fs_block_iterate3(fs, ino,
8, block_buf,
process_pass1b_block, &pb);
if (ext2fs_has_feature_xattr(fs->super) &&
ext2fs_file_acl_block(fs, EXT2_INODE(&inode))) {
blk64_t blk = ext2fs_file_acl_block(fs, EXT2_INODE(&inode));
process_pass1b_block(fs, &blk,
(-5), 0, 0, &pb);
ext2fs_file_acl_block_set(fs, EXT2_INODE(&inode), blk);
}
if (pb.dup_blocks) {
if (ino != 1) {
op = pctx.blk == pctx.blk2 ?
0x011002 : 0x011008;
fix_problem(ctx, op, pb.pctx);
}
end_problem_latch(ctx, 0x0060);
if (ino >= (((fs->super)->s_rev_level == 0) ? 11 : (fs->super)->s_first_ino) ||
ino == 2)
dup_inode_count++;
}
if (pctx.errcode)
fix_problem(ctx, 0x011006, &pctx);
}
ext2fs_close_inode_scan(scan);
e2fsck_use_inode_shortcuts(ctx, 0);
}
| void pass1b(struct_0 *a0, unsigned long long a1) {
unsigned int v0;
unsigned int v1;
char v2;
unsigned long long v3;
struct_1 *v4;
struct_0 *v5;
unsigned int v6;
unsigned int v7;
unsigned long long v8;
unsigned long long v9;
void* v10;
unsigned long v11;
unsigned long long v12[7];
unsigned long v13;
unsigned int v14;
char v15;
char v16;
unsigned long long v17;
char v18;
char v19;
unsigned long long v22;
unsigned long long v23;
unsigned long long v25;
unsigned long long v26;
unsigned int v27;
unsigned long long *v28;
unsigned long long v29;
v4 = a0->field_0;
v0 = 0;
clear_problem_context(&v13);
if (!(a0->field_4c & 2))
fix_problem(a0, 0x11000, &v13);
v13 = ext2fs_open_inode_scan(v4, a0->field_25c, &v2, a0->field_25c);
if (v13) {
fix_problem(a0, 0x11004, &v13);
a0->field_48 = a0->field_48 | 1;
} else {
a0->field_220 = EXT2_INODE(&v18);
v5 = a0;
v12[0] = &v13;
v17 = "pass1b";
while (true) {
while (true) {
if ((0 CONCAT v0) /m (v4->field_20->field_28 << 2) >> 32 == 1 && e2fsck_mmp_update(v4))
fatal_error(a0, 0x0);
v13 = ext2fs_get_next_inode_full(*(&v2), &v0, EXT2_INODE(&v18), 0xa0);
if (v13 != 2133571394)
break;
}
if (v13) {
v14 = v0;
fix_problem(a0, 0x11004, &v13);
a0->field_48 = a0->field_48 | 1;
break;
} else if (v0) {
a0->field_218 = v0;
v14 = a0->field_218;
if (v0 != 1) {
v22 = ext2fs_test_inode_bitmap2(a0->field_168, v0, v0);
continue;
}
v6 = v0;
v7 = 0;
v11 = &v18;
v8 = -1;
v9 = -1;
v10 = 0;
v12[6] = 0;
v12[5] = v12[6];
v23 = EXT2_INODE(&v18);
if (v0 == 1 || ext2fs_inode_has_valid_blocks2(v4, v23, v23))
v13 = ext2fs_block_iterate3(v4, v0, 0x8, a1, process_pass1b_block, &v5);
v27 = ext2fs_has_feature_xattr(v4->field_20);
if (v27) {
v25 = EXT2_INODE(&v18);
v27 = ext2fs_file_acl_block(v4, v25, v25);
if (v27) {
v26 = EXT2_INODE(&v18);
v3 = ext2fs_file_acl_block(v4, v26, v26);
process_pass1b_block(v4, &v3, 0xfffffffffffffffb, 0x0, 0x0, &v5);
v27 = EXT2_INODE(&v18);
ext2fs_file_acl_block_set(v4, v27, v3, v27);
}
}
if (v7) {
if (v0 != 1) {
if (*(&v15) == *(&v16))
v27 = 69634;
else
v27 = 69640;
v1 = v27;
fix_problem(a0, v1, v12);
}
end_problem_latch(a0, 0x60);
if (v4->field_20->field_4c)
v27 = v4->field_20->field_54;
else
v27 = 11;
if (v27 <= v0 || v0 == 2)
dup_inode_count = dup_inode_count + 1;
}
if (!v13)
continue;
fix_problem(a0, 0x11006, &v13);
} else {
ext2fs_close_inode_scan(*(&v2));
e2fsck_use_inode_shortcuts(a0, 0x0);
break;
}
}
}
v29 = *(&v19) ^ v28[5];
return;
}
|
static
_Bool
elide_tail_lines_seekable (char const *pretty_filename, int fd,
uintmax_t n_lines,
off_t start_pos, off_t size)
{
char buffer[
8192
];
size_t bytes_read;
off_t pos = size;
bytes_read = (pos - start_pos) %
8192
;
if (bytes_read == 0)
bytes_read =
8192
;
pos -= bytes_read;
if (elseek (fd, pos,
0
, pretty_filename) < 0)
return
0
;
bytes_read = safe_read (fd, buffer, bytes_read);
if (bytes_read == ((size_t) -1))
{
error (0,
(*__errno_location ())
, gettext ("error reading %s"), quotearg_style (shell_escape_always_quoting_style, pretty_filename));
return
0
;
}
const
_Bool
all_lines = !n_lines;
if (n_lines && bytes_read && buffer[bytes_read - 1] != line_end)
--n_lines;
while (
1
)
{
size_t n = bytes_read;
while (n)
{
if (all_lines)
n -= 1;
else
{
char const *nl;
nl = memrchr (buffer, line_end, n);
if (nl ==
((void *)0)
)
break;
n = nl - buffer;
}
if (n_lines-- == 0)
{
if (start_pos < pos)
{
enum Copy_fd_status err;
if (elseek (fd, start_pos,
0
, pretty_filename) < 0)
return
0
;
err = copy_fd (fd, pos - start_pos);
if (err != COPY_FD_OK)
{
diagnose_copy_fd_failure (err, pretty_filename);
return
0
;
}
}
xwrite_stdout (buffer, n + 1);
return 0 <= elseek (fd, pos + n + 1,
0
, pretty_filename);
}
}
if (pos == start_pos)
{
return
1
;
}
pos -=
8192
;
if (elseek (fd, pos,
0
, pretty_filename) < 0)
return
0
;
bytes_read = safe_read (fd, buffer,
8192
);
if (bytes_read == ((size_t) -1))
{
error (0,
(*__errno_location ())
, gettext ("error reading %s"), quotearg_style (shell_escape_always_quoting_style, pretty_filename));
return
0
;
}
if (bytes_read == 0)
return
1
;
}
}
| _BOOL8 elide_tail_lines_seekable(long a1, unsigned int a2, long a3, __off_t a4, long a5)
{
long v6;
char *v7;
int *v8;
long v10;
char *v11;
int *v12;
bool v15;
int v16;
long v17;
long v18;
__off_t v19;
size_t n;
_BYTE *v21;
char s[16];
unsigned long v23;
v23 = __readfsqword(0x28u);
v17 = (a5 - a4) % 0x2000;
if ( ((((unsigned long)((a5 - a4) >> 63) >> 51) + (unsigned short)a5 - (unsigned short)a4) & 0x1FFF) == (unsigned long)((a5 - a4) >> 63) >> 51 )
v17 = 0x2000LL;
v19 = a5 - v17;
if ( elseek(a2, a5 - v17, 0, a1) < 0 )
return 0LL;
v18 = safe_read(a2, s, v17);
if ( v18 == -1 )
{
v6 = quotearg_style(4LL, a1);
v7 = gettext("error reading %s");
v8 = _errno_location();
error(0, *v8, v7, v6);
return 0LL;
}
else
{
v15 = a3 == 0;
if ( a3 && v18 && s[v18 - 1] != line_end )
--a3;
LABEL_11:
n = v18;
do
{
if ( !n )
{
LABEL_24:
if ( v19 == a4 )
return 1LL;
v19 -= 0x2000LL;
if ( elseek(a2, v19, 0, a1) < 0 )
return 0LL;
v18 = safe_read(a2, s, 0x2000LL);
if ( v18 == -1 )
{
v10 = quotearg_style(4LL, a1);
v11 = gettext("error reading %s");
v12 = _errno_location();
error(0, *v12, v11, v10);
return 0LL;
}
if ( !v18 )
return 1LL;
goto LABEL_11;
}
if ( v15 )
{
--n;
}
else
{
v21 = memrchr(s, line_end, n);
if ( !v21 )
goto LABEL_24;
n = v21 - s;
}
}
while ( a3-- );
if ( a4 >= v19 )
goto LABEL_22;
if ( elseek(a2, a4, 0, a1) < 0 )
return 0LL;
v16 = copy_fd(a2, v19 - a4);
if ( v16 )
{
diagnose_copy_fd_failure(v16, a1);
return 0LL;
}
else
{
LABEL_22:
xwrite_stdout(s, n + 1);
return elseek(a2, v19 + n + 1, 0, a1) >= 0;
}
}
}
|
static int
xstrcoll (char const *a, char const *b)
{
int diff;
(*__errno_location ())
= 0;
diff = strcoll (a, b);
if (
(*__errno_location ())
)
{
error (0,
(*__errno_location ())
, gettext ("cannot compare file names %s and %s"),
quote_n (0, a), quote_n (1, b));
set_exit_status (
0
);
longjmp (failed_strcoll, 1);
}
return diff;
}
| int xstrcoll(char *param_1,char *param_2)
{
int iVar1;
int *piVar2;
undefined8 uVar3;
undefined8 uVar4;
undefined8 uVar5;
piVar2 = __errno_location();
*piVar2 = 0;
iVar1 = strcoll(param_1,param_2);
piVar2 = __errno_location();
if (*piVar2 != 0) {
uVar3 = quote_n(1,param_2);
uVar4 = quote_n(0,param_1);
uVar5 = gettext("cannot compare file names %s and %s");
piVar2 = __errno_location();
error(0,*piVar2,uVar5,uVar4,uVar3);
set_exit_status(0);
longjmp((__jmp_buf_tag *)failed_strcoll,1);
}
return iVar1;
}
|
static errcode_t rewrite_extent_replay(e2fsck_t ctx, struct extent_list *list,
struct ext2_inode_large *inode)
{
errcode_t retval;
ext2_extent_handle_t handle;
unsigned int i, ext_written;
struct ext2fs_extent *ex, extent;
blk64_t start_val, delta;
inode->i_flags &= ~0x00080000;
memset(inode->i_block, 0, sizeof(inode->i_block));
quota_data_sub(ctx->qctx, inode, list->ino,
list->blocks_freed * ctx->fs->blocksize);
retval = ext2fs_iblk_sub_blocks(ctx->fs, EXT2_INODE(inode),
list->blocks_freed);
if (retval)
return retval;
retval = ext2fs_extent_open2(ctx->fs, list->ino, EXT2_INODE(inode),
&handle);
if (retval)
return retval;
ext_written = 0;
start_val = ext2fs_get_stat_i_blocks(ctx->fs, EXT2_INODE(inode));
for (i = 0, ex = list->extents; i < list->count; i++, ex++) {
if (ex->e_len == 0)
continue;
memcpy(&extent, ex, sizeof(struct ext2fs_extent));
extent.e_flags &= 0x0002;
if (extent.e_flags & 0x0002) {
if (extent.e_len > ((1UL << 15) - 1)) {
extent.e_len = ((1UL << 15) - 1);
ex->e_pblk += ((1UL << 15) - 1);
ex->e_lblk += ((1UL << 15) - 1);
ex->e_len -= ((1UL << 15) - 1);
ex--;
i--;
}
} else {
if (extent.e_len > (1UL << 15)) {
extent.e_len = (1UL << 15);
ex->e_pblk += (1UL << 15);
ex->e_lblk += (1UL << 15);
ex->e_len -= (1UL << 15);
ex--;
i--;
}
}
retval = ext2fs_extent_insert(handle, 0x0001,
&extent);
if (retval)
goto err;
retval = ext2fs_extent_fix_parents(handle);
if (retval)
goto err;
ext_written++;
}
delta = ext2fs_get_stat_i_blocks(ctx->fs, EXT2_INODE(inode)) -
start_val;
if (delta)
quota_data_add(ctx->qctx, inode, list->ino, delta << 9);
e2fsck_write_inode(ctx, list->ino, EXT2_INODE(inode),
"rebuild_extents");
err:
ext2fs_extent_free(handle);
return retval;
}
| long rewrite_extent_replay(_QWORD *a1, long *a2, long a3)
{
long v3;
long v4;
long v6;
long v7;
long v8;
long v9;
long v10;
unsigned int v12;
int v13;
long v14;
long fixed;
void *src;
long stat_i_blocks;
long v18;
int dest[6];
unsigned long v20;
v20 = __readfsqword(0x28u);
*(_DWORD *)(a3 + 32) &= ~0x80000u;
memset((void *)(a3 + 40), 0, 0x3CuLL);
quota_data_sub(a1[79], a3, *((unsigned int *)a2 + 10), *a2 * *(unsigned int *)(*a1 + 40LL));
v3 = *a2;
v4 = EXT2_INODE(a3);
fixed = ext2fs_iblk_sub_blocks(*a1, v4, v3);
if ( fixed )
return fixed;
v6 = EXT2_INODE(a3);
fixed = ext2fs_extent_open2(*a1, *((unsigned int *)a2 + 10), v6, &v14);
if ( fixed )
return fixed;
v13 = 0;
v7 = EXT2_INODE(a3);
stat_i_blocks = ext2fs_get_stat_i_blocks(*a1, v7);
v12 = 0;
src = (void *)a2[1];
while ( v12 < *((_DWORD *)a2 + 4) )
{
if ( *((_DWORD *)src + 4) )
{
memcpy(dest, src, sizeof(dest));
dest[5] = dest[5] & 2;
if ( (dest[5] & 2) != 0 )
{
if ( dest[4] > 0x7FFFu )
{
dest[4] = 0x7FFF;
*(_QWORD *)src += 0x7FFFLL;
*((_QWORD *)src + 1) += 0x7FFFLL;
*((_DWORD *)src + 4) -= 0x7FFF;
src = (char *)src - 24;
--v12;
}
}
else if ( dest[4] > 0x8000u )
{
dest[4] = 0x8000;
*(_QWORD *)src += 0x8000LL;
*((_QWORD *)src + 1) += 0x8000LL;
*((_DWORD *)src + 4) -= 0x8000;
src = (char *)src - 24;
--v12;
}
fixed = ext2fs_extent_insert(v14, 1LL, dest);
if ( fixed )
goto LABEL_20;
fixed = ext2fs_extent_fix_parents(v14);
if ( fixed )
goto LABEL_20;
++v13;
}
++v12;
src = (char *)src + 24;
}
v8 = EXT2_INODE(a3);
v9 = ext2fs_get_stat_i_blocks(*a1, v8);
v18 = v9 - stat_i_blocks;
if ( v9 != stat_i_blocks )
quota_data_add(a1[79], a3, *((unsigned int *)a2 + 10), v18 << 9);
v10 = EXT2_INODE(a3);
e2fsck_write_inode(a1, *((unsigned int *)a2 + 10), v10, "rebuild_extents");
LABEL_20:
ext2fs_extent_free(v14);
return fixed;
}
|
void
sv_path (name)
char *name;
{
phash_flush ();
}
| long long sv_path(unsigned long a0) {
unsigned long v0;
v0 = a0;
return phash_flush();
}
|
int
kexgex_client(struct ssh *ssh)
{
struct kex *kex = ssh->kex;
int r;
u_int nbits;
nbits = dh_estimate(kex->dh_need * 8);
kex->min = 2048;
kex->max = 8192;
kex->nbits = nbits;
if (ssh->compat & 0x40000000)
kex->nbits = (((kex->nbits) < (4096)) ? (kex->nbits) : (4096));
if ((r = sshpkt_start(ssh, 34)) != 0 ||
(r = sshpkt_put_u32(ssh, kex->min)) != 0 ||
(r = sshpkt_put_u32(ssh, kex->nbits)) != 0 ||
(r = sshpkt_put_u32(ssh, kex->max)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
goto out;
sshlog("kexgexc.c", __func__, 80, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "SSH2_MSG_KEX_DH_GEX_REQUEST(%u<%u<%u) sent", kex->min, kex->nbits, kex->max)
;
sshlog("kexgexc.c", __func__, 86, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "expecting SSH2_MSG_KEX_DH_GEX_GROUP");
ssh_dispatch_set(ssh, 31,
&input_kex_dh_gex_group);
r = 0;
out:
return r;
}
| long long kexgex_client(struct_0 *a0) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned int v3[75];
unsigned int v5;
*(&v3[0]) = a0->field_8;
v2 = dh_estimate(v3[5] * 8);
v3[72] = 0x800;
v3[73] = 0x2000;
v3[74] = v2;
if ((a0->field_83c & 0x40000000)) {
if (v3[74] > 0x1000)
v5 = 0x1000;
else
v5 = v3[74];
v3[74] = v5;
}
v1 = sshpkt_start(a0, 0x22);
if (!v1) {
v1 = sshpkt_put_u32(a0, v3[72], v3[72]);
if (!v1) {
v1 = sshpkt_put_u32(a0, v3[74], v3[74]);
if (!v1) {
v1 = sshpkt_put_u32(a0, v3[73], v3[73]);
if (!v1) {
v1 = sshpkt_send(a0);
if (!v1) {
sshlog("kexgexc.c", "kexgex_client", 0x50, 0x0, 0x5, 0x0, "SSH2_MSG_KEX_DH_GEX_REQUEST(%u<%u<%u) sent", v3[72], v3[74]);
sshlog("kexgexc.c", "kexgex_client", 0x56, 0x0, 0x5, 0x0, "expecting SSH2_MSG_KEX_DH_GEX_GROUP", v3[73], *(&v0));
ssh_dispatch_set(a0, 0x1f, input_kex_dh_gex_group);
v1 = 0;
}
}
}
}
}
return v1;
}
|
int
main(int argc, char **argv)
{
char comment[1024], *passphrase =
((void *)0)
;
char *rr_hostname =
((void *)0)
, *ep, *fp, *ra;
struct sshkey *private, *public;
struct passwd *pw;
int r, opt, type;
int change_passphrase = 0, change_comment = 0, show_cert = 0;
int find_host = 0, delete_host = 0, hash_hosts = 0;
int gen_all_hostkeys = 0, gen_krl = 0, update_krl = 0, check_krl = 0;
int prefer_agent = 0, convert_to = 0, convert_from = 0;
int print_public = 0, print_generic = 0, cert_serial_autoinc = 0;
int do_gen_candidates = 0, do_screen_candidates = 0, download_sk = 0;
unsigned long long cert_serial = 0;
char *identity_comment =
((void *)0)
, *ca_key_path =
((void *)0)
, **opts =
((void *)0)
;
char *sk_application =
((void *)0)
, *sk_device =
((void *)0)
, *sk_user =
((void *)0)
;
char *sk_attestation_path =
((void *)0)
;
struct sshbuf *challenge =
((void *)0)
, *attest =
((void *)0)
;
size_t i, nopts = 0;
u_int32_t bits = 0;
uint8_t sk_flags = 0x01;
const char *errstr;
int log_level = SYSLOG_LEVEL_INFO;
char *sign_op =
((void *)0)
;
sanitise_stdfd();
__progname = ssh_get_progname(argv[0]);
seed_rng();
log_init(argv[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1);
msetlocale();
pw = getpwuid(getuid());
if (!pw)
sshfatal("ssh-keygen.c", __func__, 3350, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "No user exists for uid %lu", (u_long)getuid());
pw = pwcopy(pw);
if (gethostname(hostname, sizeof(hostname)) == -1)
sshfatal("ssh-keygen.c", __func__, 3353, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "gethostname: %s", strerror(
(*__errno_location ())
));
sk_provider = getenv("SSH_SK_PROVIDER");
while ((opt = BSDgetopt(argc, argv, "ABHKLQUXceghiklopquvy" "C:D:E:F:I:M:N:O:P:R:V:Y:Z:" "a:b:f:g:m:n:r:s:t:w:z:")
) != -1) {
switch (opt) {
case 'A':
gen_all_hostkeys = 1;
break;
case 'b':
bits = (u_int32_t)strtonum(BSDoptarg, 1,
(4294967295U)
,
&errstr);
if (errstr)
sshfatal("ssh-keygen.c", __func__, 3369, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Bits has bad value %s (%s)", BSDoptarg, errstr)
;
break;
case 'E':
fingerprint_hash = ssh_digest_alg_by_name(BSDoptarg);
if (fingerprint_hash == -1)
sshfatal("ssh-keygen.c", __func__, 3375, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Invalid hash algorithm \"%s\"", BSDoptarg);
break;
case 'F':
find_host = 1;
rr_hostname = BSDoptarg;
break;
case 'H':
hash_hosts = 1;
break;
case 'I':
cert_key_id = BSDoptarg;
break;
case 'R':
delete_host = 1;
rr_hostname = BSDoptarg;
break;
case 'L':
show_cert = 1;
break;
case 'l':
print_fingerprint = 1;
break;
case 'B':
print_bubblebabble = 1;
break;
case 'm':
if (strcasecmp(BSDoptarg, "RFC4716") == 0 ||
strcasecmp(BSDoptarg, "ssh2") == 0) {
convert_format = FMT_RFC4716;
break;
}
if (strcasecmp(BSDoptarg, "PKCS8") == 0) {
convert_format = FMT_PKCS8;
private_key_format = SSHKEY_PRIVATE_PKCS8;
break;
}
if (strcasecmp(BSDoptarg, "PEM") == 0) {
convert_format = FMT_PEM;
private_key_format = SSHKEY_PRIVATE_PEM;
break;
}
sshfatal("ssh-keygen.c", __func__, 3416, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Unsupported conversion format \"%s\"", BSDoptarg);
case 'n':
cert_principals = BSDoptarg;
break;
case 'o':
break;
case 'p':
change_passphrase = 1;
break;
case 'c':
change_comment = 1;
break;
case 'f':
if (strlcpy(identity_file, BSDoptarg,
sizeof(identity_file)) >= sizeof(identity_file))
sshfatal("ssh-keygen.c", __func__, 3432, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Identity filename too long");
have_identity = 1;
break;
case 'g':
print_generic = 1;
break;
case 'K':
download_sk = 1;
break;
case 'P':
identity_passphrase = BSDoptarg;
break;
case 'N':
identity_new_passphrase = BSDoptarg;
break;
case 'Q':
check_krl = 1;
break;
case 'O':
opts = xrecallocarray(opts, nopts, nopts + 1,
sizeof(*opts));
opts[nopts++] = xstrdup(BSDoptarg);
break;
case 'Z':
openssh_format_cipher = BSDoptarg;
if (cipher_by_name(openssh_format_cipher) ==
((void *)0)
)
sshfatal("ssh-keygen.c", __func__, 3458, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Invalid OpenSSH-format cipher '%s'", openssh_format_cipher)
;
break;
case 'C':
identity_comment = BSDoptarg;
break;
case 'q':
quiet = 1;
break;
case 'e':
convert_to = 1;
break;
case 'h':
cert_key_type = 2;
certflags_flags = 0;
break;
case 'k':
gen_krl = 1;
break;
case 'i':
case 'X':
convert_from = 1;
break;
case 'y':
print_public = 1;
break;
case 's':
ca_key_path = BSDoptarg;
break;
case 't':
key_type_name = BSDoptarg;
break;
case 'D':
pkcs11provider = BSDoptarg;
break;
case 'U':
prefer_agent = 1;
break;
case 'u':
update_krl = 1;
break;
case 'v':
if (log_level == SYSLOG_LEVEL_INFO)
log_level = SYSLOG_LEVEL_DEBUG1;
else {
if (log_level >= SYSLOG_LEVEL_DEBUG1 &&
log_level < SYSLOG_LEVEL_DEBUG3)
log_level++;
}
break;
case 'r':
rr_hostname = BSDoptarg;
break;
case 'a':
rounds = (int)strtonum(BSDoptarg, 1, 0x7fffffff, &errstr);
if (errstr)
sshfatal("ssh-keygen.c", __func__, 3516, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Invalid number: %s (%s)", BSDoptarg, errstr)
;
break;
case 'V':
parse_cert_times(BSDoptarg);
break;
case 'Y':
sign_op = BSDoptarg;
break;
case 'w':
sk_provider = BSDoptarg;
break;
case 'z':
(*__errno_location ())
= 0;
if (*BSDoptarg == '+') {
cert_serial_autoinc = 1;
BSDoptarg++;
}
cert_serial = strtoull(BSDoptarg, &ep, 10);
if (*BSDoptarg < '0' || *BSDoptarg > '9' || *ep != '\0' ||
(
(*__errno_location ())
==
34
&& cert_serial ==
(0x7fffffffffffffffLL * 2ULL + 1ULL)
))
sshfatal("ssh-keygen.c", __func__, 3537, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Invalid serial number \"%s\"", BSDoptarg);
break;
case 'M':
if (strcmp(BSDoptarg, "generate") == 0)
do_gen_candidates = 1;
else if (strcmp(BSDoptarg, "screen") == 0)
do_screen_candidates = 1;
else
sshfatal("ssh-keygen.c", __func__, 3545, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Unsupported moduli option %s", BSDoptarg);
break;
case '?':
default:
usage();
}
}
log_init(argv[0], log_level, SYSLOG_FACILITY_USER, 1);
argv += BSDoptind;
argc -= BSDoptind;
if (sign_op !=
((void *)0)
) {
if (strncmp(sign_op, "find-principals", 15) == 0) {
if (ca_key_path ==
((void *)0)
) {
sshlog("ssh-keygen.c", __func__, 3567, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for find-principals:" "missing signature file")
;
exit(1);
}
if (!have_identity) {
sshlog("ssh-keygen.c", __func__, 3572, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for find-principals:" "missing allowed keys file")
;
exit(1);
}
return sig_find_principals(ca_key_path, identity_file,
opts, nopts);
} else if (strncmp(sign_op, "match-principals", 16) == 0) {
if (!have_identity) {
sshlog("ssh-keygen.c", __func__, 3580, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for match-principals:" "missing allowed keys file")
;
exit(1);
}
if (cert_key_id ==
((void *)0)
) {
sshlog("ssh-keygen.c", __func__, 3585, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for match-principals: " "missing principal ID")
;
exit(1);
}
return sig_match_principals(identity_file, cert_key_id,
opts, nopts);
} else if (strncmp(sign_op, "sign", 4) == 0) {
if (cert_principals ==
((void *)0)
||
*cert_principals == '\0') {
sshlog("ssh-keygen.c", __func__, 3595, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for sign: " "missing namespace")
;
exit(1);
}
if (!have_identity) {
sshlog("ssh-keygen.c", __func__, 3600, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for sign: " "missing key")
;
exit(1);
}
return sig_sign(identity_file, cert_principals,
prefer_agent, argc, argv, opts, nopts);
} else if (strncmp(sign_op, "check-novalidate", 16) == 0) {
if (cert_principals ==
((void *)0)
||
*cert_principals == '\0') {
sshlog("ssh-keygen.c", __func__, 3610, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for check-novalidate: " "missing namespace")
;
exit(1);
}
if (ca_key_path ==
((void *)0)
) {
sshlog("ssh-keygen.c", __func__, 3615, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for check-novalidate: " "missing signature file")
;
exit(1);
}
return sig_verify(ca_key_path, cert_principals,
((void *)0)
,
((void *)0)
,
((void *)0)
, opts, nopts);
} else if (strncmp(sign_op, "verify", 6) == 0) {
if (cert_principals ==
((void *)0)
||
*cert_principals == '\0') {
sshlog("ssh-keygen.c", __func__, 3625, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for verify: " "missing namespace")
;
exit(1);
}
if (ca_key_path ==
((void *)0)
) {
sshlog("ssh-keygen.c", __func__, 3630, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for verify: " "missing signature file")
;
exit(1);
}
if (!have_identity) {
sshlog("ssh-keygen.c", __func__, 3635, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for sign: " "missing allowed keys file")
;
exit(1);
}
if (cert_key_id ==
((void *)0)
) {
sshlog("ssh-keygen.c", __func__, 3640, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments for verify: " "missing principal identity")
;
exit(1);
}
return sig_verify(ca_key_path, cert_principals,
cert_key_id, identity_file, rr_hostname,
opts, nopts);
}
sshlog("ssh-keygen.c", __func__, 3648, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Unsupported operation for -Y: \"%s\"", sign_op);
usage();
}
if (ca_key_path !=
((void *)0)
) {
if (argc < 1 && !gen_krl) {
sshlog("ssh-keygen.c", __func__, 3655, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too few arguments.");
usage();
}
} else if (argc > 0 && !gen_krl && !check_krl &&
!do_gen_candidates && !do_screen_candidates) {
sshlog("ssh-keygen.c", __func__, 3660, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Too many arguments.");
usage();
}
if (change_passphrase && change_comment) {
sshlog("ssh-keygen.c", __func__, 3664, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Can only have one of -p and -c.");
usage();
}
if (print_fingerprint && (delete_host || hash_hosts)) {
sshlog("ssh-keygen.c", __func__, 3668, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Cannot use -l with -H or -R.");
usage();
}
if (gen_krl) {
do_gen_krl(pw, update_krl, ca_key_path,
cert_serial, identity_comment, argc, argv);
return (0);
}
if (check_krl) {
do_check_krl(pw, print_fingerprint, argc, argv);
return (0);
}
if (ca_key_path !=
((void *)0)
) {
if (cert_key_id ==
((void *)0)
)
sshfatal("ssh-keygen.c", __func__, 3682, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Must specify key id (-I) when certifying");
for (i = 0; i < nopts; i++)
add_cert_option(opts[i]);
do_ca_sign(pw, ca_key_path, prefer_agent,
cert_serial, cert_serial_autoinc, argc, argv);
}
if (show_cert)
do_show_cert(pw);
if (delete_host || hash_hosts || find_host) {
do_known_hosts(pw, rr_hostname, find_host,
delete_host, hash_hosts);
}
if (pkcs11provider !=
((void *)0)
)
do_download(pw);
if (download_sk) {
for (i = 0; i < nopts; i++) {
if (strncasecmp(opts[i], "device=", 7) == 0) {
sk_device = xstrdup(opts[i] + 7);
} else {
sshfatal("ssh-keygen.c", __func__, 3701, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Option \"%s\" is unsupported for " "FIDO authenticator download", opts[i])
;
}
}
return do_download_sk(sk_provider, sk_device);
}
if (print_fingerprint || print_bubblebabble)
do_fingerprint(pw);
if (change_passphrase)
do_change_passphrase(pw);
if (change_comment)
do_change_comment(pw, identity_comment);
if (convert_to)
do_convert_to(pw);
if (convert_from)
do_convert_from(pw);
if (print_public)
do_print_public(pw);
if (rr_hostname !=
((void *)0)
) {
unsigned int n = 0;
if (have_identity) {
n = do_print_resource_record(pw, identity_file,
rr_hostname, print_generic);
if (n == 0)
sshfatal("ssh-keygen.c", __func__, 3731, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "%s: %s", identity_file, strerror(
(*__errno_location ())
));
exit(0);
} else {
n += do_print_resource_record(pw,
"/usr/local/etc" "/ssh_host_rsa_key", rr_hostname,
print_generic);
n += do_print_resource_record(pw,
"/usr/local/etc" "/ssh_host_dsa_key", rr_hostname,
print_generic);
n += do_print_resource_record(pw,
"/usr/local/etc" "/ssh_host_ecdsa_key", rr_hostname,
print_generic);
n += do_print_resource_record(pw,
"/usr/local/etc" "/ssh_host_ed25519_key", rr_hostname,
print_generic);
n += do_print_resource_record(pw,
"/usr/local/etc" "/ssh_host_xmss_key", rr_hostname,
print_generic);
if (n == 0)
sshfatal("ssh-keygen.c", __func__, 3751, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "no keys found.");
exit(0);
}
}
if (do_gen_candidates || do_screen_candidates) {
if (argc <= 0)
sshfatal("ssh-keygen.c", __func__, 3758, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "No output file specified");
else if (argc > 1)
sshfatal("ssh-keygen.c", __func__, 3760, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Too many output files specified");
}
if (do_gen_candidates) {
do_moduli_gen(argv[0], opts, nopts);
return 0;
}
if (do_screen_candidates) {
do_moduli_screen(argv[0], opts, nopts);
return 0;
}
if (gen_all_hostkeys) {
do_gen_all_hostkeys(pw);
return (0);
}
if (key_type_name ==
((void *)0)
)
key_type_name = "rsa";
type = sshkey_type_from_name(key_type_name);
type_bits_valid(type, key_type_name, &bits);
if (!quiet)
printf("Generating public/private %s key pair.\n",
key_type_name);
switch (type) {
case KEY_ECDSA_SK:
case KEY_ED25519_SK:
for (i = 0; i < nopts; i++) {
if (strcasecmp(opts[i], "no-touch-required") == 0) {
sk_flags &= ~0x01;
} else if (strcasecmp(opts[i], "verify-required") == 0) {
sk_flags |= 0x04;
} else if (strcasecmp(opts[i], "resident") == 0) {
sk_flags |= 0x20;
} else if (strncasecmp(opts[i], "device=", 7) == 0) {
sk_device = xstrdup(opts[i] + 7);
} else if (strncasecmp(opts[i], "user=", 5) == 0) {
sk_user = xstrdup(opts[i] + 5);
} else if (strncasecmp(opts[i], "challenge=", 10) == 0) {
if ((r = sshbuf_load_file(opts[i] + 10,
&challenge)) != 0) {
sshfatal("ssh-keygen.c", __func__, 3802, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Unable to load FIDO " "enrollment challenge \"%s\"", opts[i] + 10)
;
}
} else if (strncasecmp(opts[i],
"write-attestation=", 18) == 0) {
sk_attestation_path = opts[i] + 18;
} else if (strncasecmp(opts[i],
"application=", 12) == 0) {
sk_application = xstrdup(opts[i] + 12);
if (strncmp(sk_application, "ssh:", 4) != 0) {
sshfatal("ssh-keygen.c", __func__, 3813, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "FIDO application string must " "begin with \"ssh:\"")
;
}
} else {
sshfatal("ssh-keygen.c", __func__, 3817, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Option \"%s\" is unsupported for " "FIDO authenticator enrollment", opts[i])
;
}
}
if ((attest = sshbuf_new()) ==
((void *)0)
)
sshfatal("ssh-keygen.c", __func__, 3822, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshbuf_new failed");
r = 0;
for (i = 0 ;;) {
if (!quiet) {
printf("You may need to touch your "
"authenticator%s to authorize key "
"generation.\n",
r == 0 ? "" : " again");
}
fflush(
stdout
);
r = sshsk_enroll(type, sk_provider, sk_device,
sk_application ==
((void *)0)
? "ssh:" : sk_application,
sk_user, sk_flags, passphrase, challenge,
&private, attest);
if (r == 0)
break;
if (r == -44 &&
(sk_flags & 0x20) != 0 &&
(sk_flags & 0x10) == 0 &&
confirm_sk_overwrite(sk_application, sk_user)) {
sk_flags |= 0x10;
continue;
}
if (r != -43)
sshfatal("ssh-keygen.c", __func__, 3846, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Key enrollment failed");
else if (passphrase !=
((void *)0)
) {
sshlog("ssh-keygen.c", __func__, 3848, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "PIN incorrect");
freezero(passphrase, strlen(passphrase));
passphrase =
((void *)0)
;
}
if (++i >= 3)
sshfatal("ssh-keygen.c", __func__, 3853, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "Too many incorrect PINs");
passphrase = read_passphrase("Enter PIN for "
"authenticator: ", 0x0002);
}
if (passphrase !=
((void *)0)
) {
freezero(passphrase, strlen(passphrase));
passphrase =
((void *)0)
;
}
break;
default:
if ((r = sshkey_generate(type, bits, &private)) != 0)
sshfatal("ssh-keygen.c", __func__, 3864, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshkey_generate failed");
break;
}
if ((r = sshkey_from_private(private, &public)) != 0)
sshfatal("ssh-keygen.c", __func__, 3868, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshkey_from_private");
if (!have_identity)
ask_filename(pw, "Enter file in which to save the key");
hostfile_create_user_ssh_dir(identity_file, !quiet);
if (!confirm_overwrite(identity_file))
exit(1);
passphrase = private_key_passphrase();
if (identity_comment) {
strlcpy(comment, identity_comment, sizeof(comment));
} else {
snprintf(comment, sizeof comment, "%s@%s", pw->pw_name, hostname);
}
if ((r = sshkey_save_private(private, identity_file, passphrase,
comment, private_key_format, openssh_format_cipher, rounds)) != 0) {
sshlog("ssh-keygen.c", __func__, 3892, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Saving key \"%s\" failed", identity_file);
freezero(passphrase, strlen(passphrase));
exit(1);
}
freezero(passphrase, strlen(passphrase));
sshkey_free(private);
if (!quiet) {
printf("Your identification has been saved in %s\n",
identity_file);
}
strlcat(identity_file, ".pub", sizeof(identity_file));
if ((r = sshkey_save_public(public, identity_file, comment)) != 0)
sshfatal("ssh-keygen.c", __func__, 3906, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Unable to save public key to %s", identity_file);
if (!quiet) {
fp = sshkey_fingerprint(public, fingerprint_hash,
SSH_FP_DEFAULT);
ra = sshkey_fingerprint(public, fingerprint_hash,
SSH_FP_RANDOMART);
if (fp ==
((void *)0)
|| ra ==
((void *)0)
)
sshfatal("ssh-keygen.c", __func__, 3914, 0, SYSLOG_LEVEL_FATAL,
((void *)0)
, "sshkey_fingerprint failed");
printf("Your public key has been saved in %s\n",
identity_file);
printf("The key fingerprint is:\n");
printf("%s %s\n", fp, comment);
printf("The key's randomart image is:\n");
printf("%s\n", ra);
free(ra);
free(fp);
}
if (sk_attestation_path !=
((void *)0)
)
save_attestation(attest, sk_attestation_path);
sshbuf_free(attest);
sshkey_free(public);
exit(0);
}
| undefined8 main(undefined4 param_1,undefined8 *param_2)
{
undefined8 *puVar1;
int iVar2;
int iVar3;
undefined4 uVar4;
ulonglong uVar5;
long lVar6;
void *pvVar7;
__uid_t _Var8;
int iVar9;
undefined4 uVar10;
int *piVar11;
char *pcVar12;
ulong uVar13;
long lVar14;
undefined8 uVar15;
size_t sVar16;
undefined8 **ppuVar17;
undefined *puVar18;
undefined *puVar19;
long in_FS_OFFSET;
char *apcStack1408 [4];
ulong uStack1376;
undefined8 *local_558;
int local_54c;
byte local_53d;
undefined4 local_53c;
int local_538;
int local_534;
int local_530;
int local_52c;
int local_528;
int local_524;
int local_520;
int local_51c;
int local_518;
undefined4 local_514;
int local_510;
undefined4 local_50c;
int local_508;
int local_504;
int local_500;
undefined4 local_4fc;
undefined4 local_4f8;
int local_4f4;
int local_4f0;
int local_4ec;
int local_4e8;
int local_4e4;
int local_4e0;
int local_4dc;
char *local_4d8;
undefined8 local_4d0;
undefined8 local_4c8;
undefined8 local_4c0;
long local_4b8;
char *local_4b0;
char *local_4a8;
ulonglong local_4a0;
char *local_498;
char *local_490;
long local_488;
char *local_480;
undefined8 local_478;
undefined8 local_470;
long local_468;
long local_460;
ulong local_458;
ulong local_450;
char *local_448;
passwd *local_440;
void *local_438;
void *local_430;
char local_428 [1032];
long local_20;
ppuVar17 = &local_558;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_4b0 = (char *)0x0;
local_4a8 = (char *)0x0;
local_534 = 0;
local_530 = 0;
local_52c = 0;
local_528 = 0;
local_524 = 0;
local_520 = 0;
local_51c = 0;
local_518 = 0;
local_514 = 0;
local_510 = 0;
local_50c = 0;
local_508 = 0;
local_504 = 0;
local_500 = 0;
local_4fc = 0;
local_4f8 = 0;
local_4f4 = 0;
local_4f0 = 0;
local_4ec = 0;
local_4a0 = 0;
local_498 = (char *)0x0;
local_490 = (char *)0x0;
local_488 = 0;
local_480 = (char *)0x0;
local_478 = 0;
local_470 = 0;
local_468 = 0;
local_4c0 = 0;
local_460 = 0;
local_450 = 0;
local_53c = 0;
local_53d = 1;
local_4e8 = 3;
local_448 = (char *)0x0;
uStack1376 = 0x10d2eb;
local_558 = param_2;
local_54c = param_1;
sanitise_stdfd();
uStack1376 = 0x10d2fd;
__progname = ssh_get_progname(*local_558);
uStack1376 = 0x10d309;
seed_rng();
uStack1376 = 0x10d32a;
log_init(*local_558,3,1,1);
uStack1376 = 0x10d32f;
msetlocale();
uStack1376 = 0x10d334;
_Var8 = getuid();
uStack1376 = 0x10d33b;
local_440 = getpwuid(_Var8);
if (local_440 == (passwd *)0x0) {
uStack1376 = 0x10d351;
_Var8 = getuid();
uStack1376 = (ulong)_Var8;
ppuVar17 = (undefined8 **)(apcStack1408 + 3);
apcStack1408[3] = "No user exists for uid %lu";
sshfatal("ssh-keygen.c",&__func___27393,0xd16,0,1,0);
}
*(undefined8 *)((long)ppuVar17 + -8) = 0x10d399;
local_440 = (passwd *)pwcopy(local_440);
*(undefined8 *)((long)ppuVar17 + -8) = 0x10d3b1;
iVar9 = gethostname(hostname,0x401);
puVar18 = (undefined *)ppuVar17;
if (iVar9 == -1) {
*(undefined8 *)((long)ppuVar17 + -8) = 0x10d3bb;
piVar11 = __errno_location();
iVar9 = *piVar11;
*(undefined8 *)((long)ppuVar17 + -8) = 0x10d3c4;
pcVar12 = strerror(iVar9);
*(char **)((long)ppuVar17 + -8) = pcVar12;
puVar18 = (undefined *)((long)ppuVar17 + -0x10);
*(char **)((long)ppuVar17 + -0x10) = "gethostname: %s";
*(undefined8 *)((long)ppuVar17 + -0x18) = 0x10d3fb;
sshfatal("ssh-keygen.c",&__func___27393,0xd19,0,1,0);
}
*(undefined8 *)(puVar18 + -8) = 0x10d407;
sk_provider = getenv("SSH_SK_PROVIDER");
switchD_0010d44c_caseD_2e:
puVar1 = local_558;
*(undefined8 *)(puVar18 + -8) = 0x10dbe8;
local_4e4 = BSDgetopt(local_54c,puVar1,
"ABHKLQUXceghiklopquvyC:D:E:F:I:M:N:O:P:R:V:Y:Z:a:b:f:g:m:n:r:s:t:w:z:");
if (local_4e4 != -1) {
*(undefined8 *)(puVar18 + -8) = 0x10d423;
uVar10 = __addvsi3(local_4e4,0xffffffbf);
switch(uVar10) {
case 0:
local_51c = 1;
goto switchD_0010d44c_caseD_2e;
case 1:
print_bubblebabble = 1;
goto switchD_0010d44c_caseD_2e;
case 3:
pkcs11provider = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 4:
goto switchD_0010d44c_caseD_4;
case 5:
goto switchD_0010d44c_caseD_5;
default:
goto switchD_0010d44c_caseD_6;
case 7:
local_520 = 1;
goto switchD_0010d44c_caseD_2e;
case 8:
cert_key_id = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 10:
local_4ec = 1;
goto switchD_0010d44c_caseD_2e;
case 0xb:
local_52c = 1;
goto switchD_0010d44c_caseD_2e;
case 0xc:
goto switchD_0010d44c_caseD_c;
case 0xd:
identity_new_passphrase = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 0xe:
*(undefined8 *)(puVar18 + -8) = 0x10d7c9;
lVar14 = xrecallocarray(local_488,local_450,local_450 + 1,8);
uVar13 = local_450;
local_488 = lVar14;
local_450 = local_450 + 1;
*(undefined8 *)(puVar18 + -8) = 0x10d804;
uVar15 = xstrdup();
*(undefined8 *)(uVar13 * 8 + lVar14) = uVar15;
goto switchD_0010d44c_caseD_2e;
case 0xf:
identity_passphrase = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 0x10:
local_510 = 1;
goto switchD_0010d44c_caseD_2e;
case 0x11:
local_524 = 1;
local_4a8 = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 0x14:
local_50c = 1;
goto switchD_0010d44c_caseD_2e;
case 0x15:
goto switchD_0010d44c_caseD_15;
case 0x17:
case 0x28:
local_504 = 1;
goto switchD_0010d44c_caseD_2e;
case 0x18:
local_448 = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 0x19:
openssh_format_cipher = BSDoptarg;
*(undefined8 *)(puVar18 + -8) = 0x10d829;
lVar14 = cipher_by_name();
if (lVar14 != 0) goto switchD_0010d44c_caseD_2e;
*(char **)(puVar18 + -8) = openssh_format_cipher;
*(char **)(puVar18 + -0x10) = "Invalid OpenSSH-format cipher \'%s\'";
*(undefined8 *)(puVar18 + -0x18) = 0x10d870;
sshfatal("ssh-keygen.c",&__func___27393,0xd82,0,1,0);
puVar18 = puVar18 + -0x10;
case 2:
local_498 = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 0x20:
*(undefined8 *)(puVar18 + -8) = 0x10d9c1;
rounds = strtonum(BSDoptarg,1,0x7fffffff,&local_4b8);
if (local_4b8 != 0) {
*(long *)(puVar18 + -0x10) = local_4b8;
*(char **)(puVar18 + -0x18) = BSDoptarg;
*(char **)(puVar18 + -0x20) = "Invalid number: %s (%s)";
*(undefined8 *)(puVar18 + -0x28) = 0x10da21;
sshfatal("ssh-keygen.c",&__func___27393,0xdbc,0,1,0);
puVar18 = puVar18 + -0x20;
switchD_0010d44c_caseD_15:
*(undefined8 *)(puVar18 + -8) = 0x10da30;
parse_cert_times();
}
goto switchD_0010d44c_caseD_2e;
case 0x21:
*(undefined8 *)(puVar18 + -8) = 0x10d481;
local_53c = strtonum(BSDoptarg,1,0xffffffff,&local_4b8);
if (local_4b8 != 0) {
*(long *)(puVar18 + -0x10) = local_4b8;
*(char **)(puVar18 + -0x18) = BSDoptarg;
*(char **)(puVar18 + -0x20) = "Bits has bad value %s (%s)";
*(undefined8 *)(puVar18 + -0x28) = 0x10d4e1;
sshfatal("ssh-keygen.c",&__func___27393,0xd29,0,1,0);
puVar18 = puVar18 + -0x20;
switchD_0010d44c_caseD_4:
*(undefined8 *)(puVar18 + -8) = 0x10d4f0;
fingerprint_hash = ssh_digest_alg_by_name();
if (fingerprint_hash == -1) {
*(char **)(puVar18 + -8) = BSDoptarg;
*(char **)(puVar18 + -0x10) = "Invalid hash algorithm \"%s\"";
*(undefined8 *)(puVar18 + -0x18) = 0x10d543;
sshfatal("ssh-keygen.c",&__func___27393,0xd2f,0,1,0);
puVar18 = puVar18 + -0x10;
switchD_0010d44c_caseD_5:
local_528 = 1;
local_4a8 = BSDoptarg;
}
}
goto switchD_0010d44c_caseD_2e;
case 0x22:
local_530 = 1;
goto switchD_0010d44c_caseD_2e;
case 0x24:
local_508 = 1;
goto switchD_0010d44c_caseD_2e;
case 0x25:
*(undefined8 *)(puVar18 + -8) = 0x10d6ff;
uVar13 = strlcpy(identity_file,BSDoptarg,0x1000);
if (0xfff < uVar13) {
*(char **)(puVar18 + -0x10) = "Identity filename too long";
*(undefined8 *)(puVar18 + -0x18) = 0x10d741;
sshfatal("ssh-keygen.c",&__func___27393,0xd68,0,1,0);
puVar18 = puVar18 + -0x10;
}
have_identity = 1;
goto switchD_0010d44c_caseD_2e;
case 0x26:
local_4fc = 1;
goto switchD_0010d44c_caseD_2e;
case 0x27:
cert_key_type = 2;
certflags_flags = 0;
goto switchD_0010d44c_caseD_2e;
case 0x2a:
local_518 = 1;
goto switchD_0010d44c_caseD_2e;
case 0x2b:
print_fingerprint = 1;
goto switchD_0010d44c_caseD_2e;
case 0x2c:
*(undefined8 *)(puVar18 + -8) = 0x10d5e2;
iVar9 = strcasecmp(BSDoptarg,"RFC4716");
if (iVar9 != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10d5fc;
iVar9 = strcasecmp(BSDoptarg,"ssh2");
if (iVar9 != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10d625;
iVar9 = strcasecmp(BSDoptarg,"PKCS8");
if (iVar9 == 0) {
convert_format = 1;
private_key_format = 2;
}
else {
*(undefined8 *)(puVar18 + -8) = 0x10d658;
iVar9 = strcasecmp(BSDoptarg,"PEM");
if (iVar9 != 0) {
*(char **)(puVar18 + -8) = BSDoptarg;
*(char **)(puVar18 + -0x10) = "Unsupported conversion format \"%s\"";
*(undefined8 *)(puVar18 + -0x18) = 0x10d6b3;
sshfatal("ssh-keygen.c",&__func___27393,0xd58,0,1,0);
puVar18 = puVar18 + -0x10;
goto switchD_0010d44c_caseD_2d;
}
convert_format = 2;
private_key_format = 1;
}
goto switchD_0010d44c_caseD_2e;
}
}
convert_format = 0;
goto switchD_0010d44c_caseD_2e;
case 0x2d:
switchD_0010d44c_caseD_2d:
cert_principals = BSDoptarg;
case 0x2e:
goto switchD_0010d44c_caseD_2e;
case 0x2f:
local_534 = 1;
goto switchD_0010d44c_caseD_2e;
case 0x30:
quiet = 1;
goto switchD_0010d44c_caseD_2e;
case 0x31:
local_4a8 = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 0x32:
local_490 = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 0x33:
key_type_name = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 0x34:
local_514 = 1;
goto switchD_0010d44c_caseD_2e;
case 0x35:
if (local_4e8 == 3) {
local_4e8 = 5;
}
else if ((4 < local_4e8) && (local_4e8 < 7)) {
*(undefined8 *)(puVar18 + -8) = 0x10d980;
local_4e8 = __addvsi3(local_4e8,1);
}
goto switchD_0010d44c_caseD_2e;
case 0x36:
sk_provider = BSDoptarg;
goto switchD_0010d44c_caseD_2e;
case 0x38:
local_500 = 1;
goto switchD_0010d44c_caseD_2e;
case 0x39:
*(undefined8 *)(puVar18 + -8) = 0x10da60;
piVar11 = __errno_location();
*piVar11 = 0;
if (*BSDoptarg == '+') {
local_4f8 = 1;
BSDoptarg = BSDoptarg + 1;
}
*(undefined8 *)(puVar18 + -8) = 0x10daae;
local_4a0 = strtoull(BSDoptarg,&local_4d8,10);
if ((('/' < *BSDoptarg) && (*BSDoptarg < ':')) && (*local_4d8 == '\0')) {
*(undefined8 *)(puVar18 + -8) = 0x10dae4;
piVar11 = __errno_location();
if ((*piVar11 != 0x22) || (local_4a0 != 0xffffffffffffffff)) goto switchD_0010d44c_caseD_2e;
}
*(char **)(puVar18 + -8) = BSDoptarg;
*(char **)(puVar18 + -0x10) = "Invalid serial number \"%s\"";
*(undefined8 *)(puVar18 + -0x18) = 0x10db3b;
sshfatal("ssh-keygen.c",&__func___27393,0xdd1,0,1,0);
puVar18 = puVar18 + -0x10;
switchD_0010d44c_caseD_c:
*(undefined8 *)(puVar18 + -8) = 0x10db51;
iVar9 = strcmp(BSDoptarg,"generate");
if (iVar9 == 0) {
local_4f4 = 1;
}
else {
*(undefined8 *)(puVar18 + -8) = 0x10db77;
iVar9 = strcmp(BSDoptarg,"screen");
if (iVar9 == 0) {
local_4f0 = 1;
}
else {
*(char **)(puVar18 + -8) = BSDoptarg;
*(char **)(puVar18 + -0x10) = "Unsupported moduli option %s";
*(undefined8 *)(puVar18 + -0x18) = 0x10dbc5;
sshfatal("ssh-keygen.c",&__func___27393,0xdd9,0,1,0);
puVar18 = puVar18 + -0x10;
switchD_0010d44c_caseD_6:
*(undefined8 *)(puVar18 + -8) = 0x10dbca;
usage();
}
}
goto switchD_0010d44c_caseD_2e;
}
}
uVar15 = *local_558;
*(undefined8 *)(puVar18 + -8) = 0x10dc1d;
log_init(uVar15,local_4e8,1,1);
local_558 = local_558 + BSDoptind;
*(undefined8 *)(puVar18 + -8) = 0x10dc43;
local_54c = __subvsi3(local_54c,BSDoptind);
if (local_448 != (char *)0x0) {
*(undefined8 *)(puVar18 + -8) = 0x10dc72;
iVar9 = strncmp(local_448,"find-principals",0xf);
if (iVar9 == 0) {
if (local_490 == (char *)0x0) {
*(char **)(puVar18 + -0x10) = "Too few arguments for find-principals:missing signature file"
;
*(undefined8 *)(puVar18 + -0x18) = 0x10dcbe;
sshlog("ssh-keygen.c",&__func___27393,0xdef,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10dccc;
exit(1);
}
if (have_identity == 0) {
*(char **)(puVar18 + -0x10) =
"Too few arguments for find-principals:missing allowed keys file";
*(undefined8 *)(puVar18 + -0x18) = 0x10dd10;
sshlog("ssh-keygen.c",&__func___27393,0xdf4,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10dd1e;
exit(1);
}
*(undefined8 *)(puVar18 + -8) = 0x10dd42;
uVar15 = sig_find_principals(local_490,identity_file,local_488,local_450);
goto LAB_0010f6d2;
}
*(undefined8 *)(puVar18 + -8) = 0x10dd62;
iVar9 = strncmp(local_448,"match-principals",0x10);
if (iVar9 == 0) {
if (have_identity == 0) {
*(char **)(puVar18 + -0x10) =
"Too few arguments for match-principals:missing allowed keys file";
*(undefined8 *)(puVar18 + -0x18) = 0x10ddae;
sshlog("ssh-keygen.c",&__func___27393,0xdfc,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10ddbc;
exit(1);
}
if (cert_key_id == (char *)0x0) {
*(char **)(puVar18 + -0x10) = "Too few arguments for match-principals: missing principal ID"
;
*(undefined8 *)(puVar18 + -0x18) = 0x10de02;
sshlog("ssh-keygen.c",&__func___27393,0xe01,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10de10;
exit(1);
}
*(undefined8 *)(puVar18 + -8) = 0x10de34;
uVar15 = sig_match_principals(identity_file,cert_key_id,local_488,local_450);
goto LAB_0010f6d2;
}
*(undefined8 *)(puVar18 + -8) = 0x10de54;
iVar9 = strncmp(local_448,"sign",4);
if (iVar9 == 0) {
if ((cert_principals == (char *)0x0) || (*cert_principals == '\0')) {
*(char **)(puVar18 + -0x10) = "Too few arguments for sign: missing namespace";
*(undefined8 *)(puVar18 + -0x18) = 0x10deb0;
sshlog("ssh-keygen.c",&__func___27393,0xe0b,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10debe;
exit(1);
}
if (have_identity == 0) {
*(char **)(puVar18 + -0x10) = "Too few arguments for sign: missing key";
*(undefined8 *)(puVar18 + -0x18) = 0x10df02;
sshlog("ssh-keygen.c",&__func___27393,0xe10,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10df10;
exit(1);
}
*(ulong *)(puVar18 + -0x10) = local_450;
*(undefined8 *)(puVar18 + -0x18) = 0x10df50;
uVar15 = sig_sign(identity_file,cert_principals,local_50c,local_54c,local_558,local_488);
goto LAB_0010f6d2;
}
*(undefined8 *)(puVar18 + -8) = 0x10df74;
iVar9 = strncmp(local_448,"check-novalidate",0x10);
if (iVar9 == 0) {
if ((cert_principals == (char *)0x0) || (*cert_principals == '\0')) {
*(char **)(puVar18 + -0x10) = "Too few arguments for check-novalidate: missing namespace";
*(undefined8 *)(puVar18 + -0x18) = 0x10dfd0;
sshlog("ssh-keygen.c",&__func___27393,0xe1a,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10dfde;
exit(1);
}
if (local_490 == (char *)0x0) {
*(char **)(puVar18 + -0x10) =
"Too few arguments for check-novalidate: missing signature file";
*(undefined8 *)(puVar18 + -0x18) = 0x10e022;
sshlog("ssh-keygen.c",&__func___27393,0xe1f,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10e030;
exit(1);
}
*(ulong *)(puVar18 + -0x10) = local_450;
*(undefined8 *)(puVar18 + -0x18) = 0x10e06a;
uVar15 = sig_verify(local_490,cert_principals,0,0,0,local_488);
goto LAB_0010f6d2;
}
*(undefined8 *)(puVar18 + -8) = 0x10e08e;
iVar9 = strncmp(local_448,"verify",6);
if (iVar9 == 0) {
if ((cert_principals == (char *)0x0) || (*cert_principals == '\0')) {
*(char **)(puVar18 + -0x10) = "Too few arguments for verify: missing namespace";
*(undefined8 *)(puVar18 + -0x18) = 0x10e0ea;
sshlog("ssh-keygen.c",&__func___27393,0xe29,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10e0f8;
exit(1);
}
if (local_490 == (char *)0x0) {
*(char **)(puVar18 + -0x10) = "Too few arguments for verify: missing signature file";
*(undefined8 *)(puVar18 + -0x18) = 0x10e13c;
sshlog("ssh-keygen.c",&__func___27393,0xe2e,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10e14a;
exit(1);
}
if (have_identity == 0) {
*(char **)(puVar18 + -0x10) = "Too few arguments for sign: missing allowed keys file";
*(undefined8 *)(puVar18 + -0x18) = 0x10e18e;
sshlog("ssh-keygen.c",&__func___27393,0xe33,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10e19c;
exit(1);
}
if (cert_key_id == (char *)0x0) {
*(char **)(puVar18 + -0x10) = "Too few arguments for verify: missing principal identity";
*(undefined8 *)(puVar18 + -0x18) = 0x10e1e2;
sshlog("ssh-keygen.c",&__func___27393,0xe38,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10e1f0;
exit(1);
}
*(ulong *)(puVar18 + -0x10) = local_450;
*(undefined8 *)(puVar18 + -0x18) = 0x10e232;
uVar15 = sig_verify(local_490,cert_principals,cert_key_id,identity_file,local_4a8,local_488);
goto LAB_0010f6d2;
}
*(char **)(puVar18 + -8) = local_448;
*(char **)(puVar18 + -0x10) = "Unsupported operation for -Y: \"%s\"";
*(undefined8 *)(puVar18 + -0x18) = 0x10e277;
sshlog("ssh-keygen.c",&__func___27393,0xe40,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10e280;
usage();
}
if (local_490 == (char *)0x0) {
if ((((0 < local_54c) && (local_518 == 0)) && (local_510 == 0)) &&
((local_4f4 == 0 && (local_4f0 == 0)))) {
*(char **)(puVar18 + -0x10) = "Too many arguments.";
*(undefined8 *)(puVar18 + -0x18) = 0x10e350;
sshlog("ssh-keygen.c",&__func___27393,0xe4c,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10e359;
usage();
}
}
else if ((local_54c < 1) && (local_518 == 0)) {
*(char **)(puVar18 + -0x10) = "Too few arguments.";
*(undefined8 *)(puVar18 + -0x18) = 0x10e2de;
sshlog("ssh-keygen.c",&__func___27393,0xe47,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10e2e7;
usage();
}
if ((local_534 != 0) && (local_530 != 0)) {
*(char **)(puVar18 + -0x10) = "Can only have one of -p and -c.";
*(undefined8 *)(puVar18 + -0x18) = 0x10e3a5;
sshlog("ssh-keygen.c",&__func___27393,0xe50,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10e3ae;
usage();
}
if ((print_fingerprint != 0) && ((local_524 != 0 || (local_520 != 0)))) {
*(char **)(puVar18 + -0x10) = "Cannot use -l with -H or -R.";
*(undefined8 *)(puVar18 + -0x18) = 0x10e404;
sshlog("ssh-keygen.c",&__func___27393,0xe54,0,2,0);
*(undefined8 *)(puVar18 + -8) = 0x10e40d;
usage();
}
puVar1 = local_558;
if (local_518 == 0) {
if (local_510 == 0) {
if (local_490 != (char *)0x0) {
if (cert_key_id == (char *)0x0) {
*(char **)(puVar18 + -0x10) = "Must specify key id (-I) when certifying";
*(undefined8 *)(puVar18 + -0x18) = 0x10e4ee;
sshfatal("ssh-keygen.c",&__func___27393,0xe62,0,1,0);
puVar18 = puVar18 + -0x10;
}
for (local_458 = 0; puVar1 = &local_440->pw_name, pcVar12 = local_490, uVar5 = local_4a0,
uVar4 = local_4f8, uVar10 = local_50c, iVar9 = local_54c, local_458 < local_450;
local_458 = local_458 + 1) {
uVar15 = *(undefined8 *)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10e51f;
add_cert_option(uVar15);
}
*(undefined8 **)(puVar18 + -0x10) = local_558;
*(undefined8 *)(puVar18 + -0x18) = 0x10e577;
do_ca_sign(puVar1,pcVar12,uVar10,uVar5,uVar4,iVar9);
}
puVar1 = &local_440->pw_name;
if (local_52c != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10e593;
do_show_cert(puVar1);
}
puVar1 = &local_440->pw_name;
pcVar12 = local_4a8;
iVar3 = local_520;
iVar2 = local_524;
iVar9 = local_528;
if (((local_524 != 0) || (local_520 != 0)) || (local_528 != 0)) {
*(undefined8 *)(puVar18 + -8) = 0x10e5d9;
do_known_hosts(puVar1,pcVar12,iVar9,iVar2,iVar3);
}
puVar1 = &local_440->pw_name;
if (pkcs11provider != (char *)0x0) {
*(undefined8 *)(puVar18 + -8) = 0x10e5f4;
do_download(puVar1);
}
puVar1 = &local_440->pw_name;
if (local_4ec == 0) {
if ((print_fingerprint != 0) || (print_bubblebabble != 0)) {
*(undefined8 *)(puVar18 + -8) = 0x10e726;
do_fingerprint(puVar1);
}
puVar1 = &local_440->pw_name;
if (local_534 != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10e73e;
do_change_passphrase(puVar1);
}
puVar1 = &local_440->pw_name;
pcVar12 = local_498;
if (local_530 != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10e760;
do_change_comment(puVar1,pcVar12);
}
puVar1 = &local_440->pw_name;
if (local_508 != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10e778;
do_convert_to(puVar1);
}
puVar1 = &local_440->pw_name;
if (local_504 != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10e790;
do_convert_from(puVar1);
}
puVar1 = &local_440->pw_name;
if (local_500 != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10e7a8;
do_print_public(puVar1);
}
puVar1 = &local_440->pw_name;
pcVar12 = local_4a8;
uVar10 = local_4fc;
if (local_4a8 != (char *)0x0) {
local_4dc = 0;
if (have_identity != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10e7f1;
local_4dc = do_print_resource_record(puVar1,identity_file,pcVar12,uVar10);
puVar19 = puVar18;
if (local_4dc == 0) {
*(undefined8 *)(puVar18 + -8) = 0x10e805;
piVar11 = __errno_location();
iVar9 = *piVar11;
*(undefined8 *)(puVar18 + -8) = 0x10e80e;
pcVar12 = strerror(iVar9);
*(char **)(puVar18 + -0x10) = pcVar12;
*(undefined1 **)(puVar18 + -0x18) = identity_file;
puVar19 = puVar18 + -0x20;
*(char **)(puVar18 + -0x20) = "%s: %s";
*(undefined8 *)(puVar18 + -0x28) = 0x10e851;
sshfatal("ssh-keygen.c",&__func___27393,0xe93,0,1,0);
}
*(undefined8 *)(puVar19 + -8) = 0x10e85b;
exit(0);
}
*(undefined8 *)(puVar18 + -8) = 0x10e87e;
iVar9 = do_print_resource_record(puVar1,"/usr/local/etc/ssh_host_rsa_key",pcVar12,uVar10);
puVar1 = &local_440->pw_name;
pcVar12 = local_4a8;
uVar10 = local_4fc;
local_4dc = local_4dc + iVar9;
*(undefined8 *)(puVar18 + -8) = 0x10e8a7;
iVar9 = do_print_resource_record(puVar1,"/usr/local/etc/ssh_host_dsa_key",pcVar12,uVar10);
puVar1 = &local_440->pw_name;
pcVar12 = local_4a8;
uVar10 = local_4fc;
local_4dc = local_4dc + iVar9;
*(undefined8 *)(puVar18 + -8) = 0x10e8d0;
iVar9 = do_print_resource_record
(puVar1,"/usr/local/etc/ssh_host_ecdsa_key",pcVar12,uVar10);
puVar1 = &local_440->pw_name;
pcVar12 = local_4a8;
uVar10 = local_4fc;
local_4dc = local_4dc + iVar9;
*(undefined8 *)(puVar18 + -8) = 0x10e8f9;
iVar9 = do_print_resource_record
(puVar1,"/usr/local/etc/ssh_host_ed25519_key",pcVar12,uVar10);
puVar1 = &local_440->pw_name;
pcVar12 = local_4a8;
uVar10 = local_4fc;
local_4dc = local_4dc + iVar9;
*(undefined8 *)(puVar18 + -8) = 0x10e922;
iVar9 = do_print_resource_record(puVar1,"/usr/local/etc/ssh_host_xmss_key",pcVar12,uVar10)
;
local_4dc = local_4dc + iVar9;
puVar19 = puVar18;
if (local_4dc == 0) {
puVar19 = puVar18 + -0x10;
*(char **)(puVar18 + -0x10) = "no keys found.";
*(undefined8 *)(puVar18 + -0x18) = 0x10e96b;
sshfatal("ssh-keygen.c",&__func___27393,0xea7,0,1,0);
}
*(undefined8 *)(puVar19 + -8) = 0x10e975;
exit(0);
}
if ((local_4f4 != 0) || (local_4f0 != 0)) {
puVar19 = puVar18;
if (local_54c < 1) {
puVar19 = puVar18 + -0x10;
*(char **)(puVar18 + -0x10) = "No output file specified";
*(undefined8 *)(puVar18 + -0x18) = 0x10e9ce;
sshfatal("ssh-keygen.c",&__func___27393,0xeae,0,1,0);
}
puVar18 = puVar19;
if (1 < local_54c) {
puVar18 = puVar19 + -0x10;
*(char **)(puVar19 + -0x10) = "Too many output files specified";
*(undefined8 *)(puVar19 + -0x18) = 0x10ea11;
sshfatal("ssh-keygen.c",&__func___27393,0xeb0,0,1,0);
}
}
puVar1 = &local_440->pw_name;
uVar13 = local_450;
lVar14 = local_488;
if (local_4f4 == 0) {
if (local_4f0 == 0) {
if (local_51c == 0) {
if (key_type_name == (char *)0x0) {
key_type_name = "rsa";
}
*(undefined8 *)(puVar18 + -8) = 0x10eac8;
iVar9 = sshkey_type_from_name(key_type_name);
local_4e0 = iVar9;
*(undefined8 *)(puVar18 + -8) = 0x10eaec;
type_bits_valid(iVar9,key_type_name,&local_53c);
if (quiet == 0) {
*(undefined8 *)(puVar18 + -8) = 0x10eb11;
printf("Generating public/private %s key pair.\n",key_type_name);
}
iVar9 = local_4e0;
uVar10 = local_53c;
if ((local_4e0 == 10) || (local_4e0 == 0xc)) {
for (local_458 = 0; local_458 < local_450; local_458 = local_458 + 1) {
pcVar12 = *(char **)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10eb62;
iVar9 = strcasecmp(pcVar12,"no-touch-required");
if (iVar9 == 0) {
local_53d = local_53d & 0xfe;
}
else {
pcVar12 = *(char **)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10eb9d;
iVar9 = strcasecmp(pcVar12,"verify-required");
if (iVar9 == 0) {
local_53d = local_53d | 4;
}
else {
pcVar12 = *(char **)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10ebd8;
iVar9 = strcasecmp(pcVar12,"resident");
if (iVar9 == 0) {
local_53d = local_53d | 0x20;
}
else {
pcVar12 = *(char **)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10ec18;
iVar9 = strncasecmp(pcVar12,"device=",7);
if (iVar9 == 0) {
lVar14 = *(long *)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10ec44;
local_478 = xstrdup(lVar14 + 7);
}
else {
pcVar12 = *(char **)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10ec80;
iVar9 = strncasecmp(pcVar12,"user=",5);
if (iVar9 == 0) {
lVar14 = *(long *)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10ecac;
local_470 = xstrdup(lVar14 + 5);
}
else {
pcVar12 = *(char **)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10ece8;
iVar9 = strncasecmp(pcVar12,"challenge=",10);
if (iVar9 == 0) {
lVar14 = *(long *)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10ed22;
local_538 = sshbuf_load_file(lVar14 + 10,&local_4c0);
if (local_538 == 0) goto LAB_0010ef0d;
lVar14 = *(long *)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10ed62;
uVar15 = ssh_err(local_538);
*(long *)(puVar18 + -8) = lVar14 + 10;
*(char **)(puVar18 + -0x10) =
"Unable to load FIDO enrollment challenge \"%s\"";
*(undefined8 *)(puVar18 + -0x18) = 0x10ed96;
sshfatal("ssh-keygen.c",&__func___27393,0xeda,0,1,uVar15);
puVar18 = puVar18 + -0x10;
}
pcVar12 = *(char **)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10edc6;
iVar9 = strncasecmp(pcVar12,"write-attestation=",0x12);
if (iVar9 == 0) {
local_468 = *(long *)(local_488 + local_458 * 8) + 0x12;
}
else {
pcVar12 = *(char **)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10ee26;
iVar9 = strncasecmp(pcVar12,"application=",0xc);
puVar19 = puVar18;
if (iVar9 == 0) {
lVar14 = *(long *)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10ee56;
local_480 = (char *)xstrdup(lVar14 + 0xc);
*(undefined8 *)(puVar18 + -8) = 0x10ee78;
iVar9 = strncmp(local_480,"ssh:",4);
if (iVar9 == 0) goto LAB_0010ef0d;
puVar19 = puVar18 + -0x10;
*(char **)(puVar18 + -0x10) =
"FIDO application string must begin with \"ssh:\"";
*(undefined8 *)(puVar18 + -0x18) = 0x10eeba;
sshfatal("ssh-keygen.c",&__func___27393,0xee5,0,1,0);
}
*(undefined8 *)(puVar19 + -8) =
*(undefined8 *)(local_488 + local_458 * 8);
puVar18 = puVar19 + -0x10;
*(char **)(puVar19 + -0x10) =
"Option \"%s\" is unsupported for FIDO authenticator enrollment";
*(undefined8 *)(puVar19 + -0x18) = 0x10ef0d;
sshfatal("ssh-keygen.c",&__func___27393,0xee9,0,1,0);
}
}
}
}
}
}
LAB_0010ef0d:
}
*(undefined8 *)(puVar18 + -8) = 0x10ef2e;
local_460 = sshbuf_new();
puVar19 = puVar18;
if (local_460 == 0) {
puVar19 = puVar18 + -0x10;
*(char **)(puVar18 + -0x10) = "sshbuf_new failed";
*(undefined8 *)(puVar18 + -0x18) = 0x10ef79;
sshfatal("ssh-keygen.c",&__func___27393,0xeee,0,1,0);
}
local_538 = 0;
local_458 = 0;
while( true ) {
if (quiet == 0) {
if (local_538 == 0) {
pcVar12 = "";
}
else {
pcVar12 = " again";
}
*(undefined8 *)(puVar19 + -8) = 0x10efc5;
printf("You may need to touch your authenticator%s to authorize key generation.\n"
,pcVar12);
}
*(undefined8 *)(puVar19 + -8) = 0x10efd4;
fflush(stdout);
pcVar12 = local_480;
if (local_480 == (char *)0x0) {
pcVar12 = "ssh:";
}
*(long *)(puVar19 + -8) = local_460;
*(undefined8 **)(puVar19 + -0x10) = &local_4d0;
*(undefined8 *)(puVar19 + -0x18) = local_4c0;
*(char **)(puVar19 + -0x20) = local_4b0;
*(undefined8 *)(puVar19 + -0x28) = 0x10f039;
local_538 = sshsk_enroll(local_4e0,sk_provider,local_478,pcVar12,local_470,
local_53d);
if (local_538 == 0) break;
if (((local_538 == -0x2c) && ((local_53d & 0x20) != 0)) &&
((local_53d & 0x10) == 0)) {
*(undefined8 *)(puVar19 + -8) = 0x10f08e;
iVar9 = confirm_sk_overwrite(local_480,local_470);
if (iVar9 == 0) goto LAB_0010f09e;
local_53d = local_53d | 0x10;
}
else {
LAB_0010f09e:
puVar18 = puVar19;
if (local_538 != -0x2b) {
*(undefined8 *)(puVar19 + -8) = 0x10f0b4;
ssh_err(local_538);
puVar18 = puVar19 + -0x10;
*(char **)(puVar19 + -0x10) = "Key enrollment failed";
*(undefined8 *)(puVar19 + -0x18) = 0x10f0eb;
sshfatal("ssh-keygen.c",&__func___27393,0xf06,0,1);
}
if (local_4b0 != (char *)0x0) {
*(char **)(puVar18 + -0x10) = "PIN incorrect";
*(undefined8 *)(puVar18 + -0x18) = 0x10f12f;
sshlog("ssh-keygen.c",&__func___27393,0xf08,0,2);
*(undefined8 *)(puVar18 + -8) = 0x10f142;
sVar16 = strlen(local_4b0);
*(undefined8 *)(puVar18 + -8) = 0x10f157;
freezero(local_4b0,sVar16);
local_4b0 = (char *)0x0;
}
local_458 = local_458 + 1;
puVar19 = puVar18;
if (2 < local_458) {
puVar19 = puVar18 + -0x10;
*(char **)(puVar18 + -0x10) = "Too many incorrect PINs";
*(undefined8 *)(puVar18 + -0x18) = 0x10f1ae;
sshfatal("ssh-keygen.c",&__func___27393,0xf0d,0,1);
}
*(undefined8 *)(puVar19 + -8) = 0x10f1bf;
local_4b0 = (char *)read_passphrase("Enter PIN for authenticator: ",2);
}
}
if (local_4b0 != (char *)0x0) {
*(undefined8 *)(puVar19 + -8) = 0x10f1e9;
sVar16 = strlen(local_4b0);
*(undefined8 *)(puVar19 + -8) = 0x10f1fe;
freezero(local_4b0,sVar16);
local_4b0 = (char *)0x0;
}
}
else {
*(undefined8 *)(puVar18 + -8) = 0x10f227;
local_538 = sshkey_generate(iVar9,uVar10,&local_4d0);
puVar19 = puVar18;
if (local_538 != 0) {
puVar19 = puVar18 + -0x10;
*(char **)(puVar18 + -0x10) = "sshkey_generate failed";
*(undefined8 *)(puVar18 + -0x18) = 0x10f270;
sshfatal("ssh-keygen.c",&__func___27393,0xf18,0,1,0);
}
}
uVar15 = local_4d0;
*(undefined8 *)(puVar19 + -8) = 0x10f28d;
iVar9 = sshkey_from_private(uVar15,&local_4c8);
local_538 = iVar9;
puVar18 = puVar19;
if (iVar9 != 0) {
*(undefined8 *)(puVar19 + -8) = 0x10f2a9;
uVar15 = ssh_err(iVar9);
puVar18 = puVar19 + -0x10;
*(char **)(puVar19 + -0x10) = "sshkey_from_private";
*(undefined8 *)(puVar19 + -0x18) = 0x10f2e0;
sshfatal("ssh-keygen.c",&__func___27393,0xf1c,0,1,uVar15);
}
puVar1 = &local_440->pw_name;
if (have_identity == 0) {
*(undefined8 *)(puVar18 + -8) = 0x10f300;
ask_filename(puVar1,"Enter file in which to save the key");
}
*(undefined8 *)(puVar18 + -8) = 0x10f31c;
hostfile_create_user_ssh_dir(identity_file,quiet == 0);
*(undefined8 *)(puVar18 + -8) = 0x10f328;
iVar9 = confirm_overwrite(identity_file);
if (iVar9 == 0) {
*(undefined8 *)(puVar18 + -8) = 0x10f336;
exit(1);
}
*(undefined8 *)(puVar18 + -8) = 0x10f33b;
local_4b0 = (char *)private_key_passphrase();
pcVar12 = local_498;
if (local_498 == (char *)0x0) {
uVar15 = local_440->pw_name;
*(undefined8 *)(puVar18 + -8) = 0x10f3a0;
snprintf(local_428,0x400,"%s@%s",uVar15,hostname);
}
else {
*(undefined8 *)(puVar18 + -8) = 0x10f36a;
strlcpy(local_428,pcVar12,0x400);
}
pcVar12 = local_4b0;
uVar15 = local_4d0;
*(ulong *)(puVar18 + -0x10) = (ulong)rounds;
*(undefined8 *)(puVar18 + -0x18) = 0x10f3e2;
iVar9 = sshkey_save_private(uVar15,identity_file,pcVar12,local_428,private_key_format,
openssh_format_cipher);
pcVar12 = local_4b0;
local_538 = iVar9;
if (iVar9 != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10f402;
uVar15 = ssh_err(iVar9);
*(undefined1 **)(puVar18 + -8) = identity_file;
*(char **)(puVar18 + -0x10) = "Saving key \"%s\" failed";
*(undefined8 *)(puVar18 + -0x18) = 0x10f43d;
sshlog("ssh-keygen.c",&__func___27393,0xf34,0,2,uVar15);
pcVar12 = local_4b0;
*(undefined8 *)(puVar18 + -8) = 0x10f450;
sVar16 = strlen(pcVar12);
pcVar12 = local_4b0;
*(undefined8 *)(puVar18 + -8) = 0x10f465;
freezero(pcVar12,sVar16);
*(undefined8 *)(puVar18 + -8) = 0x10f46f;
exit(1);
}
*(undefined8 *)(puVar18 + -8) = 0x10f47e;
sVar16 = strlen(pcVar12);
pcVar12 = local_4b0;
*(undefined8 *)(puVar18 + -8) = 0x10f493;
freezero(pcVar12,sVar16);
*(undefined8 *)(puVar18 + -8) = 0x10f4a2;
sshkey_free(local_4d0);
if (quiet == 0) {
*(undefined8 *)(puVar18 + -8) = 0x10f4c4;
printf("Your identification has been saved in %s\n",identity_file);
}
*(undefined8 *)(puVar18 + -8) = 0x10f4dc;
strlcat(identity_file,&DAT_001119f6,0x1000);
uVar15 = local_4c8;
*(undefined8 *)(puVar18 + -8) = 0x10f4f9;
iVar9 = sshkey_save_public(uVar15,identity_file,local_428);
local_538 = iVar9;
puVar19 = puVar18;
if (iVar9 != 0) {
*(undefined8 *)(puVar18 + -8) = 0x10f515;
uVar15 = ssh_err(iVar9);
*(undefined1 **)(puVar18 + -8) = identity_file;
puVar19 = puVar18 + -0x10;
*(char **)(puVar18 + -0x10) = "Unable to save public key to %s";
*(undefined8 *)(puVar18 + -0x18) = 0x10f550;
sshfatal("ssh-keygen.c",&__func___27393,0xf42,0,1,uVar15);
}
uVar15 = local_4c8;
if (quiet == 0) {
*(undefined8 *)(puVar19 + -8) = 0x10f57a;
local_438 = (void *)sshkey_fingerprint(uVar15,fingerprint_hash,0);
uVar15 = local_4c8;
*(undefined8 *)(puVar19 + -8) = 0x10f59d;
local_430 = (void *)sshkey_fingerprint(uVar15,fingerprint_hash,4);
if ((local_438 == (void *)0x0) || (local_430 == (void *)0x0)) {
*(char **)(puVar19 + -0x10) = "sshkey_fingerprint failed";
*(undefined8 *)(puVar19 + -0x18) = 0x10f5f2;
sshfatal("ssh-keygen.c",&__func___27393,0xf4a,0,1,0);
puVar19 = puVar19 + -0x10;
}
*(undefined8 *)(puVar19 + -8) = 0x10f60a;
printf("Your public key has been saved in %s\n",identity_file);
*(undefined8 *)(puVar19 + -8) = 0x10f61b;
printf("The key fingerprint is:\n");
pvVar7 = local_438;
*(undefined8 *)(puVar19 + -8) = 0x10f63d;
printf("%s %s\n",pvVar7,local_428);
*(undefined8 *)(puVar19 + -8) = 0x10f64e;
printf("The key\'s randomart image is:\n");
pvVar7 = local_430;
*(undefined8 *)(puVar19 + -8) = 0x10f669;
printf("%s\n",pvVar7);
pvVar7 = local_430;
*(undefined8 *)(puVar19 + -8) = 0x10f678;
free(pvVar7);
pvVar7 = local_438;
*(undefined8 *)(puVar19 + -8) = 0x10f687;
free(pvVar7);
}
lVar6 = local_460;
lVar14 = local_468;
if (local_468 != 0) {
*(undefined8 *)(puVar19 + -8) = 0x10f6aa;
save_attestation(lVar6,lVar14);
}
lVar14 = local_460;
*(undefined8 *)(puVar19 + -8) = 0x10f6b9;
sshbuf_free(lVar14);
*(undefined8 *)(puVar19 + -8) = 0x10f6c8;
sshkey_free(local_4c8);
*(undefined8 *)(puVar19 + -8) = 0x10f6d2;
exit(0);
}
*(undefined8 *)(puVar18 + -8) = 0x10ea95;
do_gen_all_hostkeys(puVar1);
uVar15 = 0;
}
else {
uVar15 = *local_558;
*(undefined8 *)(puVar18 + -8) = 0x10ea73;
do_moduli_screen(uVar15,lVar14,uVar13);
uVar15 = 0;
}
}
else {
uVar15 = *local_558;
*(undefined8 *)(puVar18 + -8) = 0x10ea3d;
do_moduli_gen(uVar15,lVar14,uVar13);
uVar15 = 0;
}
}
else {
for (local_458 = 0; local_458 < local_450; local_458 = local_458 + 1) {
pcVar12 = *(char **)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10e641;
iVar9 = strncasecmp(pcVar12,"device=",7);
if (iVar9 == 0) {
lVar14 = *(long *)(local_488 + local_458 * 8);
*(undefined8 *)(puVar18 + -8) = 0x10e66d;
local_478 = xstrdup(lVar14 + 7);
puVar19 = puVar18;
}
else {
*(undefined8 *)(puVar18 + -8) = *(undefined8 *)(local_488 + local_458 * 8);
puVar19 = puVar18 + -0x10;
*(char **)(puVar18 + -0x10) =
"Option \"%s\" is unsupported for FIDO authenticator download";
*(undefined8 *)(puVar18 + -0x18) = 0x10e6c9;
sshfatal("ssh-keygen.c",&__func___27393,0xe75,0,1,0);
}
puVar18 = puVar19;
}
*(undefined8 *)(puVar18 + -8) = 0x10e6fe;
uVar15 = do_download_sk(sk_provider,local_478);
}
}
else {
*(undefined8 *)(puVar18 + -8) = 0x10e490;
do_check_krl(local_440,print_fingerprint,local_54c,puVar1);
uVar15 = 0;
}
}
else {
*(undefined8 **)(puVar18 + -0x10) = local_558;
*(undefined8 *)(puVar18 + -0x18) = 0x10e457;
do_gen_krl(local_440,local_514,local_490,local_4a0,local_498,local_54c);
uVar15 = 0;
}
LAB_0010f6d2:
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)(puVar18 + -8) = 0x10f6e6;
__stack_chk_fail();
}
return uVar15;
}
|
BN_cmp(dh_pub, tmp) != -1) {
BN_clear_free(tmp);
sshlog("dh.c", __func__, 262, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "invalid public DH value: >= p-1");
return 0;
}
| int BN_cmp(BIGNUM *a,BIGNUM *b)
{
halt_baddata();
}
|
static intmax_t
add_count (intmax_t a, idx_t b)
{
intmax_t sum;
if (!! __builtin_add_overflow (a, b, &sum))
((!!sizeof (struct { _Static_assert (EXIT_TROUBLE, "verify_expr (" "EXIT_TROUBLE" ", " "(error (EXIT_TROUBLE, 0, gettext(\"input is too large to count\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_TROUBLE, 0, gettext("input is too large to count")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_TROUBLE, 0, gettext("input is too large to count")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
return sum;
}
| long add_count(long a1, long a2)
{
char *v2;
if ( __OFADD__(a1, a2) )
{
v2 = gettext("input is too large to count");
error(2, 0, v2);
}
return a1 + a2;
}
|
static void
indent (amount)
int amount;
{
register int i;
do { if ((0) + (amount) >= indentation_size) { while ((0) + (amount) >= indentation_size) indentation_size += (16); indentation_string = sh_xrealloc((indentation_string), (indentation_size), "print_cmd.c", 1492); } } while (0);
for (i = 0; amount > 0; amount--)
indentation_string[i++] = ' ';
indentation_string[i] = '\0';
cprintf ("%s", indentation_string);
}
| void indent(unsigned long a0) {
unsigned int v0;
int tmp_11;
void* v3;
unsigned long long v4;
if (v0 >= indentation_size) {
for (v0 = a0; v0 >= indentation_size; indentation_size = indentation_size + 16);
indentation_string = sh_xrealloc(indentation_string, indentation_size, "print_cmd.c", 0x5d4);
}
for (v3 = 0; v0 > 0; v0 -= 1) {
tmp_11 = v3;
v3 += 1;
*((tmp_11 + indentation_string)) = 32;
}
*(v3 + indentation_string) = 0;
v4 = cprintf("%s");
return;
}
|
int
read_buffer (fd, buf, cnt)
int fd;
voidp buf;
unsigned int cnt;
{
int len;
if (0x7fffffff < cnt)
cnt = 0x7fffffff;
len = read (fd, buf, cnt);
if (len < 0 &&
(*__errno_location ())
==
11
)
{
int flags =
rpl_fcntl
(fd,
3
);
if (0 <= flags)
{
if (! (flags &
04000
))
(*__errno_location ())
=
11
;
else if (
rpl_fcntl
(fd,
4
, flags & ~
04000
) != -1)
len = read (fd, buf, cnt);
}
}
return len;
}
| int read_buffer(unsigned long a0, void* a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
v0 = a2;
if (v0 < 0)
v0 = 2147483647;
v1 = read(a0, a1, v0);
if (v1 < 0 && *(__errno_location()) == 11) {
v2 = rpl_fcntl(a0, 0x3);
if (v2 >= 0) {
if (!(v2 & 0x800)) {
*(__errno_location()) = 11;
} else if (rpl_fcntl(a0, 0x4) != -1) {
v1 = read(a0, a1, v0);
}
}
}
return v1;
}
|
int
main (int argc, char **argv)
{
unsigned long nproc, ignore = 0;
;
set_program_name (argv[0]);
setlocale (
6
, "");
bindtextdomain ("coreutils", "/usr/local/share/locale");
textdomain ("coreutils");
atexit (close_stdout);
enum nproc_query mode = NPROC_CURRENT_OVERRIDABLE;
while (
1
)
{
int c = getopt_long (argc, argv, "", longopts,
((void *)0)
);
if (c == -1)
break;
switch (c)
{
case GETOPT_HELP_CHAR: usage (
0
); break;;
case GETOPT_VERSION_CHAR: version_etc (
stdout
, "nproc", "GNU coreutils", Version, ("Giuseppe Scrivano"), (char *)
((void *)0)
); exit (
0
); break;;
case ALL_OPTION:
mode = NPROC_ALL;
break;
case IGNORE_OPTION:
ignore = xdectoumax (optarg, 0,
(0x7fffffffffffffffL * 2UL + 1UL)
, "", gettext ("invalid number"),0);
break;
default:
usage (
1
);
}
}
if (argc != optind)
{
error (0, 0, gettext ("extra operand %s"), quote (argv[optind]));
usage (
1
);
}
nproc = num_processors (mode);
if (ignore < nproc)
nproc -= ignore;
else
nproc = 1;
printf ("%lu\n", nproc);
return
0
;
}
| undefined8 main(int param_1,undefined8 *param_2)
{
int iVar1;
undefined8 uVar2;
undefined8 uVar3;
ulong uVar4;
undefined4 local_30;
long local_28;
ulong local_20;
local_20 = 0;
set_program_name(*param_2);
setlocale(6,"");
bindtextdomain("coreutils","/usr/local/share/locale");
textdomain("coreutils");
atexit(p_Ram00000000001003db);
local_30 = 2;
do {
while( true ) {
while( true ) {
iVar1 = getopt_long(param_1,param_2,&DAT_001006eb,longopts,0);
if (iVar1 == -1) {
if (param_1 != optind) {
uVar2 = quote(param_2[optind]);
uVar3 = gettext("extra operand %s");
error(0,0,uVar3,uVar2);
usage(1);
}
uVar4 = num_processors(local_30);
if (local_20 < uVar4) {
local_28 = uVar4 - local_20;
}
else {
local_28 = 1;
}
printf("%lu\n",local_28);
return 0;
}
if (iVar1 != 0x81) break;
uVar2 = gettext("invalid number");
local_20 = xdectoumax(optarg,0,0xffffffffffffffff,&DAT_001006eb,uVar2,0);
}
if (iVar1 < 0x82) break;
LAB_001004f5:
usage();
}
if (iVar1 != 0x80) {
if (iVar1 < 0x81) {
if (iVar1 == -0x83) {
LAB_00100469:
version_etc(stdout,"nproc","GNU coreutils",Version,"Giuseppe Scrivano",0);
exit(0);
}
if (iVar1 == -0x82) {
usage(0);
goto LAB_00100469;
}
}
goto LAB_001004f5;
}
local_30 = 0;
} while( true );
}
|
int
sshbuf_put_bignum2_bytes(struct sshbuf *buf, const void *v, size_t len)
{
u_char *d;
const u_char *s = (const u_char *)v;
int r, prepend;
if (len > 0x8000000 - 5) {
;
return -9;
}
for (; len > 0 && *s == 0; len--, s++)
;
prepend = len > 0 && (s[0] & 0x80) != 0;
if ((r = sshbuf_reserve(buf, len + 4 + prepend, &d)) < 0)
return r;
do { const u_int32_t __v = (len + prepend); ((u_char *)(d))[0] = (__v >> 24) & 0xff; ((u_char *)(d))[1] = (__v >> 16) & 0xff; ((u_char *)(d))[2] = (__v >> 8) & 0xff; ((u_char *)(d))[3] = __v & 0xff; } while (0);
if (prepend)
d[4] = 0;
if (len != 0)
memcpy(d + 4 + prepend, s, len);
return 0;
}
| long long sshbuf_put_bignum2_bytes(unsigned long long a0, void* a1, unsigned int a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long long v4;
char *v5;
unsigned long long v7;
unsigned int v8;
v0 = a2;
if (*(&v0) > 134217723) {
v7 = 4294967287;
} else {
for (v5 = a1; *(&v0); v5 += 1) {
if (*(v5))
break;
*(&v0) = *(&v0) - 1;
}
if (*(&v0) && *(v5) < 0)
v8 = 1;
if (!*(&v0) || *(v5) >= 0)
v8 = 0;
v1 = v8;
v2 = sshbuf_reserve(a0, *(&v0) + v1 + 4, &v4, *(&v0) + v1 + 4);
if (v2 < 0) {
v7 = v2;
} else {
v3 = v1 + *(&v0);
*(v4) = v3 >> 24;
*((v4 + 1)) = v3 >> 16;
*((v4 + 2)) = v3 >> 8;
*((v4 + 3)) = v3;
if (v1)
*((v4 + 4)) = 0;
if (*(&v0))
memcpy(v4 + v1 + 4, v5, *(&v0));
v7 = 0;
}
}
return v7;
}
|
cv_search(EditLine *el, int dir)
{
wchar_t ch;
wchar_t tmpbuf[((size_t)1024)];
ssize_t tmplen;
tmpbuf[0] = '.';
tmpbuf[1] = '*';
tmplen = 2;
el->el_search.patdir = dir;
tmplen = c_gets(el, &tmpbuf[2],
dir == 24 ? L"\n/" : L"\n?" );
if (tmplen == -1)
return 4;
tmplen += 2;
ch = tmpbuf[tmplen];
tmpbuf[tmplen] = '\0';
if (tmplen == 2) {
if (el->el_search.patlen == 0) {
re_refresh(el);
return 6;
}
if (el->el_search.patbuf[0] != '.' &&
el->el_search.patbuf[0] != '*') {
(void) wcsncpy(tmpbuf, el->el_search.patbuf,
sizeof(tmpbuf) / sizeof(*tmpbuf) - 1);
el->el_search.patbuf[0] = '.';
el->el_search.patbuf[1] = '*';
(void) wcsncpy(&el->el_search.patbuf[2], tmpbuf,
((size_t)1024) - 3);
el->el_search.patlen++;
el->el_search.patbuf[el->el_search.patlen++] = '.';
el->el_search.patbuf[el->el_search.patlen++] = '*';
el->el_search.patbuf[el->el_search.patlen] = '\0';
}
} else {
tmpbuf[tmplen++] = '.';
tmpbuf[tmplen++] = '*';
tmpbuf[tmplen] = '\0';
(void) wcsncpy(el->el_search.patbuf, tmpbuf, ((size_t)1024) - 1);
el->el_search.patlen = (size_t)tmplen;
}
el->el_state.lastcmd = (el_action_t) dir;
el->el_line.cursor = el->el_line.lastchar = el->el_line.buffer;
if ((dir == 24 ? ed_search_prev_history(el, 0) :
ed_search_next_history(el, 0)) == 6) {
re_refresh(el);
return 6;
}
if (ch == 0033) {
re_refresh(el);
return ed_newline(el, 0);
}
return 4;
}
| undefined8 cv_search(long param_1,int param_2)
{
wchar_t wVar1;
long lVar2;
char cVar3;
int iVar4;
undefined *puVar5;
long lVar6;
undefined8 uVar7;
long in_FS_OFFSET;
wchar_t local_1018 [2];
undefined local_1010 [4096];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_1018[0] = L'.';
local_1018[1] = 0x2a;
*(int *)(param_1 + 0x4a8) = param_2;
if (param_2 == 0x18) {
puVar5 = &DAT_00101464;
}
else {
puVar5 = &DAT_00101470;
}
iVar4 = c_gets(param_1,local_1010,puVar5);
lVar6 = (long)iVar4;
if (lVar6 == -1) {
uVar7 = 4;
}
else {
lVar2 = lVar6 + 2;
wVar1 = local_1018[lVar2];
local_1018[lVar2] = L'\0';
if (lVar2 == 2) {
if (*(long *)(param_1 + 0x4a0) == 0) {
re_refresh(param_1);
uVar7 = 6;
goto LAB_00101061;
}
if ((**(int **)(param_1 + 0x498) != 0x2e) && (**(int **)(param_1 + 0x498) != 0x2a)) {
wcsncpy(local_1018,*(wchar_t **)(param_1 + 0x498),0x3ff);
**(undefined4 **)(param_1 + 0x498) = 0x2e;
*(undefined4 *)(*(long *)(param_1 + 0x498) + 4) = 0x2a;
wcsncpy((wchar_t *)(*(long *)(param_1 + 0x498) + 8),local_1018,0x3fd);
*(long *)(param_1 + 0x4a0) = *(long *)(param_1 + 0x4a0) + 1;
lVar6 = *(long *)(param_1 + 0x4a0);
*(long *)(param_1 + 0x4a0) = lVar6 + 1;
*(undefined4 *)(lVar6 * 4 + *(long *)(param_1 + 0x498)) = 0x2e;
lVar6 = *(long *)(param_1 + 0x4a0);
*(long *)(param_1 + 0x4a0) = lVar6 + 1;
*(undefined4 *)(lVar6 * 4 + *(long *)(param_1 + 0x498)) = 0x2a;
*(undefined4 *)(*(long *)(param_1 + 0x4a0) * 4 + *(long *)(param_1 + 0x498)) = 0;
}
}
else {
local_1018[lVar2] = L'.';
local_1018[lVar6 + 3] = L'*';
local_1018[lVar6 + 4] = L'\0';
wcsncpy(*(wchar_t **)(param_1 + 0x498),local_1018,0x3ff);
*(long *)(param_1 + 0x4a0) = lVar6 + 4;
}
*(char *)(param_1 + 0x80) = (char)param_2;
*(undefined8 *)(param_1 + 0x60) = *(undefined8 *)(param_1 + 0x50);
*(undefined8 *)(param_1 + 0x58) = *(undefined8 *)(param_1 + 0x60);
if (param_2 == 0x18) {
cVar3 = ed_search_prev_history(param_1,0);
}
else {
cVar3 = ed_search_next_history(param_1,0);
}
if (cVar3 == '\x06') {
re_refresh(param_1);
uVar7 = 6;
}
else if (wVar1 == L'\x1b') {
re_refresh(param_1);
uVar7 = ed_newline(param_1,0);
}
else {
uVar7 = 4;
}
}
LAB_00101061:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar7;
}
|
static void
clear_line_control (struct line *p)
{
p->used = 0;
p->insert_index = 0;
p->retrieve_index = 0;
}
| _QWORD * clear_line_control(_QWORD *a1)
{
_QWORD *result;
*a1 = 0LL;
a1[1] = 0LL;
result = a1;
a1[2] = 0LL;
return result;
}
|
static int show_handler(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
print_route(n,
stdout
);
return 0;
}
| long show_handler(long a1, unsigned int *a2)
{
print_route(a2, stdout);
return 0LL;
}
|
static void
session_close_single_x11(struct ssh *ssh, int id, void *arg)
{
Session *s;
u_int i;
sshlog("session.c", __func__, 2343, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "channel %d", id);
channel_cancel_cleanup(ssh, id);
if ((s = session_by_x11_channel(id)) ==
((void *)0)
)
sshfatal("session.c", __func__, 2346, 1, SYSLOG_LEVEL_FATAL,
((void *)0)
, "no x11 channel %d", id);
for (i = 0; s->x11_chanids[i] != -1; i++) {
sshlog("session.c", __func__, 2348, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "session %d: closing channel %d", s->self, s->x11_chanids[i])
;
if (s->x11_chanids[i] != id)
session_close_x11(ssh, s->x11_chanids[i]);
}
free(s->x11_chanids);
s->x11_chanids =
((void *)0)
;
free(s->display);
s->display =
((void *)0)
;
free(s->auth_proto);
s->auth_proto =
((void *)0)
;
free(s->auth_data);
s->auth_data =
((void *)0)
;
free(s->auth_display);
s->auth_display =
((void *)0)
;
}
| void session_close_single_x11(undefined8 param_1,uint param_2,undefined8 param_3)
{
uint uVar1;
undefined4 uVar2;
void *pvVar3;
char **ppcVar4;
char *pcStack72;
ulong uStack64;
undefined auStack56 [8];
undefined8 local_30;
uint local_24;
undefined8 local_20;
uint local_14;
long local_10;
uStack64 = (ulong)param_2;
pcStack72 = "channel %d";
local_30 = param_3;
local_24 = param_2;
local_20 = param_1;
sshlog("session.c","session_close_single_x11",0x927,1,7,0);
ppcVar4 = (char **)auStack56;
uStack64 = 0x10603f;
channel_cancel_cleanup(local_20,local_24);
uStack64 = 0x106049;
local_10 = session_by_x11_channel(local_24);
if (local_10 == 0) {
uStack64 = (ulong)local_24;
ppcVar4 = &pcStack72;
pcStack72 = "no x11 channel %d";
sshfatal("session.c","session_close_single_x11",0x92a,1,1,0);
}
local_14 = 0;
while (*(int *)(*(long *)(local_10 + 0xc0) + (ulong)local_14 * 4) != -1) {
uVar1 = *(uint *)(local_10 + 4);
*(ulong *)((long)ppcVar4 + -0x10) =
(ulong)*(uint *)(*(long *)(local_10 + 0xc0) + (ulong)local_14 * 4);
*(ulong *)((long)ppcVar4 + -0x18) = (ulong)uVar1;
*(char **)((long)ppcVar4 + -0x20) = "session %d: closing channel %d";
*(undefined8 *)((long)ppcVar4 + -0x28) = 0x1060f4;
sshlog("session.c","session_close_single_x11",0x92c,1,5,0);
if (local_24 != *(uint *)(*(long *)(local_10 + 0xc0) + (ulong)local_14 * 4)) {
uVar2 = *(undefined4 *)(*(long *)(local_10 + 0xc0) + (ulong)local_14 * 4);
*(undefined8 *)((long)ppcVar4 + -8) = 0x106139;
session_close_x11(local_20,uVar2);
}
local_14 = local_14 + 1;
}
pvVar3 = *(void **)(local_10 + 0xc0);
*(undefined8 *)((long)ppcVar4 + -8) = 0x106170;
free(pvVar3);
*(undefined8 *)(local_10 + 0xc0) = 0;
pvVar3 = *(void **)(local_10 + 0x90);
*(undefined8 *)((long)ppcVar4 + -8) = 0x106192;
free(pvVar3);
*(undefined8 *)(local_10 + 0x90) = 0;
pvVar3 = *(void **)(local_10 + 0xa8);
*(undefined8 *)((long)ppcVar4 + -8) = 0x1061b4;
free(pvVar3);
*(undefined8 *)(local_10 + 0xa8) = 0;
pvVar3 = *(void **)(local_10 + 0xb0);
*(undefined8 *)((long)ppcVar4 + -8) = 0x1061d6;
free(pvVar3);
*(undefined8 *)(local_10 + 0xb0) = 0;
pvVar3 = *(void **)(local_10 + 0xa0);
*(undefined8 *)((long)ppcVar4 + -8) = 0x1061f8;
free(pvVar3);
*(undefined8 *)(local_10 + 0xa0) = 0;
return;
}
|
int
ssh_ecdsa_sign(const struct sshkey *key, u_char **sigp, size_t *lenp,
const u_char *data, size_t datalen, u_int compat)
{
ECDSA_SIG *sig =
((void *)0)
;
const BIGNUM *sig_r, *sig_s;
int hash_alg;
u_char digest[64];
size_t len, dlen;
struct sshbuf *b =
((void *)0)
, *bb =
((void *)0)
;
int ret = -1;
if (lenp !=
((void *)0)
)
*lenp = 0;
if (sigp !=
((void *)0)
)
*sigp =
((void *)0)
;
if (key ==
((void *)0)
|| key->ecdsa ==
((void *)0)
||
sshkey_type_plain(key->type) != KEY_ECDSA)
return -10;
if ((hash_alg = sshkey_ec_nid_to_hash_alg(key->ecdsa_nid)) == -1 ||
(dlen = ssh_digest_bytes(hash_alg)) == 0)
return -1;
if ((ret = ssh_digest_memory(hash_alg, data, datalen,
digest, sizeof(digest))) != 0)
goto out;
if ((sig = ECDSA_do_sign(digest, dlen, key->ecdsa)) ==
((void *)0)
) {
ret = -22;
goto out;
}
if ((bb = sshbuf_new()) ==
((void *)0)
|| (b = sshbuf_new()) ==
((void *)0)
) {
ret = -2;
goto out;
}
ECDSA_SIG_get0(sig, &sig_r, &sig_s);
if ((ret = sshbuf_put_bignum2(bb, sig_r)) != 0 ||
(ret = sshbuf_put_bignum2(bb, sig_s)) != 0)
goto out;
if ((ret = sshbuf_put_cstring(b, sshkey_ssh_name_plain(key))) != 0 ||
(ret = sshbuf_put_stringb(b, bb)) != 0)
goto out;
len = sshbuf_len(b);
if (sigp !=
((void *)0)
) {
if ((*sigp = malloc(len)) ==
((void *)0)
) {
ret = -2;
goto out;
}
memcpy(*sigp, sshbuf_ptr(b), len);
}
if (lenp !=
((void *)0)
)
*lenp = len;
ret = 0;
out:
explicit_bzero(digest, sizeof(digest));
sshbuf_free(b);
sshbuf_free(bb);
ECDSA_SIG_free(sig);
return ret;
}
| long ssh_ecdsa_sign(unsigned int *a1, void **a2, size_t *a3, long a4, long a5)
{
long v6;
const void *v7;
unsigned int v11;
unsigned int v12;
long v13;
long v14;
long v15;
long v16;
long v17;
long v18;
size_t size;
char v20[72];
unsigned long v21;
v21 = __readfsqword(0x28u);
v15 = 0LL;
v16 = 0LL;
v17 = 0LL;
if ( a3 )
*a3 = 0LL;
if ( a2 )
*a2 = 0LL;
if ( !a1 || !*((_QWORD *)a1 + 4) || (unsigned int)sshkey_type_plain(*a1) != 2 )
return 4294967286LL;
v12 = sshkey_ec_nid_to_hash_alg(a1[6]);
if ( v12 == -1 )
return 0xFFFFFFFFLL;
v18 = ssh_digest_bytes(v12);
if ( !v18 )
return 0xFFFFFFFFLL;
v11 = ssh_digest_memory(v12, a4, a5, v20, 64LL);
if ( !v11 )
{
v15 = ECDSA_do_sign(v20, (unsigned int)v18, *((_QWORD *)a1 + 4));
if ( v15 )
{
v17 = sshbuf_new();
if ( v17 )
{
v16 = sshbuf_new();
if ( v16 )
{
ECDSA_SIG_get0(v15, &v13, &v14);
v11 = sshbuf_put_bignum2(v17, v13);
if ( v11 )
goto LABEL_29;
v11 = sshbuf_put_bignum2(v17, v14);
if ( v11 )
goto LABEL_29;
v6 = sshkey_ssh_name_plain(a1);
v11 = sshbuf_put_cstring(v16, v6);
if ( v11 )
goto LABEL_29;
v11 = sshbuf_put_stringb(v16, v17);
if ( v11 )
goto LABEL_29;
size = sshbuf_len(v16);
if ( a2 )
{
*a2 = malloc(size);
if ( !*a2 )
{
v11 = -2;
goto LABEL_29;
}
v7 = (const void *)sshbuf_ptr(v16);
memcpy(*a2, v7, size);
}
if ( a3 )
*a3 = size;
v11 = 0;
goto LABEL_29;
}
}
v11 = -2;
}
else
{
v11 = -22;
}
}
LABEL_29:
explicit_bzero(v20, 64LL);
sshbuf_free(v16);
sshbuf_free(v17);
ECDSA_SIG_free(v15);
return v11;
}
|
static void xfrm_stats_print(struct xfrm_stats *s, FILE *fp,
const char *prefix)
{
if (prefix)
fputs(prefix, fp);
fprintf(fp, "stats:%s", _SL_);
if (prefix)
fputs(prefix, fp);
fprintf(fp, " replay-window %u replay %u failed %u%s",
s->replay_window, s->replay, s->integrity_failed, _SL_);
}
| void xfrm_stats_print(uint *param_1,FILE *param_2,char *param_3)
{
if (param_3 != (char *)0x0) {
fputs(param_3,param_2);
}
fprintf(param_2,"stats:%s",_SL_);
if (param_3 != (char *)0x0) {
fputs(param_3,param_2);
}
fprintf(param_2," replay-window %u replay %u failed %u%s",(ulong)*param_1,(ulong)param_1[1],
(ulong)param_1[2],_SL_);
return;
}
|
const char *
cipher_warning_message(const struct sshcipher_ctx *cc)
{
if (cc ==
((void *)0)
|| cc->cipher ==
((void *)0)
)
return
((void *)0)
;
return
((void *)0)
;
}
| long long cipher_warning_message(struct_0 *a0) {
if (!a0) {
LABEL_4003b5:
} else if (!a0->field_120) {
goto LABEL_4003b5;
}
return 0;
}
|
int
ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl,
const struct sshkey *ca_key, u_int64_t lo, u_int64_t hi)
{
struct revoked_certs *rc;
int r;
if (lo > hi || lo == 0)
return -10;
if ((r = revoked_certs_for_ca_key(krl, ca_key, &rc, 1)) != 0)
return r;
return insert_serial_range(&rc->revoked_serials, lo, hi);
}
| int ssh_krl_revoke_cert_by_serial_range(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3) {
unsigned int v0;
char v1;
unsigned int v3;
if (a2 > a3) {
v3 = -10;
return v3;
} else if (!a2) {
v3 = -10;
return v3;
} else {
v0 = revoked_certs_for_ca_key(a0, a1, &v1, 0x1);
if (v0) {
v3 = v0;
return v3;
}
v3 = insert_serial_range(*(&v1) + 8, a2, a3);
return v3;
}
}
|
static void usage (int status)
{
(void)
fputs (gettext ("Usage: su [options] [-] [username [args]]\n" "\n" "Options:\n" " -c, --command COMMAND pass COMMAND to the invoked shell\n" " -h, --help display this help message and exit\n" " -, -l, --login make the shell a login shell\n" " -m, -p,\n" " --preserve-environment do not reset environment variables, and\n" " keep the same shell\n" " -s, --shell SHELL use SHELL instead of the default in passwd\n" "\n" "If no username is given, assume root.\n")
, (
0
!= status) ?
stderr
:
stdout
);
exit (status);
}
| void usage(int a1)
{
FILE *v1;
char *v2;
if ( a1 )
v1 = stderr;
else
v1 = stdout;
v2 = gettext(
"Usage: su [options] [-] [username [args]]\n"
"\n"
"Options:\n"
" -c, --command COMMAND pass COMMAND to the invoked shell\n"
" -h, --help display this help message and exit\n"
" -, -l, --login make the shell a login shell\n"
" -m, -p,\n"
" --preserve-environment do not reset environment variables, and\n"
" keep the same shell\n"
" -s, --shell SHELL use SHELL instead of the default in passwd\n"
"\n"
"If no username is given, assume root.\n");
fputs(v2, v1);
exit(a1);
}
|
int
add_host_to_hostfile(const char *filename, const char *host,
const struct sshkey *key, int store_hash)
{
FILE *f;
int success;
if (key ==
((void *)0)
)
return 1;
hostfile_create_user_ssh_dir(filename, 0);
f = fopen(filename, "a");
if (!f)
return 0;
success = write_host_entry(f, host,
((void *)0)
, key, store_hash);
fclose(f);
return success;
}
| undefined4 add_host_to_hostfile(char *param_1,undefined8 param_2,long param_3,undefined4 param_4)
{
undefined4 uVar1;
FILE *__stream;
if (param_3 == 0) {
uVar1 = 1;
}
else {
hostfile_create_user_ssh_dir(param_1,0);
__stream = fopen(param_1,"a");
if (__stream == (FILE *)0x0) {
uVar1 = 0;
}
else {
uVar1 = write_host_entry(__stream,param_2,0,param_3,param_4);
fclose(__stream);
}
}
return uVar1;
}
|
int ask_yn(e2fsck_t ctx, const char * string, int def)
{
int c;
const char *defstr;
const char *short_yes = (gettext ("yY"));
const char *short_no = (gettext ("nN"));
const char *short_yesall = (gettext ("aA"));
const char *english_yes = "yY";
const char *english_no = "nN";
const char *english_yesall = "aA";
const char *yesall_prompt = (gettext (" ('a' enables 'yes' to all) "));
const char *extra_prompt = "";
static int yes_answers;
struct termios termios, tmp;
if (tcgetattr (0, &termios) < 0)
memset(&termios, 0, sizeof(termios));
tmp = termios;
tmp.c_lflag &= ~(
0000002
|
0000010
);
tmp.c_cc[
6
] = 1;
tmp.c_cc[
5
] = 0;
tcsetattr (0,
0
, &tmp);
if (def == 1)
defstr = (gettext ((gettext ("<y>"))));
else if (def == 0)
defstr = (gettext ((gettext ("<n>"))));
else
defstr = (gettext (" (y/n)"));
if (yes_answers > 12)
yes_answers = -1;
else if (yes_answers > 8)
extra_prompt = yesall_prompt;
log_out(ctx, "%s%s%s? ", string, extra_prompt, defstr);
while (1) {
fflush (
stdout
);
if ((c = read_a_char()) ==
(-1)
)
break;
if (c == 3) {
tcsetattr (0,
0
, &termios);
if (ctx->flags & 0x0010) {
log_out(ctx, "\n");
longjmp(e2fsck_global_ctx->abort_loc, 1);
}
log_out(ctx, "%s", (gettext ("cancelled!\n")));
yes_answers = 0;
return 0;
}
if (strchr(short_yes, (char) c)) {
do_yes:
def = 1;
if (yes_answers >= 0)
yes_answers++;
break;
} else if (strchr(short_no, (char) c)) {
do_no:
def = 0;
yes_answers = -1;
break;
} else if (strchr(short_yesall, (char)c)) {
do_all:
def = 2;
yes_answers = -1;
ctx->options |= 0x0004;
break;
} else if (strchr(english_yes, (char) c)) {
goto do_yes;
} else if (strchr(english_no, (char) c)) {
goto do_no;
} else if (strchr(english_yesall, (char) c)) {
goto do_all;
} else if ((c == 27 || c == ' ' || c == '\n') && (def != -1)) {
yes_answers = -1;
break;
}
}
if (def == 2)
log_out(ctx, "%s", (gettext ("yes to all\n")));
else if (def)
log_out(ctx, "%s", (gettext ("yes\n")));
else
log_out(ctx, "%s", (gettext ("no\n")));
tcsetattr (0,
0
, &termios);
return def;
}
| int ask_yn(long param_1,undefined8 param_2,int param_3)
{
char cVar1;
int iVar2;
char *__s;
char *__s_00;
char *__s_01;
undefined *puVar3;
undefined8 uVar4;
char *pcVar5;
long in_FS_OFFSET;
int local_fc;
undefined8 local_e0;
undefined *local_d8;
undefined8 local_98;
ulong local_90;
undefined8 local_88;
undefined8 local_80;
undefined8 local_78;
undefined8 local_70;
undefined8 local_68;
speed_t local_60;
undefined8 local_58;
ulong local_50;
undefined8 local_48;
undefined8 local_40;
undefined8 local_38;
undefined8 local_30;
undefined8 local_28;
speed_t local_20;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
__s = (char *)gettext(&DAT_00102579);
__s_00 = (char *)gettext(&DAT_0010257c);
__s_01 = (char *)gettext(&DAT_0010257f);
puVar3 = (undefined *)gettext(" (\'a\' enables \'yes\' to all) ");
local_d8 = &DAT_0010259f;
iVar2 = tcgetattr(0,(termios *)&local_98);
if (iVar2 < 0) {
memset(&local_98,0,0x3c);
}
local_58 = local_98;
local_40 = local_80;
local_38 = local_78;
local_30 = local_70;
local_28 = local_68;
local_20 = local_60;
local_50 = local_90 & 0xfffffff5ffffffff;
local_48._0_7_ = (uint7)local_88;
local_48._0_7_ = (uint7)local_48 & 0xffffffffffff;
local_48 = CONCAT17(1,(uint7)local_48);
tcsetattr(0,0,(termios *)&local_58);
if (param_3 == 1) {
uVar4 = gettext(&DAT_001025a0);
local_e0 = gettext(uVar4);
}
else if (param_3 == 0) {
uVar4 = gettext(&DAT_001025a4);
local_e0 = gettext(uVar4);
}
else {
local_e0 = gettext(" (y/n)");
}
if (yes_answers_9647 < 0xd) {
if (8 < yes_answers_9647) {
local_d8 = puVar3;
}
}
else {
yes_answers_9647 = -1;
}
log_out(param_1,"%s%s%s? ",param_2,local_d8,local_e0);
do {
fflush(stdout);
iVar2 = read_a_char();
local_fc = param_3;
if (iVar2 == -1) goto LAB_00100a80;
if (iVar2 == 3) {
tcsetattr(0,0,(termios *)&local_98);
if ((*(uint *)(param_1 + 0x48) & 0x10) != 0) {
log_out(param_1,&DAT_001025b8);
longjmp((__jmp_buf_tag *)(e2fsck_global_ctx + 0x90),1);
}
uVar4 = gettext("cancelled!\n");
log_out(param_1,&DAT_001025c6,uVar4);
yes_answers_9647 = 0;
local_fc = 0;
goto LAB_00100b33;
}
cVar1 = (char)iVar2;
pcVar5 = strchr(__s,(int)cVar1);
if (pcVar5 != (char *)0x0) {
LAB_0010091e:
local_fc = 1;
if (-1 < yes_answers_9647) {
yes_answers_9647 = yes_answers_9647 + 1;
}
goto LAB_00100a80;
}
pcVar5 = strchr(__s_00,(int)cVar1);
if (pcVar5 != (char *)0x0) {
LAB_0010096d:
local_fc = 0;
yes_answers_9647 = -1;
goto LAB_00100a80;
}
pcVar5 = strchr(__s_01,(int)cVar1);
if (pcVar5 != (char *)0x0) {
LAB_001009a9:
local_fc = 2;
yes_answers_9647 = -1;
*(uint *)(param_1 + 0x4c) = *(uint *)(param_1 + 0x4c) | 4;
goto LAB_00100a80;
}
pcVar5 = strchr("yY",(int)cVar1);
if (pcVar5 != (char *)0x0) goto LAB_0010091e;
pcVar5 = strchr("nN",(int)cVar1);
if (pcVar5 != (char *)0x0) goto LAB_0010096d;
pcVar5 = strchr("aA",(int)cVar1);
if (pcVar5 != (char *)0x0) goto LAB_001009a9;
} while ((((iVar2 != 0x1b) && (iVar2 != 0x20)) && (iVar2 != 10)) || (param_3 == -1));
yes_answers_9647 = -1;
LAB_00100a80:
if (local_fc == 2) {
uVar4 = gettext("yes to all\n");
log_out(param_1,&DAT_001025c6,uVar4);
}
else if (local_fc == 0) {
uVar4 = gettext(&DAT_001025da);
log_out(param_1,&DAT_001025c6,uVar4);
}
else {
uVar4 = gettext(&DAT_001025d5);
log_out(param_1,&DAT_001025c6,uVar4);
}
tcsetattr(0,0,(termios *)&local_98);
LAB_00100b33:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_fc;
}
__stack_chk_fail();
}
|
static void usage (void)
{
fprintf (
stderr
, gettext ("Usage: %s [-p] [name]\n"), Prog);
if (!amroot) {
exit (1);
}
fprintf (
stderr
, gettext (" %s [-p] [-h host] [-f name]\n"), Prog);
exit (1);
}
| void usage(void)
{
undefined8 uVar1;
char *pcVar2;
uVar1 = Prog;
pcVar2 = (char *)gettext("Usage: %s [-p] [name]\n");
fprintf(stderr,pcVar2,uVar1);
uVar1 = Prog;
if (amroot != '\x01') {
exit(1);
}
pcVar2 = (char *)gettext(" %s [-p] [-h host] [-f name]\n");
fprintf(stderr,pcVar2,uVar1);
exit(1);
}
|
char *
readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
{
ssize_t nr;
int input, output, save_errno, i, need_restart;
char ch, *p, *end;
struct termios term, oterm;
struct sigaction sa, savealrm, saveint, savehup, savequit, saveterm;
struct sigaction savetstp, savettin, savettou, savepipe;
if (bufsiz == 0) {
(*__errno_location ())
=
22
;
return(
((void *)0)
);
}
restart:
for (i = 0; i <
(64 + 1)
; i++)
signo[i] = 0;
nr = -1;
save_errno = 0;
need_restart = 0;
if ((flags &
0x20
) ||
(input = output = open(
"/dev/tty"
,
02
)) == -1) {
if (flags &
0x02
) {
(*__errno_location ())
=
25
;
return(
((void *)0)
);
}
input =
0
;
output =
2
;
}
if (input !=
0
&& tcgetattr(input, &oterm) == 0) {
memcpy(&term, &oterm, sizeof(term));
if (!(flags &
0x01
))
term.c_lflag &= ~(
0000010
|
0000100
);
(void)tcsetattr(input,
2
|0, &term);
} else {
memset(&term, 0, sizeof(term));
term.c_lflag |=
0000010
;
memset(&oterm, 0, sizeof(oterm));
oterm.c_lflag |=
0000010
;
}
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sa.
__sigaction_handler.sa_handler
= handler;
(void)sigaction(
14
, &sa, &savealrm);
(void)sigaction(
1
, &sa, &savehup);
(void)sigaction(
2
, &sa, &saveint);
(void)sigaction(
13
, &sa, &savepipe);
(void)sigaction(
3
, &sa, &savequit);
(void)sigaction(
15
, &sa, &saveterm);
(void)sigaction(
20
, &sa, &savetstp);
(void)sigaction(
21
, &sa, &savettin);
(void)sigaction(
22
, &sa, &savettou);
if (!(flags &
0x20
))
(void)write(output, prompt, strlen(prompt));
end = buf + bufsiz - 1;
p = buf;
while ((nr = read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r') {
if (p < end) {
if ((flags &
0x10
))
ch &= 0x7f;
if (
((*__ctype_b_loc ())[(int) ((
(unsigned char)ch
))] & (unsigned short int) _ISalpha)
) {
if ((flags &
0x04
))
ch = (char)tolower((unsigned char)ch);
if ((flags &
0x08
))
ch = (char)toupper((unsigned char)ch);
}
*p++ = ch;
}
}
*p = '\0';
save_errno =
(*__errno_location ())
;
if (!(term.c_lflag &
0000010
))
(void)write(output, "\n", 1);
if (memcmp(&term, &oterm, sizeof(term)) != 0) {
const int sigttou = signo[
22
];
while (tcsetattr(input,
2
|0, &oterm) == -1 &&
(*__errno_location ())
==
4
&& !signo[
22
])
continue;
signo[
22
] = sigttou;
}
(void)sigaction(
14
, &savealrm,
((void *)0)
);
(void)sigaction(
1
, &savehup,
((void *)0)
);
(void)sigaction(
2
, &saveint,
((void *)0)
);
(void)sigaction(
3
, &savequit,
((void *)0)
);
(void)sigaction(
13
, &savepipe,
((void *)0)
);
(void)sigaction(
15
, &saveterm,
((void *)0)
);
(void)sigaction(
20
, &savetstp,
((void *)0)
);
(void)sigaction(
21
, &savettin,
((void *)0)
);
(void)sigaction(
22
, &savettou,
((void *)0)
);
if (input !=
0
)
(void)close(input);
for (i = 0; i <
(64 + 1)
; i++) {
if (signo[i]) {
kill(getpid(), i);
switch (i) {
case
20
:
case
21
:
case
22
:
need_restart = 1;
}
}
}
if (need_restart)
goto restart;
if (save_errno)
(*__errno_location ())
= save_errno;
return(nr == -1 ?
((void *)0)
: buf);
}
| long long readpassphrase(void* a0, unsigned long long a1, unsigned long a2, unsigned long a3) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
char *v7;
unsigned long long v8;
unsigned long v9;
char v10;
unsigned int v11;
char v12;
unsigned int v13;
unsigned long long v14;
char v15;
unsigned int v16;
char v17;
char v18;
char v19;
char v20;
char v21;
char v22;
char v23;
char v24;
char v25;
unsigned int v28;
char *v29;
void* v30;
if (!a2) {
*(__errno_location()) = 22;
v30 = 0;
return v30;
}
do {
for (v3 = 0; v3 <= 64; v3 += 1) {
signo[v3] = 0;
}
v8 = -1;
v5 = 0;
v4 = 0;
if ((a3 & 32) || (v2 = open("/dev/tty", 0x2, (v3 * 4)), v1 = v2, v1 == -1)) {
if (!(a3 & 2)) {
v1 = 0;
v2 = 2;
} else {
*(__errno_location()) = 25;
v30 = 0;
return v30;
}
}
if (!v1 || tcgetattr(v1, &v12)) {
memset(&v10, 0x0, 0x3c);
v11 = *(&v11) | 8;
memset(&v12, 0x0, 0x3c);
v13 = *(&v13) | 8;
} else {
memcpy(&v10, &v12, 0x3c);
if (!(a3 & 1))
v11 &= -73;
tcsetattr(v1, 0x2, &v10);
}
sigemptyset(&v15);
v16 = 0;
v14 = handler;
sigaction(0xe, &v14, &v17);
sigaction(0x1, &v14, &v19);
sigaction(0x2, &v14, &v18);
sigaction(0xd, &v14, &v25);
sigaction(0x3, &v14, &v20);
sigaction(0xf, &v14, &v21);
sigaction(0x14, &v14, &v22);
sigaction(0x15, &v14, &v23);
sigaction(0x16, &v14, &v24);
if (!(a3 & 32))
write(v2, a0, strlen(a0));
v9 = a1 + a2 - 1;
v7 = a1;
while (true) {
v8 = read(v1, &v0, 0x1);
if (v8 == 1)
goto LABEL_40045a;
else
goto LABEL_400474;
LABEL_40045a:
switch (v0) {
case 10: case 13:
LABEL_400474:
*(v7) = 0;
v5 = *(__errno_location());
if (!(v11 & 8))
write(v2, "\n", 0x1);
if (memcmp(&v10, &v12, 0x3c)) {
v6 = g_400758;
while (true) {
if (tcsetattr(v1, 0x2, &v12) != -1)
break;
*(&v29) = *(__errno_location());
if (!(v29 == 4) || !(!g_400758))
break;
if (g_400758)
break;
}
g_400758 = v6;
}
sigaction(0xe, &v17, 0x0);
sigaction(0x1, &v19, 0x0);
sigaction(0x2, &v18, 0x0);
break;
default:
if (v7 < v9) {
if ((a3 & 16))
v0 &= 127;
v28 = *((*(__ctype_b_loc()) + v0 * 2)) & 0x400;
if (v28) {
if ((a3 & 4))
v0 = tolower(v0);
if ((a3 & 8))
v0 = toupper(v0);
}
v29 = v7;
v7 += 1;
*(v29) = v0;
continue;
}
}
}
sigaction(0x3, &v20, 0x0);
sigaction(0xd, &v25, 0x0);
sigaction(0xf, &v21, 0x0);
sigaction(0x14, &v22, 0x0);
sigaction(0x15, &v23, 0x0);
sigaction(0x16, &v24, 0x0);
if (v1)
close(v1);
for (v3 = 0; v3 <= 64; v3 += 1) {
if (signo[v3]) {
kill(getpid(), v3);
if (v3 - 20 <= 2)
v4 = 1;
}
}
} while (v4);
if (v5)
*(__errno_location()) = v5;
v30 = (v8 == -1 ? a1 : 0);
return v30;
}
|
static inline unsigned long int
select_plural (uintmax_t n)
{
enum { PLURAL_REDUCER = 1000000 };
return (n <=
(0x7fffffffffffffffL * 2UL + 1UL)
? n : n % PLURAL_REDUCER + PLURAL_REDUCER);
}
| long select_plural(long a1)
{
return a1;
}
|
void usage() {
fprintf(
stderr
, "Find the time of the next scheduled cron job.\n");
fprintf(
stderr
, "Usage:\n");
fprintf(
stderr
, " cronnext [options] [file ...]\n");
fprintf(
stderr
, "\n");
fprintf(
stderr
, "Options:\n");
fprintf(
stderr
, " -i users include only the crontab of these users\n");
fprintf(
stderr
, " -e users exclude the crontab of these users\n");
fprintf(
stderr
, " -s do not include the system crontab\n");
fprintf(
stderr
, " -a examine installed crontabs even if files are given\n");
fprintf(
stderr
, " -t time start from this time (seconds since epoch)\n");
fprintf(
stderr
, " -q time end check at this time (seconds since epoch)\n");
fprintf(
stderr
, " -j cmd only check jobs that contain cmd as a substring\n");
fprintf(
stderr
, " -l print next jobs to be executed\n");
fprintf(
stderr
, " -c print next execution of each job\n");
fprintf(
stderr
, " -f print all jobs executed in the given interval\n");
fprintf(
stderr
, " -h this help\n");
fprintf(
stderr
, " -V print version and exit\n");
}
| int usage()
{
fprintf(stderr, "Find the time of the next scheduled cron job.\n");
fprintf(stderr, "Usage:\n");
fprintf(stderr, " cronnext [options] [file ...]\n");
fprintf(stderr, "\n");
fprintf(stderr, "Options:\n");
fprintf(stderr, " -i users include only the crontab of these users\n");
fprintf(stderr, " -e users exclude the crontab of these users\n");
fprintf(stderr, " -s do not include the system crontab\n");
fprintf(stderr, " -a examine installed crontabs even if files are given\n");
fprintf(stderr, " -t time start from this time (seconds since epoch)\n");
fprintf(stderr, " -q time end check at this time (seconds since epoch)\n");
fprintf(stderr, " -j cmd only check jobs that contain cmd as a substring\n");
fprintf(stderr, " -l print next jobs to be executed\n");
fprintf(stderr, " -c print next execution of each job\n");
fprintf(stderr, " -f print all jobs executed in the given interval\n");
fprintf(stderr, " -h this help\n");
return fprintf(stderr, " -V print version and exit\n");
}
|
static u_int
agent_encode_alg(const struct sshkey *key, const char *alg)
{
if (alg !=
((void *)0)
&& sshkey_type_plain(key->type) == KEY_RSA) {
if (strcmp(alg, "rsa-sha2-256") == 0 ||
strcmp(alg, "rsa-sha2-256-cert-v01@openssh.com") == 0)
return 0x02;
if (strcmp(alg, "rsa-sha2-512") == 0 ||
strcmp(alg, "rsa-sha2-512-cert-v01@openssh.com") == 0)
return 0x04;
}
return 0;
}
| int agent_encode_alg(unsigned int *a0, char *a1) {
unsigned int v1;
if (!a1) {
v1 = 0;
return v1;
} else if (sshkey_type_plain(*(a0))) {
v1 = 0;
return v1;
} else if (!strcmp(a1, "rsa-sha2-256")) {
v1 = 2;
return v1;
} else if (!strcmp(a1, "rsa-sha2-256-cert-v01@openssh.com")) {
v1 = 2;
return v1;
} else if (!strcmp(a1, "rsa-sha2-512")) {
v1 = 4;
return v1;
} else if (!strcmp(a1, "rsa-sha2-512-cert-v01@openssh.com")) {
v1 = 4;
return v1;
} else {
v1 = 0;
return v1;
}
}
|
int xfrm_id_parse(xfrm_address_t *saddr, struct xfrm_id *id, __u16 *family,
int loose, int *argcp, char ***argvp)
{
int argc = *argcp;
char **argv = *argvp;
inet_prefix dst = {};
inet_prefix src = {};
while (1) {
if (strcmp(*argv, "src") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
get_prefix(&src, *argv, preferred_family);
if (src.family ==
0
)
invarg("value after \"src\" has an unrecognized address family", *argv);
if (family)
*family = src.family;
memcpy(saddr, &src.data, sizeof(*saddr));
filter.id_src_mask = src.bitlen;
} else if (strcmp(*argv, "dst") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
get_prefix(&dst, *argv, preferred_family);
if (dst.family ==
0
)
invarg("value after \"dst\" has an unrecognized address family", *argv);
if (family)
*family = dst.family;
memcpy(&id->daddr, &dst.data, sizeof(id->daddr));
filter.id_dst_mask = dst.bitlen;
} else if (strcmp(*argv, "proto") == 0) {
int ret;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
ret = xfrm_xfrmproto_getbyname(*argv);
if (ret < 0)
invarg("XFRM-PROTO value is invalid", *argv);
id->proto = (__u8)ret;
filter.id_proto_mask = (~0);
} else if (strcmp(*argv, "spi") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_be32(&id->spi, *argv, 0))
invarg("SPI value is invalid", *argv);
filter.id_spi_mask = (~0);
} else {
do { argv--; argc++; } while(0);
break;
}
if (!(argc - 1 > 0))
break;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
}
if (src.family && dst.family && (src.family != dst.family))
invarg("the same address family is required between values after \"src\" and \"dst\"", *argv);
if (id->spi && id->proto) {
if (xfrm_xfrmproto_is_ro(id->proto)) {
fprintf(
stderr
, "\"spi\" is invalid with XFRM-PROTO value \"%s\"\n",
strxf_xfrmproto(id->proto));
exit(1);
} else if (id->proto ==
IPPROTO_COMP
&& ntohl(id->spi) >= 0x10000) {
fprintf(
stderr
, "SPI value is too large with XFRM-PROTO value \"%s\"\n",
strxf_xfrmproto(id->proto));
exit(1);
}
}
if (loose == 0 && id->proto == 0)
missarg("XFRM-PROTO");
if (argc == *argcp)
missarg("ID");
*argcp = argc;
*argvp = argv;
return 0;
}
| long long xfrm_id_parse(void* a0, struct_1 *a1, unsigned short *a2, unsigned long a3, unsigned int *a4, unsigned long long *a5) {
unsigned int v0;
void* v1;
unsigned int v2;
unsigned int v3;
unsigned long long *v4;
void* v5;
char v6;
void* v7;
char v8;
unsigned long long v10;
unsigned long long *v11;
unsigned long v12;
unsigned long long *v13;
unsigned long long v14;
v1 = a0;
v0 = a3;
v2 = *(a4);
v4 = *(a5);
v10 = 33;
for (v11 = &v5; v10; v11 = &v11[v12]) {
v10 -= 1;
v5 = 0;
}
v14 = 33;
for (v13 = &v7; v14; v13 = &v13[v12]) {
v14 -= 1;
v7 = 0;
}
do {
if (!strcmp(*(v4), "src")) {
v4 = v4 + 1;
v2 -= 1;
if (v2 <= 0)
incomplete_command();
get_prefix(&v7, *(v4), *(&preferred_family), *(v4));
if (!*((&v7 + 6)))
invarg("value after \"src\" has an unrecognized address family", *(v4));
if (a2)
*(a2) = *((&v7 + 6));
memcpy(v1, &v8, 0x10);
g_400108 = *((&v7 + 4));
} else if (!strcmp(*(v4), "dst")) {
v4 = v4 + 1;
v2 -= 1;
if (v2 <= 0)
incomplete_command();
get_prefix(&v5, *(v4), *(&preferred_family), *(v4));
if (!*((&v5 + 6)))
invarg("value after \"dst\" has an unrecognized address family", *(v4));
if (a2)
*(a2) = *((&v5 + 6));
memcpy(a1, &v6, 0x10);
g_400109 = *((&v5 + 4));
} else if (!strcmp(*(v4), "proto")) {
v4 = v4 + 1;
v2 -= 1;
if (v2 <= 0)
incomplete_command();
v3 = xfrm_xfrmproto_getbyname(*(v4));
if (v3 < 0)
invarg("XFRM-PROTO value is invalid", *(v4));
a1->field_14 = v3;
g_40010a = 255;
} else if (!strcmp(*(v4), "spi")) {
v4 = v4 + 1;
v2 -= 1;
if (v2 <= 0)
incomplete_command();
if (get_be32(&a1->padding_0[16], *(v4), 0x0, &a1->padding_0[16]))
invarg("SPI value is invalid", *(v4));
g_40010c = -1;
} else {
v4 += 1;
v2 += 1;
goto LABEL_403d0b;
}
if (v2 <= 1)
goto LABEL_403d0b;
v4 = v4 + 1;
v2 -= 1;
} while (v2 > 0);
incomplete_command();
LABEL_403d0b:
if (*((&v7 + 6)) && *((&v5 + 6)) && *((&v7 + 6)) != *((&v5 + 6)))
invarg("the same address family is required between values after \"src\" and \"dst\"", *(v4));
if (*(&a1->padding_0[16]) && a1->field_14) {
if (xfrm_xfrmproto_is_ro(a1->field_14)) {
fprintf(*(&stderr), "\"spi\" is invalid with XFRM-PROTO value \"%s\"\n", strxf_xfrmproto(a1->field_14));
exit(0x1);
} else if (a1->field_14 == 108 && ntohl(*(&a1->padding_0[16])) > 65535) {
fprintf(*(&stderr), "SPI value is too large with XFRM-PROTO value \"%s\"\n", strxf_xfrmproto(a1->field_14));
exit(0x1);
}
}
if (!v0 && !a1->field_14)
missarg("XFRM-PROTO");
if (v2 == *(a4))
missarg("ID");
*(a4) = v2;
*(a5) = v4;
return 0;
}
|
int
sshkey_generate(int type, u_int bits, struct sshkey **keyp)
{
struct sshkey *k;
int ret = -1;
if (keyp ==
((void *)0)
)
return -10;
*keyp =
((void *)0)
;
if ((k = sshkey_new(KEY_UNSPEC)) ==
((void *)0)
)
return -2;
switch (type) {
case KEY_ED25519:
if ((k->ed25519_pk = malloc(32U)) ==
((void *)0)
||
(k->ed25519_sk = malloc(64U)) ==
((void *)0)
) {
ret = -2;
break;
}
crypto_sign_ed25519_keypair(k->ed25519_pk, k->ed25519_sk);
ret = 0;
break;
case KEY_DSA:
ret = dsa_generate_private_key(bits, &k->dsa);
break;
case KEY_ECDSA:
ret = ecdsa_generate_private_key(bits, &k->ecdsa_nid,
&k->ecdsa);
break;
case KEY_RSA:
ret = rsa_generate_private_key(bits, &k->rsa);
break;
default:
ret = -10;
}
if (ret == 0) {
k->type = type;
*keyp = k;
} else
sshkey_free(k);
return ret;
}
| long long sshkey_generate(unsigned long a0, unsigned long a1, unsigned long long *a2) {
unsigned int v0;
struct_0 *v1;
unsigned long long v3;
v0 = -1;
if (!a2) {
v3 = 4294967286;
} else {
*(a2) = 0;
v1 = sshkey_new(0xe);
if (!v1) {
v3 = 4294967294;
} else {
if (a0 == 3) {
v1->field_30 = malloc(0x20);
if (!v1->field_30) {
LABEL_403964:
v0 = -2;
} else {
v1->field_28 = malloc(0x40);
if (!v1->field_28)
goto LABEL_403964;
crypto_sign_ed25519_keypair(v1->field_30, v1->field_28, v1->field_28);
v0 = 0;
}
} else {
if (a0 <= 3) {
if (a0 == 2) {
v0 = ecdsa_generate_private_key(a1, &v1->padding_4[20], &v1->padding_4[28]);
goto LABEL_4039f1;
}
if (a0 <= 2) {
if (!a0) {
v0 = rsa_generate_private_key(a1, &v1->padding_4[4]);
goto LABEL_4039f1;
} else if (a0 == 1) {
v0 = dsa_generate_private_key(a1, &v1->padding_4[12]);
goto LABEL_4039f1;
}
}
}
v0 = -10;
}
LABEL_4039f1:
if (v0) {
sshkey_free(v1);
} else {
v1->field_0 = a0;
*(a2) = v1;
}
v3 = v0;
}
}
return v3;
}
|
static inline int
is_basic (char c)
{
return (is_basic_table [(unsigned char) c >> 5] >> ((unsigned char) c & 31))
& 1;
}
| int is_basic(unsigned long a0) {
return (*((4 * (a0 >> 5) + &is_basic_table)) >> (a0 & 31 & 31)) & 1;
}
|
static char const *
visible (cc_t ch)
{
static char buf[10];
char *bpout = buf;
if (ch ==
'\0'
)
return "<undef>";
if (ch >= 32)
{
if (ch < 127)
*bpout++ = ch;
else if (ch == 127)
{
*bpout++ = '^';
*bpout++ = '?';
}
else
{
*bpout++ = 'M';
*bpout++ = '-';
if (ch >= 128 + 32)
{
if (ch < 128 + 127)
*bpout++ = ch - 128;
else
{
*bpout++ = '^';
*bpout++ = '?';
}
}
else
{
*bpout++ = '^';
*bpout++ = ch - 128 + 64;
}
}
}
else
{
*bpout++ = '^';
*bpout++ = ch + 64;
}
*bpout = '\0';
return (char const *) buf;
}
| char * visible(byte param_1)
{
char *pcVar1;
undefined *local_10;
if (param_1 == 0) {
pcVar1 = "<undef>";
}
else {
if (param_1 < 0x20) {
buf_6240[0] = 0x5e;
buf_6240[1] = param_1 + 0x40;
local_10 = buf_6240 + 2;
}
else if (param_1 < 0x7f) {
local_10 = buf_6240 + 1;
buf_6240[0] = param_1;
}
else if (param_1 == 0x7f) {
buf_6240[0] = 0x5e;
local_10 = buf_6240 + 2;
buf_6240[1] = '?';
}
else {
buf_6240[0] = 0x4d;
buf_6240[1] = '-';
if (param_1 < 0xa0) {
buf_6240[2] = '^';
buf_6240[3] = param_1 - 0x40;
local_10 = buf_6240 + 4;
}
else if (param_1 == 0xff) {
buf_6240[2] = '^';
local_10 = buf_6240 + 4;
buf_6240[3] = '?';
}
else {
buf_6240[2] = param_1 + 0x80;
local_10 = buf_6240 + 3;
}
}
*local_10 = 0;
pcVar1 = buf_6240;
}
return pcVar1;
}
|
static const char *
sshkey_ssh_name_from_type_nid(int type, int nid)
{
const struct keytype *kt;
for (kt = keytypes; kt->type != -1; kt++) {
if (kt->type == type && (kt->nid == 0 || kt->nid == nid))
return kt->name;
}
return "ssh-unknown";
}
| int sshkey_ssh_name_from_type_nid(unsigned long a0, unsigned long a1) {
unsigned long long v0;
unsigned int v2;
v0 = &keytypes;
while (true) {
if (*((v0 + 24)) != -1) {
if (a0 == *((v0 + 24)) && (!*((v0 + 28)) || a1 == *((v0 + 28)))) {
v2 = *(v0);
break;
}
if (a0 != *((v0 + 24)) || *((v0 + 28)) && a1 != *((v0 + 28)))
v0 += 40;
} else {
v2 = &g_40bf5a;
break;
}
}
return v2;
}
|
int
strvec_strcmp (s1, s2)
register char **s1, **s2;
{
return (strcoll (*s1, *s2));
}
| long long strvec_strcmp(unsigned long long *a0, unsigned long long *a1) {
return strcoll(*(a0), *(a1));
}
|
void destroy_encryption_policy_map(e2fsck_t ctx)
{
struct encrypted_file_info *info = ctx->encrypted_files;
if (info) {
struct rb_root *policies = &info->policies;
while (!ext2fs_rb_empty_root(policies)) {
struct policy_map_entry *entry;
entry = ({ __typeof__( ((struct policy_map_entry *)0)->node ) *__mptr = (policies->rb_node); (struct policy_map_entry *)( (char *)__mptr -
__builtin_offsetof (
struct policy_map_entry
,
node
)
);})
;
ext2fs_rb_erase(&entry->node, policies);
ext2fs_free_mem(&entry);
}
info->next_policy_id = 0;
}
}
| void destroy_encryption_policy_map(struct_0 *a0) {
unsigned long v0;
struct_1 *v1;
unsigned long long *v2;
unsigned long v3;
char v4;
unsigned long long *v6;
unsigned long long v7;
v1 = a0->field_250;
if (v1) {
v2 = &v1->padding_0[24];
while (!ext2fs_rb_empty_root(v2)) {
v3 = *(v2);
v0 = v3 - 32;
ext2fs_rb_erase(v0 + 32, v2, v0 + 32);
ext2fs_free_mem(&v0);
}
v1->field_20 = 0;
}
v7 = *(&v4) ^ v6[5];
return;
}
|
static
_Bool
dumpdir_ok (char *dumpdir)
{
char *p;
int has_tempdir = 0;
int expect = 0;
for (p = dumpdir; *p; p += strlen (p) + 1)
{
if (expect && *p != expect)
{
unsigned char uc = *p;
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed dumpdir: expected '%c' but found %#3o"), expect, uc); exit_status = 2; } while (0)
;
return
0
;
}
switch (*p)
{
case 'X':
if (has_tempdir)
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed dumpdir: 'X' duplicated")); exit_status = 2; } while (0)
;
return
0
;
}
else
has_tempdir = 1;
break;
case 'R':
if (p[1] == 0)
{
if (!has_tempdir)
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed dumpdir: empty name in 'R'")); exit_status = 2; } while (0)
;
return
0
;
}
else
has_tempdir = 0;
}
expect = 'T';
break;
case 'T':
if (expect != 'T')
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed dumpdir: 'T' not preceded by 'R'")); exit_status = 2; } while (0)
;
return
0
;
}
if (p[1] == 0 && !has_tempdir)
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed dumpdir: empty name in 'T'")); exit_status = 2; } while (0)
;
return
0
;
}
expect = 0;
break;
case 'N':
case 'Y':
case 'D':
break;
default:
break;
}
}
if (expect)
{
do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed dumpdir: expected '%c' but found end of data"), expect); exit_status = 2; } while (0)
;
return
0
;
}
if (has_tempdir)
do { if ((warning_option & (0x00000002))) do { if (error_hook) error_hook (); error (0, 0, gettext ("Malformed dumpdir: 'X' never used")); } while (0); } while (0)
;
return
1
;
}
| int dumpdir_ok(char *a0) {
char v0;
unsigned int v1;
unsigned int v2;
char v3[2];
unsigned int v5;
v1 = 0;
v2 = 0;
for (*(&v3) = a0; v3[0]; *(&v3) = &v3[v5]) {
if (v2 && v2 != v3[0]) {
v0 = v3[0];
if (*(&error_hook))
*(5243072)();
error(0x0, 0x0, gettext("Malformed dumpdir: expected '%c' but found %#3o"));
exit_status = 2;
v5 = 0;
return v5;
}
switch (v3[0]) {
case 82:
if (!v3[1]) {
if (v1) {
v1 = 0;
} else {
if (*(&error_hook))
*(5243072)();
error(0x0, 0x0, gettext("Malformed dumpdir: empty name in 'R'"));
exit_status = 2;
v5 = 0;
return v5;
}
}
v2 = 84;
break;
case 84:
if (v2 != 84) {
if (*(&error_hook))
*(5243072)();
error(0x0, 0x0, gettext("Malformed dumpdir: 'T' not preceded by 'R'"));
exit_status = 2;
v5 = 0;
return v5;
}
if (!v3[1] && !v1) {
if (*(&error_hook))
*(5243072)();
error(0x0, 0x0, gettext("Malformed dumpdir: empty name in 'T'"));
exit_status = 2;
v5 = 0;
return v5;
}
v2 = 0;
break;
case 88:
if (!v1) {
v1 = 1;
break;
} else {
if (*(&error_hook))
*(5243072)();
error(0x0, 0x0, gettext("Malformed dumpdir: 'X' duplicated"));
exit_status = 2;
v5 = 0;
return v5;
}
default:
break;
}
v5 = strlen(v3) + 1;
}
if (v2) {
if (*(&error_hook))
*(5243072)();
error(0x0, 0x0, gettext("Malformed dumpdir: expected '%c' but found end of data"));
exit_status = 2;
v5 = 0;
return v5;
}
if (!v1) {
v5 = 1;
return v5;
} else if ((warning_option & 2)) {
if (*(&error_hook))
*(5243072)();
error(0x0, 0x0, gettext("Malformed dumpdir: 'X' never used"));
} else {
v5 = 1;
return v5;
}
v5 = 1;
return v5;
}
|
void
trigproc(struct pkginfo *pkg, enum trigproc_type type)
{
static struct varbuf namesarg;
struct varbuf depwhynot = { 0, 0,
((void *)0)
};
struct trigpend *tp;
struct pkginfo *gaveup;
debug(dbg_triggers, "trigproc %s", pkg_name(pkg, pnaw_always));
ensure_package_clientdata(pkg);
if (pkg->clientdata->trigprocdeferred)
pkg->clientdata->trigprocdeferred->pkg =
((void *)0)
;
pkg->clientdata->trigprocdeferred =
((void *)0)
;
if (pkg->trigpend_head) {
enum dep_check ok;
if (pkg->status != PKG_STAT_TRIGGERSPENDING &&
pkg->status != PKG_STAT_TRIGGERSAWAITED)
do_internerr("trigproc.c", 392, __func__, "package %s in non-trigger state %s", pkg_name(pkg, pnaw_always), pkg_status_name(pkg))
;
if (dependtry < DEPEND_TRY_TRIGGERS &&
type == TRIGPROC_TRY_QUEUED) {
enqueue_package(pkg);
return;
}
if (dependtry >= DEPEND_TRY_CYCLES) {
if (findbreakcycle(pkg))
sincenothing = 0;
}
ok = dependencies_ok(pkg,
((void *)0)
, &depwhynot);
if (ok == DEP_CHECK_DEFER) {
if (dependtry >= DEPEND_TRY_TRIGGERS_CYCLES) {
gaveup = check_trigger_cycle(pkg);
if (gaveup == pkg)
return;
}
varbuf_destroy(&depwhynot);
enqueue_package(pkg);
return;
} else if (ok == DEP_CHECK_HALT) {
if (type == TRIGPROC_TRY_DEFERRED) {
trigproc_reset_cycle();
varbuf_destroy(&depwhynot);
return;
}
sincenothing = 0;
varbuf_end_str(&depwhynot);
notice(gettext("dependency problems prevent processing " "triggers for %s:\n%s")
,
pkg_name(pkg, pnaw_nonambig), depwhynot.buf);
varbuf_destroy(&depwhynot);
ohshit(gettext("dependency problems - leaving triggers unprocessed"));
} else if (depwhynot.used) {
varbuf_end_str(&depwhynot);
notice(gettext("%s: dependency problems, but processing " "triggers anyway as you requested:\n%s")
,
pkg_name(pkg, pnaw_nonambig), depwhynot.buf);
varbuf_destroy(&depwhynot);
}
gaveup = check_trigger_cycle(pkg);
if (gaveup == pkg)
return;
printf(gettext("Processing triggers for %s (%s) ...\n"),
pkg_name(pkg, pnaw_nonambig),
versiondescribe(&pkg->installed.version, vdew_nonambig));
log_action("trigproc", pkg, &pkg->installed);
varbuf_reset(&namesarg);
for (tp = pkg->trigpend_head; tp; tp = tp->next) {
varbuf_add_char(&namesarg, ' ');
varbuf_add_buf(&namesarg, tp->name, strlen(tp->name));
}
varbuf_end_str(&namesarg);
pkg_set_status(pkg, PKG_STAT_HALFCONFIGURED);
modstatdb_note(pkg);
if (!f_noact) {
sincenothing = 0;
maintscript_postinst(pkg, "triggered",
namesarg.buf + 1,
((void *)0)
);
}
post_postinst_tasks(pkg, PKG_STAT_INSTALLED);
} else {
trig_clear_awaiters(pkg);
}
}
| void trigproc(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned long long v1[2];
unsigned long v2;
void* v3;
void* v4;
void* v5;
char v6;
unsigned long long v8;
unsigned long long v9;
unsigned long long *v10;
unsigned long long v11;
v3 = 0;
v4 = 0;
v5 = 0;
debug(0x1000, "trigproc %s", pkg_name(a0, 0x3));
ensure_package_clientdata(a0);
if (a0->field_138->field_18)
a0->field_138->field_18->field_8 = 0;
a0->field_138->field_18 = 0;
if (a0->field_160) {
switch (a0->field_18) {
case 5: case 6:
break;
default:
do_internerr("trigproc.c", 0x188, "trigproc", "package %s in non-trigger state %s", pkg_name(a0, 0x3), pkg_status_name(a0));
}
if (dependtry > 2 || a1 != 1) {
if (dependtry > 1 && findbreakcycle(a0))
sincenothing = 0;
v0 = dependencies_ok(a0, 0x0, &v3);
switch (v0) {
case 1:
if (dependtry <= 3 || (v2 = check_trigger_cycle(a0), v2 != a0)) {
varbuf_destroy(&v3);
enqueue_package(a0);
break;
}
case 0:
if (!a1) {
trigproc_reset_cycle();
varbuf_destroy(&v3);
break;
} else {
sincenothing = 0;
varbuf_end_str(&v3);
pkg_name(a0, 0x1);
notice(gettext("dependency problems prevent processing triggers for %s:\n%s"));
varbuf_destroy(&v3);
ohshit(gettext("dependency problems - leaving triggers unprocessed"));
goto LABEL_400b9a;
}
default:
LABEL_400b9a:
if (v3) {
varbuf_end_str(&v3);
pkg_name(a0, 0x1);
notice(gettext("%s: dependency problems, but processing triggers anyway as you requested:\n%s"));
varbuf_destroy(&v3);
}
v2 = check_trigger_cycle(a0);
if (v2 != a0) {
v8 = versiondescribe(&a0->padding_1c[124], 0x1);
v9 = pkg_name(a0, 0x1);
printf(gettext("Processing triggers for %s (%s) ...\n"));
log_action("trigproc", a0, &a0->padding_1c[44]);
varbuf_reset(&namesarg.4800);
for (v1[0] = a0->field_160; v1; v1[0] = v1[0]) {
varbuf_add_char(&namesarg.4800, 0x20);
varbuf_add_buf(&namesarg.4800, v1[1], strlen(v1[1]));
}
varbuf_end_str(&namesarg.4800);
pkg_set_status(a0, 0x4);
modstatdb_note(a0);
if (!f_noact) {
sincenothing = 0;
maintscript_postinst(a0, "triggered", g_4010b0 + 1, 0x0);
}
post_postinst_tasks(a0, 0x7);
break;
}
}
} else {
enqueue_package(a0);
}
} else {
trig_clear_awaiters(a0);
}
v11 = *(&v6) ^ v10[5];
return;
}
|
static void explain(void)
{
print_explain(
stderr
);
}
| void explain(void)
{
print_explain(stderr);
return;
}
|
char *
tilde_expand_word (const char *filename)
{
char *dirname, *expansion, *username;
int user_len;
struct passwd *user_entry;
if (filename == 0)
return ((char *)
((void *)0)
);
if (*filename != '~')
return (strcpy ((char *)sh_xmalloc((1 + strlen (filename)), "tilde.c", 346), (filename)));
if (filename[1] == '\0' || filename[1] == '/')
{
expansion = sh_get_env_value ("HOME");
if (expansion == 0)
expansion = sh_get_home_dir ();
return (glue_prefix_and_suffix (expansion, filename, 1));
}
username = isolate_tilde_prefix (filename, &user_len);
if (tilde_expansion_preexpansion_hook)
{
expansion = (*tilde_expansion_preexpansion_hook) (username);
if (expansion)
{
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
sh_xfree((username), "tilde.c", 376);
sh_xfree((expansion), "tilde.c", 377);
return (dirname);
}
}
dirname = (char *)
((void *)0)
;
user_entry = getpwnam (username);
if (user_entry == 0)
{
if (tilde_expansion_failure_hook)
{
expansion = (*tilde_expansion_failure_hook) (username);
if (expansion)
{
dirname = glue_prefix_and_suffix (expansion, filename, user_len);
sh_xfree((expansion), "tilde.c", 400);
}
}
if (dirname == 0)
dirname = strcpy ((char *)sh_xmalloc((1 + strlen (filename)), "tilde.c", 406), (filename));
}
else
dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
sh_xfree((username), "tilde.c", 413);
endpwent ();
return (dirname);
}
| char * tilde_expand_word(char *param_1)
{
size_t sVar1;
char *pcVar2;
long in_FS_OFFSET;
undefined4 local_34;
char *local_30;
long local_28;
char *local_20;
passwd *local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (param_1 == (char *)0x0) {
pcVar2 = (char *)0x0;
}
else if (*param_1 == '~') {
if ((param_1[1] == '\0') || (param_1[1] == '/')) {
local_28 = sh_get_env_value(&DAT_0010086a);
if (local_28 == 0) {
local_28 = sh_get_home_dir();
}
pcVar2 = (char *)glue_prefix_and_suffix(local_28,param_1,1);
}
else {
local_20 = (char *)isolate_tilde_prefix(param_1,&local_34);
if (tilde_expansion_preexpansion_hook != (code *)0x0) {
local_28 = (*tilde_expansion_preexpansion_hook)(local_20);
if (local_28 != 0) {
local_30 = (char *)glue_prefix_and_suffix(local_28,param_1,local_34);
sh_xfree(local_20,"tilde.c",0x178);
sh_xfree(local_28,"tilde.c",0x179);
pcVar2 = local_30;
goto LAB_0010082b;
}
}
local_30 = (char *)0x0;
local_18 = getpwnam(local_20);
if (local_18 == (passwd *)0x0) {
if (tilde_expansion_failure_hook != (code *)0x0) {
local_28 = (*tilde_expansion_failure_hook)(local_20);
if (local_28 != 0) {
local_30 = (char *)glue_prefix_and_suffix(local_28,param_1,local_34);
sh_xfree(local_28,"tilde.c",400);
}
}
if (local_30 == (char *)0x0) {
sVar1 = strlen(param_1);
pcVar2 = (char *)sh_xmalloc(sVar1 + 1,"tilde.c",0x196);
local_30 = strcpy(pcVar2,param_1);
}
}
else {
local_30 = (char *)glue_prefix_and_suffix(local_18->pw_dir,param_1,local_34);
}
sh_xfree(local_20,"tilde.c",0x19d);
endpwent();
pcVar2 = local_30;
}
}
else {
sVar1 = strlen(param_1);
pcVar2 = (char *)sh_xmalloc(sVar1 + 1,"tilde.c",0x15a);
pcVar2 = strcpy(pcVar2,param_1);
}
LAB_0010082b:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return pcVar2;
}
|
static int
dumpdir_cmp (const char *a, const char *b)
{
size_t len;
while (*a)
switch (*a)
{
case 'Y':
case 'N':
if (!strchr ("YN", *b))
return 1;
if (strcmp(a + 1, b + 1))
return 1;
len = strlen (a) + 1;
a += len;
b += len;
break;
case 'D':
if (strcmp(a, b))
return 1;
len = strlen (a) + 1;
a += len;
b += len;
break;
case 'R':
case 'T':
case 'X':
return *b;
}
return *b;
}
| int dumpdir_cmp(char *param_1,char *param_2)
{
int iVar1;
char *pcVar2;
size_t sVar3;
char *local_28;
char *local_20;
local_28 = param_2;
local_20 = param_1;
do {
if (*local_20 == '\0') {
return (int)*local_28;
}
switch(*local_20) {
case 'D':
iVar1 = strcmp(local_20,local_28);
if (iVar1 != 0) {
return 1;
}
sVar3 = strlen(local_20);
local_20 = local_20 + sVar3 + 1;
local_28 = local_28 + sVar3 + 1;
break;
case 'N':
case 'Y':
pcVar2 = strchr("YN",(int)*local_28);
if (pcVar2 == (char *)0x0) {
return 1;
}
iVar1 = strcmp(local_20 + 1,local_28 + 1);
if (iVar1 != 0) {
return 1;
}
sVar3 = strlen(local_20);
local_20 = local_20 + sVar3 + 1;
local_28 = local_28 + sVar3 + 1;
break;
case 'R':
case 'T':
case 'X':
return (int)*local_28;
}
} while( true );
}
|
static inline void
flush_file (void)
{
off_t blocks_to_skip;
set_next_block_after (current_header);
blocks_to_skip = (current_stat_info.stat.st_size
+ 512 - 1) / 512;
while (record_end - current_block <= blocks_to_skip)
{
blocks_to_skip -= (record_end - current_block);
flush_archive ();
}
current_block += blocks_to_skip;
}
| char *flush_file()
{
long v0;
char *result;
long v2;
set_next_block_after(current_header);
v0 = current_stat_info[17] + 511LL;
if ( v0 < 0 )
v0 = current_stat_info[17] + 1022LL;
v2 = v0 >> 9;
while ( v2 >= (long)(record_end - (_QWORD)current_block) >> 9 )
{
v2 -= (long)(record_end - (_QWORD)current_block) >> 9;
flush_archive();
}
result = (char *)current_block + 512 * v2;
current_block = result;
return result;
}
|
static int
ssh_packet_start_discard(struct ssh *ssh, struct sshenc *enc,
struct sshmac *mac, size_t mac_already, u_int discard)
{
struct session_state *state = ssh->state;
int r;
if (enc ==
((void *)0)
|| !cipher_is_cbc(enc->cipher) || (mac && mac->etm)) {
if ((r = sshpkt_disconnect(ssh, "Packet corrupt")) != 0)
return r;
return -30;
}
if (mac && mac->enabled) {
state->packet_discard_mac = mac;
state->packet_discard_mac_already = mac_already;
}
if (sshbuf_len(state->input) >= discard)
return ssh_packet_stop_discard(ssh);
state->packet_discard = discard - sshbuf_len(state->input);
return 0;
}
| long ssh_packet_start_discard(
unsigned int **a1,
long a2,
long a3,
long a4,
long a5,
long a6)
{
unsigned int v7;
unsigned int v10;
unsigned int *v11;
v7 = a5;
v11 = *a1;
if ( a2 && (unsigned int)cipher_is_cbc(*(_QWORD *)(a2 + 8)) && (!a3 || !*(_DWORD *)(a3 + 32)) )
{
if ( a3 && *(_DWORD *)(a3 + 8) )
{
*((_QWORD *)v11 + 58) = a3;
*((_QWORD *)v11 + 57) = a4;
}
if ( sshbuf_len(*((_QWORD *)v11 + 4)) < (unsigned long)v7 )
{
v11[113] = v7 - sshbuf_len(*((_QWORD *)v11 + 4));
return 0LL;
}
else
{
return ssh_packet_stop_discard(a1);
}
}
else
{
v10 = sshpkt_disconnect((long *)a1, "Packet corrupt", a3, a4, a5, a6);
if ( v10 )
return v10;
else
return 4294967266LL;
}
}
|
char *
last_history_line ()
{
HIST_ENTRY *he;
he = last_history_entry ();
if (he == 0)
return ((char *)
((void *)0)
);
return he->line;
}
| long long last_history_line(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;
v0 = last_history_entry(a0, a1, a2, a3, a4, a5);
return (!v0 ? *(v0) : 0);
}
|
static void
userauth_banner(struct ssh *ssh)
{
char *banner =
((void *)0)
;
if (options.banner ==
((void *)0)
)
return;
if ((banner = (use_privsep ? mm_auth2_read_banner() : auth2_read_banner())) ==
((void *)0)
)
goto done;
userauth_send_banner(ssh, banner);
done:
free(banner);
}
| void userauth_banner(undefined8 param_1)
{
void *__ptr;
if (_DAT_00105e18 != 0) {
if (use_privsep == 0) {
__ptr = (void *)auth2_read_banner();
}
else {
__ptr = (void *)mm_auth2_read_banner();
}
if (__ptr != (void *)0x0) {
userauth_send_banner(param_1,__ptr);
}
free(__ptr);
}
return;
}
|
static void help(void)
{
printf("Usage:\n"
"\t%s [options] modulename ...\n"
"Options:\n"
"\t-f, --force forces a module unload and may crash your\n"
"\t machine. This requires Forced Module Removal\n"
"\t option in your kernel. DANGEROUS\n"
"\t-s, --syslog print to syslog, not stderr\n"
"\t-v, --verbose enables more messages\n"
"\t-V, --version show version\n"
"\t-h, --help show this help\n",
program_invocation_short_name);
}
| int help()
{
return printf(
"Usage:\n"
"\t%s [options] modulename ...\n"
"Options:\n"
"\t-f, --force forces a module unload and may crash your\n"
"\t machine. This requires Forced Module Removal\n"
"\t option in your kernel. DANGEROUS\n"
"\t-s, --syslog print to syslog, not stderr\n"
"\t-v, --verbose enables more messages\n"
"\t-V, --version show version\n"
"\t-h, --help show this help\n",
program_invocation_short_name);
}
|
int
acl_calc_mask(acl_t *acl_p)
{
acl_obj *acl_obj_p;
acl_entry_obj *entry_obj_p, *mask_obj_p =
((void *)0)
;
permset_t perm = (0x0000);
if (!acl_p) {
(*__errno_location ())
=
22
;
return -1;
}
acl_obj_p = ((acl_obj *)__ext2int_and_check(*acl_p, (0x712C)));
if (!acl_obj_p)
return -1;
for( (entry_obj_p) = (acl_obj_p)->i.a_next; (entry_obj_p) != (acl_entry_obj *)(acl_obj_p); (entry_obj_p) = (entry_obj_p)->i.e_next ) {
switch(entry_obj_p->i.e_entry.e_tag) {
case (0x01):
case (0x20):
break;
case (0x10):
mask_obj_p = entry_obj_p;
break;
case (0x02):
case (0x04):
case (0x08):
perm |= entry_obj_p->i.e_entry.e_perm.i.s_perm;
break;
default:
(*__errno_location ())
=
22
;
return -1;
}
}
if (mask_obj_p ==
((void *)0)
) {
mask_obj_p = __acl_create_entry_obj(acl_obj_p);
if (mask_obj_p ==
((void *)0)
)
return -1;
mask_obj_p->i.e_entry.e_tag = (0x10);
__acl_reorder_entry_obj_p(mask_obj_p);
}
mask_obj_p->i.e_entry.e_perm.i.s_perm = perm;
return 0;
}
| long long acl_calc_mask(unsigned long long *a0) {
unsigned int v0;
struct_1 *v1;
void* v2;
struct_0 *v3;
unsigned long long v5;
v2 = 0;
v0 = 0;
if (!a0) {
*(__errno_location()) = 22;
v5 = 4294967295;
} else {
v3 = __ext2int_and_check(*(a0), 0x712c);
if (!v3) {
v5 = 4294967295;
} else {
v1 = v3->field_10;
while (true) {
if (v1 != v3) {
switch (v1->field_20) {
case 1: case 32:
break;
case 2: case 4: case 8:
v0 |= v1->field_40;
break;
case 16:
v2 = v1;
break;
default:
*(__errno_location()) = 22;
v5 = 4294967295;
}
v1 = v1->field_10;
} else {
if (!v2) {
v2 = __acl_create_entry_obj(v3);
if (!v2) {
v5 = 4294967295;
break;
} else {
*(&v2[32]) = 16;
__acl_reorder_entry_obj_p(v2);
}
}
if (v2 || v2) {
*(&v2[64]) = v0;
v5 = 0;
break;
}
}
}
}
}
return v5;
}
|
static uintmax_t
dump_remainder (
_Bool
want_header, char const *pretty_filename, int fd,
uintmax_t n_bytes)
{
uintmax_t n_written;
uintmax_t n_remaining = n_bytes;
n_written = 0;
while (
1
)
{
char buffer[
8192
];
size_t n =
(((
n_remaining
)<(8192))?(
n_remaining
):(8192))
;
size_t bytes_read = safe_read (fd, buffer, n);
if (bytes_read == ((size_t) -1))
{
if (
(*__errno_location ())
!=
11
)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"error reading %s\"), quotearg_style (shell_escape_always_quoting_style, pretty_filename)), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, gettext ("error reading %s"), quotearg_style (shell_escape_always_quoting_style, pretty_filename)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, gettext ("error reading %s"), quotearg_style (shell_escape_always_quoting_style, pretty_filename)), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
break;
}
if (bytes_read == 0)
break;
if (want_header)
{
write_header (pretty_filename);
want_header =
0
;
}
xwrite_stdout (buffer, bytes_read);
n_written += bytes_read;
if (n_bytes !=
(18446744073709551615UL)
)
{
n_remaining -= bytes_read;
if (n_remaining == 0 || n_bytes == (
(18446744073709551615UL)
- 1))
break;
}
}
return n_written;
}
| long dump_remainder(char param_1,undefined8 param_2,undefined4 param_3,ulong param_4)
{
ulong uVar1;
long lVar2;
int *piVar3;
undefined8 uVar4;
undefined8 uVar5;
long in_FS_OFFSET;
char local_204c;
long local_2048;
ulong local_2040;
undefined local_2028 [8200];
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_2048 = 0;
local_204c = param_1;
local_2040 = param_4;
do {
uVar1 = 0x2000;
if (local_2040 < 0x2001) {
uVar1 = local_2040;
}
lVar2 = safe_read(param_3,local_2028,uVar1);
if (lVar2 == -1) {
piVar3 = __errno_location();
if (*piVar3 == 0xb) {
LAB_00101d1d:
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_2048;
}
__stack_chk_fail();
}
uVar4 = quotearg_style(4,param_2);
uVar5 = gettext("error reading %s");
piVar3 = __errno_location();
error(1,*piVar3,uVar5,uVar4);
}
if (lVar2 == 0) goto LAB_00101d1d;
if (local_204c != '\0') {
write_header(param_2);
local_204c = '\0';
}
xwrite_stdout(local_2028,lVar2);
local_2048 = local_2048 + lVar2;
if ((param_4 != 0xffffffffffffffff) &&
((local_2040 = local_2040 - lVar2, local_2040 == 0 || (param_4 == 0xfffffffffffffffe))))
goto LAB_00101d1d;
} while( true );
}
|
_Bool
force_breaks(struct deppossi *possi)
{
return in_force(FORCE_BREAKS) ||
ignore_depends_possi(possi) ||
ignore_depends(possi->up->up);
}
| _BOOL8 force_breaks(long **a1)
{
return (unsigned char)in_force((const char *)&loc_10)
|| (unsigned char)ignore_depends_possi((long)a1)
|| (unsigned char)ignore_depends(**a1);
}
|
void
dispose_variable (var)
SHELL_VAR *var;
{
if (var == 0)
return;
if (((((var)->attributes) & (0x0020000))) == 0)
dispose_variable_value (var);
do { if ((var)->exportstr) sh_xfree(((var)->exportstr), "variables.c", 3793); } while (0);
sh_xfree((var->name), "variables.c", 3795);
if (((((var)->attributes) & (0x0000001))))
array_needs_making = 1;
sh_xfree((var), "variables.c", 3800);
}
| void dispose_variable(struct_0 *a0) {
unsigned long long v1;
if (a0) {
if (!(a0->field_28 & 0x20000))
dispose_variable_value(a0);
if (a0->field_10)
sh_xfree(a0->field_10, "variables.c", 0xed1);
sh_xfree(a0->field_0, "variables.c", 0xed3);
if ((a0->field_28 & 1))
array_needs_making = 1;
v1 = sh_xfree(a0, "variables.c", 0xed8);
}
return;
}
|
inline errcode_t ext2fs_free_mem(void *ptr)
{
void *p;
memcpy(&p, ptr, sizeof(p));
free(p);
p = 0;
memcpy(ptr, &p, sizeof(p));
return 0;
}
| void ext2fs_free_mem(void)
{
halt_baddata();
}
|
int
auth2_setup_methods_lists(Authctxt *authctxt)
{
u_int i;
if (options.num_auth_methods == 1 &&
strcmp(options.auth_methods[0], "any") == 0) {
free(options.auth_methods[0]);
options.auth_methods[0] =
((void *)0)
;
options.num_auth_methods = 0;
}
if (options.num_auth_methods == 0)
return 0;
sshlog("auth2.c", __func__, 617, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "checking methods");
authctxt->auth_methods = xcalloc(options.num_auth_methods,
sizeof(*authctxt->auth_methods));
authctxt->num_auth_methods = 0;
for (i = 0; i < options.num_auth_methods; i++) {
if (auth2_methods_valid(options.auth_methods[i], 1) != 0) {
sshlog("auth2.c", __func__, 623, 0, SYSLOG_LEVEL_INFO,
((void *)0)
, "Authentication methods list \"%s\" contains " "disabled method, skipping", options.auth_methods[i])
;
continue;
}
sshlog("auth2.c", __func__, 628, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "authentication methods list %d: %s", authctxt->num_auth_methods, options.auth_methods[i])
;
authctxt->auth_methods[authctxt->num_auth_methods++] =
xstrdup(options.auth_methods[i]);
}
if (authctxt->num_auth_methods == 0) {
sshlog("auth2.c", __func__, 634, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "No AuthenticationMethods left after eliminating " "disabled methods")
;
return -1;
}
return 0;
}
| int auth2_setup_methods_lists(unsigned long a0) {
unsigned long v0;
int tmp_47;
int tmp_53;
int tmp_59;
unsigned long v1;
struct_0 *v2;
unsigned int v3;
unsigned int v5;
v2 = a0;
if (g_501e98 == 1 && !strcmp(*(*(5250720)), "any")) {
free(*(*(5250720)));
*(*(5250720)) = 0;
g_501e98 = 0;
}
if (!g_501e98) {
v5 = 0;
} else {
sshlog("auth2.c", "auth2_setup_methods_lists", 0x269, 0x1, 0x7, 0x0, "checking methods");
v2->field_40 = xcalloc(g_501e98, 0x8);
v2->field_48 = 0;
for (v3 = 0; v3 < g_501e98; v3 += 1) {
if (auth2_methods_valid(*((*(5250720) + (v3 << 3))), 0x1)) {
v1 = *((*(5250720) + v3 * 8));
sshlog("auth2.c", "auth2_setup_methods_lists", 0x26f, 0x0, 0x3, 0x0, "Authentication methods list \"%s\" contains disabled method, skipping");
} else {
v0 = v2->field_48;
sshlog("auth2.c", "auth2_setup_methods_lists", 0x274, 0x0, 0x5, 0x0, "authentication methods list %d: %s");
tmp_47 = *((*(5250720) + v3 * 8));
tmp_53 = v2->field_40;
tmp_59 = v2->field_48;
v2->field_48 = v2->field_48 + 1;
*((tmp_53 + tmp_59 * 8)) = xstrdup(tmp_47);
}
}
if (v2->field_48) {
v5 = 0;
} else {
sshlog("auth2.c", "auth2_setup_methods_lists", 0x27a, 0x0, 0x2, 0x0, "No AuthenticationMethods left after eliminating disabled methods");
v5 = -1;
}
}
return v5;
}
|
void set_cron_uid(void) {
if (setuid(0) < 0) {
perror("setuid");
exit(1);
}
}
| int set_cron_uid()
{
int result;
result = setuid(0);
if ( result < 0 )
{
perror("setuid");
exit(1);
}
return result;
}
|
static void
who (char const *filename, int options)
{
size_t n_users;
STRUCT_UTMP *utmp_buf;
if (read_utmp (filename, &n_users, &utmp_buf, options) != 0)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, filename)), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, filename)), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, filename)), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
if (short_list)
list_entries_who (n_users, utmp_buf);
else
scan_entries (n_users, utmp_buf);
free (utmp_buf);
}
| unsigned long who(long a1, unsigned int a2)
{
const char *v2;
int *v3;
char *v5;
void *ptr;
unsigned long v7;
v7 = __readfsqword(0x28u);
if ( (unsigned int)read_utmp(a1, &v5, &ptr, a2) )
{
v2 = (const char *)quotearg_n_style_colon(0LL, 3LL, a1);
v3 = _errno_location();
error(1, *v3, "%s", v2);
}
if ( short_list )
list_entries_who((long)v5, (long)ptr);
else
scan_entries(v5, (long)ptr);
free(ptr);
return __readfsqword(0x28u) ^ v7;
}
|
static char *copy_field (char *in, char *out, char *extra)
{
char *cp =
((void *)0)
;
while (
((void *)0)
!= in) {
cp = strchr (in, ',');
if (
((void *)0)
!= cp) {
*cp++ = '\0';
}
if (strchr (in, '=') ==
((void *)0)
) {
break;
}
if (
((void *)0)
!= extra) {
if ('\0' != extra[0]) {
strcat (extra, ",");
}
strcat (extra, in);
}
in = cp;
}
if ((
((void *)0)
!= in) && (
((void *)0)
!= out)) {
strcpy (out, in);
}
return cp;
}
| int copy_field(char *a0, char *a1, char *a2) {
void* v0;
void* v1;
void* v3;
v0 = a0;
v1 = 0;
while (true) {
if (!v0)
break;
v1 = strchr(v0, 0x2c);
if (v1) {
v3 = v1;
v1 += 1;
*(v3) = 0;
}
if (!strchr(v0, 0x3d))
break;
if (a2) {
if (*(a2))
strcat(a2, ",");
strcat(a2, v0);
}
v0 = v1;
}
if (v0 && a1)
strcpy(a1, v0);
return v1;
}
|
int
sshsk_load_resident(const char *provider_path, const char *device,
const char *pin, u_int flags, struct sshsk_resident_key ***srksp,
size_t *nsrksp)
{
struct sshsk_provider *skp =
((void *)0)
;
int r = -1;
struct sk_resident_key **rks =
((void *)0)
;
size_t i, nrks = 0, nsrks = 0;
struct sshkey *key =
((void *)0)
;
struct sshsk_resident_key *srk =
((void *)0)
, **srks =
((void *)0)
, **tmp;
uint8_t sk_flags;
struct sk_option **opts =
((void *)0)
;
sshlog("ssh-sk.c", __func__, 797, 1, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "provider \"%s\"%s", provider_path, (pin !=
((void *)0)
&& *pin != '\0') ? ", have-pin": "")
;
if (srksp ==
((void *)0)
|| nsrksp ==
((void *)0)
)
return -10;
*srksp =
((void *)0)
;
*nsrksp = 0;
if ((r = make_options(device,
((void *)0)
, &opts)) != 0)
goto out;
if ((skp = sshsk_open(provider_path)) ==
((void *)0)
) {
r = -4;
goto out;
}
if ((r = skp->sk_load_resident_keys(pin, opts, &rks, &nrks)) != 0) {
sshlog("ssh-sk.c", __func__, 812, 0, SYSLOG_LEVEL_ERROR,
((void *)0)
, "Provider \"%s\" returned failure %d", provider_path, r);
r = skerr_to_ssherr(r);
goto out;
}
for (i = 0; i < nrks; i++) {
sshlog("ssh-sk.c", __func__, 817, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "rk %zu: slot %zu, alg %d, app \"%s\", uidlen %zu", i, rks[i]->slot, rks[i]->alg, rks[i]->application, rks[i]->user_id_len)
;
if (strncmp(rks[i]->application, "ssh:", 4) != 0)
continue;
switch (rks[i]->alg) {
case 0x00:
case 0x01:
break;
default:
continue;
}
sk_flags = 0x01|0x20;
if ((rks[i]->flags & 0x04))
sk_flags |= 0x04;
if ((r = sshsk_key_from_response(rks[i]->alg,
rks[i]->application, sk_flags, &rks[i]->key, &key)) != 0)
goto out;
if ((srk = calloc(1, sizeof(*srk))) ==
((void *)0)
) {
sshlog("ssh-sk.c", __func__, 837, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "calloc failed");
r = -2;
goto out;
}
srk->key = key;
key =
((void *)0)
;
if ((srk->user_id = calloc(1, rks[i]->user_id_len)) ==
((void *)0)
) {
sshlog("ssh-sk.c", __func__, 844, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "calloc failed");
r = -2;
goto out;
}
memcpy(srk->user_id, rks[i]->user_id, rks[i]->user_id_len);
srk->user_id_len = rks[i]->user_id_len;
if ((tmp = recallocarray(srks, nsrks, nsrks + 1,
sizeof(*tmp))) ==
((void *)0)
) {
sshlog("ssh-sk.c", __func__, 852, 1, SYSLOG_LEVEL_ERROR,
((void *)0)
, "recallocarray failed");
r = -2;
goto out;
}
srks = tmp;
srks[nsrks++] = srk;
srk =
((void *)0)
;
}
*srksp = srks;
*nsrksp = nsrks;
srks =
((void *)0)
;
nsrks = 0;
r = 0;
out:
sshsk_free_options(opts);
sshsk_free(skp);
sshsk_free_sk_resident_keys(rks, nrks);
sshkey_free(key);
sshsk_free_resident_key(srk);
sshsk_free_resident_keys(srks, nsrks);
return r;
}
| long long sshsk_load_resident(char *a0, char *a1, char *a2, unsigned long a3, unsigned long long *a4, unsigned long long *a5) {
unsigned long long v0;
int tmp_21;
void* v1;
unsigned long long v2;
unsigned long v3;
unsigned long long v4;
unsigned long v5;
unsigned int v6;
char v7;
unsigned int v8;
void* v9;
void* v10;
void* v11;
void* v12;
void* v13;
void* v14;
void* v15;
void* v16;
void* v17;
unsigned long v18;
unsigned long long v20;
unsigned long long v21;
v6 = a3;
v13 = 0;
v8 = -1;
v9 = 0;
v10 = 0;
v15 = 0;
v11 = 0;
v16 = 0;
v17 = 0;
v12 = 0;
if (!a2 || !*(a2))
v20 = &g_402c4e;
else
v20 = ", have-pin";
v4 = v20;
v3 = a0;
v2 = "provider \"%s\"%s";
sshlog("ssh-sk.c", "sshsk_load_resident", 0x31d, 0x1, 0x5, 0x0);
if (!a4) {
v21 = 4294967286;
return v21;
} else if (!a5) {
v21 = 4294967286;
return v21;
} else {
*(a4) = 0;
*(a5) = 0;
v8 = make_options(a1, NULL, &v12);
if (!v8) {
v13 = sshsk_open(a0);
if (!v13) {
v8 = -0x4;
} else {
v8 = v13[40](a2, v12, &v9, &v10, v13[40]);
if (v8) {
v4 = v8;
v3 = a0;
v2 = "Provider \"%s\" returned failure %d";
sshlog("ssh-sk.c", "sshsk_load_resident", 0x32c, 0x0, 0x2, 0x0);
v8 = skerr_to_ssherr(v8);
} else {
v14 = 0;
while (true) {
if (v14 >= v10) {
*(a4) = v17;
*(a5) = v15;
v17 = 0;
v15 = 0;
v8 = 0;
break;
} else {
v5 = *((*((v9 + 0x8 * v14)) + 128));
v4 = *((*((v9 + 0x8 * v14)) + 16));
v3 = *(*((v9 + 0x8 * v14)));
v2 = *((*((v9 + 0x8 * v14)) + 8));
v1 = v14;
v0 = "rk %zu: slot %zu, alg %d, app \"%s\", uidlen %zu";
sshlog("ssh-sk.c", "sshsk_load_resident", 0x331, 0x1, 0x7, 0x0);
if (!strncmp(*((*((v9 + 0x8 * v14)) + 16)), "ssh:", 0x4) && *(*((v9 + 0x8 * v14))) <= 1) {
v7 = 33;
if ((*((*((v9 + 0x8 * v14)) + 112)) & 4))
v7 |= 4;
v8 = sshsk_key_from_response(*(*((v9 + 0x8 * v14))), *((*((v9 + 0x8 * v14)) + 16)), v7, *((v9 + 0x8 * v14)) + 24, &v11);
if (v8)
break;
v16 = calloc(0x1, 0x18);
if (!v16) {
v4 = "calloc failed";
sshlog("ssh-sk.c", "sshsk_load_resident", 0x345, 0x1, 0x2, 0x0);
v8 = -2;
break;
} else {
*(v16) = v11;
v11 = 0;
*(&v16[8]) = calloc(0x1, *((*((v9 + 0x8 * v14)) + 128)));
if (!v16[8]) {
v4 = "calloc failed";
sshlog("ssh-sk.c", "sshsk_load_resident", 0x34c, 0x1, 0x2, 0x0);
v8 = -2;
break;
} else {
memcpy(v16[8], *((*((v9 + 0x8 * v14)) + 120)), *((*((v9 + 0x8 * v14)) + 128)));
*(&v16[16]) = *((*((v9 + 0x8 * v14)) + 128));
v18 = recallocarray(v17, v15, v15 + 1, 0x8);
if (v18) {
v17 = v18;
tmp_21 = v15;
v15 += 1;
*((8 * tmp_21 + v17)) = v16;
v16 = 0;
} else {
v4 = "recallocarray failed";
sshlog("ssh-sk.c", "sshsk_load_resident", 0x354, 0x1, 0x2, 0x0);
v8 = -2;
break;
}
}
}
}
v14 += 1;
}
}
}
}
}
sshsk_free_options(v12);
sshsk_free(v13);
sshsk_free_sk_resident_keys(v9, v10);
sshkey_free(v11);
sshsk_free_resident_key(v16);
sshsk_free_resident_keys(v17, v15);
v21 = v8;
return v21;
}
}
|
static inline int ila_csum_name2mode(char *name)
{
if (strcmp(name, "adj-transport") == 0)
return ILA_CSUM_ADJUST_TRANSPORT;
else if (strcmp(name, "neutral-map") == 0)
return ILA_CSUM_NEUTRAL_MAP;
else if (strcmp(name, "neutral-map-auto") == 0)
return ILA_CSUM_NEUTRAL_MAP_AUTO;
else if (strcmp(name, "no-action") == 0)
return ILA_CSUM_NO_ACTION;
else if (strcmp(name, "neutral-map-auto") == 0)
return ILA_CSUM_NEUTRAL_MAP_AUTO;
else
return -1;
}
| int ila_csum_name2mode(char *a0) {
return (!strcmp(a0, "adj-transport") ? (!strcmp(a0, "neutral-map") ? (!strcmp(a0, "neutral-map-auto") ? (!strcmp(a0, "no-action") ? (!strcmp(a0, "neutral-map-auto") ? -1 : 3) : 2) : 3) : 1) : 0);
}
|
static int
record_hostkey(struct hostkey_foreach_line *l, void *_ctx)
{
struct load_callback_ctx *ctx = (struct load_callback_ctx *)_ctx;
struct hostkeys *hostkeys = ctx->hostkeys;
struct hostkey_entry *tmp;
if (l->status == 1) {
sshlog("hostfile.c", __func__, 239, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "%s:%ld: parse error in hostkeys file", l->path, l->linenum)
;
return 0;
}
sshlog("hostfile.c", __func__, 244, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0)
, "found %skey type %s in file %s:%lu", l->marker == MRK_NONE ? "" : (l->marker == MRK_CA ? "ca " : "revoked "), sshkey_type(l->key), l->path, l->linenum)
;
if ((tmp = recallocarray(hostkeys->entries, hostkeys->num_entries,
hostkeys->num_entries + 1, sizeof(*hostkeys->entries))) ==
((void *)0)
)
return -2;
hostkeys->entries = tmp;
hostkeys->entries[hostkeys->num_entries].host = xstrdup(ctx->host);
hostkeys->entries[hostkeys->num_entries].file = xstrdup(l->path);
hostkeys->entries[hostkeys->num_entries].line = l->linenum;
hostkeys->entries[hostkeys->num_entries].key = l->key;
l->key =
((void *)0)
;
hostkeys->entries[hostkeys->num_entries].marker = l->marker;
hostkeys->entries[hostkeys->num_entries].note = l->note;
hostkeys->num_entries++;
ctx->num_loaded++;
return 0;
}
| long long record_hostkey(struct_0 *a0, unsigned long a1) {
unsigned long long v0;
unsigned long long v1;
unsigned long v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
unsigned long long v6[3];
struct_6 *v7;
unsigned long v8;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
v5 = a1;
v6[0] = v5;
v7 = v6[2];
if (a0->field_10 == 1) {
v4 = a0->field_8;
v3 = a0->field_0;
v2 = "%s:%ld: parse error in hostkeys file";
sshlog("hostfile.c", "record_hostkey", 0xef, 0x0, 0x5, 0x0);
v10 = 0;
} else {
v11 = sshkey_type(a0->field_40);
if (a0->field_20 == 1) {
v12 = &g_402eda;
} else if (a0->field_20 == 3) {
v12 = "ca ";
} else {
v12 = "revoked ";
}
v4 = a0->field_8;
v3 = a0->field_0;
v2 = v11;
v1 = v12;
v0 = "found %skey type %s in file %s:%lu";
sshlog("hostfile.c", "record_hostkey", 0xf4, 0x1, 0x7, 0x0);
v8 = recallocarray(v7->field_0, v7->field_8, v7->field_8 + 1, 0x28);
if (!v8) {
v10 = 4294967294;
} else {
v7->field_0 = v8;
*((v7->field_0 + v7->field_8 * 40)) = xstrdup(v6[0], v7->field_8, v6[0], v7->field_0);
*((v7->field_0 + v7->field_8 * 40 + 8)) = xstrdup(a0->field_0, v7->field_8, a0->field_0, v7->field_0);
*((v7->field_0 + v7->field_8 * 40 + 16)) = a0->field_8;
*((v7->field_0 + v7->field_8 * 40 + 24)) = a0->field_40;
a0->field_40 = 0;
v13 = v7->field_8;
*((v7->field_8 * 40 + v7->field_0 + 32)) = a0->field_20;
*((v7->field_0 + v13 * 40 + 36)) = a0->field_50;
v7->field_8 = v13 + 1;
v6[1] = v6[1] + 1;
v10 = 0;
}
}
return v10;
}
|
void
platform_pledge_sftp_server(void)
{
}
| void platform_pledge_sftp_server(void)
{
return;
}
|
int
acl_add_perm(acl_permset_t permset_d, acl_perm_t perm)
{
acl_permset_obj *acl_permset_obj_p = ((acl_permset_obj *)__ext2int_and_check(permset_d, (0x1ED5)));
if (!acl_permset_obj_p || (perm & ~((0x04)|(0x02)|(0x01))))
return -1;
acl_permset_obj_p->i.s_perm |= perm;
return 0;
}
| long long acl_add_perm(unsigned long long a0, unsigned long a1) {
struct_0 *v0;
unsigned long long v2;
v0 = __ext2int_and_check(a0, 0x1ed5);
if (!v0) {
v2 = 4294967295;
return v2;
} else if ((a1 & -8)) {
v2 = 4294967295;
return v2;
} else {
v0->field_8 = v0->field_8 | a1;
v2 = 0;
return v2;
}
}
|
void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo,
struct rtattr *tb[], FILE *fp, const char *prefix,
const char *title)
{
char buf[(128)] = {};
xfrm_selector_print(&xpinfo->sel, preferred_family, fp, title);
if (tb[XFRMA_SEC_CTX])
xfrm_sec_ctx_print(fp, tb[XFRMA_SEC_CTX]);
if (prefix)
strlcat(buf, prefix, sizeof(buf));
strlcat(buf, "\t", sizeof(buf));
fputs(buf, fp);
if (xpinfo->dir >= XFRM_POLICY_MAX) {
xpinfo->dir -= XFRM_POLICY_MAX;
fprintf(fp, "socket ");
} else
fprintf(fp, "dir ");
switch (xpinfo->dir) {
case XFRM_POLICY_IN:
fprintf(fp, "in");
break;
case XFRM_POLICY_OUT:
fprintf(fp, "out");
break;
case XFRM_POLICY_FWD:
fprintf(fp, "fwd");
break;
default:
fprintf(fp, "%u", xpinfo->dir);
break;
}
fprintf(fp, " ");
switch (xpinfo->action) {
case 0:
if (show_stats > 0)
fprintf(fp, "action allow ");
break;
case 1:
fprintf(fp, "action block ");
break;
default:
fprintf(fp, "action %u ", xpinfo->action);
break;
}
if (show_stats)
fprintf(fp, "index %u ", xpinfo->index);
fprintf(fp, "priority %u ", xpinfo->priority);
if (tb[XFRMA_POLICY_TYPE]) {
struct xfrm_userpolicy_type *upt;
fprintf(fp, "ptype ");
if (((int)((tb[XFRMA_POLICY_TYPE])->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))) < sizeof(*upt))
fprintf(fp, "(ERROR truncated)");
upt = ((void*)(((char*)(tb[XFRMA_POLICY_TYPE])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))));
fprintf(fp, "%s ", strxf_ptype(upt->type));
}
if (show_stats > 0)
fprintf(fp, "share %s ", strxf_share(xpinfo->share));
if (show_stats > 0 || xpinfo->flags) {
__u8 flags = xpinfo->flags;
fprintf(fp, "flag ");
do { if (flags & 1) { flags &= ~1; fprintf(fp, "localok" "%s", (flags ? " " : "")); } } while(0);
do { if (flags & 2) { flags &= ~2; fprintf(fp, "icmp" "%s", (flags ? " " : "")); } } while(0);
if (flags)
fprintf(fp, "%x", flags);
}
if (show_stats > 0)
fprintf(fp, " (0x%s)", strxf_mask8(xpinfo->flags));
fprintf(fp, "%s", _SL_);
if (show_stats > 0)
xfrm_lifetime_print(&xpinfo->lft, &xpinfo->curlft, fp, buf);
xfrm_xfrma_print(tb, xpinfo->sel.family, fp, buf,
0
);
}
| unsigned long xfrm_policy_info_print(long a1, long a2, FILE *a3, long a4, const char *a5)
{
char *v5;
char *v6;
const char *v7;
const char *v8;
const char *v9;
unsigned char v13;
char s[8];
long v15;
long v16;
long v17;
long v18;
long v19;
long v20;
long v21;
long v22;
long v23;
long v24;
long v25;
long v26;
long v27;
long v28;
long v29;
unsigned long v30;
v30 = __readfsqword(0x28u);
*(_QWORD *)s = 0LL;
v15 = 0LL;
v16 = 0LL;
v17 = 0LL;
v18 = 0LL;
v19 = 0LL;
v20 = 0LL;
v21 = 0LL;
v22 = 0LL;
v23 = 0LL;
v24 = 0LL;
v25 = 0LL;
v26 = 0LL;
v27 = 0LL;
v28 = 0LL;
v29 = 0LL;
xfrm_selector_print(a1, preferred_family, a3, a5);
if ( *(_QWORD *)(a2 + 64) )
xfrm_sec_ctx_print(a3, *(const char **)(a2 + 64));
if ( a4 )
strlcat(s, a4, 128LL);
strlcat(s, "\t", 128LL);
fputs(s, a3);
if ( *(_BYTE *)(a1 + 160) <= 2u )
{
fprintf(a3, "dir ");
}
else
{
*(_BYTE *)(a1 + 160) -= 3;
fprintf(a3, "socket ");
}
if ( *(_BYTE *)(a1 + 160) == 2 )
{
fprintf(a3, "fwd");
}
else if ( *(unsigned char *)(a1 + 160) > 2u )
{
fprintf(a3, "%u", *(unsigned char *)(a1 + 160));
}
else if ( *(_BYTE *)(a1 + 160) )
{
fprintf(a3, "out");
}
else
{
fprintf(a3, "in");
}
fprintf(a3, " ");
if ( *(_BYTE *)(a1 + 161) )
{
if ( *(_BYTE *)(a1 + 161) == 1 )
fprintf(a3, "action block ");
else
fprintf(a3, "action %u ", *(unsigned char *)(a1 + 161));
}
else if ( show_stats > 0 )
{
fprintf(a3, "action allow ");
}
if ( show_stats )
fprintf(a3, "index %u ", *(unsigned int *)(a1 + 156));
fprintf(a3, "priority %u ", *(unsigned int *)(a1 + 152));
if ( *(_QWORD *)(a2 + 128) )
{
fprintf(a3, "ptype ");
if ( (unsigned long)**(unsigned short **)(a2 + 128) - 4 <= 5 )
fprintf(a3, "(ERROR truncated)");
v5 = strxf_ptype(*(_BYTE *)(*(_QWORD *)(a2 + 128) + 4LL));
fprintf(a3, "%s ", v5);
}
if ( show_stats > 0 )
{
v6 = strxf_share(*(_BYTE *)(a1 + 163));
fprintf(a3, "share %s ", v6);
}
if ( show_stats > 0 || *(_BYTE *)(a1 + 162) )
{
v13 = *(_BYTE *)(a1 + 162);
fprintf(a3, "flag ");
if ( (v13 & 1) != 0 )
{
v13 &= ~1u;
if ( v13 )
v7 = " ";
else
v7 = (const char *)&unk_57B6;
fprintf(a3, "localok%s", v7);
}
if ( (v13 & 2) != 0 )
{
v13 &= ~2u;
if ( v13 )
v8 = " ";
else
v8 = (const char *)&unk_57B6;
fprintf(a3, "icmp%s", v8);
}
if ( v13 )
fprintf(a3, "%x", v13);
}
if ( show_stats > 0 )
{
v9 = strxf_mask8(*(_BYTE *)(a1 + 162));
fprintf(a3, " (0x%s)", v9);
}
fprintf(a3, "%s", SL_);
if ( show_stats > 0 )
xfrm_lifetime_print((long *)(a1 + 56), (_QWORD *)(a1 + 120), a3, s);
xfrm_xfrma_print(a2, *(_WORD *)(a1 + 40), a3, s, 0);
return __readfsqword(0x28u) ^ v30;
}
|
static void
wait_for_grandchild (pid_t pid)
{
int wait_status;
int exit_code = 0;
while (waitpid (pid, &wait_status, 0) == -1)
if (
(*__errno_location ())
!=
4
)
{
waitpid_error (use_compress_program_option);
break;
}
if (
(((signed char) (((
wait_status
) & 0x7f) + 1) >> 1) > 0)
)
raise (
((
wait_status
) & 0x7f)
);
else if (
(((
wait_status
) & 0xff00) >> 8)
!= 0)
exit_code =
(((
wait_status
) & 0xff00) >> 8)
;
exit (exit_code);
}
| void wait_for_grandchild(unsigned long a0) {
char v0;
unsigned int v1;
unsigned long v2;
unsigned long long *v4;
unsigned long long v5;
v2 = v4[5];
v1 = 0;
while (true) {
v5 = waitpid(a0, &v0, 0x0);
if (v5 != -1)
break;
*(&v5) = *(__errno_location());
if (v5 == 4)
continue;
waitpid_error(use_compress_program_option);
break;
}
if (((*(&v0) & 127) + 1 >> 1) > 0) {
raise(*(&v0) & 127);
} else if ((*(&v0) >> 8)) {
v1 = (*(&v0) >> 8) & 255;
}
exit(v1);
}
|
static void cmd_parser(int argc, char **argv)
{
char *rest =
((void *)0)
;
int optct = process_options(argc,argv);
argc -= optct;
argv += optct;
if (rest ==
((void *)0)
&& argc > 0)
rest = argv[0];
if (gnutls_cli_options.present.fips140_mode) {
if (gnutls_fips140_mode_enabled() != 0) {
fprintf(
stderr
, "library is in FIPS140-2 mode\n");
exit(0);
}
fprintf(
stderr
, "library is NOT in FIPS140-2 mode\n");
exit(1);
}
if (gnutls_cli_options.present.list_config) {
const gnutls_library_config_st *p;
for (p = gnutls_get_library_config(); p->name; p++) {
log_msg(
stdout
, "%s: %s\n", p->name, p->value);
}
log_msg(
stdout
, "system-config: %s\n", gnutls_get_system_config_file());
exit(0);
}
if (gnutls_cli_options.present.benchmark_ciphers) {
benchmark_cipher(gnutls_cli_options.value.debug);
exit(0);
}
if (gnutls_cli_options.present.benchmark_tls_ciphers) {
benchmark_tls(gnutls_cli_options.value.debug, 1);
exit(0);
}
if (gnutls_cli_options.present.benchmark_tls_kx) {
benchmark_tls(gnutls_cli_options.value.debug, 0);
exit(0);
}
if (gnutls_cli_options.present.priority) {
priorities = gnutls_cli_options.arg.priority;
}
verbose = gnutls_cli_options.present.verbose;
if (verbose)
print_cert = 1;
else
print_cert = gnutls_cli_options.present.print_cert;
if (gnutls_cli_options.present.list) {
print_list(priorities, verbose);
exit(0);
}
if (gnutls_cli_options.present.priority_list) {
print_priority_list();
exit(0);
}
disable_sni = gnutls_cli_options.present.disable_sni;
disable_extensions = gnutls_cli_options.present.disable_extensions;
if (disable_extensions)
init_flags |= (1<<4);
if (gnutls_cli_options.present.single_key_share)
init_flags |= GNUTLS_KEY_SHARE_TOP;
if (gnutls_cli_options.present.post_handshake_auth)
init_flags |= GNUTLS_POST_HANDSHAKE_AUTH;
inline_commands = gnutls_cli_options.present.inline_commands;
if (gnutls_cli_options.present.inline_commands_prefix) {
if (strlen(gnutls_cli_options.arg.inline_commands_prefix) > 1) {
fprintf(
stderr
,
"inline-commands-prefix value is a single US-ASCII character (octets 0 - 127)\n");
exit(1);
}
inline_commands_prefix =
(char *) gnutls_cli_options.arg.inline_commands_prefix;
if (!
(((
inline_commands_prefix[0]
) & ~0x7f) == 0)
) {
fprintf(
stderr
,
"inline-commands-prefix value is a single US-ASCII character (octets 0 - 127)\n");
exit(1);
}
} else
inline_commands_prefix = "^";
starttls = gnutls_cli_options.present.starttls;
resume = gnutls_cli_options.present.resume;
rehandshake = gnutls_cli_options.present.rehandshake;
insecure = gnutls_cli_options.present.insecure;
ranges = gnutls_cli_options.present.ranges;
waitresumption = gnutls_cli_options.present.waitresumption;
if (insecure || gnutls_cli_options.present.verify_allow_broken) {
global_vflags |= (GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2|GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5);
}
udp = gnutls_cli_options.present.udp;
mtu = gnutls_cli_options.value.mtu;
if (gnutls_cli_options.present.port) {
snprintf(service, sizeof(service), "%s", gnutls_cli_options.arg.port);
} else {
if (gnutls_cli_options.present.starttls_proto)
snprintf(service, sizeof(service), "%s", starttls_proto_to_service(gnutls_cli_options.arg.starttls_proto));
else
strcpy(service, "443");
}
record_max_size = gnutls_cli_options.value.recordsize;
if (gnutls_cli_options.present.x509fmtder)
x509ctype = GNUTLS_X509_FMT_DER;
else
x509ctype = GNUTLS_X509_FMT_PEM;
if (gnutls_cli_options.present.srpusername)
srp_username = gnutls_cli_options.arg.srpusername;
if (gnutls_cli_options.present.srppasswd)
srp_passwd = gnutls_cli_options.arg.srppasswd;
if (gnutls_cli_options.present.x509cafile)
x509_cafile = gnutls_cli_options.arg.x509cafile;
if (gnutls_cli_options.present.x509crlfile)
x509_crlfile = gnutls_cli_options.arg.x509crlfile;
if (gnutls_cli_options.present.x509keyfile)
x509_keyfile = gnutls_cli_options.arg.x509keyfile;
if (gnutls_cli_options.present.x509certfile)
x509_certfile = gnutls_cli_options.arg.x509certfile;
if (gnutls_cli_options.present.rawpkkeyfile)
rawpk_keyfile = gnutls_cli_options.arg.rawpkkeyfile;
if (gnutls_cli_options.present.rawpkfile)
rawpk_file = gnutls_cli_options.arg.rawpkfile;
if (gnutls_cli_options.present.pskusername)
psk_username = gnutls_cli_options.arg.pskusername;
if (gnutls_cli_options.present.pskkey) {
psk_key.data = (unsigned char *) gnutls_cli_options.arg.pskkey;
psk_key.size = strlen(gnutls_cli_options.arg.pskkey);
} else
psk_key.size = 0;
crlf = gnutls_cli_options.present.crlf;
fastopen = gnutls_cli_options.present.fastopen;
if (rest !=
((void *)0)
)
hostname = rest;
if (hostname ==
((void *)0)
) {
fprintf(
stderr
, "No hostname specified\n");
exit(1);
}
}
| void cmd_parser(unsigned long a0, unsigned long long a1) {
unsigned long long v0;
int tmp_9;
unsigned int v1;
unsigned int v2;
void* v3;
unsigned long long *v4;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
v1 = a0;
v0 = a1;
v3 = 0;
v2 = process_options(v1, v0, v0);
v1 -= v2;
v0 += v2 * 8;
if (!v3 && v1 > 0)
v3 = *(v0);
if (g_500134) {
if (!gnutls_fips140_mode_enabled()) {
fprintf(*(&stderr), "library is NOT in FIPS140-2 mode\n");
exit(0x1);
}
fprintf(*(&stderr), "library is in FIPS140-2 mode\n");
exit(0x0);
} else {
if (g_500135) {
for (v4 = gnutls_get_library_config(); *(v4); v4 += 2) {
log_msg(stdout, "%s: %s\n", *(v4));
}
log_msg(stdout, "system-config: %s\n", gnutls_get_system_config_file());
exit(0x0);
} else if (g_500122) {
benchmark_cipher(*(&select));
exit(0x0);
} else if (g_500124) {
benchmark_tls(*(&select), 0x1);
exit(0x0);
} else if (g_500123) {
benchmark_tls(*(&select), 0x0);
exit(0x0);
} else {
if (g_500113)
priorities = gnutls_init;
verbose = g_5000f9;
if (verbose)
print_cert = 1;
else
print_cert = g_50010c;
if (g_500125) {
print_list(priorities, verbose, verbose);
exit(0x0);
} else if (g_500126) {
print_priority_list();
exit(0x0);
} else {
disable_sni = g_50012d;
disable_extensions = g_50012e;
if (disable_extensions)
init_flags = init_flags | 16;
if (g_50012f) {
v6 = init_flags;
*(&v6) = (init_flags >> 8) | 8;
tmp_9 = v6;
init_flags = tmp_9;
}
if (canonicalize_host) {
v7 = init_flags;
*(&v7) = (init_flags >> 8) | 64;
tmp_9 = v7;
init_flags = tmp_9;
}
inline_commands = g_500131;
if (!g_500132) {
inline_commands_prefix = "^";
} else if (strlen(gnutls_error_is_fatal) > 1) {
fprintf(*(&stderr), "inline-commands-prefix value is a single US-ASCII character (octets 0 - 127)\n");
exit(0x1);
} else {
inline_commands_prefix = gnutls_error_is_fatal;
if (*(inline_commands_prefix) < 0) {
fprintf(*(&stderr), "inline-commands-prefix value is a single US-ASCII character (octets 0 - 127)\n");
exit(0x1);
}
}
starttls = g_500105;
resume = fopen;
rehandshake = g_500102;
insecure = g_50011f;
ranges = g_500121;
waitresumption = g_500139;
if (!insecure && !gnutls_ocsp_status_request_get2)
goto LABEL_403a49;
global_vflags = global_vflags | 48;
LABEL_403a49:
udp = g_500107;
mtu = g_500244;
if (g_50011e) {
snprintf(&service, 0x20, "%s", compress_cert_set_methods);
} else if (!g_500106) {
strcpy(&service, "443");
} else {
snprintf(&service, 0x20, "%s", starttls_proto_to_service(dane_strerror));
}
record_max_size = g_50024c;
if (g_50010b)
x509ctype = 0;
else
x509ctype = 1;
if (g_50011a)
srp_username = gnutls_credentials_set;
if (g_50011b)
srp_passwd = gnutls_certificate_set_retrieve_function2;
if (g_500114)
x509_cafile = gnutls_dtls_set_mtu;
if (g_500115)
x509_crlfile = gnutls_set_default_priority;
if (g_500116)
x509_keyfile = gnutls_priority_set_direct;
if (g_500117)
x509_certfile = gnutls_server_name_set;
if (fclose)
rawpk_keyfile = gnutls_dh_set_prime_bits;
if (g_500119)
rawpk_file = gnutls_alpn_set_protocols;
if (g_50011c)
psk_username = gnutls_certificate_set_verify_function;
if (!g_50011d) {
g_405468 = 0;
} else {
psk_key = gnutls_record_set_max_size;
g_405468 = strlen(gnutls_record_set_max_size);
}
crlf = g_500109;
fastopen = g_50010a;
if (v3)
hostname = v3;
v8 = hostname;
if (hostname)
return;
fprintf(*(&stderr), "No hostname specified\n");
exit(0x1);
}
}
}
}
|
vi_comment_out(EditLine *el, wint_t c __attribute__((__unused__)))
{
el->el_line.cursor = el->el_line.buffer;
c_insert(el, 1);
*el->el_line.cursor = '#';
re_refresh(el);
return ed_newline(el, 0);
}
| void vi_comment_out(long param_1)
{
*(undefined8 *)(param_1 + 0x58) = *(undefined8 *)(param_1 + 0x50);
c_insert(param_1,1);
**(undefined4 **)(param_1 + 0x58) = 0x23;
re_refresh(param_1);
ed_newline(param_1,0);
return;
}
|
int inflateGetHeader(strm, head)
z_streamp strm;
gz_headerp head;
{
struct inflate_state *state;
if (inflateStateCheck(strm)) return (-2);
state = (struct inflate_state *)strm->state;
if ((state->wrap & 2) == 0) return (-2);
state->head = head;
head->done = 0;
return 0;
}
| long long inflateGetHeader(struct_0 *a0, struct_1 *a1) {
struct_2 *v0;
unsigned long long v3;
if (inflateStateCheck(a0)) {
v3 = 4294967294;
} else {
v0 = a0->field_38;
if (!(v0->field_10 & 2)) {
v3 = 4294967294;
} else {
v0->field_30 = a1;
a1->field_48 = 0;
v3 = 0;
}
}
return v3;
}
|
int
launch (struct buildcmd_control *ctl, void *usercontext, int argc, char **argv)
{
pid_t child_pid;
static int first_time = 1;
struct exec_val *execp = usercontext;
(void) ctl;
(void) argc;
if (options.debug_options & DebugExec)
{
int i;
fprintf (
stderr
, "DebugExec: launching process (argc=%"
"l" "u"
"):",
(uintmax_t) execp->state.cmd_argc - 1);
for (i=0; i<execp->state.cmd_argc -1; ++i)
{
fprintf (
stderr
, " %s",
safely_quote_err_filename (0, execp->state.cmd_argv[i]));
}
fprintf (
stderr
, "\n");
}
rpl_fflush
(
stdout
);
rpl_fflush
(
stderr
);
if (first_time)
{
first_time = 0;
signal (
17
,
((__sighandler_t) 0)
);
}
child_pid = fork ();
if (child_pid == -1)
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"cannot fork\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, gettext ("cannot fork")), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, gettext ("cannot fork")), ((
0
) ? (void) 0 : __builtin_unreachable ()))));
if (child_pid == 0)
{
((void) sizeof ((((void *)0)
!= execp->wd_for_exec
) ? 1 : 0), __extension__ ({ if (((void *)0)
!= execp->wd_for_exec
) ; else __assert_fail (
"NULL != execp->wd_for_exec"
, "exec.c", 321, __extension__ __PRETTY_FUNCTION__); }))
;
if (!prep_child_for_exec (execp->close_stdin, execp->wd_for_exec))
{
_exit (1);
}
else
{
if (fd_leak_check_is_enabled ())
{
complain_about_leaky_fds ();
}
}
if (bc_args_exceed_testing_limit (argv))
(*__errno_location ())
=
7
;
else
execvp (argv[0], argv);
error (0,
(*__errno_location ())
, "%s",
safely_quote_err_filename (0, argv[0]));
_exit (1);
}
while (waitpid (child_pid, &(execp->last_child_status), 0) == (pid_t) -1)
{
if (
(*__errno_location ())
!=
4
)
{
error (0,
(*__errno_location ())
, gettext ("error waiting for %s"),
safely_quote_err_filename (0, argv[0]));
state.exit_status =
1
;
return 0;
}
}
if (
(((signed char) (((
execp->last_child_status
) & 0x7f) + 1) >> 1) > 0)
)
{
error (0, 0, gettext ("%s terminated by signal %d"),
quotearg_n_style (0, options.err_quoting_style, argv[0]),
((
execp->last_child_status
) & 0x7f)
);
if (execp->multiple)
{
state.exit_status =
1
;
}
return 1;
}
int ex =
(((
execp->last_child_status
) & 0xff00) >> 8)
;
if (options.debug_options & DebugExec)
{
fprintf (
stderr
,
"DebugExec: process (PID=%ld) terminated with exit status: %d\n",
(long) child_pid, ex);
}
if (0 == ex)
{
return 1;
}
else
{
if (execp->multiple)
{
state.exit_status =
1
;
}
return 1;
}
}
| long long launch(unsigned long a0, struct_0 *a1, unsigned long a2, unsigned long long *a3) {
unsigned int v0;
unsigned long v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned long long v6;
unsigned long long v8;
unsigned long long v10;
unsigned long long v12;
unsigned long long v13;
v1 = a0;
v0 = a2;
if ((fd_leak_check_is_enabled & 32)) {
fprintf(stderr, "DebugExec: launching process (argc=%lu):", (a1->field_60 - 1));
for (v2 = 0; v2 < a1->field_60 - 1; v2 += 1) {
fprintf(stderr, " %s", safely_quote_err_filename(0x0, *((a1->field_68 + v2 * 8))));
}
fprintf(stderr, "\n");
}
rpl_fflush(stdout);
rpl_fflush(stderr);
if (first_time.6332) {
first_time.6332 = 0;
signal(0x11, 0x0);
}
v3 = fork();
if (v3 == -1) {
error(0x1, *(__errno_location()), gettext("cannot fork"));
} else if (v3) {
while (true) {
v6 = waitpid(v3, &a1->field_c8, 0x0);
if (v6 == -1) {
*(&v6) = *(__errno_location());
if (v6 == 4)
continue;
v8 = safely_quote_err_filename(0x0, *(a3));
error(0x0, *(__errno_location()), gettext("error waiting for %s"));
g_500044 = 1;
v12 = 0;
break;
} else {
if (((a1->field_c8 & 127) + 1 >> 1) > 0) {
v10 = quotearg_n_style(0x0, g_50012c, *(a3));
error(0x0, 0x0, gettext("%s terminated by signal %d"));
if (a1->field_0)
g_500044 = 1;
v12 = 1;
break;
} else {
v4 = (a1->field_c8 >> 8) & 255;
if ((fd_leak_check_is_enabled & 32))
fprintf(stderr, "DebugExec: process (PID=%ld) terminated with exit status: %d\n", v3, v4);
if (!v4) {
v12 = 1;
break;
} else {
if (a1->field_0)
g_500044 = 1;
v12 = 1;
break;
}
}
}
}
return v12;
} else if (!a1->field_c0) {
__assert_fail();
} else if ((prep_child_for_exec(a1->field_bc, a1->field_c0) ^ 1)) {
_exit(0x1);
} else {
if (fd_leak_check_is_enabled())
complain_about_leaky_fds();
if (bc_args_exceed_testing_limit(a3))
*(__errno_location()) = 7;
else
execvp(*(a3), a3);
v13 = safely_quote_err_filename(0x0, *(a3));
error(0x0, *(__errno_location()), "%s");
_exit(0x1);
}
}
|
char *
array_to_string (a, sep, quoted)
ARRAY *a;
char *sep;
int quoted;
{
if (a == 0)
return((char *)
((void *)0)
);
if (((a)->num_elements == 0))
return((char *)strcpy (sh_xmalloc((1 + strlen ("")), "array.c", 1068), ("")));
return (array_to_string_internal (((a->head)->next), a->head, sep, quoted));
}
| long long array_to_string(struct_0 *a0, char *a1, unsigned long a2) {
void* v1;
if (!a0) {
v1 = 0;
} else if (a0->field_8) {
v1 = array_to_string_internal(a0->field_10->field_10, a0->field_10, a1, a2);
} else {
v1 = strcpy(sh_xmalloc(strlen(&g_4026e4) + 1, "array.c", 0x42c), &g_4026e4);
}
return v1;
}
|
int
rl_message (const char *format, ...)
{
va_list args;
int bneed;
__builtin_va_start(
args
,
format
)
;
if (msg_buf == 0)
msg_buf = xmalloc (msg_bufsiz = 128);
bneed = vsnprintf (msg_buf, msg_bufsiz, format, args);
if (bneed >= msg_bufsiz - 1)
{
msg_bufsiz = bneed + 1;
msg_buf = xrealloc (msg_buf, msg_bufsiz);
__builtin_va_end(
args
)
;
__builtin_va_start(
args
,
format
)
;
vsnprintf (msg_buf, msg_bufsiz - 1, format, args);
}
__builtin_va_end(
args
)
;
if (saved_local_prompt == 0)
{
rl_save_prompt ();
msg_saved_prompt = 1;
}
else if (local_prompt != saved_local_prompt)
{
if (local_prompt) free (local_prompt);
if (local_prompt_prefix) free (local_prompt_prefix);
local_prompt = (char *)
((void *)0)
;
}
rl_display_prompt = msg_buf;
local_prompt = expand_prompt (msg_buf, 0, &prompt_visible_length,
&prompt_last_invisible,
&prompt_invis_chars_first_line,
&prompt_physical_chars);
local_prompt_prefix = (char *)
((void *)0)
;
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
(*rl_redisplay_function) ();
return 0;
}
| long rl_message(const char *a1, long a2, long a3, long a4, long a5, long a6, ...)
{
int v6;
int v8;
gcc_va_list arg;
unsigned long v10;
long v11;
long v12;
long v13;
long v14;
long v15;
va_start(arg, a6);
v11 = a2;
v12 = a3;
v13 = a4;
v14 = a5;
v15 = a6;
v10 = __readfsqword(0x28u);
arg[0].gp_offset = 8;
if ( !msg_buf )
{
msg_bufsiz = 128;
msg_buf = (char *)xmalloc(128LL);
}
v8 = vsnprintf(msg_buf, msg_bufsiz, a1, arg);
if ( v8 >= msg_bufsiz - 1 )
{
msg_bufsiz = v8 + 1;
msg_buf = (char *)xrealloc(msg_buf, v8 + 1);
va_end(arg);
va_start(arg, a6);
vsnprintf(msg_buf, msg_bufsiz - 1, a1, arg);
}
if ( saved_local_prompt )
{
if ( local_prompt != (char *)saved_local_prompt )
{
if ( local_prompt )
free(local_prompt);
if ( local_prompt_prefix )
free(local_prompt_prefix);
local_prompt = 0LL;
}
}
else
{
rl_save_prompt();
msg_saved_prompt = 1;
}
rl_display_prompt = msg_buf;
local_prompt = expand_prompt(
msg_buf,
0,
&prompt_visible_length,
&prompt_last_invisible,
&prompt_invis_chars_first_line,
&prompt_physical_chars);
local_prompt_prefix = 0LL;
if ( local_prompt )
v6 = strlen(local_prompt);
else
v6 = 0;
local_prompt_len = v6;
rl_redisplay_function();
return 0LL;
}
|
static void
print_forceinfo(const struct forceinfo *fi)
{
char *desc, *line;
desc = m_strdup(gettext(fi->desc));
line = strtok(desc, "\n");
print_forceinfo_line(fi->type, fi->name, line);
while ((line = strtok(
((void *)0)
, "\n")))
print_forceinfo_line(FORCETYPE_DISABLED, "", line);
free(desc);
}
| void print_forceinfo(long a1)
{
char *v1;
char *s;
char *v3;
char *v4;
v1 = gettext(*(const char **)(a1 + 16));
s = (char *)m_strdup(v1);
v3 = strtok(s, "\n");
print_forceinfo_line(*(char *)(a1 + 12), *(const char **)a1, v3);
while ( 1 )
{
v4 = strtok(0LL, "\n");
if ( !v4 )
break;
print_forceinfo_line(0, (const char *)&unk_EE5, v4);
}
free(s);
}
|
static int
history_load(History *h, const char *fname)
{
FILE *fp;
char *line;
size_t llen;
ssize_t sz;
size_t max_size;
char *ptr;
int i = -1;
HistEvent ev;
char *decode_result;
if ((fp = fopen(fname, "r")) ==
((void *)0)
)
return i;
line =
((void *)0)
;
llen = 0;
if ((sz = getline(&line, &llen, fp)) == -1)
goto done;
if (strncmp(line, hist_cookie, (size_t)sz) != 0)
goto done;
ptr = malloc((max_size = 1024) * sizeof(*ptr));
if (ptr ==
((void *)0)
)
goto done;
for (i = 0; (sz = getline(&line, &llen, fp)) != -1; i++) {
if (sz > 0 && line[sz - 1] == '\n')
line[--sz] = '\0';
if (max_size < (size_t)sz) {
char *nptr;
max_size = ((size_t)sz + 1024) & (size_t)~1023;
nptr = realloc((ptr), (max_size * sizeof(*ptr)));
if (nptr ==
((void *)0)
) {
i = -1;
goto oomem;
}
ptr = nptr;
}
(void) strunvis(ptr, line);
decode_result = (ptr);
if (decode_result ==
((void *)0)
)
continue;
if ((*(h)->h_enter)((h)->h_ref, &ev, decode_result) == -1) {
i = -1;
goto oomem;
}
}
oomem:
free(ptr);
done:
free(line);
(void) fclose(fp);
return i;
}
| int history_load(undefined8 *param_1,char *param_2)
{
void *pvVar1;
int iVar2;
long in_FS_OFFSET;
int local_6c;
char *local_68;
size_t local_60;
ulong local_58;
ulong local_50;
void *local_48;
FILE *local_40;
void *local_38;
void *local_30;
undefined local_28 [24];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_6c = -1;
local_40 = fopen(param_2,"r");
if (local_40 == (FILE *)0x0) {
local_6c = -1;
}
else {
local_68 = (char *)0x0;
local_60 = 0;
local_58 = getline(&local_68,&local_60,local_40);
if ((local_58 != 0xffffffffffffffff) &&
(iVar2 = strncmp(local_68,"_HiStOrY_V2_\n",local_58), iVar2 == 0)) {
local_50 = 0x400;
local_48 = malloc(0x400);
if (local_48 != (void *)0x0) {
local_6c = 0;
while (local_58 = getline(&local_68,&local_60,local_40), local_58 != 0xffffffffffffffff) {
if ((0 < (long)local_58) && (local_68[local_58 - 1] == '\n')) {
local_58 = local_58 - 1;
local_68[local_58] = '\0';
}
pvVar1 = local_48;
if (local_50 < local_58) {
local_50 = local_58 + 0x400 & 0xfffffffffffffc00;
local_38 = realloc(local_48,local_50);
pvVar1 = local_38;
if (local_38 == (void *)0x0) {
local_6c = -1;
break;
}
}
local_48 = pvVar1;
strunvis(local_48,local_68);
local_30 = local_48;
if ((local_48 != (void *)0x0) &&
(iVar2 = (*(code *)param_1[10])(*param_1,local_28,local_48), iVar2 == -1)) {
local_6c = -1;
break;
}
local_6c = local_6c + 1;
}
free(local_48);
}
}
free(local_68);
fclose(local_40);
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_6c;
}
__stack_chk_fail();
}
|
static void
do_ssh2_kex(struct ssh *ssh)
{
char *myproposal[PROPOSAL_MAX] = { "sntrup761x25519-sha512@openssh.com," "curve25519-sha256," "curve25519-sha256@libssh.org," "ecdh-sha2-nistp256," "ecdh-sha2-nistp384," "ecdh-sha2-nistp521," "diffie-hellman-group-exchange-sha256," "diffie-hellman-group16-sha512," "diffie-hellman-group18-sha512," "diffie-hellman-group14-sha256", "ssh-ed25519-cert-v01@openssh.com," "ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "sk-ssh-ed25519-cert-v01@openssh.com," "sk-ecdsa-sha2-nistp256-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-ed25519," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "sk-ssh-ed25519@openssh.com," "sk-ecdsa-sha2-nistp256@openssh.com," "rsa-sha2-512," "rsa-sha2-256", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr," "aes128-gcm@openssh.com,aes256-gcm@openssh.com", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr," "aes128-gcm@openssh.com,aes256-gcm@openssh.com", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "none,zlib@openssh.com", "none,zlib@openssh.com", "", "" };
struct kex *kex;
char *prop_kex =
((void *)0)
, *prop_enc =
((void *)0)
, *prop_hostkey =
((void *)0)
;
int r;
myproposal[PROPOSAL_KEX_ALGS] = prop_kex = compat_kex_proposal(ssh,
options.kex_algorithms);
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
myproposal[PROPOSAL_ENC_ALGS_STOC] = prop_enc =
compat_cipher_proposal(ssh, options.ciphers);
myproposal[PROPOSAL_MAC_ALGS_CTOS] =
myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs;
if (options.compression == 0) {
myproposal[PROPOSAL_COMP_ALGS_CTOS] =
myproposal[PROPOSAL_COMP_ALGS_STOC] = "none";
}
if (options.rekey_limit || options.rekey_interval)
ssh_packet_set_rekey_limits(ssh, options.rekey_limit,
options.rekey_interval);
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = prop_hostkey =
compat_pkalg_proposal(ssh, list_hostkey_types());
if ((r = kex_setup(ssh, myproposal)) != 0)
sshfatal("sshd.c", __func__, 2403, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "kex_setup");
kex = ssh->kex;
kex->kex[KEX_DH_GRP1_SHA1] = kex_gen_server;
kex->kex[KEX_DH_GRP14_SHA1] = kex_gen_server;
kex->kex[KEX_DH_GRP14_SHA256] = kex_gen_server;
kex->kex[KEX_DH_GRP16_SHA512] = kex_gen_server;
kex->kex[KEX_DH_GRP18_SHA512] = kex_gen_server;
kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
kex->kex[KEX_ECDH_SHA2] = kex_gen_server;
kex->kex[KEX_C25519_SHA256] = kex_gen_server;
kex->kex[KEX_KEM_SNTRUP761X25519_SHA512] = kex_gen_server;
kex->load_host_public_key=&get_hostkey_public_by_type;
kex->load_host_private_key=&get_hostkey_private_by_type;
kex->host_key_index=&get_hostkey_index;
kex->sign = sshd_hostkey_sign;
ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &kex->done);
free(prop_kex);
free(prop_enc);
free(prop_hostkey);
sshlog("sshd.c", __func__, 2437, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0)
, "KEX done");
}
| unsigned long do_ssh2_kex(long a1)
{
const char *v1;
long v2;
unsigned int v4;
char *ptr;
char *v6;
char *v7;
_QWORD *v8;
const char *v9;
const char *v10;
const char *v11;
const char *v12;
const char *v13;
const char *v14;
const char *v15;
const char *v16;
void *v17;
void *v18;
unsigned long v19;
v19 = __readfsqword(0x28u);
v9 = "sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-ni"
"stp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group"
"18-sha512,diffie-hellman-group14-sha256";
v10 = "ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.c"
"om,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@"
"openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,"
"ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256";
v11 = "chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com";
v12 = "chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com";
v13 = "umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hma"
"c-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1";
v14 = "umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hma"
"c-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1";
v15 = "none,zlib@openssh.com";
v16 = "none,zlib@openssh.com";
v17 = &unk_737C;
v18 = &unk_737C;
ptr = (char *)compat_kex_proposal(a1, *(_QWORD *)&options[306]);
v9 = ptr;
v6 = (char *)compat_cipher_proposal(a1, *(_QWORD *)&options[302]);
v12 = v6;
v11 = v6;
v14 = *(const char **)&options[304];
v13 = v14;
if ( !options[342] )
{
v16 = "none";
v15 = "none";
}
if ( *(_QWORD *)&options[1952] || options[1954] )
ssh_packet_set_rekey_limits(a1, *(_QWORD *)&options[1952], (unsigned int)options[1954]);
v1 = list_hostkey_types();
v7 = (char *)compat_pkalg_proposal(a1, v1);
v10 = v7;
v4 = kex_setup(a1, &v9);
if ( v4 )
{
v2 = ssh_err(v4);
sshfatal("sshd.c", "do_ssh2_kex", 2403LL, 0LL, 1LL, v2, "kex_setup");
}
v8 = *(_QWORD **)(a1 + 8);
v8[25] = &kex_gen_server;
v8[26] = &kex_gen_server;
v8[27] = &kex_gen_server;
v8[28] = &kex_gen_server;
v8[29] = &kex_gen_server;
v8[30] = &kexgex_server;
v8[31] = &kexgex_server;
v8[32] = &kex_gen_server;
v8[33] = &kex_gen_server;
v8[34] = &kex_gen_server;
v8[21] = get_hostkey_public_by_type;
v8[22] = get_hostkey_private_by_type;
v8[23] = get_hostkey_index;
v8[24] = sshd_hostkey_sign;
ssh_dispatch_run_fatal(a1, 0LL, v8 + 17);
free(ptr);
free(v6);
free(v7);
sshlog("sshd.c", "do_ssh2_kex", 2437LL, 0LL, 5LL, 0LL, "KEX done");
return __readfsqword(0x28u) ^ v19;
}
|
int
local_is_dir(const char *path)
{
struct stat sb;
if (stat(path, &sb) == -1)
return(0);
return(
((((
sb.st_mode
)) & 0170000) == (0040000))
);
}
| bool local_is_dir(char *param_1)
{
int iVar1;
long in_FS_OFFSET;
bool bVar2;
stat local_a8;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = stat(param_1,&local_a8);
if (iVar1 == -1) {
bVar2 = false;
}
else {
bVar2 = (local_a8.st_mode & 0xf000) == 0x4000;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return bVar2;
}
|
char *get_name_from_nsid(int nsid)
{
struct nsid_cache *c;
if (nsid < 0)
return
((void *)0)
;
netns_nsid_socket_init();
netns_map_init();
c = netns_map_get_by_nsid(nsid);
if (c)
return c->name;
return
((void *)0)
;
}
| long long get_name_from_nsid(unsigned long a0) {
unsigned long v0;
void* v2;
if (a0 < 0) {
v2 = 0;
} else {
netns_nsid_socket_init();
netns_map_init();
v0 = netns_map_get_by_nsid(a0);
if (!v0)
v2 = 0;
else
v2 = v0 + 36;
}
return v2;
}
|
static void fail_exit (int status)
{
if (spw_locked) {
if (spw_unlock () == 0) {
fprintf (
stderr
, gettext ("%s: failed to unlock %s\n"), Prog, spw_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failed to unlock %s", spw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
}
if (pw_locked) {
if (pw_unlock () == 0) {
fprintf (
stderr
, gettext ("%s: failed to unlock %s\n"), Prog, pw_dbname ());
do { char *old_locale = setlocale (
6
,
((void *)0)
); char *saved_locale =
((void *)0)
; if (
((void *)0)
!= old_locale) { saved_locale = strdup (old_locale); } if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, "C"); } syslog (
3
, "failed to unlock %s", pw_dbname ()) ; if (
((void *)0)
!= saved_locale) { (void) setlocale (
6
, saved_locale); free (saved_locale); } } while (
0
);
}
}
exit (status);
}
| void fail_exit(unsigned long a0) {
void* v0;
void* v1;
char *v2;
char *v3;
unsigned long v4;
unsigned long v5;
unsigned long v7;
unsigned long v8;
unsigned long long v9;
unsigned long long v10;
v5 = v7;
v4 = v8;
if (spw_locked && !spw_unlock()) {
v9 = spw_dbname();
fprintf(stderr, gettext("%s: failed to unlock %s\n"));
v2 = setlocale(0x6, NULL);
v0 = 0;
if (v2)
v0 = strdup(v2);
if (v0)
setlocale(0x6, "C");
spw_dbname();
syslog(0x3, "failed to unlock %s");
if (v0) {
setlocale(0x6, v0);
free(v0);
}
}
if (pw_locked && !pw_unlock()) {
v10 = pw_dbname();
fprintf(stderr, gettext("%s: failed to unlock %s\n"));
v3 = setlocale(0x6, NULL);
v1 = 0;
if (v3)
v1 = strdup(v3);
if (v1)
setlocale(0x6, "C");
pw_dbname();
syslog(0x3, "failed to unlock %s");
if (v1) {
setlocale(0x6, v1);
free(v1);
}
}
exit(a0);
}
|
static idx_t
get_format_flags (char const *format, int *flags_ptr)
{
int flags = 0;
for (idx_t count = 0; ; count++)
{
switch (format[count])
{
case '-':
case '0':
break;
case '\'':
flags |= FLAG_THOUSANDS;
break;
case '#':
flags |= FLAG_ALTERNATIVE;
break;
default:
*flags_ptr = flags;
return count;
}
}
}
| int get_format_flags(void* a0, unsigned int *a1) {
unsigned int v0;
void* v1;
v0 = 0;
v1 = 0;
while (true) {
if (*((a0 + v1)) != 48) {
if (*((a0 + v1)) > 48)
break;
if (*((a0 + v1)) <= 48 && *((a0 + v1)) != 45) {
if (*((a0 + v1)) > 45)
break;
if (*((a0 + v1)) <= 45) {
if (*((a0 + v1)) != 35) {
if (*((a0 + v1)) != 39)
break;
if (*((a0 + v1)) == 39)
v0 |= 1;
} else {
v0 |= 2;
}
}
}
}
v1 += 1;
}
*(a1) = v0;
return v1;
}
|
void
clear_deconfigure_queue(void)
{
struct pkg_deconf_list *deconf, *deconf_next;
for (deconf = deconfigure; deconf; deconf = deconf_next) {
deconf_next = deconf->next;
free(deconf);
}
deconfigure =
((void *)0)
;
}
| void clear_deconfigure_queue(void)
{
undefined8 *puVar1;
undefined8 *local_18;
local_18 = deconfigure;
while (local_18 != (undefined8 *)0x0) {
puVar1 = (undefined8 *)*local_18;
free(local_18);
local_18 = puVar1;
}
deconfigure = (undefined8 *)0x0;
return;
}
|
static void
report_file_err(int exitval, int errno_value,
_Bool
is_target_file, const char *name)
{
if (!is_target_file || !state.already_issued_stat_error_msg)
{
error (exitval, errno_value, "%s", safely_quote_err_filename (0, name));
state.exit_status =
1
;
}
if (is_target_file)
{
state.already_issued_stat_error_msg =
1
;
}
}
| void report_file_err(undefined4 param_1,undefined4 param_2,char param_3,undefined8 param_4)
{
undefined8 uVar1;
if ((param_3 != '\x01') || (atof != '\x01')) {
uVar1 = safely_quote_err_filename(0,param_4);
error(param_1,param_2,&DAT_00102922,uVar1);
_DAT_00104074 = 1;
}
if (param_3 != '\0') {
atof = '\x01';
}
return;
}
|
_Bool
pred_or (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
if (pred_ptr->pred_left ==
((void *)0)
|| !apply_predicate (pathname, stat_buf, pred_ptr->pred_left))
{
return apply_predicate (pathname, stat_buf, pred_ptr->pred_right);
}
else
return
1
;
}
| undefined8 pred_or(undefined8 param_1,undefined8 param_2,long param_3)
{
char cVar1;
undefined8 uVar2;
if ((*(long *)(param_3 + 0x110) != 0) &&
(cVar1 = apply_predicate(param_1,param_2,*(undefined8 *)(param_3 + 0x110)), cVar1 == '\x01')) {
return 1;
}
uVar2 = apply_predicate(param_1,param_2,*(undefined8 *)(param_3 + 0x118));
return uVar2;
}
|
struct passwd *
pwcopy(struct passwd *pw)
{
struct passwd *copy = xcalloc(1, sizeof(*copy));
copy->pw_name = xstrdup(pw->pw_name);
copy->pw_passwd = xstrdup(pw->pw_passwd ==
((void *)0)
? "*" : pw->pw_passwd);
copy->pw_gecos = xstrdup(pw->pw_gecos);
copy->pw_uid = pw->pw_uid;
copy->pw_gid = pw->pw_gid;
copy->pw_dir = xstrdup(pw->pw_dir);
copy->pw_shell = xstrdup(pw->pw_shell);
return copy;
}
| long long pwcopy(struct_0 *a0) {
struct_0 *v0;
unsigned long long v2;
v0 = xcalloc(0x1, 0x30);
v0->field_0 = xstrdup(a0->field_0);
if (!a0->field_8)
v2 = "*";
else
v2 = a0->field_8;
v0->field_8 = xstrdup(v2);
v0->field_18 = xstrdup(a0->field_18);
v0->field_10 = a0->field_10;
v0->field_14 = a0->field_14;
v0->field_20 = xstrdup(a0->field_20);
v0->field_28 = xstrdup(a0->field_28);
return v0;
}
|
static void usage(void)
{
fprintf(
stderr
,
"Usage: ip nexthop { list | flush } [ protocol ID ] SELECTOR\n"
" ip nexthop { add | replace } id ID NH [ protocol ID ]\n"
" ip nexthop { get | del } id ID\n"
" ip nexthop bucket list BUCKET_SELECTOR\n"
" ip nexthop bucket get id ID index INDEX\n"
"SELECTOR := [ id ID ] [ dev DEV ] [ vrf NAME ] [ master DEV ]\n"
" [ groups ] [ fdb ]\n"
"BUCKET_SELECTOR := SELECTOR | [ nhid ID ]\n"
"NH := { blackhole | [ via ADDRESS ] [ dev DEV ] [ onlink ]\n"
" [ encap ENCAPTYPE ENCAPHDR ] |\n"
" group GROUP [ fdb ] [ type TYPE [ TYPE_ARGS ] ] }\n"
"GROUP := [ <id[,weight]>/<id[,weight]>/... ]\n"
"TYPE := { mpath | resilient }\n"
"TYPE_ARGS := [ RESILIENT_ARGS ]\n"
"RESILIENT_ARGS := [ buckets BUCKETS ] [ idle_timer IDLE ]\n"
" [ unbalanced_timer UNBALANCED ]\n"
"ENCAPTYPE := [ mpls ]\n"
"ENCAPHDR := [ MPLSLABEL ]\n");
exit(-1);
}
| void usage(void)
{
fprintf(stderr,
"Usage: ip nexthop { list | flush } [ protocol ID ] SELECTOR\n ip nexthop { add | replace } id ID NH [ protocol ID ]\n ip nexthop { get | del } id ID\n ip nexthop bucket list BUCKET_SELECTOR\n ip nexthop bucket get id ID index INDEX\nSELECTOR := [ id ID ] [ dev DEV ] [ vrf NAME ] [ master DEV ]\n [ groups ] [ fdb ]\nBUCKET_SELECTOR := SELECTOR | [ nhid ID ]\nNH := { blackhole | [ via ADDRESS ] [ dev DEV ] [ onlink ]\n [ encap ENCAPTYPE ENCAPHDR ] |\n group GROUP [ fdb ] [ type TYPE [ TYPE_ARGS ] ] }\nGROUP := [ <id[,weight]>/<id[,weight]>/... ]\nTYPE := { mpath | resilient }\nTYPE_ARGS := [ RESILIENT_ARGS ]\nRESILIENT_ARGS := [ buckets BUCKETS ] [ idle_timer IDLE ]\n [ unbalanced_timer UNBALANCED ]\nENCAPTYPE := [ mpls ]\nENCAPHDR := [ MPLSLABEL ]\n"
);
exit(-1);
}
|
static
_Bool
audit_status(struct pkginfo *pkg, const struct audit_problem *problem)
{
if (pkg->eflag & PKG_EFLAG_REINSTREQ)
return
0
;
return (int)pkg->status == problem->value.number;
}
| long long audit_status(unsigned int a0[7], struct_0 *a1) {
void* v1;
if ((a0[5] & 1)) {
v1 = 0;
} else {
v1 = a1->field_8;
*(&v1) = a0[6] == a1->field_8;
}
return v1;
}
|
static
_Bool
parse_obsolete_option (int argc, char * const *argv, uintmax_t *n_units)
{
char const *p;
char const *n_string;
char const *n_string_end;
int default_count = 10;
_Bool
t_from_start;
_Bool
t_count_lines =
1
;
_Bool
t_forever =
0
;
if (! (argc == 2
|| (argc == 3 && ! (argv[2][0] == '-' && argv[2][1]))
|| (3 <= argc && argc <= 4 && (strcmp (argv[2], "--") == 0))))
return
0
;
int posix_ver = posix2_version ();
_Bool
obsolete_usage = posix_ver < 200112;
_Bool
traditional_usage = obsolete_usage || 200809 <= posix_ver;
p = argv[1];
switch (*p++)
{
default:
return
0
;
case '+':
if (!traditional_usage)
return
0
;
t_from_start =
1
;
break;
case '-':
if (!obsolete_usage && !p[p[0] == 'c'])
return
0
;
t_from_start =
0
;
break;
}
n_string = p;
while (((unsigned int) (*p) - '0' <= 9))
p++;
n_string_end = p;
switch (*p)
{
case 'b': default_count *= 512; __attribute__ ((__fallthrough__));
case 'c': t_count_lines =
0
; __attribute__ ((__fallthrough__));
case 'l': p++; break;
}
if (*p == 'f')
{
t_forever =
1
;
++p;
}
if (*p)
return
0
;
if (n_string == n_string_end)
*n_units = default_count;
else if ((xstrtoumax (n_string,
((void *)0)
, 10, n_units, "b")
& ~LONGINT_INVALID_SUFFIX_CHAR)
!= LONGINT_OK)
{
((!!sizeof (struct { _Static_assert (
1
, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s: %s\", gettext (\"invalid number\"), quote (argv[1])), assume (false))" ")"); int _gl_dummy; })) ? ((error (
1
,
(*__errno_location ())
, "%s: %s", gettext ("invalid number"), quote (argv[1])), ((
0
) ? (void) 0 : __builtin_unreachable ()))) : ((error (
1
,
(*__errno_location ())
, "%s: %s", gettext ("invalid number"), quote (argv[1])), ((
0
) ? (void) 0 : __builtin_unreachable ()))))
;
}
from_start = t_from_start;
count_lines = t_count_lines;
forever = t_forever;
return
1
;
}
| long parse_obsolete_option(int a1, long a2, _QWORD *a3)
{
bool v4;
char *v5;
int v6;
int v7;
const char *v8;
char *v9;
int *v10;
char v12;
char v13;
char v14;
bool v15;
int v16;
int v17;
_BYTE *v18;
_BYTE *v19;
_BYTE *v20;
v16 = 10;
v13 = 1;
v14 = 0;
if ( a1 != 2
&& (a1 != 3 || **(_BYTE **)(a2 + 16) == 45 && *(_BYTE *)(*(_QWORD *)(a2 + 16) + 1LL))
&& (a1 <= 2 || a1 > 4 || strcmp(*(const char **)(a2 + 16), "--")) )
{
return 0LL;
}
v17 = posix2_version();
v4 = v17 <= 200111 || v17 > 200808;
v15 = v4;
v5 = *(char **)(a2 + 8);
v18 = v5 + 1;
v6 = *v5;
if ( v6 == 43 )
{
if ( !v15 )
return 0LL;
v12 = 1;
}
else
{
if ( v6 != 45 )
return 0LL;
if ( v17 > 200111 && !v18[*v18 == 99] )
return 0LL;
v12 = 0;
}
v19 = v18;
while ( (unsigned int)((char)*v18 - 48) <= 9 )
++v18;
v20 = v18;
v7 = (char)*v18;
if ( v7 == 108 )
{
LABEL_33:
++v18;
goto LABEL_34;
}
if ( v7 <= 108 )
{
if ( v7 == 98 )
{
v16 = 5120;
}
else if ( v7 != 99 )
{
goto LABEL_34;
}
v13 = 0;
goto LABEL_33;
}
LABEL_34:
if ( *v18 == 102 )
{
v14 = 1;
++v18;
}
if ( *v18 )
return 0LL;
if ( v19 == v20 )
{
*a3 = v16;
}
else if ( (xstrtoumax(v19, 0LL, 10LL, a3, "b") & 0xFFFFFFFD) != 0 )
{
v8 = (const char *)quote(*(_QWORD *)(a2 + 8));
v9 = gettext("invalid number");
v10 = _errno_location();
error(1, *v10, "%s: %s", v9, v8);
}
from_start = v12;
count_lines = v13;
forever = v14;
return 1LL;
}
|
void clear_istobes(void) {
struct pkg_hash_iter *iter;
struct pkginfo *pkg;
iter = pkg_hash_iter_new();
while ((pkg = pkg_hash_iter_next_pkg(iter)) !=
((void *)0)
) {
ensure_package_clientdata(pkg);
pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
pkg->clientdata->replacingfilesandsaid= 0;
}
pkg_hash_iter_free(iter);
}
| void clear_istobes(void)
{
undefined8 uVar1;
long lVar2;
uVar1 = pkg_hash_iter_new();
while( true ) {
lVar2 = pkg_hash_iter_next_pkg(uVar1);
if (lVar2 == 0) break;
ensure_package_clientdata(lVar2);
**(undefined4 **)(lVar2 + 0x138) = 0;
*(undefined4 *)(*(long *)(lVar2 + 0x138) + 0xc) = 0;
}
pkg_hash_iter_free(uVar1);
return;
}
|
static void
kill_error (pid, e)
pid_t pid;
int e;
{
char *x;
x = strerror (e);
if (x == 0)
x = gettext("Unknown error");
builtin_error ("(%ld) - %s", (long)pid, x);
}
| long kill_error(int a1, int a2)
{
if ( !strerror(a2) )
gettext("Unknown error");
return builtin_error("(%ld) - %s", a1);
}
|
void
rl_reset_screen_size (void)
{
_rl_get_screen_size (fileno (rl_instream), 0);
}
| void rl_reset_screen_size(void)
{
int iVar1;
iVar1 = fileno(rl_instream);
_rl_get_screen_size(iVar1,0);
return;
}
|
static void explain(void)
{
print_explain(
stderr
);
}
| int explain()
{
return print_explain(stderr);
}
|
void
errc(int status, int code, const char *format, ...)
{
va_list ap;
__builtin_va_start(
ap
,
format
)
;
verrc(status, code, format, ap);
__builtin_va_end(
ap
)
;
}
| void errc(int a1, int a2, const char *a3, long a4, long a5, long a6, ...)
{
gcc_va_list va;
unsigned long v7;
long v8;
long v9;
long v10;
va_start(va, a6);
v8 = a4;
v9 = a5;
v10 = a6;
v7 = __readfsqword(0x28u);
va[0].gp_offset = 24;
verrc(a1, a2, a3, va);
}
|
int
ssh_packet_have_data_to_write(struct ssh *ssh)
{
return sshbuf_len(ssh->state->output) != 0;
}
| int ssh_packet_have_data_to_write(struct struct_0 **a0) {
return sshbuf_len(*(a0)->field_28);
}
|
static SHELL_VAR *
assign_comp_wordbreaks (self, value, unused, key)
SHELL_VAR *self;
char *value;
arrayind_t unused;
char *key;
{
if (rl_completer_word_break_characters &&
rl_completer_word_break_characters != rl_basic_word_break_characters)
sh_xfree(((void *)rl_completer_word_break_characters), "variables.c", 1641);
rl_completer_word_break_characters = (char *)strcpy (sh_xmalloc((1 + strlen (value)), "variables.c", 1643), (value));
return self;
}
| long long assign_comp_wordbreaks(unsigned long a0, char *a1, unsigned long a2, unsigned long a3) {
unsigned long v0;
unsigned long v1;
v1 = a2;
v0 = a3;
if (rl_completer_word_break_characters && rl_completer_word_break_characters != rl_basic_word_break_characters)
sh_xfree(rl_completer_word_break_characters, "variables.c", 0x669);
rl_completer_word_break_characters = strcpy(sh_xmalloc(strlen(a1) + 1, "variables.c", 0x66b), a1);
return a0;
}
|
void
translate_range (struct file_data const *file,
lin a, lin b,
printint *aptr, printint *bptr)
{
*aptr = translate_line_number (file, a - 1) + 1;
*bptr = translate_line_number (file, b + 1) - 1;
}
| long * translate_range(long a1, long a2, long a3, _QWORD *a4, long *a5)
{
long v5;
long *result;
*a4 = translate_line_number(a1, a2 - 1) + 1;
v5 = translate_line_number(a1, a3 + 1) - 1;
result = a5;
*a5 = v5;
return result;
}
|
static void load_data(common_info_st *cinfo, gnutls_datum_t *data)
{
FILE *fp;
size_t size;
fp = fopen(cinfo->data_file, "r");
if (fp ==
((void *)0)
) {
fprintf(
stderr
, "Could not open %s\n", cinfo->data_file);
app_exit(1);
}
data->data = (void *) _gnutls_fread_file(fp, 0, &size);
if (data->data ==
((void *)0)
) {
fprintf(
stderr
, "Error reading data file");
app_exit(1);
}
data->size = size;
fclose(fp);
}
| void load_data(struct_0 *a0, struct_1 *a1) {
char v0;
void* v1;
char v2;
unsigned long long *v4;
unsigned long long v5;
v1 = fopen(a0->field_48, "r");
if (!v1) {
fprintf(*(&stderr), "Could not open %s\n", a0->field_48);
app_exit(0x1);
}
a1->field_0 = _gnutls_fread_file(v1, 0x0, &v0);
if (a1->field_0) {
a1->field_8 = *(&v0);
fclose(v1);
v5 = *(&v2) ^ v4[5];
return;
}
fprintf(*(&stderr), "Error reading data file");
app_exit(0x1);
}
|
vi_to_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
{
return cv_csearch(el, (-1), -1, el->el_state.argument, 1);
}
| long long vi_to_prev_char(struct_0 *a0, unsigned long a1) {
unsigned int v0;
v0 = a1;
return cv_csearch(a0, 0xffffffff, 0xffffffff, a0->field_78, 0x1);
}
|
void
_rl_block_sigwinch (void)
{
if (sigwinch_blocked)
return;
sigemptyset (&sigwinch_set);
sigemptyset (&sigwinch_oset);
sigaddset (&sigwinch_set,
28
);
sigprocmask (
0
, &sigwinch_set, &sigwinch_oset);
sigwinch_blocked = 1;
}
| long long _rl_block_sigwinch() {
unsigned long long v1;
v1 = sigwinch_blocked;
if (!sigwinch_blocked) {
sigemptyset(&sigwinch_set);
sigemptyset(&sigwinch_oset);
sigaddset(&sigwinch_set, 0x1c);
v1 = sigprocmask(0x0, &sigwinch_set, &sigwinch_oset);
sigwinch_blocked = 1;
}
return v1;
}
|
static int get_void(FILE *f)
{
int c;
while ((c = getc(f)) !=
(-1)
&& c != '\n')
;
return (c !=
(-1)
);
}
| void get_void(void* a0) {
unsigned int v0;
unsigned long v2;
do { } while ((v0 = getc(a0), v0 != -1 && v0 != 10));
v2 = v0 != -1;
return;
}
|
static inline
_Bool
usable_st_size (struct stat const *sb)
{
return (
((((
sb->st_mode
)) & 0170000) == (0100000))
||
((((
sb->st_mode
)) & 0170000) == (0120000))
||
((
sb
)->st_mode - (
sb
)->st_mode)
||
0
);
}
| _BOOL8 usable_st_size(long a1)
{
return (*(_DWORD *)(a1 + 24) & 0xF000) == 0x8000 || (*(_DWORD *)(a1 + 24) & 0xF000) == 40960;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.