input
stringlengths
28
169k
output
stringlengths
20
317k
int log_change_level(LogLevel new_log_level) { if (argv0 == ((void *)0) ) return 0; switch (new_log_level) { case SYSLOG_LEVEL_QUIET: case SYSLOG_LEVEL_FATAL: case SYSLOG_LEVEL_ERROR: case SYSLOG_LEVEL_INFO: case SYSLOG_LEVEL_VERBOSE: case SYSLOG_LEVEL_DEBUG1: case SYSLOG_LEVEL_DEBUG2: case SYSLOG_LEVEL_DEBUG3: log_level = new_log_level; return 0; default: return -1; } }
int log_change_level(unsigned long a0) { unsigned int v1; if (!argv0) { v1 = 0; return v1; } else if (a0 <= 7) { log_level = a0; v1 = 0; return v1; } else { v1 = -1; return v1; } }
int compress2(dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; int level; { z_stream stream; int err; const uInt max = (uInt)-1; uLong left; left = *destLen; *destLen = 0; stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; stream.opaque = (voidpf)0; err = deflateInit_((&stream), (level), "1.2.13", (int)sizeof(z_stream)); if (err != 0) return err; stream.next_out = dest; stream.avail_out = 0; stream.next_in = ( Bytef *)source; stream.avail_in = 0; do { if (stream.avail_out == 0) { stream.avail_out = left > (uLong)max ? max : (uInt)left; left -= stream.avail_out; } if (stream.avail_in == 0) { stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen; sourceLen -= stream.avail_in; } err = deflate(&stream, sourceLen ? 0 : 4); } while (err == 0); *destLen = stream.total_out; deflateEnd(&stream); return err == 1 ? 0 : err; }
long compress2(long a1, unsigned long *a2, long a3, unsigned long a4, unsigned int a5) { unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v11; unsigned int v12; unsigned long v13; long v14; unsigned int v15; long v16; unsigned int v17; unsigned long v18; long v19; long v20; long v21; unsigned long v22; v22 = __readfsqword(0x28u); v13 = *a2; *a2 = 0LL; v19 = 0LL; v20 = 0LL; v21 = 0LL; v11 = deflateInit_(&v14, a5, "1.2.13", 112LL); if ( v11 ) return v11; v16 = a1; v17 = 0; v14 = a3; v15 = 0; do { if ( !v17 ) { if ( v13 > 0xFFFFFFFF ) v6 = -1; else v6 = v13; v17 = v6; v13 -= v6; } if ( !v15 ) { if ( a4 > 0xFFFFFFFF ) v7 = -1; else v7 = a4; v15 = v7; a4 -= v7; } if ( a4 ) v8 = 0; else v8 = 4; v12 = deflate(&v14, v8); } while ( !v12 ); *a2 = v18; deflateEnd(&v14); if ( v12 == 1 ) return 0LL; else return v12; }
int getpeereid(int s, uid_t *euid, gid_t *gid) { struct ucred cred; socklen_t len = sizeof(cred); if (getsockopt(s, 1 , 17 , &cred, &len) < 0) return (-1); *euid = cred.uid; *gid = cred.gid; return (0); }
long getpeereid(int a1, _DWORD *a2, _DWORD *a3) { socklen_t optlen; char optval[4]; int v7; int v8; unsigned long v9; v9 = __readfsqword(0x28u); optlen = 12; if ( getsockopt(a1, 1, 17, optval, &optlen) < 0 ) return 0xFFFFFFFFLL; *a2 = v7; *a3 = v8; return 0LL; }
static int chk_atstar (name, quoted, pflags, quoted_dollar_atp, contains_dollar_at) char *name; int quoted, pflags; int *quoted_dollar_atp, *contains_dollar_at; { char *temp1; if (name == 0) { if (quoted_dollar_atp) *quoted_dollar_atp = 0; if (contains_dollar_at) *contains_dollar_at = 0; return 0; } if (name[0] == '@' && name[1] == 0) { if ((quoted & (0x002|0x001)) && quoted_dollar_atp) *quoted_dollar_atp = 1; if (contains_dollar_at) *contains_dollar_at = 1; return 1; } else if (name[0] == '*' && name[1] == '\0' && quoted == 0) { if (contains_dollar_at && expand_no_split_dollar_star == 0) *contains_dollar_at = 1; return 1; } else if (valid_array_reference (name, 0)) { temp1 = mbschr (name, '['); if (temp1 && temp1[1] == '@' && temp1[2] == ']') { if ((quoted & (0x002|0x001)) && quoted_dollar_atp) *quoted_dollar_atp = 1; if (contains_dollar_at) *contains_dollar_at = 1; return 1; } if (temp1 && temp1[1] == '*' && temp1[2] == ']' && quoted == 0) { if (contains_dollar_at) *contains_dollar_at = 1; return 1; } } return 0; }
int chk_atstar(char a0[2], unsigned long a1, unsigned long a2, unsigned int *a3, unsigned int *a4) { unsigned int v0; char v1[3]; unsigned int v3; v0 = a2; if (!a0) { if (a3) *(a3) = 0; if (a4) *(a4) = 0; v3 = 0; } else { if (a0[0] == 64 && !a0[1]) { if ((a1 & 3) && a3) *(a3) = 1; if (a4) *(a4) = 1; v3 = 1; } if (a0[1] || a0[0] != 64) { if (a0[0] == 42 && !a0[1] && !a1) { if (a4 && !expand_no_split_dollar_star) *(a4) = 1; v3 = 1; } if (a0[1] || a1 || a0[0] != 42) { v3 = valid_array_reference(a0, 0x0); if (v3) { *(&v1) = mbschr(a0, 0x5b); if (v1) { if (v1[1] == 64 && v1[2] == 93) { if ((a1 & 3) && a3) *(a3) = 1; if (a4) *(a4) = 1; v3 = 1; } if ((v1[1] != 64 || v1[2] != 93) && v1[1] == 42 && v1[2] == 93 && !a1) { if (a4) *(a4) = 1; v3 = 1; } } } if (!v3 || !v1 || v1[1] != 64 && v1[1] != 42 || v1[1] != 64 && a1 || v1[1] != 64 && v1[2] != 93 || v1[1] != 42 && v1[2] != 93 || v1[2] != 93 && a1 || v1[2] != 93 && v1[2] != 93) v3 = 0; } } } return v3; }
static void int32_divmod_uint14(crypto_int32 *q,crypto_uint16 *r,crypto_int32 x,crypto_uint16 m) { crypto_uint32 uq,uq2; crypto_uint16 ur,ur2; crypto_uint32 mask; uint32_divmod_uint14(&uq,&ur,0x80000000+(crypto_uint32)x,m); uint32_divmod_uint14(&uq2,&ur2,0x80000000,m); ur -= ur2; uq -= uq2; mask = -(crypto_uint32)(ur>>15); ur += mask&m; uq += mask; *r = ur; *q = uq; }
void int32_divmod_uint14(unsigned int *a0, unsigned short *a1, unsigned long a2, unsigned long a3) { unsigned short v0; char v1; unsigned int v2; char v3; unsigned int v4; char v5; unsigned int v7; unsigned long long *v8; unsigned long long v9; uint32_divmod_uint14(&v2, &v0, a2 - 0x80000000, a3); uint32_divmod_uint14(&v3, &v1, 0x80000000, a3); v0 = *(&v0) - *(&v1); v2 = *(&v2) - *(&v3); v4 = -((v0 >> 15)); v7 = v4; *(&v7) = v4 & a3; *(&v7) = v0 + v7; v0 = v7; v2 = v4 + v2; *(a1) = v0; *(a0) = v2; v9 = *(&v5) ^ v8[5]; return; }
errcode_t e2fsck_check_rebuild_extents(e2fsck_t ctx, ext2_ino_t ino, struct ext2_inode *inode, struct problem_context *pctx) { struct extent_tree_info eti; struct ext2_extent_info info, top_info; struct ext2fs_extent extent; ext2_extent_handle_t ehandle; ext2_filsys fs = ctx->fs; errcode_t retval; if (!(inode->i_flags & 0x00080000) && !(inode->i_flags & 0x10000000) && (ctx->options & 0x4000)) { return e2fsck_rebuild_extents_later(ctx, ino); } if (!(inode->i_flags & 0x00080000)) return 0; memset(&eti, 0, sizeof(eti)); eti.ino = ino; retval = ext2fs_extent_open2(fs, ino, inode, &ehandle); if (retval) return 0; retval = ext2fs_extent_get_info(ehandle, &top_info); if (retval) goto out; pctx->ino = ino; pctx->blk = top_info.max_depth; pctx->blk2 = ext2fs_max_extent_depth(ehandle); if (pctx->blk2 < pctx->blk && fix_problem(ctx, 0x01007F, pctx)) eti.force_rebuild = 1; pctx->blk = 5; if (pctx->blk2 > pctx->blk) fix_problem(ctx, 0x014005, pctx); if (ctx->options & 0x8000) goto out; retval = ext2fs_extent_get(ehandle, 0x0001, &extent); if (retval) goto out; do { retval = ext2fs_extent_get_info(ehandle, &info); if (retval) break; if (info.curr_entry == 1 && !(extent.e_flags & 0x0004) && !eti.force_rebuild) { struct extent_tree_level *etl; etl = eti.ext_info + info.curr_level; etl->num_extents += info.num_entries; etl->max_extents += info.max_entries; if (info.curr_level && info.num_entries < info.max_entries) etl->max_extents--; } if (extent.e_flags & 0x0001) { retval = ext2fs_extent_get(ehandle, 0x0004, &extent); if (retval) break; } retval = ext2fs_extent_get(ehandle, 0x0009, &extent); } while (retval == 0); out: ext2fs_extent_free(ehandle); return e2fsck_should_rebuild_extents(ctx, pctx, &eti, &top_info); }
undefined8 e2fsck_check_rebuild_extents(undefined8 *param_1,undefined4 param_2,long param_3,long param_4) { int iVar1; undefined8 uVar2; long lVar3; long in_FS_OFFSET; undefined8 local_e8; undefined8 local_e0; long local_d8; int *local_d0; undefined local_c8 [20]; uint local_b4; int local_a8; int local_a4; int local_a0; int local_9c; undefined local_78 [16]; int local_68; undefined4 local_48; int local_44; int aiStack64 [12]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_e0 = *param_1; if ((((*(uint *)(param_3 + 0x20) & 0x80000) == 0) && ((*(uint *)(param_3 + 0x20) & 0x10000000) == 0)) && ((*(uint *)((long)param_1 + 0x4c) & 0x4000) != 0)) { uVar2 = e2fsck_rebuild_extents_later(param_1,param_2); } else if ((*(uint *)(param_3 + 0x20) & 0x80000) == 0) { uVar2 = 0; } else { memset(&local_48,0,0x30); local_48 = param_2; local_d8 = ext2fs_extent_open2(local_e0,param_2,param_3,&local_e8); if (local_d8 == 0) { local_d8 = ext2fs_extent_get_info(local_e8,local_78); if (local_d8 == 0) { *(undefined4 *)(param_4 + 8) = param_2; *(long *)(param_4 + 0x28) = (long)local_68; uVar2 = ext2fs_max_extent_depth(local_e8); *(undefined8 *)(param_4 + 0x30) = uVar2; if ((*(ulong *)(param_4 + 0x30) < *(ulong *)(param_4 + 0x28)) && (iVar1 = fix_problem(param_1,0x1007f,param_4), iVar1 != 0)) { local_44 = 1; } *(undefined8 *)(param_4 + 0x28) = 5; if (*(ulong *)(param_4 + 0x28) < *(ulong *)(param_4 + 0x30)) { fix_problem(param_1,0x14005,param_4); } if (((*(uint *)((long)param_1 + 0x4c) & 0x8000) == 0) && (local_d8 = ext2fs_extent_get(local_e8,1,local_c8), local_d8 == 0)) { while (local_d8 = ext2fs_extent_get_info(local_e8,&local_a8), local_d8 == 0) { if (((local_a8 == 1) && ((local_b4 & 4) == 0)) && (local_44 == 0)) { lVar3 = (long)local_a4; local_d0 = aiStack64 + lVar3 * 2; *local_d0 = local_a0 + *local_d0; aiStack64[lVar3 * 2 + 1] = local_9c + aiStack64[lVar3 * 2 + 1]; if ((local_a4 != 0) && (local_a0 < local_9c)) { aiStack64[lVar3 * 2 + 1] = aiStack64[lVar3 * 2 + 1] + -1; } } if ((((local_b4 & 1) != 0) && (local_d8 = ext2fs_extent_get(local_e8,4,local_c8), local_d8 != 0)) || (local_d8 = ext2fs_extent_get(local_e8,9,local_c8), local_d8 != 0)) break; } } } ext2fs_extent_free(local_e8); uVar2 = e2fsck_should_rebuild_extents(param_1,param_4,&local_48,local_78); } else { uVar2 = 0; } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar2; } __stack_chk_fail(); }
0 ) do { fprintf ( stderr , gettext ("Try '%s --help' for more information.\n"), program_name); } while (0);
int fprintf(FILE *__stream,char *__format,...) { halt_baddata(); }
int move_to_high_fd (fd, check_new, maxfd) int fd, check_new, maxfd; { int script_fd, nfds, ignore; if (maxfd < 20) { nfds = getdtablesize (); if (nfds <= 0) nfds = 20; if (nfds > 256) nfds = 256; } else nfds = maxfd; for (nfds--; check_new && nfds > 3; nfds--) if (fcntl (nfds, 1 , &ignore) == -1) break; if (nfds > 3 && fd != nfds && (script_fd = dup2 (fd, nfds)) != -1) { if (check_new == 0 || fd != fileno ( stderr )) close (fd); return (script_fd); } return (fd); }
int move_to_high_fd(unsigned long a0, unsigned long a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned int v3; if (a2 > 19) { v0 = a2; } else { v0 = getdtablesize(); if (v0 <= 0) v0 = 20; if (v0 > 0x100) v0 = 0x100; } for (v0 = v0 - 1; a1 && v0 > 3 && fcntl(v0, 0x1) != -1; v0 = v0 - 1); if (v0 > 3 && a0 != v0) { v1 = dup2(a0, v0); if (v1 != -1) { if (!a1 || a0 != fileno(stderr)) close(a0); v3 = v1; return v3; } } v3 = a0; return v3; }
int _ssh_send_banner(struct ssh *ssh, struct sshbuf *banner) { char *cp; int r; if ((r = sshbuf_putf(banner, "SSH-2.0-%.100s\r\n", "OpenSSH_9.1")) != 0) return r; if ((r = sshbuf_putb(ssh_packet_get_output(ssh), banner)) != 0) return r; if ((r = sshbuf_consume_end(banner, 2)) != 0) return r; if ((cp = sshbuf_dup_string(banner)) == ((void *)0) ) return -2; sshlog("ssh_api.c", __func__, 422, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "Local version string %.100s", cp); free(cp); return 0; }
int _ssh_send_banner(unsigned long long a0, unsigned long long a1) { unsigned int v0; void* v1; unsigned int v3; v0 = sshbuf_putf(a1, "SSH-2.0-%.100s\r\n", "OpenSSH_9.1"); if (v0) { v3 = v0; return v3; } v3 = ssh_packet_get_output(a0); v0 = sshbuf_putb(v3, a1, v3); if (v0) { v3 = v0; return v3; } v0 = sshbuf_consume_end(a1, 0x2); if (v0) { v3 = v0; return v3; } v1 = sshbuf_dup_string(a1); if (!v1) { v3 = -2; return v3; } sshlog("ssh_api.c", "_ssh_send_banner", 0x1a6, 0x0, 0x5, 0x0, "Local version string %.100s", v1); free(v1); v3 = 0; return v3; }
static void tallylog_reset (const char *user_name) { const char pam_tally2[] = "/sbin/pam_tally2"; const char *pname; pid_t childpid; int failed; int status; if (access(pam_tally2, 1 ) == -1) return; failed = 0; switch (childpid = fork()) { case -1: failed = 1; break; case 0: pname = strrchr(pam_tally2, '/'); if (pname == ((void *)0) ) pname = pam_tally2; else pname++; execl(pam_tally2, pname, "--user", user_name, "--reset", "--quiet", ((void *)0) ); perror(pam_tally2); exit(42); break; default: if (waitpid(childpid, &status, 0) == -1 || ! ((( status ) & 0x7f) == 0) || ((( status ) & 0xff00) >> 8) != 0) failed = 1; break; } if (failed) { fprintf ( stderr , gettext ("%s: failed to reset the tallylog entry of user \"%s\"\n"), Prog, user_name); 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 , "failed to reset the tallylog entry of user \"%s\"", user_name) ; if ( ((void *)0) != saved_locale) { (void) setlocale ( 6 , saved_locale); free (saved_locale); } } while ( 0 ); } return; }
unsigned long tallylog_reset(const char *a1) { long v1; char *v2; int stat_loc; int v5; __pid_t pid; char *arg; char *locale; char *s; char name[24]; unsigned long v11; v11 = __readfsqword(0x28u); strcpy(name, "/sbin/pam_tally2"); if ( access(name, 1) != -1 ) { v5 = 0; pid = fork(); if ( pid == -1 ) { v5 = 1; } else { if ( !pid ) { arg = strrchr(name, 47); if ( arg ) execl(name, arg + 1, "--user", a1, "--reset", "--quiet", 0LL); else execl(name, name, "--user", a1, "--reset", "--quiet", 0LL); perror(name); exit(42); } if ( waitpid(pid, &stat_loc, 0) == -1 || (stat_loc & 0x7F) != 0 || BYTE1(stat_loc) ) v5 = 1; } if ( v5 ) { v1 = Prog; v2 = gettext("%s: failed to reset the tallylog entry of user \"%s\"\n"); fprintf(stderr, v2, v1, a1); s = setlocale(6, 0LL); locale = 0LL; if ( s ) locale = strdup(s); if ( locale ) setlocale(6, "C"); syslog(4, "failed to reset the tallylog entry of user \"%s\"", a1); if ( locale ) { setlocale(6, locale); free(locale); } } } return __readfsqword(0x28u) ^ v11; }
skipwhite (char *s) { while (*s == ' ' || *s == '\t') s++; return s; }
char * skipwhite(char *param_1) { char *local_10; for (local_10 = param_1; (*local_10 == ' ' || (*local_10 == '\t')); local_10 = local_10 + 1) { } return local_10; }
static void forkparent(struct job *jp, union node *n, int mode, pid_t pid) { if (pid < 0) { ; if (jp) freejob(jp); sh_error("Cannot fork"); } ; if (!jp) return; if (mode != 2 && jp->jobctl) { int pgrp; if (jp->nprocs == 0) pgrp = pid; else pgrp = jp->ps[0].pid; (void)setpgid(pid, pgrp); } if (mode == 1) { backgndpid = pid; set_curjob(jp, 1); } if (jp) { struct procstat *ps = &jp->ps[jp->nprocs++]; ps->pid = pid; ps->status = -1; ps->cmd = nullstr; if (jobctl && n) ps->cmd = commandtext(n); } }
void forkparent(long param_1,long param_2,int param_3,int param_4) { ushort uVar1; int *piVar2; undefined8 uVar3; __pid_t local_14; if (param_4 < 0) { if (param_1 != 0) { freejob(param_1); } sh_error(); } if (param_1 != 0) { if ((param_3 != 2) && ((*(byte *)(param_1 + 0x1f) & 2) != 0)) { local_14 = param_4; if (*(short *)(param_1 + 0x1c) != 0) { local_14 = **(__pid_t **)(param_1 + 0x10); } setpgid(param_4,local_14); } if (param_3 == 1) { backgndpid = param_4; set_curjob(param_1,1); } if (param_1 != 0) { uVar1 = *(ushort *)(param_1 + 0x1c); *(ushort *)(param_1 + 0x1c) = uVar1 + 1; piVar2 = (int *)((ulong)uVar1 * 0x10 + *(long *)(param_1 + 0x10)); *piVar2 = param_4; piVar2[1] = -1; *(undefined **)(piVar2 + 2) = &nullstr; if ((jobctl != 0) && (param_2 != 0)) { uVar3 = commandtext(param_2); *(undefined8 *)(piVar2 + 2) = uVar3; } } } return; }
void rl_reset_after_signal (void) { if (rl_prep_term_function) (*rl_prep_term_function) (_rl_meta_flag); rl_set_signals (); }
void rl_reset_after_signal(void) { if (rl_prep_term_function != (code *)0x0) { (*rl_prep_term_function)(_rl_meta_flag); } rl_set_signals(); return; }
int ssh_krl_check_key(struct ssh_krl *krl, const struct sshkey *key) { int r; ; if ((r = is_key_revoked(krl, key)) != 0) return r; if (sshkey_is_cert(key)) { sshlog("krl.c", __func__, 1322, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0) , "checking CA key"); if ((r = is_key_revoked(krl, key->cert->signature_key)) != 0) return r; } ; return 0; }
long ssh_krl_check_key(long *a1, long a2) { unsigned int v3; unsigned int v4; v3 = is_key_revoked(a1, a2); if ( v3 ) return v3; if ( (unsigned int)sshkey_is_cert(a2) ) { sshlog("krl.c", "ssh_krl_check_key", 1322LL, 1LL, 6LL, 0LL, "checking CA key"); v4 = is_key_revoked(a1, *(_QWORD *)(*(_QWORD *)(a2 + 128) + 80LL)); if ( v4 ) return v4; } return 0LL; }
void mux_tty_alloc_failed(struct ssh *ssh, Channel *c) { struct sshbuf *m; Channel *mux_chan; int r; sshlog("mux.c", __func__, 1241, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "channel %d: TTY alloc failed", c->self); if ((mux_chan = channel_by_id(ssh, c->ctl_chan)) == ((void *)0) ) sshfatal("mux.c", __func__, 1244, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "channel %d missing mux %d", c->self, c->ctl_chan); if ((m = sshbuf_new()) == ((void *)0) ) sshfatal("mux.c", __func__, 1248, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "sshbuf_new"); if ((r = sshbuf_put_u32(m, 0x80000008)) != 0 || (r = sshbuf_put_u32(m, c->self)) != 0 || (r = sshbuf_put_stringb(mux_chan->output, m)) != 0) sshfatal("mux.c", __func__, 1252, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "reply"); sshbuf_free(m); }
long long mux_tty_alloc_failed(unsigned long long a0, unsigned int a1[18]) { unsigned long v0; unsigned long v1; unsigned int v2; struct_0 *v3; unsigned long long v4; char v5; unsigned long long v7; unsigned long long v8; v1 = a1[1]; sshlog("mux.c", "mux_tty_alloc_failed", 0x4d9, 0x1, 0x7, 0x0, "channel %d: TTY alloc failed"); v3 = channel_by_id(a0, a1[17], a1[17]); if (!v3) { v0 = a1[1]; sshfatal("mux.c", "mux_tty_alloc_failed", 0x4dc, 0x1, 0x1, 0x0, "channel %d missing mux %d"); } v4 = sshbuf_new(a0, a1, v7, 0x1, v8, 0x0); if (!v4) { v4 = "sshbuf_new"; sshfatal("mux.c", "mux_tty_alloc_failed", 0x4e0, 0x1, 0x1, 0x0, *(&v5)); } v2 = sshbuf_put_u32(v4, 0x80000008); if (!v2) { v2 = sshbuf_put_u32(v4, a1[1]); if (!v2) v2 = sshbuf_put_stringb(v3->field_70, v4, v4); } if (v2 || v2 || v2) { v4 = "reply"; sshfatal("mux.c", "mux_tty_alloc_failed", 0x4e4, 0x1, 0x1, ssh_err(v2), *(&v5)); } return sshbuf_free(v4); }
static struct request * request_find(struct requests *requests, u_int id) { struct request *req; for (req = ((requests)->tqh_first); req != ((void *)0) && req->id != id; req = ((req)->tq.tqe_next)) ; return req; }
int * request_find(int **param_1,int param_2) { int *local_10; for (local_10 = *param_1; (local_10 != (int *)0x0 && (param_2 != *local_10)); local_10 = *(int **)(local_10 + 6)) { } return local_10; }
static void print_current_files (void) { size_t i; switch (format) { case one_per_line: for (i = 0; i < cwd_n_used; i++) { print_file_name_and_frills (sorted_file[i], 0); putchar_unlocked (eolbyte); } break; case many_per_line: if (! line_length) print_with_separator (' '); else print_many_per_line (); break; case horizontal: if (! line_length) print_with_separator (' '); else print_horizontal (); break; case with_commas: print_with_separator (','); break; case long_format: for (i = 0; i < cwd_n_used; i++) { set_normal_color (); print_long_format (sorted_file[i]); dired_outbyte (eolbyte); } break; } }
void print_current_files() { void* v0; unsigned long long v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; v2 = format; switch (format) { case 0: v0 = 0; while (true) { v5 = *(&cwd_n_used); if (v0 >= *(&cwd_n_used)) break; set_normal_color(); print_long_format(*((*(&sorted_file) + v0 * 8))); dired_outbyte(eolbyte); v0 += 1; } case 1: v0 = 0; while (true) { v4 = *(&cwd_n_used); if (v0 >= *(&cwd_n_used)) break; print_file_name_and_frills(*((*(&sorted_file) + v0 * 8)), 0x0); putchar_unlocked(eolbyte); v0 += 1; } case 2: if (!*(&line_length)) { v7 = print_with_separator(0x20); break; } else { v6 = print_many_per_line(); break; } case 3: if (!*(&line_length)) { v9 = print_with_separator(0x20); break; } else { v8 = print_horizontal(); break; } case 4: v3 = print_with_separator(0x2c); break; } return; }
cron_db database(int installed, char **additional) { cron_db db = { ((void *)0) , ((void *)0) , (time_t) 0}; struct passwd pw; int fd; struct stat ss; user *u; if (installed) load_database(&db); for ( ; *additional != ((void *)0) ; additional++) { fd = open(*additional, 00 ); if (fd == -1) { perror(*additional); continue; } fstat(fd, &ss); if ( (((( ss.st_mode )) & 0170000) == (0040000)) ) { fprintf( stderr , "%s is a directory - skipping\n", *additional); close(fd); continue; } memset(&pw, 0, sizeof(pw)); pw.pw_name = *additional; pw.pw_passwd = ""; pw.pw_dir = "."; u = load_user(fd, &pw, *additional, *additional, *additional); if (u == ((void *)0) ) { printf("cannot load crontab %s\n", *additional); continue; } link_user(&db, u); } return db; }
void database(unsigned long long a0[3], unsigned long a1, unsigned long a2) { unsigned long long *v0; unsigned int v1; unsigned long long v2; void* v3; void* v4; void* v5; unsigned long v6; unsigned long long v7; unsigned long long v8; char v9; char v10; unsigned long long v12[3]; v0 = a2; v3 = 0; v4 = 0; v5 = 0; if (a1) load_database(&v3); for (; *(v0); v0 += 1) { v1 = open(*(v0), 0x0, *(v0)); if (v1 == -1) { perror(*(v0)); } else { fstat(v1, &v9); if ((*(&v10) & 0xf000) == 0x4000) { fprintf(stderr, "%s is a directory - skipping\n", *(v0)); close(v1); } else { memset(&v6, 0x0, 0x30); v6 = *(v0); v7 = &g_401244; v8 = "."; v2 = load_user(v1, &v6, *(v0), *(v0), *(v0)); if (v2) link_user(&v3, v2, v2); else printf("cannot load crontab %s\n", *(v0)); } } } a0[0] = v3; a0[1] = v4; a0[2] = v5; v12 = a0; return; }
const struct sshcipher * cipher_by_name(const char *name) { const struct sshcipher *c; for (c = ciphers; c->name != ((void *)0) ; c++) if (strcmp(c->name, name) == 0) return c; return ((void *)0) ; }
int cipher_by_name(char *a0) { unsigned long long v0; unsigned int v2; v0 = &ciphers; while (true) { if (*(v0)) { v2 = strcmp(*(v0), a0); if (!v2) { v2 = v0; break; } else { v0 += 40; } } else { v2 = 0; break; } } return v2; }
_Bool pred_fls (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { FILE * stream = pred_ptr->args.printf_vec.stream; list_file (pathname, state.cwd_dir_fd, state.rel_pathname, stat_buf, options.start_time.tv_sec, options.output_block_size, pred_ptr->literal_control_chars, stream); return 1 ; }
void pred_fls(unsigned long long a0, unsigned long long a1, struct_0 *a2) { unsigned long v0; unsigned long v1; unsigned long long v3; v1 = a2->field_40; v0 = v1; list_file(a0, __errno_location, strcmp, a1, error, g_500084, a2->field_28); v3 = 1; return; }
int set_cloexec_flag (int desc, _Bool value) { int flags = rpl_fcntl (desc, 1 , 0); if (0 <= flags) { int newflags = (value ? flags | 1 : flags & ~ 1 ); if (flags == newflags || rpl_fcntl (desc, 2 , newflags) != -1) return 0; } return -1; }
long long set_cloexec_flag(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; unsigned int v3; unsigned long long v4; v0 = rpl_fcntl(a0, 0x1, 0x0); if (v0 >= 0) { if (!a1) v3 = v0 & -2; else v3 = v0 | 1; v1 = v3; if (v0 == v1) { LABEL_400071: v4 = 0; goto LABEL_40007d; } else if (!(rpl_fcntl(a0, 0x2, v1) == -1)) { goto LABEL_400071; } } v4 = 4294967295; LABEL_40007d: return v4; }
static int ipstats_show_64(struct ipstats_stat_show_attrs *attrs, unsigned int group, unsigned int subgroup) { struct rtnl_link_stats64 stats; const struct rtattr *at; int err; at = ipstats_stat_show_get_attr(attrs, group, subgroup, &err); if (at == ((void *)0) ) return err; do { const struct rtattr *__at = (at); size_t __at_sz = __at->rta_len - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)); size_t __var_sz = sizeof(stats); typeof(stats) *__dest = &stats; memset(__dest, 0, __var_sz); memcpy(__dest, ((void*)(((char*)(__at)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), ((( __at_sz )<( __var_sz ))?( __at_sz ):( __var_sz )) ); } while (0); open_json_object("stats64"); print_stats64( stdout , &stats, ((void *)0) , ((void *)0) ); close_json_object(); return 0; }
void ipstats_show_64(void* a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { char v0; unsigned long v1; unsigned short *v2; unsigned long v3; unsigned long long v4; void* v5; char v6; unsigned long long v8; unsigned long long v9; void* v10; v1 = ipstats_stat_show_get_attr(a0, a1, a2, &v0); if (!v1) { v8 = *(&v0); } else { v2 = v1; v3 = *(v2) - 4; v4 = 200; v5 = &v6; memset(v5, 0x0, v4); v9 = v3; if (v4 <= v3) v9 = v4; memcpy(v9, v9 + 4, v9); open_json_object("stats64"); print_stats64(stdout, &v6, 0x0, 0x0); close_json_object(a0, &v6, 0x0, 0x0, a4, a5); v10 = 0; } return; }
static union block * write_short_name (struct tar_stat_info *st) { union block *header = find_next_block (); memset (header->buffer, 0, sizeof (union block)); tar_name_copy_str (header->header.name, st->file_name, 100); return header; }
void * write_short_name(long a1) { void *s; s = (void *)find_next_block(); memset(s, 0, 0x200uLL); tar_name_copy_str((long)s, *(_QWORD *)(a1 + 8), 0x64uLL); return s; }
int main (int argc, char **argv) { int optc; char const *datestr = ((void *)0) ; char const *set_datestr = ((void *)0) ; struct timespec when; _Bool set_date = 0 ; char const *format = ((void *)0) ; _Bool get_resolution = 0 ; char *batch_file = ((void *)0) ; char *reference = ((void *)0) ; struct stat refstats; _Bool ok; ; set_program_name (argv[0]); setlocale ( 6 , ""); bindtextdomain ("coreutils", "/usr/local/share/locale"); textdomain ("coreutils"); atexit (close_stdout); while ((optc = getopt_long (argc, argv, short_options, long_options, ((void *)0) )) != -1) { char const *new_format = ((void *)0) ; switch (optc) { case 'd': datestr = optarg; break; case DEBUG_DATE_PARSING_OPTION: parse_datetime_flags |= 1; break; case 'f': batch_file = optarg; break; case RESOLUTION_OPTION: get_resolution = 1 ; break; case RFC_3339_OPTION: { static char const rfc_3339_format[][32] = { "%Y-%m-%d", "%Y-%m-%d %H:%M:%S%:z", "%Y-%m-%d %H:%M:%S.%N%:z" }; enum Time_spec i = ((time_spec + 2) [__xargmatch_internal ("--rfc-3339", optarg, time_spec_string + 2, (void const *) (time_spec + 2), sizeof *(time_spec + 2), argmatch_die, 1 )]) ; new_format = rfc_3339_format[i]; break; } case 'I': { static char const iso_8601_format[][32] = { "%Y-%m-%d", "%Y-%m-%dT%H:%M:%S%:z", "%Y-%m-%dT%H:%M:%S,%N%:z", "%Y-%m-%dT%H%:z", "%Y-%m-%dT%H:%M%:z" }; enum Time_spec i = (optarg ? ((time_spec) [__xargmatch_internal ("--iso-8601", optarg, time_spec_string, (void const *) (time_spec), sizeof *(time_spec), argmatch_die, 1 )]) : TIME_SPEC_DATE); new_format = iso_8601_format[i]; break; } case 'r': reference = optarg; break; case 'R': new_format = rfc_email_format; break; case 's': set_datestr = optarg; set_date = 1 ; break; case 'u': if (putenv (bad_cast ("TZ=UTC0")) != 0) xalloc_die (); ; break; case GETOPT_HELP_CHAR: usage ( 0 ); break;; case GETOPT_VERSION_CHAR: version_etc ( stdout , "date", "GNU coreutils", Version, ("David MacKenzie"), (char *) ((void *)0) ); exit ( 0 ); break;; default: usage ( 1 ); } if (new_format) { if (format) ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, gettext (\"multiple output formats specified\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, gettext ("multiple output formats specified")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, gettext ("multiple output formats specified")), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); format = new_format; } } int option_specified_date = (!!datestr + !!batch_file + !!reference + get_resolution); if (option_specified_date > 1) { error (0, 0, gettext ("the options to specify dates for printing are mutually exclusive")); usage ( 1 ); } if (set_date && option_specified_date) { error (0, 0, gettext ("the options to print and set the time may not be used together")); usage ( 1 ); } if (optind < argc) { if (optind + 1 < argc) { error (0, 0, gettext ("extra operand %s"), quote (argv[optind + 1])); usage ( 1 ); } if (argv[optind][0] == '+') { if (format) ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, gettext (\"multiple output formats specified\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, gettext ("multiple output formats specified")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, gettext ("multiple output formats specified")), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); format = argv[optind++] + 1; } else if (set_date || option_specified_date) { error (0, 0, gettext ("the argument %s lacks a leading '+';\n" "when using an option to specify date(s), any non-option\n" "argument must be a format string beginning with '+'") , quote (argv[optind])); usage ( 1 ); } } if (!format) { if (get_resolution) format = "%s.%N"; else { format = nl_langinfo ( _DATE_FMT ); if (! *format) format = "%a %b %e %H:%M:%S %Z %Y"; } } char *format_copy = adjust_resolution (format); char const *format_res = format_copy ? format_copy : format; char const *tzstring = getenv ("TZ"); timezone_t tz = tzalloc (tzstring); if (batch_file != ((void *)0) ) ok = batch_convert (batch_file, format_res, tz, tzstring); else { _Bool valid_date = 1 ; ok = 1 ; if (!option_specified_date && !set_date) { if (optind < argc) { set_date = 1 ; datestr = argv[optind]; valid_date = posixtime (&when.tv_sec, datestr, (1 | 2 | 4)); when.tv_nsec = 0; } else { gettime (&when); } } else { if (reference != ((void *)0) ) { if (stat (reference, &refstats) != 0) ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, reference)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, reference)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, reference)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); when = get_stat_mtime (&refstats); } else if (get_resolution) { long int res = gettime_res (); when.tv_sec = res / TIMESPEC_HZ; when.tv_nsec = res % TIMESPEC_HZ; } else { if (set_datestr) datestr = set_datestr; valid_date = parse_datetime2 (&when, datestr, ((void *)0) , parse_datetime_flags, tz, tzstring); } } if (! valid_date) ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, gettext (\"invalid date %s\"), quote (datestr)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, gettext ("invalid date %s"), quote (datestr)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, gettext ("invalid date %s"), quote (datestr)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); if (set_date) { if (settime (&when) != 0) { error (0, (*__errno_location ()) , gettext ("cannot set date")); ok = 0 ; } } ok &= show_date (format_res, when, tz); } return ok ? 0 : 1 ; }
int main(int argc, const char **argv, const char **envp) { int v3; char *v4; char *v5; char *v6; char *v7; long v8; char *v9; char *v10; int v11; long v12; char *v13; long v14; const char *v15; int *v16; long v17; long v18; char *v19; char *v20; int *v21; char v24; unsigned char v25; bool v26; char v27; char v28; int v29; int v30; char *v31; char *v32; char *v33; char *v34; const char *file; char *v36; char *v37; char *v38; long v39; long v40; long stat_mtime; long v42; struct stat v43; unsigned long v44; v44 = __readfsqword(0x28u); v31 = 0LL; v32 = 0LL; v24 = 0; v33 = 0LL; v25 = 0; v34 = 0LL; file = 0LL; set_program_name(*argv, argv, envp); setlocale(6, locale); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); atexit((void (*)(void))&close_stdout); while ( 2 ) { v29 = getopt_long(argc, (char *const *)argv, "d:f:I_r:Rs:u", &long_options, 0LL); if ( v29 != -1 ) { v36 = 0LL; if ( v29 <= 130 ) { if ( v29 >= 73 ) { switch ( v29 ) { case 73: if ( optarg ) v3 = *((_DWORD *)&time_spec + _xargmatch_internal("--iso-8601", optarg, time_spec_string, &time_spec, 4LL, argmatch_die, 1LL)); else v3 = 0; v36 = &iso_8601_format_6307[32 * v3]; goto LABEL_25; case 82: v36 = "%a, %d %b %Y %H:%M:%S %z"; goto LABEL_25; case 100: v31 = optarg; goto LABEL_25; case 102: v34 = optarg; goto LABEL_25; case 114: file = optarg; goto LABEL_25; case 115: v32 = optarg; v24 = 1; goto LABEL_25; case 117: v4 = (char *)bad_cast((long)"TZ=UTC0"); if ( !putenv(v4) ) goto LABEL_25; xalloc_die(); goto LABEL_22; case 128: parse_datetime_flags |= 1u; goto LABEL_25; case 129: v25 = 1; goto LABEL_25; case 130: v36 = &rfc_3339_format_6304[32 * *((unsigned int *)&time_spec + _xargmatch_internal( "--rfc-3339", optarg, off_2E70, &unk_1708, 4LL, argmatch_die, 1LL) + 2)]; LABEL_25: if ( v36 ) { if ( v33 ) { v5 = gettext("multiple output formats specified"); error(1, 0, v5); } v33 = v36; } continue; default: goto LABEL_24; } } if ( v29 == -131 ) { version_etc(stdout, "date", "GNU coreutils", Version, "David MacKenzie", 0LL); exit(0); } if ( v29 == -130 ) LABEL_22: usage(0); } LABEL_24: usage(1); } break; } v30 = (file != 0LL) + (v34 != 0LL) + (v31 != 0LL) + v25; if ( v30 > 1 ) { v6 = gettext("the options to specify dates for printing are mutually exclusive"); error(0, 0, v6); usage(1); } if ( v24 && v30 ) { v7 = gettext("the options to print and set the time may not be used together"); error(0, 0, v7); usage(1); } if ( argc > optind ) { if ( argc > optind + 1 ) { v8 = quote(argv[optind + 1]); v9 = gettext("extra operand %s"); error(0, 0, v9, v8); usage(1); } if ( *argv[optind] == 43 ) { if ( v33 ) { v10 = gettext("multiple output formats specified"); error(1, 0, v10); } v11 = optind++; v33 = (char *)(argv[v11] + 1); } else if ( v24 || v30 ) { v12 = quote(argv[optind]); v13 = gettext( "the argument %s lacks a leading '+';\n" "when using an option to specify date(s), any non-option\n" "argument must be a format string beginning with '+'"); error(0, 0, v13, v12); usage(1); } } if ( !v33 ) { if ( v25 ) { v33 = "%s.%N"; v14 = adjust_resolution("%s.%N"); goto LABEL_51; } v33 = nl_langinfo(131180); if ( !*v33 ) v33 = "%a %b %e %H:%M:%S %Z %Y"; } v14 = adjust_resolution(v33); LABEL_51: if ( !v14 ) v14 = (long)v33; v37 = (char *)v14; v38 = getenv("TZ"); v39 = tzalloc(v38); if ( v34 ) { v26 = batch_convert(v34, v37, v39, (long)v38); } else { v28 = 1; v27 = 1; if ( v30 || v24 == 1 ) { if ( file ) { if ( stat(file, &v43) ) { v15 = (const char *)quotearg_n_style_colon(0LL, 3LL, file); v16 = _errno_location(); error(1, *v16, "%s", v15); } stat_mtime = get_stat_mtime(&v43); v42 = v17; } else if ( v25 ) { v40 = gettime_res(); stat_mtime = v40 / 1000000000; v42 = v40 % 1000000000; } else { if ( v32 ) v31 = v32; v28 = parse_datetime2(&stat_mtime, v31, 0LL, (unsigned int)parse_datetime_flags, v39, v38); } } else if ( argc <= optind ) { gettime(&stat_mtime); } else { v24 = 1; v31 = (char *)argv[optind]; v28 = posixtime(&stat_mtime, v31, 7LL); v42 = 0LL; } if ( v28 != 1 ) { v18 = quote(v31); v19 = gettext("invalid date %s"); error(1, 0, v19, v18); } if ( v24 && (unsigned int)settime(&stat_mtime) ) { v20 = gettext("cannot set date"); v21 = _errno_location(); error(0, *v21, v20); v27 = 0; } v26 = (unsigned char)(v27 & show_date(v37, stat_mtime, v42, v39)) != 0; } return !v26; }
static void faillog_reset (uid_t uid) { struct faillog fl; int fd; off_t offset_uid = (off_t) (sizeof fl) * uid; struct stat st; if (stat ("/var/log/faillog", &st) != 0 || st.st_size <= offset_uid) { return; } explicit_bzero((&fl), (sizeof (fl))); fd = open ("/var/log/faillog", 02 ); if (-1 == fd) { fprintf ( stderr , gettext ("%s: failed to open the faillog file for UID %lu: %s\n"), Prog, (unsigned long) uid, strerror ( (*__errno_location ()) )); 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 , "failed to open the faillog file for UID %lu", (unsigned long) uid) ; if ( ((void *)0) != saved_locale) { (void) setlocale ( 6 , saved_locale); free (saved_locale); } } while ( 0 ); return; } if ( (lseek (fd, offset_uid, 0 ) != offset_uid) || (write (fd, &fl, sizeof (fl)) != (ssize_t) sizeof (fl)) || (fsync (fd) != 0)) { fprintf ( stderr , gettext ("%s: failed to reset the faillog entry of UID %lu: %s\n"), Prog, (unsigned long) uid, strerror ( (*__errno_location ()) )); 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 , "failed to reset the faillog entry of UID %lu", (unsigned long) uid) ; if ( ((void *)0) != saved_locale) { (void) setlocale ( 6 , saved_locale); free (saved_locale); } } while ( 0 ); } if (close (fd) != 0) { fprintf ( stderr , gettext ("%s: failed to close the faillog file for UID %lu: %s\n"), Prog, (unsigned long) uid, strerror ( (*__errno_location ()) )); 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 , "failed to close the faillog file for UID %lu", (unsigned long) uid) ; if ( ((void *)0) != saved_locale) { (void) setlocale ( 6 , saved_locale); free (saved_locale); } } while ( 0 ); } }
unsigned long faillog_reset(unsigned int a1) { int *v1; char *v2; long v3; char *v4; int *v5; char *v6; long v7; char *v8; int *v9; char *v10; long v11; char *v12; int fd; char *locale; char *v16; char *v17; long offset; const char *v19; const char *v20; const char *s; char buf[32]; struct stat v23; unsigned long v24; v24 = __readfsqword(0x28u); offset = 32LL * a1; if ( !stat("/var/log/faillog", &v23) && offset < v23.st_size ) { explicit_bzero(buf, 32LL); fd = open("/var/log/faillog", 2); if ( fd == -1 ) { v1 = _errno_location(); v2 = strerror(*v1); v3 = Prog; v4 = gettext("%s: failed to open the faillog file for UID %lu: %s\n"); fprintf(stderr, v4, v3, a1, v2); s = setlocale(6, 0LL); locale = 0LL; if ( s ) locale = strdup(s); if ( locale ) setlocale(6, "C"); syslog(4, "failed to open the faillog file for UID %lu", a1); if ( locale ) { setlocale(6, locale); free(locale); } } else { if ( offset != lseek(fd, offset, 0) || write(fd, buf, 0x20uLL) != 32 || fsync(fd) ) { v5 = _errno_location(); v6 = strerror(*v5); v7 = Prog; v8 = gettext("%s: failed to reset the faillog entry of UID %lu: %s\n"); fprintf(stderr, v8, v7, a1, v6); v19 = setlocale(6, 0LL); v16 = 0LL; if ( v19 ) v16 = strdup(v19); if ( v16 ) setlocale(6, "C"); syslog(4, "failed to reset the faillog entry of UID %lu", a1); if ( v16 ) { setlocale(6, v16); free(v16); } } if ( close(fd) ) { v9 = _errno_location(); v10 = strerror(*v9); v11 = Prog; v12 = gettext("%s: failed to close the faillog file for UID %lu: %s\n"); fprintf(stderr, v12, v11, a1, v10); v20 = setlocale(6, 0LL); v17 = 0LL; if ( v20 ) v17 = strdup(v20); if ( v17 ) setlocale(6, "C"); syslog(4, "failed to close the faillog file for UID %lu", a1); if ( v17 ) { setlocale(6, v17); free(v17); } } } } return __readfsqword(0x28u) ^ v24; }
static const char * fwd_ident(int who, int where) { if (who == 0x100) { if (where == (1<<1)) return "admin local"; else if (where == (1)) return "admin remote"; } else if (who == 0x101) { if (where == (1<<1)) return "user local"; else if (where == (1)) return "user remote"; } sshfatal("channels.c", __func__, 505, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "Unknown forward permission list %d/%d", who, where); }
int fwd_ident(unsigned long a0, unsigned long a1) { unsigned long long v0; unsigned long v1; unsigned long v2; unsigned int v4; switch (a0) { case 256: switch (a1) { case 2: v4 = &g_410f73; return v4; case 1: v4 = &g_410f7f; return v4; default: v2 = a1; v1 = a0; v0 = "Unknown forward permission list %d/%d"; v4 = sshfatal("channels.c", "fwd_ident", 0x1f9, 0x0, 0x1, 0x0); return v4; } case 257: switch (a1) { case 2: v4 = &g_410f8c; return v4; case 1: v4 = &g_410f97; return v4; default: v2 = a1; v1 = a0; v0 = "Unknown forward permission list %d/%d"; v4 = sshfatal("channels.c", "fwd_ident", 0x1f9, 0x0, 0x1, 0x0); return v4; } default: v2 = a1; v1 = a0; v0 = "Unknown forward permission list %d/%d"; v4 = sshfatal("channels.c", "fwd_ident", 0x1f9, 0x0, 0x1, 0x0); return v4; } }
static struct strlist * msort(struct strlist *list, int len) { struct strlist *p, *q = ((void *)0) ; struct strlist **lpp; int half; int n; if (len <= 1) return list; half = len >> 1; p = list; for (n = half ; --n >= 0 ; ) { q = p; p = p->next; } q->next = ((void *)0) ; q = msort(list, half); p = msort(p, len - half); lpp = &list; for (;;) { if (strcmp(p->text, q->text) < 0) { *lpp = p; lpp = &p->next; if ((p = *lpp) == ((void *)0) ) { *lpp = q; break; } } else { *lpp = q; lpp = &q->next; if ((q = *lpp) == ((void *)0) ) { *lpp = p; break; } } } return list; }
long msort(long a1, int a2) { long v3; int v4; int v5; long v6; long v7; long *v8; v3 = a1; v7 = 0LL; if ( a2 <= 1 ) return v3; v5 = a2 >> 1; v6 = v3; v4 = a2 >> 1; while ( --v4 >= 0 ) { v7 = v6; v6 = *(_QWORD *)v6; } *(_QWORD *)v7 = 0LL; v7 = msort(v3, v5); v6 = msort(v6, a2 - v5); v8 = &v3; do { while ( strcmp(*(const char **)(v6 + 8), *(const char **)(v7 + 8)) < 0 ) { *v8 = v6; v8 = (long *)v6; v6 = *(_QWORD *)v6; if ( !v6 ) { *v8 = v7; return v3; } } *v8 = v7; v8 = (long *)v7; v7 = *(_QWORD *)v7; } while ( v7 ); *v8 = v6; return v3; }
static inline void initialize_exit_failure (int status) { if (status != 1 ) exit_failure = status; }
void initialize_exit_failure(unsigned long long a0) { unsigned long long v1; if (a0 != 1) { v1 = a0; exit_failure = a0; } return; }
static void send_status(u_int32_t id, u_int32_t status) { send_status_errmsg(id, status, ((void *)0) ); }
void send_status(unsigned long a0, unsigned long a1) { unsigned long long v1; v1 = send_status_errmsg(a0, a1, 0x0); return; }
enum dep_check dependencies_ok(struct pkginfo *pkg, struct pkginfo *removing, struct varbuf *aemsgs) { enum dep_check ok; enum found_status found, thisf; int interestingwarnings; _Bool matched, anycannotfixbytrig; struct varbuf oemsgs = { 0, 0, ((void *)0) }; struct dependency *dep; struct deppossi *possi, *provider; struct pkginfo *possfixbytrig, *canfixbytrig; ok = DEP_CHECK_OK; debug(dbg_depcon,"checking dependencies of %s (- %s)", pkg_name(pkg, pnaw_always), removing ? pkg_name(removing, pnaw_always) : "<none>"); anycannotfixbytrig = 0 ; canfixbytrig = ((void *)0) ; for (dep= pkg->installed.depends; dep; dep= dep->next) { if (dep->type != dep_depends && dep->type != dep_predepends) continue; debug(dbg_depcondetail," checking group ..."); matched = 0 ; interestingwarnings = 0; varbuf_reset(&oemsgs); found = FOUND_NONE; possfixbytrig = ((void *)0) ; for (possi = dep->list; found != FOUND_OK && possi; possi = possi->next) { struct deppossi_pkg_iterator *possi_iter; struct pkginfo *pkg_pos; debug(dbg_depcondetail," checking possibility -> %s",possi->ed->name); if (possi->cyclebreak) { debug(dbg_depcondetail," break cycle so ok and found"); found = FOUND_OK; break; } thisf = FOUND_NONE; possi_iter = deppossi_pkg_iter_new(possi, wpb_installed); while ((pkg_pos = deppossi_pkg_iter_next(possi_iter))) { thisf = deppossi_ok_found(pkg_pos, pkg, removing, ((void *)0) , &possfixbytrig, &matched, possi, &interestingwarnings, &oemsgs); if (thisf > found) found = thisf; if (found == FOUND_OK) break; } deppossi_pkg_iter_free(possi_iter); if (found != FOUND_OK) { for (provider = possi->ed->depended.installed; found != FOUND_OK && provider; provider = provider->rev_next) { if (provider->up->type != dep_provides) continue; debug(dbg_depcondetail, " checking provider %s", pkg_name(provider->up->up, pnaw_always)); if (!deparchsatisfied(&provider->up->up->installed, provider->arch, possi)) { debug(dbg_depcondetail, " provider does not satisfy arch"); continue; } thisf = deppossi_ok_found(provider->up->up, pkg, removing, provider, &possfixbytrig, &matched, possi, &interestingwarnings, &oemsgs); if (thisf == FOUND_DEFER && provider->up->up == pkg && !removing) { thisf = FOUND_OK; } if (thisf > found) found = thisf; } } debug(dbg_depcondetail," found %d",found); if (thisf > found) found= thisf; } if (in_force(FORCE_DEPENDS)) { thisf = found_forced_on(DEPEND_TRY_FORCE_DEPENDS); if (thisf > found) { found = thisf; debug(dbg_depcondetail, " rescued by force-depends, found %d", found); } } debug(dbg_depcondetail, " found %d matched %d possfixbytrig %s", found, matched, possfixbytrig ? pkg_name(possfixbytrig, pnaw_always) : "-"); if (removing && !matched) continue; switch (found) { case FOUND_NONE: anycannotfixbytrig = 1 ; ok = DEP_CHECK_HALT; case FOUND_FORCED: varbuf_add_buf(aemsgs, " ", strlen(" ")); varbuf_add_pkgbin_name(aemsgs, pkg, &pkg->installed, pnaw_nonambig); varbuf_add_buf(aemsgs, gettext(" depends on "), strlen(gettext(" depends on "))); varbufdependency(aemsgs, dep); if (interestingwarnings) { varbuf_end_str(&oemsgs); varbuf_add_buf(aemsgs, gettext("; however:\n"), strlen(gettext("; however:\n"))); varbuf_add_buf(aemsgs, oemsgs.buf, strlen(oemsgs.buf)); } else { varbuf_add_buf(aemsgs, ".\n", strlen(".\n")); } break; case FOUND_DEFER: if (possfixbytrig) canfixbytrig = possfixbytrig; else anycannotfixbytrig = 1 ; if (ok > DEP_CHECK_DEFER) ok = DEP_CHECK_DEFER; break; case FOUND_OK: break; default: do_internerr("packages.c", 746, __func__, "unknown value for found '%d'", found); } } if (ok == DEP_CHECK_HALT && (pkg->clientdata && pkg->clientdata->istobe == PKG_ISTOBE_REMOVE)) ok = DEP_CHECK_DEFER; if (!anycannotfixbytrig && canfixbytrig) progress_bytrigproc = canfixbytrig; varbuf_destroy(&oemsgs); debug(dbg_depcon,"ok %d msgs >>%.*s<<", ok, (int)aemsgs->used, aemsgs->buf); return ok; }
long long dependencies_ok(struct_0 *a0, unsigned long long a1, unsigned long long a2[3], unsigned long long a3, unsigned long long a4, unsigned long long a5) { char v0; char v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; void* v6; struct_2 *v7; struct_3 *v8; struct_5 *v9; void* v10; unsigned long long v11; void* v12; void* v13; void* v14; void* v15; unsigned long long v19; v13 = 0; v14 = 0; v15 = 0; v3 = 2; debug(0x20, "checking dependencies of %s (- %s)", pkg_name(a0, 0x3), (!a1 ? pkg_name(a1, 0x3) : "<none>"), a4, a5); v1 = 0; v10 = 0; v7 = a0->field_48; while (v7) { switch (v7->field_18) { case 2: case 3: debug(0x100, " checking group ...", a2, a3, v4, a5); v0 = 0; v2 = 0; varbuf_reset(&v13); v4 = 0; v6 = 0; v8 = v7->field_10; while (true) { if (!(v4 != 3) || !(v8)) break; debug(0x100, " checking possibility -> %s", v8->field_8->field_8, a3, a4, a5); if (!v8->field_4d) { v5 = 0; v11 = deppossi_pkg_iter_new(v8, 0x0); while (true) { v12 = deppossi_pkg_iter_next(v11); if (!v12) break; v5 = deppossi_ok_found(v12, a0, a1, 0x0, &v6, &v0, v8, &v2, &v13); if (v5 > v4) v4 = v5; if (v4 == 3) break; } deppossi_pkg_iter_free(v11); if (v4 != 3) { for (v9 = v8->field_8->field_198; v4 != 3 && v9; v9 = v9->field_18) { if (v9->field_0->field_18 == 6) { debug(0x100, " checking provider %s", pkg_name(v9->field_0->field_0, 0x3), a3, a4, a5); if ((deparchsatisfied(v9->field_0->field_0 + 72, v9->field_28, v8, v9->field_0->field_0 + 72) ^ 1)) { debug(0x100, " provider does not satisfy arch", a2, a3, a4, a5); } else { v5 = deppossi_ok_found(v9->field_0->field_0, a0, a1, v9, &v6, &v0, v8, &v2, &v13); if (v5 == 1 && a0 == v9->field_0->field_0 && !a1) v5 = 3; if (v5 > v4) v4 = v5; } } } } debug(0x100, " found %d", v4, a3, a4, a5); if (v5 > v4) v4 = v5; v8 = v8->field_10; } else { debug(0x100, " break cycle so ok and found", a2, a3, a4, a5); v4 = 3; break; } } if (in_force(0x1000)) { v5 = found_forced_on(0x6); if (v5 > v4) { v4 = v5; debug(0x100, " rescued by force-depends, found %d", v4, a3, a4, a5); } } if (!v6) v19 = "-"; else v19 = pkg_name(v6, 0x3); debug(0x100, " found %d matched %d possfixbytrig %s", v4, v0, v19, a5); if (a1) if (!(v0 ^ 1)) goto LABEL_401ad1; else goto LABEL_401caa; LABEL_401ad1: switch (v4) { case 1: if (!v6) v1 = 1; else v10 = v6; if (v3 > 1) v3 = 1; break; case 0: v1 = 1; v3 = 0; case 2: varbuf_add_buf(a2, " ", strlen(" ")); varbuf_add_pkgbin_name(a2, a0, &a0->field_48, 0x1); varbuf_add_buf(a2, gettext(" depends on "), strlen(gettext(" depends on "))); varbufdependency(a2, v7, v7); if (!v2) { varbuf_add_buf(a2, ".\n", strlen(".\n")); break; } else { varbuf_end_str(&v13); varbuf_add_buf(a2, gettext("; however:\n"), strlen(gettext("; however:\n"))); varbuf_add_buf(a2, v15, strlen(v15)); break; } case 3: LABEL_401caa: v7 = v7->field_8; break; default: do_internerr("packages.c", 0x2ea, "dependencies_ok", "unknown value for found '%d'", v4); v7 = v7->field_8; break; } default: v7 = v7->field_8; break; } } if (!v3 && a0->field_138 && a0->field_138->field_0 == 1) v3 = 1; if ((v1 ^ 1) && v10) progress_bytrigproc = v10; varbuf_destroy(&v13); debug(0x20, "ok %d msgs >>%.*s<<", v3, a2[0], a2[2], a5); return v3; }
static void print_nh_res_bucket(FILE *fp, const struct rtattr *res_bucket_attr) { struct rtattr *tb[(__NHA_RES_BUCKET_MAX - 1) + 1]; (parse_rtattr_flags((tb), ((__NHA_RES_BUCKET_MAX - 1)), ((void*)(((char*)(res_bucket_attr)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), ((int)((res_bucket_attr)->rta_len) - (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0))), (1 << 15))); open_json_object("bucket"); if (tb[NHA_RES_BUCKET_INDEX]) print_uint(PRINT_ANY, "index", "index %u ", rta_getattr_u16(tb[NHA_RES_BUCKET_INDEX])); if (tb[NHA_RES_BUCKET_IDLE_TIME]) { struct rtattr *rta = tb[NHA_RES_BUCKET_IDLE_TIME]; struct timeval tv; __jiffies_to_tv(&tv, rta_getattr_u64(rta)); print_tv(PRINT_ANY, "idle_time", "idle_time %g ", &tv); } if (tb[NHA_RES_BUCKET_NH_ID]) print_uint(PRINT_ANY, "nhid", "nhid %u ", rta_getattr_u32(tb[NHA_RES_BUCKET_NH_ID])); close_json_object(); }
void print_nh_res_bucket(unsigned long a0, unsigned short *a1) { unsigned long v0; unsigned long long v1; char v2; char v3; char v4; char v5; char v6; char v7; unsigned long long *v9; unsigned long long v10; v0 = a0; parse_rtattr_flags(&v3, 0x3, a1 + 2, *(a1) - 4, 0x8000); open_json_object("bucket"); if (*(&v4)) print_uint(0x4, "index", "index %u ", rta_getattr_u16(*(&v4))); if (*(&v5)) { v1 = *(&v5); __jiffies_to_tv(&v2, rta_getattr_u64(v1)); print_tv(0x4, "idle_time", "idle_time %g ", &v2); } if (*(&v6)) print_uint(0x4, "nhid", "nhid %u ", rta_getattr_u32(*(&v6))); close_json_object(); v10 = *(&v7) ^ v9[5]; return; }
static int ext4_add_extent_to_list(e2fsck_t ctx, struct extent_list *list, struct ext2fs_extent *ex) { return ext4_modify_extent_list(ctx, list, ex, 0 ); }
void ext4_add_extent_to_list(undefined8 param_1,undefined8 param_2,undefined8 param_3) { ext4_modify_extent_list(param_1,param_2,param_3,0); return; }
int sshbuf_check_reserve(const struct sshbuf *buf, size_t len) { int r; if ((r = sshbuf_check_sanity(buf)) != 0) return r; if (buf->readonly || buf->refcount > 1) return -49; ; if (len > buf->max_size || buf->max_size - len < buf->size - buf->off) return -9; return 0; }
int sshbuf_check_reserve(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned int v2; v0 = sshbuf_check_sanity(a0); if (v0) { v2 = v0; } else if (a0->field_30) { LABEL_40093c: v2 = -49; } else { if (!(a0->field_38 <= 1)) goto LABEL_40093c; if (a1 > a0->field_20) { LABEL_40097b: v2 = -9; } else { if (a0->field_20 - a1 < a0->field_18 - a0->field_10) goto LABEL_40097b; v2 = 0; } } return v2; }
static void mm_session_close(Session *s) { sshlog("monitor.c", __func__, 1537, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "session %d pid %ld", s->self, (long)s->pid); if (s->ttyfd != -1) { sshlog("monitor.c", __func__, 1539, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "tty %s ptyfd %d", s->tty, s->ptyfd); session_pty_cleanup2(s); } session_unused(s->self); }
void mm_session_close(unsigned int a0[14]) { unsigned long long v0; unsigned long v1; unsigned long v2; unsigned long long v4; v2 = a0[8]; v1 = a0[1]; v0 = "session %d pid %ld"; sshlog("monitor.c", "mm_session_close", 0x601, 0x1, 0x7, 0x0); if (a0[13] != -1) { v2 = a0[12]; v1 = &a0[1 + 5]; v0 = "tty %s ptyfd %d"; sshlog("monitor.c", "mm_session_close", 0x603, 0x1, 0x7, 0x0); session_pty_cleanup2(a0); } v4 = session_unused(a0[1]); return; }
(key->type == KEY_RSA_CERT && (ssh->compat & 0x00000002))) { return match_list(sshkey_ssh_name(key), options.pubkey_accepted_algos, ((void *)0) ); }
void match_list(void) { halt_baddata(); }
static void cmd_parser(int argc, char **argv) { process_options(argc,argv); gnutls_global_set_log_function(tls_log_func); if (systemkey_tool_options.present.debug) { gnutls_global_set_log_level(systemkey_tool_options.value.debug); printf("Setting log level to %d\n", (int) systemkey_tool_options.value.debug); } if (systemkey_tool_options.present.outder) { outcert_format = GNUTLS_X509_FMT_DER; outkey_format = GNUTLS_X509_FMT_DER; } else { outcert_format = GNUTLS_X509_FMT_PEM; outkey_format = GNUTLS_X509_FMT_PEM; } if (systemkey_tool_options.present.outfile) { outfile = safe_open_rw(systemkey_tool_options.arg.outfile, 0); if (outfile == ((void *)0) ) { fprintf( stderr , "%s", systemkey_tool_options.arg.outfile); app_exit(1); } outfile_name = systemkey_tool_options.arg.outfile; } else outfile = stdout ; if (systemkey_tool_options.present.delete) { systemkey_delete(systemkey_tool_options.arg.delete, outfile); } else if (systemkey_tool_options.present.list) { systemkey_list(outfile); } else { usage ( stdout , (1)); } fclose(outfile); gnutls_global_deinit(); }
void cmd_parser(unsigned long long a0, unsigned long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned long long v1; process_options(a0, a1, a1); gnutls_global_set_log_function(tls_log_func); if (systemkey_tool_options) { gnutls_global_set_log_level(usage); a1 = usage; printf("Setting log level to %d\n", usage); } if (g_500034) { outcert_format = 0; outkey_format = 0; } else { outcert_format = 1; outkey_format = 1; } if (g_500031) { outfile = safe_open_rw(printf, 0x0); if (!outfile) { fprintf(stderr, "%s", printf); app_exit(0x1); } outfile_name = printf; } else { outfile = stdout; } if (!g_500031 || outfile) { if (g_500033) { systemkey_delete(safe_open_rw, outfile); } else if (g_500032) { systemkey_list(outfile); } else { usage(stdout, 0x1); } fclose(outfile); v1 = gnutls_global_deinit(a0, a1, a2, a3, a4, a5); return; } }
int starttls_proto_to_port(const char *app_proto) { struct servent *s; if (strcasecmp(app_proto, "xmpp") == 0) app_proto = "xmpp-server";; s = getservbyname(app_proto, ((void *)0) ); if (s != ((void *)0) ) { return ntohs(s->s_port); } endservent(); return 443; }
long long starttls_proto_to_port(char *a0) { unsigned long long v0; struct_0 *v1; unsigned long long v4; v0 = a0; if (!strcasecmp(v0, "xmpp")) v0 = "xmpp-server"; v1 = &getservbyname(v0, NULL)->s_name; if (v1) { v4 = ntohs(v1->field_10); } else { endservent(); v4 = 443; } return v4; }
char ** array_to_argv (a, countp) ARRAY *a; int *countp; { char **ret, *t; int i; ARRAY_ELEMENT *ae; if (a == 0 || ((a)->num_elements == 0)) { if (countp) *countp = 0; return ((char **) ((void *)0) ); } ret = strvec_create (((a)->num_elements) + 1); i = 0; for (ae = ((a->head)->next); ae != a->head; ae = ((ae)->next)) { t = ((ae)->value); if (t) ret[i++] = (char *)strcpy (sh_xmalloc((1 + strlen (t)), "array.c", 849), (t)); } ret[i] = (char *) ((void *)0) ; if (countp) *countp = i; return (ret); }
long array_to_argv(long param_1,int *param_2) { long lVar1; size_t sVar2; char *__dest; char *pcVar3; int local_34; long local_30; if ((param_1 == 0) || (*(long *)(param_1 + 8) == 0)) { if (param_2 != (int *)0x0) { *param_2 = 0; } lVar1 = 0; } else { lVar1 = strvec_create((int)*(undefined8 *)(param_1 + 8) + 1); local_34 = 0; for (local_30 = *(long *)(*(long *)(param_1 + 0x10) + 0x10); local_30 != *(long *)(param_1 + 0x10); local_30 = *(long *)(local_30 + 0x10)) { pcVar3 = *(char **)(local_30 + 8); if (pcVar3 != (char *)0x0) { sVar2 = strlen(pcVar3); __dest = (char *)sh_xmalloc(sVar2 + 1,"array.c",0x351); pcVar3 = strcpy(__dest,pcVar3); *(char **)((long)local_34 * 8 + lVar1) = pcVar3; local_34 = local_34 + 1; } } *(undefined8 *)(lVar1 + (long)local_34 * 8) = 0; if (param_2 != (int *)0x0) { *param_2 = local_34; } } return lVar1; }
int cipher_init(struct sshcipher_ctx **ccp, const struct sshcipher *cipher, const u_char *key, u_int keylen, const u_char *iv, u_int ivlen, int do_encrypt) { struct sshcipher_ctx *cc = ((void *)0) ; int ret = -1; const EVP_CIPHER *type; int klen; *ccp = ((void *)0) ; if ((cc = calloc(sizeof(*cc), 1)) == ((void *)0) ) return -2; cc->plaintext = (cipher->flags & (1<<3)) != 0; cc->encrypt = do_encrypt; if (keylen < cipher->key_len || (iv != ((void *)0) && ivlen < cipher_ivlen(cipher))) { ret = -10; goto out; } cc->cipher = cipher; if ((cc->cipher->flags & (1<<1)) != 0) { cc->cp_ctx = chachapoly_new(key, keylen); ret = cc->cp_ctx != ((void *)0) ? 0 : -10; goto out; } if ((cc->cipher->flags & (1<<3)) != 0) { ret = 0; goto out; } type = (*cipher->evptype)(); if ((cc->evp = EVP_CIPHER_CTX_new()) == ((void *)0) ) { ret = -2; goto out; } if (EVP_CipherInit(cc->evp, type, ((void *)0) , (u_char *)iv, (do_encrypt == 1)) == 0) { ret = -22; goto out; } if (cipher_authlen(cipher) && !EVP_CIPHER_CTX_ctrl(cc->evp, 0x12 , -1, (u_char *)iv)) { ret = -22; goto out; } klen = EVP_CIPHER_CTX_get_key_length (cc->evp); if (klen > 0 && keylen != (u_int)klen) { if (EVP_CIPHER_CTX_set_key_length(cc->evp, keylen) == 0) { ret = -22; goto out; } } if (EVP_CipherInit(cc->evp, ((void *)0) , (u_char *)key, ((void *)0) , -1) == 0) { ret = -22; goto out; } ret = 0; out: if (ret == 0) { *ccp = cc; } else { if (cc != ((void *)0) ) { EVP_CIPHER_CTX_free(cc->evp); freezero(cc, sizeof(*cc)); } } return ret; }
long long cipher_init(unsigned long long *a0, unsigned int a1[7], unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5, unsigned int v4) { unsigned int v0; unsigned int v1; void* v2; unsigned long long v3; unsigned long long v5; unsigned int v6; v2 = 0; v0 = -1; *(a0) = 0; v2 = calloc(0x128, 0x1); if (!v2) { v5 = 4294967294; } else { v2->field_0 = (a1[6] & 8); v2->field_4 = v4; if (a3 < a1[3]) { LABEL_40046a: v0 = -10; } else if (!a4) { LABEL_400476: v2->field_120 = &a1[0]; if ((v2->field_120->field_18 & 2)) { v2->field_10 = chachapoly_new(a2, a3, a3); if (!v2->field_10) v6 = -10; else v6 = 0; v0 = v6; } else if ((v2->field_120->field_18 & 8)) { v0 = 0; } else { v3 = *(&a1[1 + 1])(); v2->field_8 = EVP_CIPHER_CTX_new(a0, 0x1, a1, a3, a4, a5); if (!v2->field_8) { v0 = -2; } else if (!EVP_CipherInit(v2->field_8, v3, 0x0, a4, v4 == 1)) { v0 = -22; } else { if (cipher_authlen(a1) && !EVP_CIPHER_CTX_ctrl(v2->field_8, 0x12, 0xffffffff, a4)) { v0 = -22; goto LABEL_40061f; } v1 = EVP_CIPHER_CTX_get_key_length(v2->field_8); if (v1 > 0 && a3 != v1 && !EVP_CIPHER_CTX_set_key_length(v2->field_8, a3, a3)) { v0 = -22; goto LABEL_40061f; } if (!EVP_CipherInit(v2->field_8, 0x0, a2, 0x0, 0xffffffff)) v0 = -22; else v0 = 0; } } } else { if (!(a5 < cipher_ivlen(a1))) goto LABEL_400476; goto LABEL_40046a; } LABEL_40061f: if (!v0) { *(a0) = v2; } else if (v2) { EVP_CIPHER_CTX_free(v2->field_8); freezero(v2, 0x128); } v5 = v0; } return v5; }
int sshbuf_poke_u8(struct sshbuf *buf, size_t offset, u_char val) { u_char *p = ((void *)0) ; int r; if ((r = check_woffset(buf, offset, 1, &p)) != 0) return r; *p = val; return 0; }
long long sshbuf_poke_u8(unsigned long long a0, unsigned long a1, unsigned long a2) { unsigned int v0; void* v1; void* v3; v1 = 0; v0 = check_woffset(a0, a1, 0x1, &v1); if (v0) { v3 = v0; } else { *(v1) = a2; v3 = 0; } return v3; }
int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n, const unsigned char *p) { unsigned int work[96]; unsigned char e[32]; unsigned int i; for (i = 0;i < 32;++i) e[i] = n[i]; e[0] &= 248; e[31] &= 127; e[31] |= 64; for (i = 0;i < 32;++i) work[i] = p[i]; mainloop(work,e); recip(work + 32,work + 32); mult(work + 64,work,work + 32); freeze(work + 64); for (i = 0;i < 32;++i) q[i] = work[64 + i]; return 0; }
long long crypto_scalarmult_curve25519(char *a0, char *a1, char *a2) { unsigned int v0; char v1; char v2; char v3; char v4; char v5; for (v0 = 0; v0 <= 31; v0 += 1) { (&v4)[v0] = a1[v0]; } v4 &= 4294967288; v5 &= 127; v5 |= 64; for (v0 = 0; v0 <= 31; v0 += 1) { *(&(&v1)[4 * v0]) = a2[v0]; } mainloop(&v1, &v4); recip(&v2, &v2); mult(&v3, &v1, &v2); freeze(&v3); for (v0 = 0; v0 <= 31; v0 += 1) { a0[v0] = *(&(&v1)[0x100 + 4 * v0]); } return 0; }
pid_t subprocess(const char *tag, const char *command, int ac, char **av, FILE **child, u_int flags, struct passwd *pw, privdrop_fn *drop_privs, privrestore_fn *restore_privs) { FILE *f = ((void *)0) ; struct stat st; int fd, devnull, p[2], i; pid_t pid; char *cp, errmsg[512]; u_int nenv = 0; char **env = ((void *)0) ; if (drop_privs != ((void *)0) && (pw == ((void *)0) || restore_privs == ((void *)0) )) { sshlog("misc.c", __func__, 2647, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: inconsistent arguments", tag); return 0; } if (pw == ((void *)0) && (pw = getpwuid(getuid())) == ((void *)0) ) { sshlog("misc.c", __func__, 2651, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: no user for current uid", tag); return 0; } if (child != ((void *)0) ) *child = ((void *)0) ; sshlog("misc.c", __func__, 2657, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "%s command \"%s\" running as %s (flags 0x%x)", tag, command, pw->pw_name, flags) ; if ((flags & (1)) != 0 && (flags & (1<<1)) != 0) { sshlog("misc.c", __func__, 2663, 1, SYSLOG_LEVEL_ERROR, ((void *)0) , "inconsistent flags"); return 0; } if (((flags & (1<<1)) == 0) != (child == ((void *)0) )) { sshlog("misc.c", __func__, 2667, 1, SYSLOG_LEVEL_ERROR, ((void *)0) , "inconsistent flags/output"); return 0; } if (!path_absolute(av[0])) { sshlog("misc.c", __func__, 2676, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s path is not absolute", tag); return 0; } if (drop_privs != ((void *)0) ) drop_privs(pw); if (stat(av[0], &st) == -1) { sshlog("misc.c", __func__, 2682, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "Could not stat %s \"%s\": %s", tag, av[0], strerror( (*__errno_location ()) )) ; goto restore_return; } if ((flags & (1<<3)) == 0 && safe_path(av[0], &st, ((void *)0) , 0, errmsg, sizeof(errmsg)) != 0) { sshlog("misc.c", __func__, 2688, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "Unsafe %s \"%s\": %s", tag, av[0], errmsg); goto restore_return; } if (pipe(p) == -1) { sshlog("misc.c", __func__, 2693, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: pipe: %s", tag, strerror( (*__errno_location ()) )); restore_return: if (restore_privs != ((void *)0) ) restore_privs(); return 0; } if (restore_privs != ((void *)0) ) restore_privs(); switch ((pid = fork())) { case -1: sshlog("misc.c", __func__, 2704, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: fork: %s", tag, strerror( (*__errno_location ()) )); close(p[0]); close(p[1]); return 0; case 0: if ((flags & (1<<4)) == 0) { nenv = 5; env = xcalloc(sizeof(*env), nenv); child_set_env(&env, &nenv, "PATH", "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"); child_set_env(&env, &nenv, "USER", pw->pw_name); child_set_env(&env, &nenv, "LOGNAME", pw->pw_name); child_set_env(&env, &nenv, "HOME", pw->pw_dir); if ((cp = getenv("LANG")) != ((void *)0) ) child_set_env(&env, &nenv, "LANG", cp); } for (i = 1; i < (64 + 1) ; i++) ssh_signal(i, ((__sighandler_t) 0) ); if ((devnull = open( "/dev/null" , 02 )) == -1) { sshlog("misc.c", __func__, 2725, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: open %s: %s", tag, "/dev/null" , strerror( (*__errno_location ()) )) ; _exit(1); } if (dup2(devnull, 0 ) == -1) { sshlog("misc.c", __func__, 2730, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: dup2: %s", tag, strerror( (*__errno_location ()) )); _exit(1); } fd = -1; if ((flags & (1<<1)) != 0) fd = p[1]; else if ((flags & (1)) != 0) fd = devnull; if (fd != -1 && dup2(fd, 1 ) == -1) { sshlog("misc.c", __func__, 2741, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: dup2: %s", tag, strerror( (*__errno_location ()) )); _exit(1); } closefrom( 2 + 1); if (geteuid() == 0 && initgroups(pw->pw_name, pw->pw_gid) == -1) { sshlog("misc.c", __func__, 2748, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: initgroups(%s, %u): %s", tag, pw->pw_name, (u_int)pw->pw_gid, strerror( (*__errno_location ()) )) ; _exit(1); } if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) == -1) { sshlog("misc.c", __func__, 2753, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: setresgid %u: %s", tag, (u_int)pw->pw_gid, strerror( (*__errno_location ()) )) ; _exit(1); } if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) == -1) { sshlog("misc.c", __func__, 2758, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: setresuid %u: %s", tag, (u_int)pw->pw_uid, strerror( (*__errno_location ()) )) ; _exit(1); } if ((flags & (1)) != 0 && dup2( 0 , 2 ) == -1) { sshlog("misc.c", __func__, 2765, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: dup2: %s", tag, strerror( (*__errno_location ()) )); _exit(1); } if (env != ((void *)0) ) execve(av[0], av, env); else execv(av[0], av); sshlog("misc.c", __func__, 2772, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s %s \"%s\": %s", tag, env == ((void *)0) ? "execv" : "execve", command, strerror( (*__errno_location ()) )) ; _exit(127); default: break; } close(p[1]); if ((flags & (1<<1)) == 0) close(p[0]); else if ((f = fdopen(p[0], "r")) == ((void *)0) ) { sshlog("misc.c", __func__, 2783, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "%s: fdopen: %s", tag, strerror( (*__errno_location ()) )); close(p[0]); kill(pid, 15 ); while (waitpid(pid, ((void *)0) , 0) == -1 && (*__errno_location ()) == 4 ) ; return 0; } sshlog("misc.c", __func__, 2792, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "%s pid %ld", tag, (long)pid); if (child != ((void *)0) ) *child = f; return pid; }
long subprocess( const char *a1, const char *a2, long a3, const char **a4, FILE **a5, unsigned int a6, struct passwd *a7, void ( *a8)(struct passwd *), void (*a9)(void)) { __uid_t v10; int *v11; char *v12; int *v13; char *v14; int *v15; char *v16; int *v17; char *v18; int *v19; char *v20; int *v21; char *v22; int *v23; char *v24; int *v25; char *v26; int *v27; char *v28; int *v29; char *v30; int *v31; char *v32; const char *v33; int *v34; char *v35; struct passwd *v36; unsigned int v40; int v41; int i; __pid_t pid; int fd; char **envp; FILE *v46; char *v47; int pipedes[2]; struct stat v49; char v50[520]; unsigned long v51; v36 = a7; v51 = __readfsqword(0x28u); v46 = 0LL; v40 = 0; envp = 0LL; if ( a8 && (!a7 || !a9) ) { sshlog("misc.c", "subprocess", 2647LL, 0LL, 2LL, 0LL, "%s: inconsistent arguments", a1); return 0LL; } if ( !a7 ) { v10 = getuid(); v36 = getpwuid(v10); if ( !v36 ) { sshlog("misc.c", "subprocess", 2651LL, 0LL, 2LL, 0LL, "%s: no user for current uid", a1); return 0LL; } } if ( a5 ) *a5 = 0LL; sshlog( "misc.c", "subprocess", 2657LL, 1LL, 7LL, 0LL, "%s command \"%s\" running as %s (flags 0x%x)", a1, a2, v36->pw_name, a6); if ( (a6 & 1) != 0 && (a6 & 2) != 0 ) { sshlog("misc.c", "subprocess", 2663LL, 1LL, 2LL, 0LL, "inconsistent flags"); return 0LL; } if ( ((a6 & 2) == 0) != (a5 == 0LL) ) { sshlog("misc.c", "subprocess", 2667LL, 1LL, 2LL, 0LL, "inconsistent flags/output"); return 0LL; } if ( !path_absolute(*a4) ) { sshlog("misc.c", "subprocess", 2676LL, 0LL, 2LL, 0LL, "%s path is not absolute", a1); return 0LL; } if ( a8 ) a8(v36); if ( stat(*a4, &v49) == -1 ) { v11 = _errno_location(); v12 = strerror(*v11); sshlog("misc.c", "subprocess", 2682LL, 0LL, 2LL, 0LL, "Could not stat %s \"%s\": %s", a1, *a4, v12); LABEL_26: if ( a9 ) a9(); return 0LL; } if ( (a6 & 8) == 0 && (unsigned int)safe_path(*a4, (long)&v49, 0LL, 0, v50, 0x200uLL) ) { sshlog("misc.c", "subprocess", 2688LL, 0LL, 2LL, 0LL, "Unsafe %s \"%s\": %s", a1, *a4, v50); goto LABEL_26; } if ( pipe(pipedes) == -1 ) { v13 = _errno_location(); v14 = strerror(*v13); sshlog("misc.c", "subprocess", 2693LL, 0LL, 2LL, 0LL, "%s: pipe: %s", a1, v14); goto LABEL_26; } if ( a9 ) a9(); pid = fork(); if ( pid == -1 ) { v15 = _errno_location(); v16 = strerror(*v15); sshlog("misc.c", "subprocess", 2704LL, 0LL, 2LL, 0LL, "%s: fork: %s", a1, v16); close(pipedes[0]); close(pipedes[1]); return 0LL; } if ( !pid ) { if ( (a6 & 0x10) == 0 ) { v40 = 5; envp = (char **)xcalloc(8LL, 5LL); child_set_env(&envp, &v40, "PATH", "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"); child_set_env(&envp, &v40, "USER", v36->pw_name); child_set_env(&envp, &v40, "LOGNAME", v36->pw_name); child_set_env(&envp, &v40, "HOME", v36->pw_dir); v47 = getenv("LANG"); if ( v47 ) child_set_env(&envp, &v40, "LANG", v47); } for ( i = 1; i <= 64; ++i ) ssh_signal(i, 0LL); fd = open("/dev/null", 2); if ( fd == -1 ) { v17 = _errno_location(); v18 = strerror(*v17); sshlog("misc.c", "subprocess", 2725LL, 0LL, 2LL, 0LL, "%s: open %s: %s", a1, "/dev/null", v18); exit(1); } if ( dup2(fd, 0) == -1 ) { v19 = _errno_location(); v20 = strerror(*v19); sshlog("misc.c", "subprocess", 2730LL, 0LL, 2LL, 0LL, "%s: dup2: %s", a1, v20); exit(1); } v41 = -1; if ( (a6 & 2) != 0 ) { v41 = pipedes[1]; } else if ( (a6 & 1) != 0 ) { v41 = fd; } if ( v41 != -1 && dup2(v41, 1) == -1 ) { v21 = _errno_location(); v22 = strerror(*v21); sshlog("misc.c", "subprocess", 2741LL, 0LL, 2LL, 0LL, "%s: dup2: %s", a1, v22); exit(1); } closefrom(3LL); if ( !geteuid() && initgroups(v36->pw_name, v36->pw_gid) == -1 ) { v23 = _errno_location(); v24 = strerror(*v23); sshlog( "misc.c", "subprocess", 2748LL, 0LL, 2LL, 0LL, "%s: initgroups(%s, %u): %s", a1, v36->pw_name, v36->pw_gid, v24); exit(1); } if ( setresgid(v36->pw_gid, v36->pw_gid, v36->pw_gid) == -1 ) { v25 = _errno_location(); v26 = strerror(*v25); sshlog("misc.c", "subprocess", 2753LL, 0LL, 2LL, 0LL, "%s: setresgid %u: %s", a1, v36->pw_gid, v26); exit(1); } if ( setresuid(v36->pw_uid, v36->pw_uid, v36->pw_uid) == -1 ) { v27 = _errno_location(); v28 = strerror(*v27); sshlog("misc.c", "subprocess", 2758LL, 0LL, 2LL, 0LL, "%s: setresuid %u: %s", a1, v36->pw_uid, v28); exit(1); } if ( (a6 & 1) != 0 && dup2(0, 2) == -1 ) { v29 = _errno_location(); v30 = strerror(*v29); sshlog("misc.c", "subprocess", 2765LL, 0LL, 2LL, 0LL, "%s: dup2: %s", a1, v30); exit(1); } if ( envp ) execve(*a4, (char *const *)a4, envp); else execv(*a4, (char *const *)a4); v31 = _errno_location(); v32 = strerror(*v31); if ( envp ) v33 = "execve"; else v33 = "execv"; sshlog("misc.c", "subprocess", 2772LL, 0LL, 2LL, 0LL, "%s %s \"%s\": %s", a1, v33, a2, v32); exit(127); } close(pipedes[1]); if ( (a6 & 2) != 0 ) { v46 = fdopen(pipedes[0], "r"); if ( !v46 ) { v34 = _errno_location(); v35 = strerror(*v34); sshlog("misc.c", "subprocess", 2783LL, 0LL, 2LL, 0LL, "%s: fdopen: %s", a1, v35); close(pipedes[0]); kill(pid, 15); while ( waitpid(pid, 0LL, 0) == -1 && *_errno_location() == 4 ) ; return 0LL; } } else { close(pipedes[0]); } sshlog("misc.c", "subprocess", 2792LL, 1LL, 7LL, 0LL, "%s pid %ld", a1, pid); if ( a5 ) *a5 = v46; return (unsigned int)pid; }
void mm_send_keystate(struct ssh *ssh, struct monitor *monitor) { struct sshbuf *m; int r; if ((m = sshbuf_new()) == ((void *)0) ) sshfatal("monitor_wrap.c", __func__, 558, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "sshbuf_new failed"); if ((r = ssh_packet_get_state(ssh, m)) != 0) sshfatal("monitor_wrap.c", __func__, 560, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "ssh_packet_get_state"); mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, m); sshlog("monitor_wrap.c", __func__, 562, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "Finished sending state"); sshbuf_free(m); }
long long mm_send_keystate(unsigned long long a0, unsigned int *a1) { unsigned long long v0; unsigned int v1; unsigned long long v2; char v3; v2 = sshbuf_new(); if (!v2) { v0 = "sshbuf_new failed"; sshfatal("monitor_wrap.c", "mm_send_keystate", 0x22e, 0x1, 0x1, 0x0); } v1 = ssh_packet_get_state(a0, v2, v2); if (v1) { v2 = "ssh_packet_get_state"; sshfatal("monitor_wrap.c", "mm_send_keystate", 0x230, 0x1, 0x1, ssh_err(v1)); } mm_request_send(*(a1), 0x1a, v2); v2 = "Finished sending state"; sshlog("monitor_wrap.c", "mm_send_keystate", 0x232, 0x1, 0x7, 0x0, *(&v3)); return sshbuf_free(v2); }
int assertpredep(const char *const *argv) { struct dpkg_version version = { 0, "1.1.0", ((void *)0) }; return assert_version_support(argv, &version, gettext("Pre-Depends field")); }
long long assertpredep(unsigned long long *a0) { unsigned int v0; unsigned long long v1; void* v2; v0 = 0; v1 = "1.1.0"; v2 = 0; return assert_version_support(a0, &v0, gettext("Pre-Depends field")); }
static void usage(void) { fprintf( stderr , "Usage: rtmon [ OPTIONS ] file FILE [ all | LISTofOBJECTS ]\n" "OPTIONS := { -f[amily] { inet | inet6 | link | help } |\n" " -4 | -6 | -0 | -V[ersion] }\n" "LISTofOBJECTS := [ link ] [ address ] [ route ]\n"); exit(-1); }
void usage() { fprintf(stderr, "Usage: rtmon [ OPTIONS ] file FILE [ all | LISTofOBJECTS ]\nOPTIONS := { -f[amily] { inet | inet6 | link | help } |\n -4 | -6 | -0 | -V[ersion] }\nLISTofOBJECTS := [ link ] [ address ] [ route ]\n"); exit(0xffffffff); }
static int strtoul_cc_t (char const *s, int base, char **p, cc_t *result, char delim) { unsigned long ul; (*__errno_location ()) = 0; ul = strtoul (s, p, base); if ( (*__errno_location ()) || **p != delim || *p == s || (cc_t) ul != ul) return -1; *result = ul; return 0; }
long strtoul_cc_t(const char *a1, int a2, char **a3, _BYTE *a4, char a5) { unsigned long v9; *_errno_location() = 0; v9 = strtoul(a1, a3, a2); if ( *_errno_location() || a5 != **a3 || a1 == *a3 || v9 != (unsigned char)v9 ) return 0xFFFFFFFFLL; *a4 = v9; return 0LL; }
void rl_redisplay (void) { int in, out, c, linenum, cursor_linenum; int inv_botlin, lb_botlin, lb_linenum, o_cpos; int newlines, lpos, temp, n0, num, prompt_lines_estimate; char *prompt_this_line; char cur_face; int hl_begin, hl_end; int mb_cur_max = (__ctype_get_mb_cur_max ()) ; wchar_t wc; size_t wc_bytes; int wc_width; mbstate_t ps; int _rl_wrapped_multicolumn = 0; if (_rl_echoing_p == 0) return; _rl_block_sigint (); (rl_readline_state |= (0x1000000)); cur_face = '0'; hl_begin = hl_end = -1; if (rl_mark_active_p ()) set_active_region (&hl_begin, &hl_end); if (!rl_display_prompt) rl_display_prompt = ""; if (line_structures_initialized == 0) { init_line_structures (0); rl_on_new_line (); } else if (line_size <= _rl_screenwidth) init_line_structures (_rl_screenwidth + 1); if (_rl_screenheight <= 1) { if (_rl_horizontal_scroll_mode == 0) horizontal_scrolling_autoset = 1; _rl_horizontal_scroll_mode = 1; } else if (horizontal_scrolling_autoset) _rl_horizontal_scroll_mode = 0; cpos_buffer_position = -1; prompt_multibyte_chars = prompt_visible_length - prompt_physical_chars; out = inv_botlin = 0; modmark = 0; if (_rl_mark_modified_lines && current_history () && rl_undo_list) { invis_addc (&out, '*', cur_face); invis_nul (&out); modmark = 1; } if ((line_state_visible->line)[0] != (line_state_invisible->line)[0]) rl_display_fixed = 0; if (rl_display_prompt == rl_prompt || local_prompt) { if (local_prompt_prefix && forced_display) _rl_output_some_chars (local_prompt_prefix, strlen (local_prompt_prefix)); if (local_prompt_len > 0) invis_adds (&out, local_prompt, local_prompt_len, cur_face); invis_nul (&out); wrap_offset = local_prompt_len - prompt_visible_length; } else { int pmtlen; prompt_this_line = strrchr (rl_display_prompt, '\n'); if (!prompt_this_line) prompt_this_line = rl_display_prompt; else { prompt_this_line++; pmtlen = prompt_this_line - rl_display_prompt; if (forced_display) { _rl_output_some_chars (rl_display_prompt, pmtlen); if (pmtlen < 2 || prompt_this_line[-2] != '\r') cr (); } } prompt_physical_chars = pmtlen = strlen (prompt_this_line); invis_adds (&out, prompt_this_line, pmtlen, cur_face); invis_nul (&out); wrap_offset = prompt_invis_chars_first_line = 0; } (line_state_invisible->lbreaks)[newlines = 0] = 0; lpos = prompt_physical_chars + modmark; memset (line_state_invisible->wrapped_line, 0, line_state_invisible->wbsize * sizeof (int)); num = 0; prompt_lines_estimate = lpos / _rl_screenwidth; if (lpos >= _rl_screenwidth) { temp = 0; while (local_prompt_newlines[newlines+1] != -1) { temp = local_prompt_newlines[newlines+1]; (line_state_invisible->lbreaks)[++newlines] = temp; } if (mb_cur_max > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0) lpos = _rl_col_width (local_prompt, temp, local_prompt_len, 1) - (wrap_offset - prompt_invis_chars_first_line); else lpos -= (_rl_screenwidth * newlines); } prompt_last_screen_line = newlines; lb_linenum = 0; in = 0; if (mb_cur_max > 1 && rl_byte_oriented == 0) { memset (&ps, 0, sizeof (mbstate_t)); if (_rl_utf8locale && (((rl_line_buffer[0]) & 0x80) == 0)) { wc = (wchar_t)rl_line_buffer[0]; wc_bytes = 1; } else wc_bytes = mbrtowc (&wc, rl_line_buffer, rl_end, &ps); } else wc_bytes = 1; while (in < rl_end) { if (in == hl_begin) cur_face = '1'; else if (in == hl_end) cur_face = '0'; c = (unsigned char)rl_line_buffer[in]; if (mb_cur_max > 1 && rl_byte_oriented == 0) { if (((wc_bytes) == (size_t)-1 || (wc_bytes) == (size_t)-2)) { wc_bytes = 1; wc_width = 1; memset (&ps, 0, sizeof (mbstate_t)); } else if (((wc_bytes) == 0)) break; else { temp = ((_rl_utf8locale && ((wc) >= 768 && (wc) <= 879)) ? 0 : _rl_wcwidth(wc)); wc_width = (temp >= 0) ? temp : 1; } } if (in == rl_point) { cpos_buffer_position = out; lb_linenum = newlines; } if (((c) > 0x07f && (c) <= 255) && _rl_output_meta_chars == 0) { if (_rl_output_meta_chars == 0) { char obuf[5]; int olen; olen = sprintf (obuf, "\\%o", c); if (lpos + olen >= _rl_screenwidth) { temp = _rl_screenwidth - lpos; do { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } } while (0); (line_state_invisible->lbreaks)[++newlines] = out + temp; line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; lpos = olen - temp; } else lpos += olen; for (temp = 0; temp < olen; temp++) { invis_addc (&out, obuf[temp], cur_face); do { lpos++; if (lpos >= _rl_screenwidth) { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } (line_state_invisible->lbreaks)[++newlines] = out; if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; lpos = 0; } } while (0); } } else { invis_addc (&out, c, cur_face); do { lpos++; if (lpos >= _rl_screenwidth) { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } (line_state_invisible->lbreaks)[++newlines] = out; if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; lpos = 0; } } while (0); } } else if (c == '\t') { register int newout; newout = out + 8 - lpos % 8; temp = newout - out; if (lpos + temp >= _rl_screenwidth) { register int temp2; temp2 = _rl_screenwidth - lpos; do { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } } while (0); (line_state_invisible->lbreaks)[++newlines] = out + temp2; line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; lpos = temp - temp2; while (out < newout) invis_addc (&out, ' ', cur_face); } else { while (out < newout) invis_addc (&out, ' ', cur_face); lpos += temp; } } else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up) { invis_addc (&out, '\0', cur_face); do { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } } while (0); (line_state_invisible->lbreaks)[++newlines] = out; line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; lpos = 0; } else if (((c) < 0x020 && (((c) & 0x80) == 0)) || c == 0x7f) { invis_addc (&out, '^', cur_face); do { lpos++; if (lpos >= _rl_screenwidth) { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } (line_state_invisible->lbreaks)[++newlines] = out; if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; lpos = 0; } } while (0); invis_addc (&out, ((c) < 0x020 && (((c) & 0x80) == 0)) ? ((1 && (1 && ((*__ctype_b_loc ())[(int) (( (unsigned char)((c)|0x40) ))] & (unsigned short int) _ISlower) )) ? toupper((unsigned char)(((c)|0x40))) : (((c)|0x40))) : '?', cur_face); do { lpos++; if (lpos >= _rl_screenwidth) { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } (line_state_invisible->lbreaks)[++newlines] = out; if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; lpos = 0; } } while (0); } else { if (mb_cur_max > 1 && rl_byte_oriented == 0) { register int i; _rl_wrapped_multicolumn = 0; if (_rl_screenwidth < lpos + wc_width) for (i = lpos; i < _rl_screenwidth; i++) { invis_addc (&out, ' ', cur_face); _rl_wrapped_multicolumn++; do { lpos++; if (lpos >= _rl_screenwidth) { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } (line_state_invisible->lbreaks)[++newlines] = out; if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; lpos = 0; } } while (0); } if (in == rl_point) { cpos_buffer_position = out; lb_linenum = newlines; } for (i = in; i < in+wc_bytes; i++) invis_addc (&out, rl_line_buffer[i], cur_face); for (i = 0; i < wc_width; i++) do { lpos++; if (lpos >= _rl_screenwidth) { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } (line_state_invisible->lbreaks)[++newlines] = out; if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; lpos = 0; } } while (0); } else { invis_addc (&out, c, cur_face); do { lpos++; if (lpos >= _rl_screenwidth) { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } (line_state_invisible->lbreaks)[++newlines] = out; if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; lpos = 0; } } while (0); } } if (mb_cur_max > 1 && rl_byte_oriented == 0) { in += wc_bytes; if (_rl_utf8locale && (((rl_line_buffer[in]) & 0x80) == 0)) { wc = (wchar_t)rl_line_buffer[in]; wc_bytes = 1; memset (&ps, 0, sizeof (mbstate_t)); } else wc_bytes = mbrtowc (&wc, rl_line_buffer + in, rl_end - in, &ps); } else in++; } invis_nul (&out); line_totbytes = out; if (cpos_buffer_position < 0) { cpos_buffer_position = out; lb_linenum = newlines; } if (_rl_quick_redisplay && newlines > 0) _rl_quick_redisplay = 0; inv_botlin = lb_botlin = _rl_inv_botlin = newlines; do { if (newlines >= ((line_state_invisible->lbsize) - 2)) { (line_state_invisible->lbsize) *= 2; (line_state_invisible->lbreaks) = (int *)xrealloc ((line_state_invisible->lbreaks), (line_state_invisible->lbsize) * sizeof (int)); } if (newlines >= (line_state_invisible->wbsize - 2)) { line_state_invisible->wbsize *= 2; line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, line_state_invisible->wbsize * sizeof(int)); } } while (0); (line_state_invisible->lbreaks)[newlines+1] = out; line_state_invisible->wrapped_line[newlines+1] = _rl_wrapped_multicolumn; cursor_linenum = lb_linenum; displaying_prompt_first_line = 1; if (_rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up) { int nleft, pos, changed_screen_line, tx; if (!rl_display_fixed || forced_display) { forced_display = 0; if (out >= _rl_screenchars) { if (mb_cur_max > 1 && rl_byte_oriented == 0) out = _rl_find_prev_mbchar ((line_state_invisible->line), _rl_screenchars, 0x00); else out = _rl_screenchars - 1; } if (rl_mark_active_p () && inv_botlin > _rl_screenheight) { int extra; extra = inv_botlin - _rl_screenheight; for (linenum = 0; linenum <= extra; linenum++) norm_face (((line_state_invisible->lface) + (line_state_invisible->lbreaks)[linenum]), ((line_state_invisible->lbreaks)[linenum+1] - (line_state_invisible->lbreaks)[linenum])); } for (linenum = 0; linenum <= inv_botlin; linenum++) { o_cpos = _rl_last_c_pos; cpos_adjusted = 0; update_line (((linenum) > _rl_vis_botlin) ? "" : ((line_state_visible->line) + (line_state_visible->lbreaks)[linenum]), ((linenum) > _rl_vis_botlin) ? "" : ((line_state_visible->lface) + (line_state_visible->lbreaks)[linenum]), ((line_state_invisible->line) + (line_state_invisible->lbreaks)[linenum]), ((line_state_invisible->lface) + (line_state_invisible->lbreaks)[linenum]), linenum, ((linenum) > _rl_vis_botlin ? 0 : ((line_state_visible->lbreaks)[linenum+1] - (line_state_visible->lbreaks)[linenum])), ((line_state_invisible->lbreaks)[linenum+1] - (line_state_invisible->lbreaks)[linenum]), inv_botlin); if (linenum == 0 && (mb_cur_max > 1 && rl_byte_oriented == 0) && (cpos_adjusted == 0 && _rl_last_c_pos != o_cpos && _rl_last_c_pos > wrap_offset && o_cpos < prompt_last_invisible)) _rl_last_c_pos -= prompt_invis_chars_first_line; else if (cpos_adjusted == 0 && linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth && (mb_cur_max > 1 && rl_byte_oriented == 0) && _rl_last_c_pos != o_cpos && _rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line)) _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line); if (linenum == 0 && inv_botlin == 0 && _rl_last_c_pos == out && (wrap_offset > visible_wrap_offset) && (_rl_last_c_pos < visible_first_line_len)) { if (mb_cur_max > 1 && rl_byte_oriented == 0) nleft = _rl_screenwidth - _rl_last_c_pos; else nleft = _rl_screenwidth + wrap_offset - _rl_last_c_pos; if (nleft) _rl_clear_to_eol (nleft); } if (linenum == 0) visible_first_line_len = (inv_botlin > 0) ? (line_state_invisible->lbreaks)[1] : out - wrap_offset; } if (_rl_vis_botlin > inv_botlin) { char *tt; for (; linenum <= _rl_vis_botlin; linenum++) { tt = ((line_state_visible->line) + (line_state_visible->lbreaks)[linenum]); _rl_move_vert (linenum); _rl_move_cursor_relative (0, tt, ((line_state_visible->lface) + (line_state_visible->lbreaks)[linenum])); _rl_clear_to_eol ((linenum == _rl_vis_botlin) ? strlen (tt) : _rl_screenwidth); } } _rl_vis_botlin = inv_botlin; changed_screen_line = _rl_last_v_pos != cursor_linenum; if (changed_screen_line) { _rl_move_vert (cursor_linenum); if ((mb_cur_max == 1 || rl_byte_oriented) && cursor_linenum == 0 && wrap_offset) _rl_last_c_pos += wrap_offset; } nleft = prompt_visible_length + wrap_offset; if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 && _rl_last_c_pos < (( (__ctype_get_mb_cur_max ()) > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible+1) && local_prompt) { _rl_cr (); if (modmark) _rl_output_some_chars ("*", 1); _rl_output_some_chars (local_prompt, nleft); if (mb_cur_max > 1 && rl_byte_oriented == 0) _rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft, 1) - wrap_offset + modmark; else _rl_last_c_pos = nleft + modmark; } pos = (line_state_invisible->lbreaks)[cursor_linenum]; nleft = cpos_buffer_position - pos; if (wrap_offset && cursor_linenum == 0 && nleft < _rl_last_c_pos) { if (mb_cur_max > 1 && rl_byte_oriented == 0) tx = _rl_col_width (&(line_state_visible->line)[pos], 0, nleft, 1) - visible_wrap_offset; else tx = nleft; if (tx >= 0 && _rl_last_c_pos > tx) { _rl_backspace (_rl_last_c_pos - tx); _rl_last_c_pos = tx; } } if (mb_cur_max > 1 && rl_byte_oriented == 0) _rl_move_cursor_relative (nleft, &(line_state_invisible->line)[pos], &(line_state_invisible->lface)[pos]); else if (nleft != _rl_last_c_pos) _rl_move_cursor_relative (nleft, &(line_state_invisible->line)[pos], &(line_state_invisible->lface)[pos]); } } else { int lmargin, ndisp, nleft, phys_c_pos, t; _rl_last_v_pos = 0; ndisp = cpos_buffer_position - wrap_offset; nleft = prompt_visible_length + wrap_offset; phys_c_pos = cpos_buffer_position - (last_lmargin ? last_lmargin : wrap_offset); t = _rl_screenwidth / 3; if (phys_c_pos > _rl_screenwidth - 2) { lmargin = cpos_buffer_position - (2 * t); if (lmargin < 0) lmargin = 0; if (wrap_offset && lmargin > 0 && lmargin < nleft) lmargin = nleft; } else if (ndisp < _rl_screenwidth - 2) lmargin = 0; else if (phys_c_pos < 1) { lmargin = ((cpos_buffer_position - 1) / t) * t; if (wrap_offset && lmargin > 0 && lmargin < nleft) lmargin = nleft; } else lmargin = last_lmargin; displaying_prompt_first_line = lmargin < nleft; if (lmargin > 0) (line_state_invisible->line)[lmargin] = '<'; t = lmargin + ((lmargin) == 0 ? wrap_offset : 0) + _rl_screenwidth; if (t > 0 && t < out) (line_state_invisible->line)[t - 1] = '>'; if (rl_display_fixed == 0 || forced_display || lmargin != last_lmargin) { forced_display = 0; o_cpos = _rl_last_c_pos; cpos_adjusted = 0; update_line (&(line_state_visible->line)[last_lmargin], &(line_state_visible->lface)[last_lmargin], &(line_state_invisible->line)[lmargin], &(line_state_invisible->lface)[lmargin], 0, _rl_screenwidth + visible_wrap_offset, _rl_screenwidth + (lmargin ? 0 : wrap_offset), 0); if ((mb_cur_max > 1 && rl_byte_oriented == 0) && displaying_prompt_first_line && (cpos_adjusted == 0 && _rl_last_c_pos != o_cpos && _rl_last_c_pos > wrap_offset && o_cpos < prompt_last_invisible)) _rl_last_c_pos -= prompt_invis_chars_first_line; t = _rl_last_c_pos - ((lmargin) == 0 ? wrap_offset : 0); if ((((lmargin) == 0 ? wrap_offset : 0) > visible_wrap_offset) && (_rl_last_c_pos == out) && displaying_prompt_first_line && t < visible_first_line_len) { nleft = _rl_screenwidth - t; _rl_clear_to_eol (nleft); } visible_first_line_len = out - lmargin - ((lmargin) == 0 ? wrap_offset : 0); if (visible_first_line_len > _rl_screenwidth) visible_first_line_len = _rl_screenwidth; _rl_move_cursor_relative (cpos_buffer_position - lmargin, &(line_state_invisible->line)[lmargin], &(line_state_invisible->lface)[lmargin]); last_lmargin = lmargin; } } fflush (rl_outstream); { struct line_state *vtemp = line_state_visible; line_state_visible = line_state_invisible; line_state_invisible = vtemp; rl_display_fixed = 0; if (_rl_horizontal_scroll_mode && last_lmargin) visible_wrap_offset = 0; else visible_wrap_offset = wrap_offset; _rl_quick_redisplay = 0; } (rl_readline_state &= ~(0x1000000)); _rl_release_sigint (); }
unsigned long rl_redisplay() { unsigned int v0; long v1; int v2; int v3; _QWORD *v4; _QWORD *v5; long v6; _QWORD *v7; long v8; _QWORD *v9; int v10; int v11; _QWORD *v12; _QWORD *v13; long v14; _QWORD *v15; _QWORD *v16; long v17; _QWORD *v18; long v19; _QWORD *v20; char v21; _QWORD *v22; long v23; _QWORD *v24; int i; _QWORD *v26; long v27; _QWORD *v28; int j; int k; _QWORD *v31; long v32; _QWORD *v33; _QWORD *v34; long v35; _QWORD *v36; _QWORD *v37; _QWORD *v38; int v39; _BYTE *v40; char *v41; int v42; int v43; int v44; int v45; int v46; int v47; int v48; int v49; int v50; int v51; char v53; int prev_mbchar; int v55; int v56; wchar_t pwc; int v58; int n; int v60; int v61; int v62; int m; int v64; int v65; int v66; int v67; int v68; int mb_cur_max; int v70; int v71; int v72; int v73; int v74; int v75; int v76; signed int v77; int v78; _BOOL4 v79; int v80; int v81; int v82; int v83; int v84; int v85; char *s; size_t v87; char *v88; void *v89; mbstate_t p; char v91[5]; unsigned long v92; v92 = __readfsqword(0x28u); mb_cur_max = _ctype_get_mb_cur_max(); v65 = 0; if ( rl_echoing_p ) { rl_block_sigint(); rl_readline_state |= 0x1000000uLL; v53 = 48; v56 = -1; v55 = -1; if ( (unsigned int)rl_mark_active_p() ) set_active_region(&v55, &v56); if ( !rl_display_prompt ) rl_display_prompt = (char *)&unk_7D8E; if ( line_structures_initialized ) { if ( line_size <= rl_screenwidth ) init_line_structures(rl_screenwidth + 1); } else { init_line_structures(0); rl_on_new_line(); } if ( rl_screenheight > 1 ) { if ( horizontal_scrolling_autoset ) rl_horizontal_scroll_mode = 0; } else { if ( !rl_horizontal_scroll_mode ) horizontal_scrolling_autoset = 1; rl_horizontal_scroll_mode = 1; } cpos_buffer_position = -1; prompt_multibyte_chars = prompt_visible_length - prompt_physical_chars; v70 = 0; prev_mbchar = 0; modmark = 0; if ( rl_mark_modified_lines && current_history() && rl_undo_list ) { invis_addc(&prev_mbchar, 42, 48); invis_nul(&prev_mbchar); modmark = 1; } if ( **(_BYTE **)line_state_visible != **(_BYTE **)line_state_invisible ) rl_display_fixed = 0; if ( rl_display_prompt == rl_prompt || local_prompt ) { if ( local_prompt_prefix && forced_display ) { v0 = strlen(local_prompt_prefix); rl_output_some_chars(local_prompt_prefix, v0); } if ( local_prompt_len > 0 ) invis_adds(&prev_mbchar, (long)local_prompt, local_prompt_len, 48); invis_nul(&prev_mbchar); wrap_offset = local_prompt_len - prompt_visible_length; } else { s = strrchr(rl_display_prompt, 10); if ( s ) { v71 = (_DWORD)++s - (_DWORD)rl_display_prompt; if ( forced_display ) { rl_output_some_chars(rl_display_prompt, (unsigned int)v71); if ( v71 <= 1 || *(s - 2) != 13 ) cr(); } } else { s = rl_display_prompt; } v71 = strlen(s); prompt_physical_chars = v71; invis_adds(&prev_mbchar, (long)s, v71, 48); invis_nul(&prev_mbchar); prompt_invis_chars_first_line = 0; wrap_offset = 0; } v61 = 0; **((_DWORD **)line_state_invisible + 2) = 0; v62 = prompt_physical_chars + modmark; memset(*((void **)line_state_invisible + 4), 0, 4LL * *((int *)line_state_invisible + 7)); v72 = 0; v73 = v62 / rl_screenwidth; if ( v62 >= rl_screenwidth ) { m = 0; while ( *((_DWORD *)local_prompt_newlines + v61 + 1) != -1 ) { m = *((_DWORD *)local_prompt_newlines + v61 + 1); v1 = *((_QWORD *)line_state_invisible + 2); *(_DWORD *)(v1 + 4LL * ++v61) = m; } if ( mb_cur_max <= 1 || rl_byte_oriented || prompt_multibyte_chars <= 0 ) v62 -= v61 * rl_screenwidth; else v62 = rl_col_width(local_prompt, m, local_prompt_len, 1u) - (wrap_offset - prompt_invis_chars_first_line); } prompt_last_screen_line = v61; v60 = 0; v58 = 0; if ( mb_cur_max <= 1 || rl_byte_oriented ) { v87 = 1LL; } else { memset(&p, 0, sizeof(p)); if ( rl_utf8locale && *rl_line_buffer >= 0 ) { pwc = *rl_line_buffer; v87 = 1LL; } else { v87 = mbrtowc(&pwc, rl_line_buffer, rl_end, &p); } } while ( v58 < rl_end ) { if ( v58 == v55 ) { v53 = 49; } else if ( v58 == v56 ) { v53 = 48; } v74 = (unsigned char)rl_line_buffer[v58]; if ( mb_cur_max > 1 && !rl_byte_oriented ) { if ( v87 < 0xFFFFFFFFFFFFFFFELL ) { if ( !v87 ) break; if ( rl_utf8locale && pwc > 767 && pwc <= 879 ) v2 = 0; else v2 = rl_wcwidth(pwc); m = v2; if ( v2 < 0 ) v3 = 1; else v3 = m; v64 = v3; } else { v87 = 1LL; v64 = 1; memset(&p, 0, sizeof(p)); } } if ( v58 == rl_point ) { cpos_buffer_position = prev_mbchar; v60 = v61; } if ( v74 <= 127 || v74 > 255 || rl_output_meta_chars ) { if ( v74 == 9 ) { v10 = prev_mbchar + 8 - v62 % 8; m = 8 - v62 % 8; if ( m + v62 < rl_screenwidth ) { while ( v10 > prev_mbchar ) invis_addc(&prev_mbchar, 32, v53); v62 += m; } else { v11 = rl_screenwidth - v62; if ( v61 >= *((_DWORD *)line_state_invisible + 6) - 2 ) { *((_DWORD *)line_state_invisible + 6) *= 2; v12 = line_state_invisible; v12[2] = xrealloc(*((_QWORD *)line_state_invisible + 2), 4LL * *((int *)line_state_invisible + 6)); } if ( v61 >= *((_DWORD *)line_state_invisible + 7) - 2 ) { *((_DWORD *)line_state_invisible + 7) *= 2; v13 = line_state_invisible; v13[4] = xrealloc(*((_QWORD *)line_state_invisible + 4), 4LL * *((int *)line_state_invisible + 7)); } v14 = *((_QWORD *)line_state_invisible + 2); *(_DWORD *)(4LL * ++v61 + v14) = v11 + prev_mbchar; *(_DWORD *)(*((_QWORD *)line_state_invisible + 4) + 4LL * v61) = v65; v62 = m - v11; while ( v10 > prev_mbchar ) invis_addc(&prev_mbchar, 32, v53); } } else if ( v74 == 10 && !rl_horizontal_scroll_mode && rl_term_up && *rl_term_up ) { invis_addc(&prev_mbchar, 0, v53); if ( v61 >= *((_DWORD *)line_state_invisible + 6) - 2 ) { *((_DWORD *)line_state_invisible + 6) *= 2; v15 = line_state_invisible; v15[2] = xrealloc(*((_QWORD *)line_state_invisible + 2), 4LL * *((int *)line_state_invisible + 6)); } if ( v61 >= *((_DWORD *)line_state_invisible + 7) - 2 ) { *((_DWORD *)line_state_invisible + 7) *= 2; v16 = line_state_invisible; v16[4] = xrealloc(*((_QWORD *)line_state_invisible + 4), 4LL * *((int *)line_state_invisible + 7)); } v17 = *((_QWORD *)line_state_invisible + 2); *(_DWORD *)(v17 + 4LL * ++v61) = prev_mbchar; *(_DWORD *)(*((_QWORD *)line_state_invisible + 4) + 4LL * v61) = v65; v62 = 0; } else if ( (v74 > 31 || (v74 & 0x80) != 0) && v74 != 127 ) { if ( mb_cur_max <= 1 || rl_byte_oriented ) { invis_addc(&prev_mbchar, v74, v53); if ( ++v62 >= rl_screenwidth ) { if ( v61 >= *((_DWORD *)line_state_invisible + 6) - 2 ) { *((_DWORD *)line_state_invisible + 6) *= 2; v34 = line_state_invisible; v34[2] = xrealloc(*((_QWORD *)line_state_invisible + 2), 4LL * *((int *)line_state_invisible + 6)); } v35 = *((_QWORD *)line_state_invisible + 2); *(_DWORD *)(v35 + 4LL * ++v61) = prev_mbchar; if ( v61 >= *((_DWORD *)line_state_invisible + 7) - 2 ) { *((_DWORD *)line_state_invisible + 7) *= 2; v36 = line_state_invisible; v36[4] = xrealloc(*((_QWORD *)line_state_invisible + 4), 4LL * *((int *)line_state_invisible + 7)); } *(_DWORD *)(*((_QWORD *)line_state_invisible + 4) + 4LL * v61) = v65; v62 = 0; } } else { v65 = 0; if ( v64 + v62 > rl_screenwidth ) { for ( i = v62; i < rl_screenwidth; ++i ) { invis_addc(&prev_mbchar, 32, v53); ++v65; if ( ++v62 >= rl_screenwidth ) { if ( v61 >= *((_DWORD *)line_state_invisible + 6) - 2 ) { *((_DWORD *)line_state_invisible + 6) *= 2; v26 = line_state_invisible; v26[2] = xrealloc(*((_QWORD *)line_state_invisible + 2), 4LL * *((int *)line_state_invisible + 6)); } v27 = *((_QWORD *)line_state_invisible + 2); *(_DWORD *)(v27 + 4LL * ++v61) = prev_mbchar; if ( v61 >= *((_DWORD *)line_state_invisible + 7) - 2 ) { *((_DWORD *)line_state_invisible + 7) *= 2; v28 = line_state_invisible; v28[4] = xrealloc(*((_QWORD *)line_state_invisible + 4), 4LL * *((int *)line_state_invisible + 7)); } *(_DWORD *)(*((_QWORD *)line_state_invisible + 4) + 4LL * v61) = v65; v62 = 0; } } } if ( v58 == rl_point ) { cpos_buffer_position = prev_mbchar; v60 = v61; } for ( j = v58; j < v58 + v87; ++j ) invis_addc(&prev_mbchar, rl_line_buffer[j], v53); for ( k = 0; k < v64; ++k ) { if ( ++v62 >= rl_screenwidth ) { if ( v61 >= *((_DWORD *)line_state_invisible + 6) - 2 ) { *((_DWORD *)line_state_invisible + 6) *= 2; v31 = line_state_invisible; v31[2] = xrealloc(*((_QWORD *)line_state_invisible + 2), 4LL * *((int *)line_state_invisible + 6)); } v32 = *((_QWORD *)line_state_invisible + 2); *(_DWORD *)(v32 + 4LL * ++v61) = prev_mbchar; if ( v61 >= *((_DWORD *)line_state_invisible + 7) - 2 ) { *((_DWORD *)line_state_invisible + 7) *= 2; v33 = line_state_invisible; v33[4] = xrealloc(*((_QWORD *)line_state_invisible + 4), 4LL * *((int *)line_state_invisible + 7)); } *(_DWORD *)(*((_QWORD *)line_state_invisible + 4) + 4LL * v61) = v65; v62 = 0; } } } } else { invis_addc(&prev_mbchar, 94, v53); if ( ++v62 >= rl_screenwidth ) { if ( v61 >= *((_DWORD *)line_state_invisible + 6) - 2 ) { *((_DWORD *)line_state_invisible + 6) *= 2; v18 = line_state_invisible; v18[2] = xrealloc(*((_QWORD *)line_state_invisible + 2), 4LL * *((int *)line_state_invisible + 6)); } v19 = *((_QWORD *)line_state_invisible + 2); *(_DWORD *)(v19 + 4LL * ++v61) = prev_mbchar; if ( v61 >= *((_DWORD *)line_state_invisible + 7) - 2 ) { *((_DWORD *)line_state_invisible + 7) *= 2; v20 = line_state_invisible; v20[4] = xrealloc(*((_QWORD *)line_state_invisible + 4), 4LL * *((int *)line_state_invisible + 7)); } *(_DWORD *)(*((_QWORD *)line_state_invisible + 4) + 4LL * v61) = v65; v62 = 0; } if ( v74 > 31 || (v74 & 0x80) != 0 ) { v21 = 63; } else if ( ((*_ctype_b_loc())[(unsigned char)v74 | 0x40] & 0x200) != 0 ) { v21 = toupper((unsigned char)v74 | 0x40); } else { v21 = v74 | 0x40; } invis_addc(&prev_mbchar, v21, v53); if ( ++v62 >= rl_screenwidth ) { if ( v61 >= *((_DWORD *)line_state_invisible + 6) - 2 ) { *((_DWORD *)line_state_invisible + 6) *= 2; v22 = line_state_invisible; v22[2] = xrealloc(*((_QWORD *)line_state_invisible + 2), 4LL * *((int *)line_state_invisible + 6)); } v23 = *((_QWORD *)line_state_invisible + 2); *(_DWORD *)(v23 + 4LL * ++v61) = prev_mbchar; if ( v61 >= *((_DWORD *)line_state_invisible + 7) - 2 ) { *((_DWORD *)line_state_invisible + 7) *= 2; v24 = line_state_invisible; v24[4] = xrealloc(*((_QWORD *)line_state_invisible + 4), 4LL * *((int *)line_state_invisible + 7)); } *(_DWORD *)(*((_QWORD *)line_state_invisible + 4) + 4LL * v61) = v65; v62 = 0; } } } else { v75 = sprintf(v91, "\\%o", (unsigned int)v74); if ( v75 + v62 < rl_screenwidth ) { v62 += v75; } else { m = rl_screenwidth - v62; if ( v61 >= *((_DWORD *)line_state_invisible + 6) - 2 ) { *((_DWORD *)line_state_invisible + 6) *= 2; v4 = line_state_invisible; v4[2] = xrealloc(*((_QWORD *)line_state_invisible + 2), 4LL * *((int *)line_state_invisible + 6)); } if ( v61 >= *((_DWORD *)line_state_invisible + 7) - 2 ) { *((_DWORD *)line_state_invisible + 7) *= 2; v5 = line_state_invisible; v5[4] = xrealloc(*((_QWORD *)line_state_invisible + 4), 4LL * *((int *)line_state_invisible + 7)); } v6 = *((_QWORD *)line_state_invisible + 2); *(_DWORD *)(4LL * ++v61 + v6) = prev_mbchar + m; *(_DWORD *)(*((_QWORD *)line_state_invisible + 4) + 4LL * v61) = v65; v62 = v75 - m; } for ( m = 0; m < v75; ++m ) { invis_addc(&prev_mbchar, v91[m], v53); if ( ++v62 >= rl_screenwidth ) { if ( v61 >= *((_DWORD *)line_state_invisible + 6) - 2 ) { *((_DWORD *)line_state_invisible + 6) *= 2; v7 = line_state_invisible; v7[2] = xrealloc(*((_QWORD *)line_state_invisible + 2), 4LL * *((int *)line_state_invisible + 6)); } v8 = *((_QWORD *)line_state_invisible + 2); *(_DWORD *)(v8 + 4LL * ++v61) = prev_mbchar; if ( v61 >= *((_DWORD *)line_state_invisible + 7) - 2 ) { *((_DWORD *)line_state_invisible + 7) *= 2; v9 = line_state_invisible; v9[4] = xrealloc(*((_QWORD *)line_state_invisible + 4), 4LL * *((int *)line_state_invisible + 7)); } *(_DWORD *)(*((_QWORD *)line_state_invisible + 4) + 4LL * v61) = v65; v62 = 0; } } } if ( mb_cur_max <= 1 || rl_byte_oriented ) { ++v58; } else { v58 += v87; if ( rl_utf8locale && rl_line_buffer[v58] >= 0 ) { pwc = rl_line_buffer[v58]; v87 = 1LL; memset(&p, 0, sizeof(p)); } else { v87 = mbrtowc(&pwc, &rl_line_buffer[v58], rl_end - v58, &p); } } } invis_nul(&prev_mbchar); line_totbytes = prev_mbchar; if ( cpos_buffer_position < 0 ) { cpos_buffer_position = prev_mbchar; v60 = v61; } if ( rl_quick_redisplay && v61 > 0 ) rl_quick_redisplay = 0; rl_inv_botlin = v61; v76 = v61; v70 = v61; if ( v61 >= *((_DWORD *)line_state_invisible + 6) - 2 ) { *((_DWORD *)line_state_invisible + 6) *= 2; v37 = line_state_invisible; v37[2] = xrealloc(*((_QWORD *)line_state_invisible + 2), 4LL * *((int *)line_state_invisible + 6)); } if ( v61 >= *((_DWORD *)line_state_invisible + 7) - 2 ) { *((_DWORD *)line_state_invisible + 7) *= 2; v38 = line_state_invisible; v38[4] = xrealloc(*((_QWORD *)line_state_invisible + 4), 4LL * *((int *)line_state_invisible + 7)); } *(_DWORD *)(*((_QWORD *)line_state_invisible + 2) + 4 * (v61 + 1LL)) = prev_mbchar; *(_DWORD *)(*((_QWORD *)line_state_invisible + 4) + 4 * (v61 + 1LL)) = v65; v77 = v60; displaying_prompt_first_line = 1; if ( !rl_horizontal_scroll_mode && rl_term_up && *rl_term_up ) { if ( !rl_display_fixed || forced_display ) { forced_display = 0; if ( prev_mbchar >= rl_screenchars ) { if ( mb_cur_max <= 1 || rl_byte_oriented ) prev_mbchar = rl_screenchars - 1; else prev_mbchar = rl_find_prev_mbchar(*(_QWORD *)line_state_invisible, rl_screenchars, 0LL); } if ( (unsigned int)rl_mark_active_p() && v70 > rl_screenheight ) { v78 = v70 - rl_screenheight; for ( n = 0; n <= v78; ++n ) norm_face( (void *)(*((_QWORD *)line_state_invisible + 1) + *(int *)(4LL * n + *((_QWORD *)line_state_invisible + 2))), *(_DWORD *)(4 * (n + 1LL) + *((_QWORD *)line_state_invisible + 2)) - *(_DWORD *)(4LL * n + *((_QWORD *)line_state_invisible + 2))); } for ( n = 0; n <= v70; ++n ) { v81 = rl_last_c_pos; cpos_adjusted = 0; if ( n > rl_vis_botlin ) v39 = 0; else v39 = *(_DWORD *)(4 * (n + 1LL) + *((_QWORD *)line_state_visible + 2)) - *(_DWORD *)(4LL * n + *((_QWORD *)line_state_visible + 2)); if ( n > rl_vis_botlin ) v40 = &unk_7D8E; else v40 = (_BYTE *)(*(int *)(4LL * n + *((_QWORD *)line_state_visible + 2)) + *((_QWORD *)line_state_visible + 1)); if ( n > rl_vis_botlin ) v41 = (char *)&unk_7D8E; else v41 = (char *)(*(_QWORD *)line_state_visible + *(int *)(4LL * n + *((_QWORD *)line_state_visible + 2))); update_line( v41, v40, (char *)(*(int *)(4LL * n + *((_QWORD *)line_state_invisible + 2)) + *(_QWORD *)line_state_invisible), (_BYTE *)(*((_QWORD *)line_state_invisible + 1) + *(int *)(4LL * n + *((_QWORD *)line_state_invisible + 2))), n, v39, *(_DWORD *)(4 * (n + 1LL) + *((_QWORD *)line_state_invisible + 2)) - *(_DWORD *)(4LL * n + *((_QWORD *)line_state_invisible + 2)), v70); if ( n || mb_cur_max <= 1 || rl_byte_oriented || cpos_adjusted || v81 == rl_last_c_pos || rl_last_c_pos <= wrap_offset || v81 >= prompt_last_invisible ) { if ( !cpos_adjusted && n == prompt_last_screen_line && prompt_physical_chars > rl_screenwidth && mb_cur_max > 1 && !rl_byte_oriented && v81 != rl_last_c_pos && prompt_last_invisible - rl_screenwidth - prompt_invis_chars_first_line < rl_last_c_pos ) { rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line; } } else { rl_last_c_pos -= prompt_invis_chars_first_line; } if ( !n && !v70 && rl_last_c_pos == prev_mbchar && wrap_offset > visible_wrap_offset && rl_last_c_pos < visible_first_line_len ) { v66 = mb_cur_max <= 1 || rl_byte_oriented ? wrap_offset + rl_screenwidth - rl_last_c_pos : rl_screenwidth - rl_last_c_pos; if ( v66 ) rl_clear_to_eol(v66); } if ( !n ) { if ( v70 <= 0 ) v42 = prev_mbchar - wrap_offset; else v42 = *(_DWORD *)(*((_QWORD *)line_state_invisible + 2) + 4LL); visible_first_line_len = v42; } } if ( v70 < rl_vis_botlin ) { while ( n <= rl_vis_botlin ) { v88 = (char *)(*(_QWORD *)line_state_visible + *(int *)(4LL * n + *((_QWORD *)line_state_visible + 2))); rl_move_vert(n); rl_move_cursor_relative( 0, v88, *(int *)(4LL * n + *((_QWORD *)line_state_visible + 2)) + *((_QWORD *)line_state_visible + 1)); if ( n == rl_vis_botlin ) v43 = strlen(v88); else v43 = rl_screenwidth; rl_clear_to_eol(v43); ++n; } } rl_vis_botlin = v70; v79 = v77 != rl_last_v_pos; if ( v77 != rl_last_v_pos ) { rl_move_vert(v77); if ( (mb_cur_max == 1 || rl_byte_oriented) && !v77 && wrap_offset ) rl_last_c_pos += wrap_offset; } v66 = prompt_visible_length + wrap_offset; if ( !v77 && wrap_offset > 0 && rl_last_c_pos > 0 ) { v44 = _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented ? prompt_last_invisible + 1 : prompt_physical_chars; if ( v44 > rl_last_c_pos && local_prompt ) { rl_cr(); if ( modmark ) rl_output_some_chars("*", 1LL); rl_output_some_chars(local_prompt, (unsigned int)v66); if ( mb_cur_max <= 1 || rl_byte_oriented ) rl_last_c_pos = modmark + v66; else rl_last_c_pos = rl_col_width(local_prompt, 0, v66, 1u) - wrap_offset + modmark; } } v80 = *(_DWORD *)(4LL * v77 + *((_QWORD *)line_state_invisible + 2)); v66 = cpos_buffer_position - v80; if ( wrap_offset && !v77 && v66 < rl_last_c_pos ) { v67 = mb_cur_max <= 1 || rl_byte_oriented ? v66 : rl_col_width((char *)(*(_QWORD *)line_state_visible + v80), 0, v66, 1u) - visible_wrap_offset; if ( v67 >= 0 && v67 < rl_last_c_pos ) { rl_backspace((unsigned int)(rl_last_c_pos - v67)); rl_last_c_pos = v67; } } if ( mb_cur_max > 1 && !rl_byte_oriented || v66 != rl_last_c_pos ) rl_move_cursor_relative( v66, (char *)(v80 + *(_QWORD *)line_state_invisible), v80 + *((_QWORD *)line_state_invisible + 1)); } } else { rl_last_v_pos = 0; v82 = cpos_buffer_position - wrap_offset; v83 = prompt_visible_length + wrap_offset; if ( last_lmargin ) v45 = last_lmargin; else v45 = wrap_offset; v84 = cpos_buffer_position - v45; v85 = rl_screenwidth / 3; if ( cpos_buffer_position - v45 < rl_screenwidth - 1 ) { if ( v82 >= rl_screenwidth - 2 ) { if ( v84 > 0 ) { v68 = last_lmargin; } else { v68 = (cpos_buffer_position - 1) / v85 * v85; if ( wrap_offset && v68 > 0 && v68 < v83 ) v68 = v83; } } else { v68 = 0; } } else { v68 = cpos_buffer_position - 2 * v85; if ( v68 < 0 ) v68 = 0; if ( wrap_offset && v68 > 0 && v68 < v83 ) v68 = v83; } displaying_prompt_first_line = v68 < v83; if ( v68 > 0 ) *(_BYTE *)(*(_QWORD *)line_state_invisible + v68) = 60; if ( v68 ) v46 = 0; else v46 = wrap_offset; v85 = v46 + v68 + rl_screenwidth; if ( v85 > 0 && v85 < prev_mbchar ) *(_BYTE *)(v85 - 1LL + *(_QWORD *)line_state_invisible) = 62; if ( !rl_display_fixed || forced_display || v68 != last_lmargin ) { forced_display = 0; v81 = rl_last_c_pos; cpos_adjusted = 0; if ( v68 ) v47 = 0; else v47 = wrap_offset; update_line( (char *)(*(_QWORD *)line_state_visible + last_lmargin), (_BYTE *)(last_lmargin + *((_QWORD *)line_state_visible + 1)), (char *)(v68 + *(_QWORD *)line_state_invisible), (_BYTE *)(*((_QWORD *)line_state_invisible + 1) + v68), 0, rl_screenwidth + visible_wrap_offset, v47 + rl_screenwidth, 0); if ( mb_cur_max > 1 && !rl_byte_oriented && displaying_prompt_first_line && !cpos_adjusted && v81 != rl_last_c_pos && rl_last_c_pos > wrap_offset && v81 < prompt_last_invisible ) { rl_last_c_pos -= prompt_invis_chars_first_line; } if ( v68 ) v48 = 0; else v48 = wrap_offset; v85 = rl_last_c_pos - v48; if ( v68 ) v49 = 0; else v49 = wrap_offset; if ( v49 > visible_wrap_offset && rl_last_c_pos == prev_mbchar && displaying_prompt_first_line && v85 < visible_first_line_len ) { v83 = rl_screenwidth - v85; rl_clear_to_eol(rl_screenwidth - v85); } v50 = prev_mbchar - v68; if ( v68 ) v51 = 0; else v51 = wrap_offset; visible_first_line_len = v50 - v51; if ( v50 - v51 > rl_screenwidth ) visible_first_line_len = rl_screenwidth; rl_move_cursor_relative( cpos_buffer_position - v68, (char *)(v68 + *(_QWORD *)line_state_invisible), v68 + *((_QWORD *)line_state_invisible + 1)); last_lmargin = v68; } } fflush(rl_outstream); v89 = line_state_visible; line_state_visible = line_state_invisible; line_state_invisible = v89; rl_display_fixed = 0; if ( rl_horizontal_scroll_mode && last_lmargin ) visible_wrap_offset = 0; else visible_wrap_offset = wrap_offset; rl_quick_redisplay = 0; rl_readline_state &= ~0x1000000uLL; rl_release_sigint(); } return __readfsqword(0x28u) ^ v92; }
int times_builtin (list) WORD_LIST *list; { struct rusage self, kids; ((void) &(list)); if (no_options (list)) return (258); getrusage ( RUSAGE_SELF , &self); getrusage ( RUSAGE_CHILDREN , &kids); print_timeval ( stdout , &self.ru_utime); putchar (' '); print_timeval ( stdout , &self.ru_stime); putchar ('\n'); print_timeval ( stdout , &kids.ru_utime); putchar (' '); print_timeval ( stdout , &kids.ru_stime); putchar ('\n'); return (sh_chkwrite (0)); }
long long times_builtin(unsigned long long a0) { char v0; char v1; char v2; char v3; unsigned long long v6; if (no_options(a0)) { v6 = 258; } else { getrusage(0x0, &v0); getrusage(0xffffffff, &v2); print_timeval(stdout, &v0, &v0); putchar(0x20); print_timeval(stdout, &v1, &v1); putchar(0xa); print_timeval(stdout, &v2, &v2); putchar(0x20); print_timeval(stdout, &v3, &v3); putchar(0xa); v6 = sh_chkwrite(0x0); } return v6; }
static void print_date (time_t date) { struct tm *tp; char buf[80]; tp = gmtime (&date); if ( ((void *)0) == tp) { (void) printf ("time_t: %lu\n", (unsigned long)date); } else { (void) strftime (buf, sizeof buf, iflg ? "%Y-%m-%d" : "%b %d, %Y", tp); (void) puts (buf); } }
void print_date(unsigned long a0) { char v0; void* v1; char v2; char v3; unsigned long long v5; unsigned long long *v6; unsigned long long v7; v1 = gmtime(&v0); if (!v1) { printf("time_t: %lu\n", a0); } else { if (iflg) v5 = "%Y-%m-%d"; else v5 = "%b %d, %Y"; strftime(&v2, 0x50, v5, v1); puts(&v2); } v7 = *(&v3) ^ v6[5]; return; }
static void spawn_shell(const char *confold, const char *confnew) { pid_t pid; fputs(gettext("Useful environment variables:\n"), stderr ); fputs(" - DPKG_SHELL_REASON\n", stderr ); fputs(" - DPKG_CONFFILE_OLD\n", stderr ); fputs(" - DPKG_CONFFILE_NEW\n", stderr ); fputs(gettext("Type 'exit' when you're done.\n"), stderr ); pid = subproc_fork(); if (!pid) { setenv("DPKG_SHELL_REASON", "conffile-prompt", 1); setenv("DPKG_CONFFILE_OLD", confold, 1); setenv("DPKG_CONFFILE_NEW", confnew, 1); command_shell( ((void *)0) , gettext("conffile shell")); } subproc_reap(pid, gettext("conffile shell"), SUBPROC_NOCHECK); }
void spawn_shell(char *param_1,char *param_2) { FILE *pFVar1; int iVar2; char *pcVar3; undefined8 uVar4; pFVar1 = stderr; pcVar3 = (char *)gettext("Useful environment variables:\n"); fputs(pcVar3,pFVar1); fputs(" - DPKG_SHELL_REASON\n",stderr); fputs(" - DPKG_CONFFILE_OLD\n",stderr); fputs(" - DPKG_CONFFILE_NEW\n",stderr); pFVar1 = stderr; pcVar3 = (char *)gettext("Type \'exit\' when you\'re done.\n"); fputs(pcVar3,pFVar1); iVar2 = subproc_fork(); if (iVar2 == 0) { setenv("DPKG_SHELL_REASON","conffile-prompt",1); setenv("DPKG_CONFFILE_OLD",param_1,1); setenv("DPKG_CONFFILE_NEW",param_2,1); uVar4 = gettext("conffile shell"); command_shell(0,uVar4); } uVar4 = gettext("conffile shell"); subproc_reap(iVar2,uVar4,4); return; }
static SHELL_VAR * assign_bash_argv0 (var, value, unused, key) SHELL_VAR *var; char *value; arrayind_t unused; char *key; { size_t vlen; if (value == 0) return var; do { if (dollar_vars[0]) sh_xfree((dollar_vars[0]), "variables.c", 1566); } while (0); dollar_vars[0] = (char *)strcpy (sh_xmalloc((1 + strlen (value)), "variables.c", 1567), (value)); vlen = (((value) && (value)[0]) ? ((value)[1] ? ((value)[2] ? strlen(value) : 2) : 1) : 0); static_shell_name = sh_xrealloc((static_shell_name), (vlen + 1), "variables.c", 1571); strcpy (static_shell_name, value); shell_name = static_shell_name; return var; }
void assign_bash_argv0(unsigned long long a0, char a1[3], unsigned long a2, unsigned long a3) { unsigned long v0; unsigned long v1; unsigned long long v2; unsigned long long v4; unsigned long long v5; unsigned long long v6; v1 = a2; v0 = a3; if (!a1) { v4 = a0; } else { sh_xfree(0x94d7e8000000, "variables.c", 0x61e); nameref_invalid_value = strcpy(sh_xmalloc(strlen(a1) + 1, "variables.c", 0x61f), a1); if (a1 && a1[0]) { if (!a1[1]) { v5 = 1; goto LABEL_402391; } else if (!a1[2]) { v5 = 2; goto LABEL_402391; } else { v5 = strlen(a1); goto LABEL_402391; } } v5 = 0; LABEL_402391: v2 = v5; static_shell_name = sh_xrealloc(static_shell_name, v2 + 1, "variables.c", 0x623); strcpy(static_shell_name, a1); shell_name = static_shell_name; v6 = a0; } return; }
static void free_out_dir(struct out_dir *outdir) { free(outdir->buf); free(outdir->hashes); outdir->max = 0; outdir->num =0; }
void free_out_dir(undefined4 *param_1) { free(*(void **)(param_1 + 2)); free(*(void **)(param_1 + 4)); param_1[1] = 0; *param_1 = 0; return; }
static int xfrm_selector_iszero(struct xfrm_selector *s) { struct xfrm_selector s0 = {}; return (memcmp(&s0, s, sizeof(s0)) == 0); }
bool xfrm_selector_iszero(void *param_1) { int iVar1; long in_FS_OFFSET; undefined8 local_48; undefined8 local_40; undefined8 local_38; undefined8 local_30; undefined8 local_28; undefined8 local_20; undefined8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_48 = 0; local_40 = 0; local_38 = 0; local_30 = 0; local_28 = 0; local_20 = 0; local_18 = 0; iVar1 = memcmp(&local_48,param_1,0x38); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return iVar1 == 0; }
static void nlmon_print_help(struct link_util *lu, int argc, char **argv, FILE *f) { fprintf(f, "Usage: ... nlmon\n"); }
void nlmon_print_help(void) { FILE *in_RCX; fprintf(in_RCX,"Usage: ... nlmon\n"); return; }
int main(int argc, char *argv[]) { int exitstatus; if ((ProgramName = strrchr(argv[0], '/')) == ((void *)0) ) { ProgramName = argv[0]; } else { ++ProgramName; } Pid = getpid(); MailCmd[0] = '\0'; cron_default_mail_charset[0] = '\0'; setlocale( 6 , ""); parse_args(argc, argv); check_spool_dir(); if (!allowed(RealUser, "/usr/local/etc/cron.allow", "/usr/local/etc/cron.deny")) { fprintf( stderr , "You (%s) are not allowed to use this program (%s)\n", User, ProgramName); fprintf( stderr , "See crontab(1) for more information\n"); log_it(RealUser, Pid, "AUTH", "crontab command not allowed", 0); exit(1); } exitstatus = 0; switch (Option) { case opt_unknown: exitstatus = 1; break; case opt_list: list_cmd(); break; case opt_delete: delete_cmd(); break; case opt_edit: edit_cmd(); break; case opt_replace: if (replace_cmd() < 0) exitstatus = 1; break; case opt_hostset: if (hostset_cmd() < 0) exitstatus = 1; break; case opt_hostget: if (hostget_cmd() < 0) exitstatus = 1; break; case opt_test: if (test_cmd() < 0) exitstatus = 1; break; default: abort(); } exit(exitstatus); }
int main(unsigned long long a0) { unsigned int v0; unsigned long long *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; RandomScale = strrchr(*(v2), 0x2f); RandomScale = -541125437600005303; if (false) RandomScale = *(v2); Pid = getpid(); cron_default_mail_charset = 0; cron_default_mail_charset = 0; setlocale(0x6, &g_406013); parse_args(a0, v2); check_spool_dir(a0, v2, v3, v4, v5, v6); if (!allowed(&RealUser, "/usr/local/etc/cron.allow", "/usr/local/etc/cron.deny")) { fprintf(stderr, "You (%s) are not allowed to use this program (%s)\n", &User, 283935560); fprintf(stderr, "See crontab(1) for more information\n"); log_it(&RealUser, Pid, "AUTH", "crontab command not allowed", 0x0); exit(0x1); } v0 = 0; switch (Option) { case 0: v0 = 1; break; case 1: list_cmd(); break; case 2: delete_cmd(); break; case 3: edit_cmd(); break; case 4: if (replace_cmd() < 0) v0 = 1; break; case 5: if (hostset_cmd() < 0) v0 = 1; break; case 6: if (hostget_cmd() < 0) v0 = 1; break; case 7: if (test_cmd() < 0) v0 = 1; break; default: abort(); } exit(v0); }
static int delete_all(int agent_fd, int qflag) { int ret = -1; if (ssh_remove_all_identities(agent_fd, 2) == 0) ret = 0; ssh_remove_all_identities(agent_fd, 1); if (ret != 0) fprintf( stderr , "Failed to remove all identities.\n"); else if (!qflag) fprintf( stderr , "All identities removed.\n"); return ret; }
int delete_all(undefined4 param_1,int param_2) { int iVar1; int local_c; local_c = -1; iVar1 = ssh_remove_all_identities(param_1,2); if (iVar1 == 0) { local_c = 0; } ssh_remove_all_identities(param_1,1); if (local_c == 0) { if (param_2 == 0) { fprintf(stderr,"All identities removed.\n"); } } else { fprintf(stderr,"Failed to remove all identities.\n"); } return local_c; }
static int make_pipe(int fd) { int fds[2]; if (pipe(fds)) { initlog((1|2), "pipe: %m"); return -1; } dup2(fds[0], fd); close(fds[0]); fcntl(fds[1], 2 , 1); fcntl(fd, 2 , 0); safe_write(fds[1], Signature, 8); return fds[1]; }
int make_pipe(unsigned long a0, unsigned long a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned int a5) { char v0; char v1; unsigned int v3; if (pipe(&v0)) { initlog(0x3, "pipe: %m", a2, a3, a4, a5); v3 = -1; return v3; } dup2(*(&v0), a0); close(*(&v0)); fcntl(*(&v1), 0x2); fcntl(a0, 0x2); safe_write(*(&v1), Signature, 0x8); v3 = *(&v1); return v3; }
int same_file (path1, path2, stp1, stp2) const char *path1, *path2; struct stat *stp1, *stp2; { struct stat st1, st2; if (stp1 == ((void *)0) ) { if (stat (path1, &st1) != 0) return (0); stp1 = &st1; } if (stp2 == ((void *)0) ) { if (stat (path2, &st2) != 0) return (0); stp2 = &st2; } return ((stp1->st_dev == stp2->st_dev) && (stp1->st_ino == stp2->st_ino)); }
long long same_file(char *a0, char *a1, unsigned long a2, unsigned long a3) { unsigned long long v0[2]; unsigned long long v1[2]; char v2; char v3; unsigned long long v5; v1[0] = a2; v0[0] = a3; if (!v1) { if (stat(a0, &v2)) { v5 = 0; goto LABEL_400e18; } else { v1[0] = &v2; } } if (!v0) { if (stat(a1, &v3)) { v5 = 0; goto LABEL_400e18; } else { v0[0] = &v3; } } if (v1[0] == v0[0] && v1[1] == v0[1]) { v5 = 1; goto LABEL_400e18; } v5 = 0; LABEL_400e18: return v5; }
static char * dumpdir_locate (struct dumpdir *dump, const char *name) { char **ptr; if (!dump) return ((void *)0) ; ptr = bsearch (&name, dump->elv, dump->elc, sizeof (dump->elv[0]), compare_dirnames); return ptr ? *ptr - 1: ((void *)0) ; }
int dumpdir_locate(unsigned long long a0[4], unsigned long a1) { unsigned long v0; unsigned long long *v1; unsigned int v3; v0 = a1; if (!a0) { v3 = 0; return v3; } v1 = bsearch(&v0, a0[3], a0[2], 0x8, compare_dirnames); v3 = (!v1 ? (*(v1) - 1) : 0); return v3; }
int sshkey_is_shielded(struct sshkey *k) { return k != ((void *)0) && k->shielded_private != ((void *)0) ; }
_BOOL8 sshkey_is_shielded(long a1) { return a1 && *(_QWORD *)(a1 + 136); }
static inline char * timetostr (time_t t, char *buf) { return ((! ((time_t) 0 < (time_t) -1)) ? imaxtostr (t, buf) : umaxtostr (t, buf)); }
int timetostr(unsigned long long a0, unsigned long long a1) { return imaxtostr(a0, a1, a1); }
static void history_def_delete(history_t *h, HistEvent *ev __attribute__((__unused__)), hentry_t *hp) { HistEventPrivate *evp = (void *)&hp->ev; if (hp == &h->list) abort(); if (h->cursor == hp) { h->cursor = hp->prev; if (h->cursor == &h->list) h->cursor = hp->next; } hp->prev->next = hp->next; hp->next->prev = hp->prev; free(evp->str); free(hp); h->cur--; }
void history_def_delete(struct_0 *a0, unsigned long a1, struct_1 *a2) { unsigned long v0; struct_0 *v2; v0 = a1; if (a2 == a0) abort(); if (a2 == a0->field_28) { a0->field_28 = a2->field_20; if (a0->field_28 == a0) a0->field_28 = a2->field_18; } a2->field_20->field_18 = a2->field_18; a2->field_18->field_20 = a2->field_20; free(a2->field_8); free(a2); v2 = a0; a0->field_34 = a0->field_34 - 1; return; }
static int extract_symlink (char *file_name, int typeflag) { _Bool interdir_made = 0 ; if (! absolute_names_option && ( ((( current_stat_info.link_name )[0]) == '/') || contains_dot_dot (current_stat_info.link_name))) return create_placeholder_file (file_name, 1 , &interdir_made, ((void *)0) ); while (symlinkat (current_stat_info.link_name, chdir_fd, file_name) != 0) switch (maybe_recoverable (file_name, 0 , &interdir_made)) { case 1: continue; case 2: return 0; case 0: symlink_error (current_stat_info.link_name, file_name); return -1; } set_stat (file_name, &current_stat_info, -1, 0, 0, '2', 0 , 0x100 ); return 0; }
undefined8 extract_symlink(char *param_1) { char cVar1; int iVar2; undefined8 uVar3; long in_FS_OFFSET; undefined local_11; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_11 = 0; if ((absolute_names_option == '\x01') || ((*_free != '/' && (cVar1 = contains_dot_dot(_free), cVar1 == '\0')))) { do { iVar2 = symlinkat(_free,chdir_fd,param_1); if (iVar2 == 0) { set_stat(param_1,&current_stat_info,0xffffffff,0,0,0x32,0,0x100); uVar3 = 0; goto LAB_00103338; } iVar2 = maybe_recoverable(param_1,0,&local_11); if (iVar2 == 2) { uVar3 = 0; goto LAB_00103338; } } while ((2 < iVar2) || (iVar2 != 0)); symlink_error(_free,param_1); uVar3 = 0xffffffff; } else { uVar3 = create_placeholder_file(param_1,1,&local_11,0); } LAB_00103338: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar3; } __stack_chk_fail(); }
static void fail_exit (int code) { 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 ); } } closelog (); exit (code); }
void fail_exit(int a1) { long v1; long v2; char *v3; const char *v4; long v5; long v6; char *v7; const char *v8; char *locale; char *v10; const char *s; const char *v12; if ( spw_locked && !(unsigned int)spw_unlock() ) { v1 = spw_dbname(); v2 = Prog; v3 = gettext("%s: failed to unlock %s\n"); fprintf(stderr, v3, v2, v1); s = setlocale(6, 0LL); locale = 0LL; if ( s ) locale = strdup(s); if ( locale ) setlocale(6, "C"); v4 = (const char *)spw_dbname(); syslog(3, "failed to unlock %s", v4); if ( locale ) { setlocale(6, locale); free(locale); } } if ( pw_locked && !(unsigned int)pw_unlock() ) { v5 = pw_dbname(); v6 = Prog; v7 = gettext("%s: failed to unlock %s\n"); fprintf(stderr, v7, v6, v5); v12 = setlocale(6, 0LL); v10 = 0LL; if ( v12 ) v10 = strdup(v12); if ( v10 ) setlocale(6, "C"); v8 = (const char *)pw_dbname(); syslog(3, "failed to unlock %s", v8); if ( v10 ) { setlocale(6, v10); free(v10); } } closelog(); exit(a1); }
static int session_break_req(struct ssh *ssh, Session *s) { int r; if ((r = sshpkt_get_u32(ssh, ((void *)0) )) != 0 || (r = sshpkt_get_end(ssh)) != 0) sshpkt_fatal(ssh, r, "%s: parse packet", __func__); if (s->ptymaster == -1 || tcsendbreak(s->ptymaster, 0) == -1) return 0; return 1; }
int session_break_req(unsigned long long a0, struct_0 *a1, unsigned long long a2) { unsigned int v0; unsigned int v2; v0 = sshpkt_get_u32(a0, 0x0, a2); if (v0 || (v0 = sshpkt_get_end(a0), v0)) sshpkt_fatal(a0, v0, "%s: parse packet", "session_break_req"); if (a1->field_38 == -1) { v2 = 0; return v2; } else if (tcsendbreak(a1->field_38, 0x0) == -1) { v2 = 0; return v2; } else { v2 = 1; return v2; } }
static int Rq_recip3(Fq *out,const small *in) { Fq f[761 +1],g[761 +1],v[761 +1],r[761 +1]; int i,loop,delta; int swap,t; crypto_int32 f0,g0; Fq scale; for (i = 0;i < 761 +1;++i) v[i] = 0; for (i = 0;i < 761 +1;++i) r[i] = 0; r[0] = Fq_recip(3); for (i = 0;i < 761;++i) f[i] = 0; f[0] = 1; f[761 -1] = f[761] = -1; for (i = 0;i < 761;++i) g[761 -1-i] = in[i]; g[761] = 0; delta = 1; for (loop = 0;loop < 2*761 -1;++loop) { for (i = 761;i > 0;--i) v[i] = v[i-1]; v[0] = 0; swap = int16_negative_mask(-delta) & int16_nonzero_mask(g[0]); delta ^= swap&(delta^-delta); delta += 1; for (i = 0;i < 761 +1;++i) { t = swap&(f[i]^g[i]); f[i] ^= t; g[i] ^= t; t = swap&(v[i]^r[i]); v[i] ^= t; r[i] ^= t; } f0 = f[0]; g0 = g[0]; for (i = 0;i < 761 +1;++i) g[i] = Fq_freeze(f0*g[i]-g0*f[i]); for (i = 0;i < 761 +1;++i) r[i] = Fq_freeze(f0*r[i]-g0*v[i]); for (i = 0;i < 761;++i) g[i] = g[i+1]; g[761] = 0; } scale = Fq_recip(f[0]); for (i = 0;i < 761;++i) out[i] = Fq_freeze(scale*(crypto_int32)v[761 -1-i]); return int16_nonzero_mask(delta); }
long Rq_recip3(long a1, long a2) { int v2; short v4; int i; int j; int k; int m; int ii; int jj; int kk; int mm; int nn; int i1; int n; int v16; int v17; int v18; int v19; short v20; short v21; short v22[768]; short v23[260]; short v24; short v25[768]; short v26[764]; unsigned long v27; v27 = __readfsqword(0x28u); for ( i = 0; i <= 761; ++i ) v25[i] = 0; for ( j = 0; j <= 761; ++j ) v26[j] = 0; v26[0] = Fq_recip(3); for ( k = 0; k <= 760; ++k ) v22[k] = 0; v22[0] = 1; v22[761] = -1; v22[760] = -1; for ( m = 0; m <= 760; ++m ) v23[760 - m] = *(char *)(m + a2); v24 = 0; v16 = 1; for ( n = 0; n <= 1520; ++n ) { for ( ii = 761; ii > 0; --ii ) v25[ii] = v25[ii - 1]; v25[0] = 0; v2 = int16_negative_mask(-(short)v16); v17 = v2 & int16_nonzero_mask(v23[0]); v16 = (v17 & (v16 ^ -v16) ^ v16) + 1; for ( jj = 0; jj <= 761; ++jj ) { v20 = v17 & (v22[jj] ^ v23[jj]); v22[jj] ^= v20; v23[jj] ^= v20; v21 = v17 & (v25[jj] ^ v26[jj]); v25[jj] ^= v21; v26[jj] ^= v21; } v18 = v22[0]; v19 = v23[0]; for ( kk = 0; kk <= 761; ++kk ) v23[kk] = Fq_freeze(v23[kk] * v18 - v22[kk] * v19); for ( mm = 0; mm <= 761; ++mm ) v26[mm] = Fq_freeze(v26[mm] * v18 - v25[mm] * v19); for ( nn = 0; nn <= 760; ++nn ) v23[nn] = v23[nn + 1]; v24 = 0; } v4 = Fq_recip(v22[0]); for ( i1 = 0; i1 <= 760; ++i1 ) *(_WORD *)(2LL * i1 + a1) = Fq_freeze(v4 * v25[760 - i1]); return int16_nonzero_mask(v16); }
static void nh_reset(nh_ctx *hc) { hc->bytes_hashed = 0; hc->next_data_empty = 0; hc->state[0] = 0; hc->state[1] = 0; hc->state[2] = 0; hc->state[3] = 0; }
long nh_reset(long a1) { long result; *(_DWORD *)(a1 + 1140) = 0; *(_DWORD *)(a1 + 1136) = 0; *(_QWORD *)(a1 + 1144) = 0LL; *(_QWORD *)(a1 + 1152) = 0LL; *(_QWORD *)(a1 + 1160) = 0LL; result = a1; *(_QWORD *)(a1 + 1168) = 0LL; return result; }
int kex_ecdh_dec(struct kex *kex, const struct sshbuf *server_blob, struct sshbuf **shared_secretp) { int r; r = kex_ecdh_dec_key_group(kex, server_blob, kex->ec_client_key, kex->ec_group, shared_secretp); EC_KEY_free(kex->ec_client_key); kex->ec_client_key = ((void *)0) ; return r; }
long long kex_ecdh_dec(unsigned long long a0[40], unsigned long long a1, unsigned long long *a2, unsigned long a3, unsigned long a4, unsigned long long a5) { unsigned int v0; v0 = kex_ecdh_dec_key_group(a0, a1, a0[38], a0[39], a2, a5); EC_KEY_free(a0[38]); a0[38] = 0; return v0; }
int vasnmprintf(char **str, size_t maxsz, int *wp, const char *fmt, va_list ap) { char *src; char *sp; char *dst; char *dp; char *tp; size_t sz; wchar_t wc; int len; int ret; int width; int total_width, max_width, print; src = ((void *)0) ; if ((ret = vasprintf(&src, fmt, ap)) <= 0) goto fail; sz = strlen(src) + 1; if ((dst = malloc(sz)) == ((void *)0) ) { free(src); ret = -1; goto fail; } if (maxsz > 0x7fffffff) maxsz = 0x7fffffff; sp = src; dp = dst; ret = 0; print = 1; total_width = 0; max_width = wp == ((void *)0) ? 0x7fffffff : *wp; while (*sp != '\0') { if ((len = mbtowc(&wc, sp, (__ctype_get_mb_cur_max ()) )) == -1) { (void)mbtowc( ((void *)0) , ((void *)0) , (__ctype_get_mb_cur_max ()) ); if (dangerous_locale()) { ret = -1; break; } len = 1; width = -1; } else if (wp == ((void *)0) && (wc == L'\n' || wc == L'\r' || wc == L'\t')) { width = 0; } else if ((width = wcwidth(wc)) == -1 && dangerous_locale()) { ret = -1; break; } if (width >= 0) { if (print && (dp - dst >= (int)maxsz - len || total_width > max_width - width)) print = 0; if (print) { if (grow_dst(&dst, &sz, maxsz, &dp, len) == -1) { ret = -1; break; } total_width += width; memcpy(dp, sp, len); dp += len; } sp += len; if (ret >= 0) ret += len; continue; } while (len > 0) { if (print && (dp - dst >= (int)maxsz - 4 || total_width > max_width - 4)) print = 0; if (print) { if (grow_dst(&dst, &sz, maxsz, &dp, 4) == -1) { ret = -1; break; } tp = vis(dp, *sp, 0x01 | 0x400, 0); width = tp - dp; total_width += width; dp = tp; } else width = 4; len--; sp++; if (ret >= 0) ret += width; } if (len > 0) break; } free(src); *dp = '\0'; *str = dst; if (wp != ((void *)0) ) *wp = total_width; if (ret < (int)maxsz && !print) ret = -1; return ret; fail: if (wp != ((void *)0) ) *wp = 0; if (ret == 0) { *str = src; return 0; } else { *str = ((void *)0) ; return -1; } }
int vasnmprintf(unsigned long long *a0, unsigned long long a1, unsigned int *a2, char *a3, unsigned long a4) { unsigned long long v0; char v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; void* v8; void* v9; char *v10; unsigned int v11; void* v12; unsigned long long v13; unsigned long long v15; unsigned long long v16; unsigned long long v17; v0 = a1; v8 = 0; v3 = vasprintf(&v8, a3, a4); if (v3 > 0) { *(&v11) = strlen(v8) + 1; v9 = malloc(*(&v11)); if (!v9) { free(v8); v3 = -1; } else { if (v0 >= 0x80000000) v0 = 2147483647; v12 = v8; v10 = v9; v3 = 0; v6 = 1; v5 = 0; if (a2) v15 = *(a2); else v15 = 2147483647; for (v7 = v15; *(v12); v3 = __addvsi3(v3, v2)) { v2 = mbtowc(&v1, v12, __ctype_get_mb_cur_max()); if (v2 == -1) { mbtowc(NULL, NULL, __ctype_get_mb_cur_max()); v15 = dangerous_locale(); if (v15) { v3 = -1; break; } else { v2 = 1; v4 = -1; } } else { if (!a2 && (*(&v1) == 13 || *(&v1) == 10 || *(&v1) == 9)) v4 = 0; if (a2 || *(&v1) != 13 && *(&v1) != 10 && *(&v1) != 9) { v4 = wcwidth(*(&v1)); if (v4 == -1) { v15 = dangerous_locale(); if (v15) { v3 = -1; break; } } } } if (!v15 && v2 == -1 || !v15 && v2 != -1 || v2 != -1 && v4 != -1 || *(&v1) == 13 && !a2 && v2 != -1 || *(&v1) == 10 && !a2 && v2 != -1 || !a2 && *(&v1) == 9 && v2 != -1) { if (v4 >= 0) { if (v6) { v17 = __subvdi3(v10, v9, v9); v15 = __subvsi3(v0, v2); if (v17 < v15) v15 = __subvsi3(v7, v4); if (v5 > v15 || v17 >= v15) v6 = 0; } if (v6) { v15 = grow_dst(&v9, &v11, v0, &v10, v2); if (v15 == -1) { v3 = -1; break; } else { v5 = __addvsi3(v5, v4); memcpy(v10, v12, v2); v10 = &v10[v2]; } } if (!v6 || v15 != -1) { v12 += v2; if (v3 < 0) continue; } } else { for (; v2 > 0; v3 = __addvsi3(v3, v4)) { if (v6) { v16 = __subvdi3(v10, v9, v9); v15 = __addvsi3(v0, 0xfffffffc); if (v16 < v15) v15 = __addvsi3(v7, 0xfffffffc); if (v16 >= v15 || v5 > v15) v6 = 0; } if (v6) { v15 = grow_dst(&v9, &v11, v0, &v10, 0x4); if (v15 == -1) { v3 = -1; break; } else { v13 = vis(v10, *(v12), 0x401, 0x0); v4 = __subvdi3(v13, v10, 0x401); v5 = __addvsi3(v5, v4); v10 = v13; } } else { v4 = 4; } if (!v6 || v15 != -1) { v2 = __addvsi3(v2, 0xffffffff); v12 += 1; if (v3 < 0) continue; } } if (v2 > 0) break; } } } free(v8); *(v10) = 0; *(a0) = v9; if (a2) *(a2) = v5; if (v3 < v0 && !v6) v3 = -1; v15 = v3; } } if (!v9 || v3 <= 0) { if (a2) *(a2) = 0; if (!v3) { *(a0) = v8; v15 = 0; } else { *(a0) = 0; v15 = -1; } } return v15; }
static int bash_complete_hostname_internal (what_to_do) int what_to_do; { return bash_specific_completion (what_to_do, hostname_completion_function); }
long bash_complete_hostname_internal(unsigned int a1) { return bash_specific_completion(a1, (long)hostname_completion_function); }
void reinit_special_variables () { sv_comp_wordbreaks ("COMP_WORDBREAKS"); sv_globignore ("GLOBIGNORE"); sv_opterr ("OPTERR"); }
long long reinit_special_variables() { sv_comp_wordbreaks("COMP_WORDBREAKS"); sv_globignore("GLOBIGNORE"); return sv_opterr("OPTERR"); }
char * get_local_name(int fd) { char *host, myname[ 1025 ]; if ((host = get_socket_address(fd, 0, 8 )) != ((void *)0) ) return host; if (gethostname(myname, sizeof(myname)) == -1) { sshlog("canohost.c", __func__, 144, 1, SYSLOG_LEVEL_VERBOSE, ((void *)0) , "gethostname: %s", strerror( (*__errno_location ()) )); host = xstrdup("UNKNOWN"); } else { host = xstrdup(myname); } return host; }
long get_local_name(int a1) { int *v2; char *v3; long socket_address; char name[1032]; unsigned long v7; v7 = __readfsqword(0x28u); socket_address = get_socket_address(a1, 0, 8); if ( socket_address ) return socket_address; if ( gethostname(name, 0x401uLL) != -1 ) return xstrdup(name); v2 = _errno_location(); v3 = strerror(*v2); sshlog("canohost.c", "get_local_name", 144LL, 1LL, 4LL, 0LL, "gethostname: %s", v3); return xstrdup("UNKNOWN"); }
static _Bool devlist_compare (void const *x, void const *y) { struct devlist const *a = x; struct devlist const *b = y; return a->dev_num == b->dev_num; }
bool devlist_compare(_QWORD *a1, _QWORD *a2) { return *a1 == *a2; }
static void size_decoder (struct tar_stat_info *st, char const *keyword, char const *arg, size_t size __attribute__((unused))) { uintmax_t u; if (decode_num (&u, arg, ((off_t) (! (! ((off_t) 0 < (off_t) -1)) ? (off_t) -1 : ((((off_t) 1 << ((sizeof (off_t) * 8) - 2)) - 1) * 2 + 1))), keyword)) st->stat.st_size = u; }
unsigned long size_decoder(long a1, long a2, long a3) { long v4; unsigned long v5; v5 = __readfsqword(0x28u); if ( (unsigned char)decode_num(&v4, a3, 0x7FFFFFFFFFFFFFFFLL, a2) ) *(_QWORD *)(a1 + 136) = v4; return __readfsqword(0x28u) ^ v5; }
!ext2fs_has_feature_extents(fs->super) && fix_problem(ctx, 0x000048, &pctx)) { ext2fs_set_feature_extents(fs->super); ext2fs_mark_super_dirty(fs); }
int ext2fs_has_feature_extents(struct_0 *a0) { return (a0->field_60 & 64); }
static void history_def_delete(history_t *h, HistEvent *ev __attribute__((__unused__)), hentry_t *hp) { HistEventPrivate *evp = (void *)&hp->ev; if (hp == &h->list) abort(); if (h->cursor == hp) { h->cursor = hp->prev; if (h->cursor == &h->list) h->cursor = hp->next; } hp->prev->next = hp->next; hp->next->prev = hp->prev; free(evp->str); free(hp); h->cur--; }
void history_def_delete(struct_3 *a0, unsigned long a1, struct_0 *a2) { unsigned long v0; struct_3 *v2; v0 = a1; if (a2 == a0) abort(); if (a2 == a0->field_28) { a0->field_28 = a2->field_20; if (a0->field_28 == a0) a0->field_28 = a2->field_18; } a2->field_20->field_18 = a2->field_18; a2->field_18->field_20 = a2->field_20; free(a2->field_8); free(a2); v2 = a0; a0->field_34 = a0->field_34 - 1; return; }
static int file_has_acl_cache (char const *file, struct fileinfo *f) { static dev_t unsupported_device; if (f->stat.st_dev == unsupported_device) { (*__errno_location ()) = 95 ; return 0; } (*__errno_location ()) = 0; int n = file_has_acl (file, &f->stat); if (n <= 0 && errno_unsupported ( (*__errno_location ()) )) unsupported_device = f->stat.st_dev; return n; }
int file_has_acl_cache(unsigned long long a0, struct_0 *a1) { unsigned int v0; unsigned int v2; if (a1->field_18 == unsupported_device.9567) { *(__errno_location()) = 95; v2 = 0; } else { *(__errno_location()) = 0; v0 = file_has_acl(a0, &a1->field_18, &a1->field_18); if (v0 <= 0 && errno_unsupported(*(__errno_location()))) unsupported_device.9567 = a1->field_18; v2 = v0; } return v2; }
int rl_stop_output (int count, int key) { int fildes = fileno (rl_instream); tcflow (fildes, 0 ); return 0; }
undefined8 rl_stop_output(void) { int __fd; __fd = fileno(rl_instream); tcflow(__fd,0); return 0; }
static struct hash_entry * safe_hasher (const Hash_table *table, const void *key) { size_t n = table->hasher (key, table->n_buckets); if (! (n < table->n_buckets)) abort (); return table->bucket + n; }
int safe_hasher(unsigned long long a0[7], unsigned long long a1) { unsigned long v0; v0 = a0[6](a1, a0[2], a0[2], a0[6]); if (v0 >= a0[2]) abort(); return a0[0] + v0 * 16; }
static void builtin_error_prolog () { char *name; name = get_name_for_error (); fprintf ( stderr , "%s: ", name); if (interactive_shell == 0) fprintf ( stderr , gettext("line %d: "), executing_line_number ()); if (this_command_name && *this_command_name) fprintf ( stderr , "%s: ", this_command_name); }
void builtin_error_prolog() { unsigned long v0; unsigned long long v2; char *v3; unsigned long long v4; unsigned long long v5; v0 = get_name_for_error(); fprintf(stderr, "%s: ", v0); if (!interactive_shell) { v2 = executing_line_number(); fprintf(stderr, gettext("line %d: ")); } v3 = this_command_name; if (this_command_name) { v4 = *(this_command_name); if (*(this_command_name)) v5 = fprintf(stderr, "%s: ", this_command_name); } return; }
static _Bool copy_file (char const *from, char const *to, int to_dirfd, char const *to_relname, const struct cp_options *x) { _Bool copy_into_self; if (copy_only_if_needed && !need_copy (from, to, to_dirfd, to_relname, x)) return 1 ; return copy (from, to, to_dirfd, to_relname, 0, x, &copy_into_self, ((void *)0) ); }
int copy_file(char *a0, unsigned long long a1, unsigned long a2, unsigned long long a3, void* a4) { void* v0; char v1; unsigned int v3; if (copy_only_if_needed) { v3 = need_copy(a0, a1, a2, a3, a4); *(&v3) = v3 ^ 1; if (v3) { v3 = 1; goto LABEL_400e45; } } v0 = 0; v3 = copy(a0, a1, a2, a3, 0x0, a4, &v1); LABEL_400e45: return v3; }
static _Bool stream_is_tty (FILE *fp) { int fd = fileno (fp); if (-1 == fd) { return 0 ; } else { return isatty (fd) ? 1 : 0 ; } }
int stream_is_tty(void* a0) { unsigned int v0; unsigned int v2; v0 = fileno(a0); if (v0 == -1) { v2 = 0; } else { v2 = isatty(v0); *(&v2) = v2; } return v2; }
static int bash_check_expchar (dirname, need_closer, nextp, closerp) char *dirname; int need_closer; int *nextp, *closerp; { char *t; int ret, n, c; ret = n = c = 0; if (t = mbschr (dirname, '$')) { ret = '$'; n = t[1]; if (n == '(') c = ')'; else if (n == '{') c = '}'; else n = 0; if (c && need_closer) { int p; char delims[2]; delims[0] = c; delims[1] = 0; p = skip_to_delim (t, 1, delims, 0x001|0x100); if (t[p] != c) ret = 0; } } else if (dirname[0] == '~') ret = '~'; else { t = mbschr (dirname, '`'); if (t) { if (need_closer == 0) ret = '`'; else if (unclosed_pair (dirname, strlen (dirname), "`") == 0) ret = '`'; } } if (nextp) *nextp = n; if (closerp) *closerp = c; return ret; }
int bash_check_expchar(char *a0, unsigned long a1, unsigned int *a2, unsigned int *a3) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long v4; char v5; char v6; v2 = 0; v1 = v2; v0 = v1; *(&v4) = mbschr(a0, 0x24, a2); if (v4) { v0 = 36; v1 = v4[1]; if (v1 == 40) { v2 = 41; } else { if (v1 == 123) v2 = 125; else v1 = 0; } if (v2 && a1) { v5 = v2; v6 = 0; v3 = skip_to_delim(v4, 0x1, &v5, 0x101); if (v2 != v4[v3]) v0 = 0; } } else if (*(a0) == 126) { v0 = 126; } else { v4 = mbschr(a0, 0x60, a2); if (v4) { if (!a1) { v0 = 96; } else if (!unclosed_pair(a0, strlen(a0), "`", strlen(a0))) { v0 = 96; } } } if (a2) *(a2) = v1; if (a3) *(a3) = v2; return v0; }
int rl_delete_text (int from, int to) { register char *text; register int diff, i; if (from > to) do { int t; t = from; from = to; to = t; } while (0); if (to > rl_end) { to = rl_end; if (from > to) from = to; } if (from < 0) from = 0; text = rl_copy_text (from, to); diff = to - from; for (i = from; i < rl_end - diff; i++) rl_line_buffer[i] = rl_line_buffer[i + diff]; if (_rl_doing_an_undo == 0) rl_add_undo (UNDO_DELETE, from, to, text); else xfree (text); rl_end -= diff; rl_line_buffer[rl_end] = '\0'; _rl_fix_mark (); return (diff); }
void rl_delete_text(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v5; char *v6; unsigned long long v7; v1 = a0; v0 = a1; if (v1 > v0) { v2 = v1; v1 = v0; v0 = v2; } if (v0 > rl_end) { v0 = rl_end; if (v1 > v0) v1 = v0; } if (v1 < 0) v1 = 0; v5 = rl_copy_text(v1, v0, v0); for (v6 = v1; v6 < rl_end - (v0 - v1); v6 = v6 + 1) { v6[rl_line_buffer] = v6[rl_line_buffer + v0 + -1 * v1]; } if (!_rl_doing_an_undo) rl_add_undo(0x0, v1, v0, v5); else xfree(v5); rl_end = rl_end - (v0 - v1); *((rl_end + rl_line_buffer)) = 0; _rl_fix_mark(); v7 = v0 - v1; return; }
int sshkey_putb(const struct sshkey *key, struct sshbuf *b) { return to_blob_buf(key, b, 0, SSHKEY_SERIALIZE_DEFAULT); }
int sshkey_putb(unsigned long long a0, unsigned long long a1) { return to_blob_buf(a0, a1, 0x0, 0x0); }
histdata_t free_history_entry(HIST_ENTRY *he) { return he ? ((void *)0) : ((void *)0) ; }
long long free_history_entry(unsigned long a0) { unsigned long v0; v0 = a0; return 0; }
static inline void inet_prefix_reset(inet_prefix *p) { p->flags = 0; }
_WORD * inet_prefix_reset(_WORD *a1) { _WORD *result; result = a1; *a1 = 0; return result; }
static void update_mail_file (i) int i; { char *file; struct stat finfo; file = mailfiles[i]->name; if (mailstat (file, &finfo) == 0) do { mailfiles[i]->access_time = finfo. st_atim.tv_sec ; mailfiles[i]->mod_time = finfo. st_mtim.tv_sec ; mailfiles[i]->file_size = finfo.st_size; mailfiles[i]->flags |= 0x01; } while (0); else do { mailfiles[i]->access_time = mailfiles[i]->mod_time = 0; mailfiles[i]->file_size = 0; mailfiles[i]->flags = 0; } while (0); }
void update_mail_file(int param_1) { long lVar1; int iVar2; long in_FS_OFFSET; undefined local_a8 [48]; undefined8 local_78; undefined8 local_60; undefined8 local_50; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar2 = mailstat(**(undefined8 **)(mailfiles + (long)param_1 * 8),local_a8); if (iVar2 == 0) { *(undefined8 *)(*(long *)(mailfiles + (long)param_1 * 8) + 0x10) = local_60; *(undefined8 *)(*(long *)(mailfiles + (long)param_1 * 8) + 0x18) = local_50; *(undefined8 *)(*(long *)(mailfiles + (long)param_1 * 8) + 0x20) = local_78; *(uint *)(*(long *)(mailfiles + (long)param_1 * 8) + 0x28) = *(uint *)(*(long *)(mailfiles + (long)param_1 * 8) + 0x28) | 1; } else { lVar1 = *(long *)(mailfiles + (long)param_1 * 8); *(undefined8 *)(lVar1 + 0x18) = 0; *(undefined8 *)(*(long *)(mailfiles + (long)param_1 * 8) + 0x10) = *(undefined8 *)(lVar1 + 0x18) ; *(undefined8 *)(*(long *)(mailfiles + (long)param_1 * 8) + 0x20) = 0; *(undefined4 *)(*(long *)(mailfiles + (long)param_1 * 8) + 0x28) = 0; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
static void initcmd_setenv(char *data, int size) { char *env, *p, *e; size_t sz; int i, eq; e = data + size; while (*data && data < e) { for (p = data; *p && p < e; p++) ; if (*p) break; env = data; data = ++p; if (strncmp(env, "INIT_", 5) != 0) continue; sz = strcspn(env, "="); eq = (env[sz] == '='); for (i = 0; i < 16; i++) { if (extra_env[i] == ((void *)0) ) continue; if (sz != strcspn(extra_env[i], "=")) continue; if (strncmp(extra_env[i], env, sz) == 0) { free(extra_env[i]); extra_env[i] = ((void *)0) ; } } if (eq == 0) continue; for (i = 0; i < 16; i++) { if (extra_env[i] == ((void *)0) ) { extra_env[i] = istrdup(env); break; } } } }
void initcmd_setenv(char *param_1,int param_2) { char cVar1; int iVar2; size_t __n; size_t sVar3; undefined8 uVar4; char *local_40; int local_30; char *local_28; local_28 = param_1; do { do { do { local_40 = local_28; if ((*local_40 == '\0') || (param_1 + param_2 <= local_40)) { return; } for (local_28 = local_40; (*local_28 != '\0' && (local_28 < param_1 + param_2)); local_28 = local_28 + 1) { } if (*local_28 != '\0') { return; } local_28 = local_28 + 1; iVar2 = strncmp(local_40,"INIT_",5); } while (iVar2 != 0); __n = strcspn(local_40,"="); cVar1 = local_40[__n]; for (local_30 = 0; local_30 < 0x10; local_30 = local_30 + 1) { if (((*(long *)(extra_env + (long)local_30 * 8) != 0) && (sVar3 = strcspn(*(char **)(extra_env + (long)local_30 * 8),"="), __n == sVar3)) && (iVar2 = strncmp(*(char **)(extra_env + (long)local_30 * 8),local_40,__n), iVar2 == 0)) { free(*(void **)(extra_env + (long)local_30 * 8)); *(undefined8 *)(extra_env + (long)local_30 * 8) = 0; } } } while (cVar1 != '='); for (local_30 = 0; local_30 < 0x10; local_30 = local_30 + 1) { if (*(long *)(extra_env + (long)local_30 * 8) == 0) { uVar4 = istrdup(local_40); *(undefined8 *)(extra_env + (long)local_30 * 8) = uVar4; break; } } } while( true ); }
void builtin_usage () { if (this_command_name && *this_command_name) fprintf ( stderr , gettext("%s: usage: "), this_command_name); fprintf ( stderr , "%s\n", gettext(current_builtin->short_doc)); fflush ( stderr ); }
void builtin_usage() { unsigned long long v1; if (this_command_name && *(this_command_name)) fprintf(stderr, gettext("%s: usage: ")); fprintf(stderr, "%s\n", gettext(*((current_builtin + 32)))); v1 = fflush(stderr); return; }
static void macsec_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) { if (!tb) return; if (tb[IFLA_MACSEC_SCI]) { if (is_json_context()) { char b1[64]; snprintf(b1, sizeof(b1), "%016llx", ((1==ntohl(1)) ? (rta_getattr_u64(tb[IFLA_MACSEC_SCI])) : ((uint64_t)ntohl((rta_getattr_u64(tb[IFLA_MACSEC_SCI])) & 0xFFFFFFFF) << 32) | ntohl((rta_getattr_u64(tb[IFLA_MACSEC_SCI])) >> 32))); print_string(PRINT_JSON, "sci", ((void *)0) , b1); } else { fprintf(f, "sci %016llx ", ((1==ntohl(1)) ? (rta_getattr_u64(tb[IFLA_MACSEC_SCI])) : ((uint64_t)ntohl((rta_getattr_u64(tb[IFLA_MACSEC_SCI])) & 0xFFFFFFFF) << 32) | ntohl((rta_getattr_u64(tb[IFLA_MACSEC_SCI])) >> 32))); } } print_flag(tb, "protect", IFLA_MACSEC_PROTECT); if (tb[IFLA_MACSEC_CIPHER_SUITE]) { __u64 csid = rta_getattr_u64(tb[IFLA_MACSEC_CIPHER_SUITE]); print_string(PRINT_ANY, "cipher_suite", "cipher %s ", cs_id_to_name(csid)); } if (tb[IFLA_MACSEC_ICV_LEN]) { if (is_json_context()) { char b2[4]; snprintf(b2, sizeof(b2), "%hhu", rta_getattr_u8(tb[IFLA_MACSEC_ICV_LEN])); print_uint(PRINT_JSON, "icv_len", ((void *)0) , atoi(b2)); } else { fprintf(f, "icvlen %hhu ", rta_getattr_u8(tb[IFLA_MACSEC_ICV_LEN])); } } if (tb[IFLA_MACSEC_ENCODING_SA]) { if (is_json_context()) { char b2[4]; snprintf(b2, sizeof(b2), "%hhu", rta_getattr_u8(tb[IFLA_MACSEC_ENCODING_SA])); print_uint(PRINT_JSON, "encoding_sa", ((void *)0) , atoi(b2)); } else { fprintf(f, "encodingsa %hhu ", rta_getattr_u8(tb[IFLA_MACSEC_ENCODING_SA])); } } if (tb[IFLA_MACSEC_VALIDATION]) { __u8 val = rta_getattr_u8(tb[IFLA_MACSEC_VALIDATION]); print_string(PRINT_ANY, "validation", "validate %s ", validate_to_str(val)); } if (tb[IFLA_MACSEC_OFFLOAD]) { __u8 val = rta_getattr_u8(tb[IFLA_MACSEC_OFFLOAD]); print_string(PRINT_ANY, "offload", "offload %s ", offload_to_str(val)); } const char *inc_sci, *es, *replay; if (is_json_context()) { inc_sci = "inc_sci"; replay = "replay_protect"; es = "es"; } else { inc_sci = "send_sci"; es = "end_station"; replay = "replay"; } print_flag(tb, "encrypt", IFLA_MACSEC_ENCRYPT); print_flag(tb, inc_sci, IFLA_MACSEC_INC_SCI); print_flag(tb, es, IFLA_MACSEC_ES); print_flag(tb, "scb", IFLA_MACSEC_SCB); print_flag(tb, replay, IFLA_MACSEC_REPLAY_PROTECT); if (tb[IFLA_MACSEC_WINDOW]) print_int(PRINT_ANY, "window", "window %d ", rta_getattr_u32(tb[IFLA_MACSEC_WINDOW])); }
long long macsec_print_opt(unsigned long long a0, void* a1, unsigned long long a2[16], unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned long v0; char v1; char v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned int v6; char v7; unsigned long long v10; unsigned long long v11; unsigned long long v15; unsigned long long v17; v0 = a0; if (a2) { if (a2[1]) { if (is_json_context(a0, a1, a2, a3, a4, a5)) { v11 = ntohl(0x1); if (v11 == 1) v11 = rta_getattr_u64(a2[1]); else *(&v11) = ntohl(rta_getattr_u64(a2[1]) >> 32) | ntohl(rta_getattr_u64(a2[1])) * 0x100000000; snprintf(&v7, 0x40, "%016llx", v11); print_string(0x2, "sci", 0x0, &v7); } else { v10 = ntohl(0x1); if (v10 == 1) v10 = rta_getattr_u64(a2[1]); else *(&v10) = ntohl(rta_getattr_u64(a2[1]) >> 32) | ntohl(rta_getattr_u64(a2[1])) * 0x100000000; fprintf(a1, "sci %016llx ", v10); } } print_flag(a2, "protect", 0x8, a1, a4, a5); if (a2[4]) { *(&v6) = rta_getattr_u64(a2[4]); print_string(0x4, "cipher_suite", "cipher %s ", cs_id_to_name(*(&v6))); } if (a2[3]) { if (is_json_context(a0, a1, a2, a1, a4, a5)) { snprintf(&v7, 0x4, "%hhu", rta_getattr_u8(a2[3])); print_uint(0x2, "icv_len", 0x0, atoi(&v7)); } else { v15 = rta_getattr_u8(a2[3]); a2 = v15; fprintf(a1, "icvlen %hhu ", v15); } } if (a2[6]) { if (is_json_context(a0, a1, a2, a1, a4, a5)) { snprintf(&v7, 0x4, "%hhu", rta_getattr_u8(a2[6])); print_uint(0x2, "encoding_sa", 0x0, atoi(&v7)); } else { v17 = rta_getattr_u8(a2[6]); *(&a2[0]) = v15; fprintf(a1, "encodingsa %hhu ", v15); } } if (a2[13]) { v1 = rta_getattr_u8(a2[13]); print_string(0x4, "validation", "validate %s ", validate_to_str(v1)); } if (a2[15]) { v2 = rta_getattr_u8(a2[15]); print_string(0x4, "offload", "offload %s ", offload_to_str(v2)); } if (is_json_context(a0, a1, a2, a1, a4, a5)) { v3 = "inc_sci"; v5 = "replay_protect"; v4 = "es"; } else { v3 = "send_sci"; v4 = "end_station"; v5 = "replay"; } print_flag(a2, "encrypt", 0x7, a1, a4, a5); print_flag(a2, v3, 0x9, v3, a4, a5); print_flag(a2, v4, 0xa, v4, a4, a5); print_flag(a2, "scb", 0xb, a1, a4, a5); print_flag(a2, v5, 0xc, v5, a4, a5); if (a2[5]) print_int(0x4, "window", "window %d ", rta_getattr_u32(a2[5])); } return 0; }
static int do_add(int cmd, int argc, char **argv) { struct ip_tunnel_parm p; const char *basedev; if (parse_args(argc, argv, cmd, &p) < 0) return -1; if (p.iph.ttl && p.iph.frag_off == 0) { fprintf( stderr , "ttl != 0 and nopmtudisc are incompatible\n"); return -1; } basedev = tnl_defname(&p); if (!basedev) { fprintf( stderr , "cannot determine tunnel mode (ipip, gre, vti or sit)\n"); return -1; } return tnl_add_ioctl(cmd, basedev, p.name, &p); }
long do_add(int a1, int a2, const char **a3) { const char *v4; int v5[9]; short v6; char v7; unsigned long v8; v8 = __readfsqword(0x28u); if ( (int)parse_args(a2, a3, a1, (uint32_t *)v5) < 0 ) return 0xFFFFFFFFLL; if ( !v7 || v6 ) { v4 = tnl_defname((long)v5); if ( v4 ) { return tnl_add_ioctl((unsigned int)a1, v4, v5, v5); } else { fprintf(stderr, "cannot determine tunnel mode (ipip, gre, vti or sit)\n"); return 0xFFFFFFFFLL; } } else { fprintf(stderr, "ttl != 0 and nopmtudisc are incompatible\n"); return 0xFFFFFFFFLL; } }
char * string_list (list) WORD_LIST *list; { return (string_list_internal (list, " ")); }
void string_list(undefined8 param_1) { string_list_internal(param_1,&DAT_0011fa66); return; }
static void server_listen(void) { u_int i; srclimit_init(options.max_startups, options.per_source_max_startups, options.per_source_masklen_ipv4, options.per_source_masklen_ipv6); for (i = 0; i < options.num_listen_addrs; i++) { listen_on_addrs(&options.listen_addrs[i]); freeaddrinfo(options.listen_addrs[i].addrs); free(options.listen_addrs[i].rdomain); memset(&options.listen_addrs[i], 0, sizeof(options.listen_addrs[i])); } free(options.listen_addrs); options.listen_addrs = ((void *)0) ; options.num_listen_addrs = 0; if (!num_listen_socks) sshfatal("sshd.c", __func__, 1121, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "Cannot bind any address."); }
void server_listen() { unsigned long long v0; unsigned int v1; unsigned long long v3; unsigned long long v4; srclimit_init(0x4808ec8348000fe3, 0x5936058d4808ec83, 0x415000005936058d, 0xb941500000); for (v1 = 0; v1 < 3347663062; v1 += 1) { listen_on_addrs(9892403239566442635 + v1 * 16); freeaddrinfo(*((9892403239566442635 + v1 * 16 + 8))); free(*((9892403239566442635 + v1 * 16))); memset(9892403239566442635 + v1 * 16, 0x0, 0x10); } free(0x8948e0558d48008b); g_400438 = 0; g_400440 = 0; v3 = num_listen_socks; if (!num_listen_socks) { v0 = "Cannot bind any address."; v4 = sshfatal("sshd.c"); return; } return; }
static long getwidth (FILE *fp) { char const *columns; struct winsize ws; if (ioctl (fileno (fp), 0x5413 , &ws) == 0 && 0 < ws.ws_col) return ws.ws_col; columns = getenv ("COLUMNS"); if (columns) { long int col = strtol (columns, ((void *)0) , 10); if (0 < col) return col; } return 80; }
int getwidth(void* a0) { char *v0; unsigned long v1; char v2; unsigned int v4; if (!ioctl(fileno(a0), 0x5413) && *(&v2)) { v4 = *(&v2); return v4; } v0 = getenv("COLUMNS"); if (!v0) { v4 = 80; return v4; } v1 = strtol(v0, NULL, 0xa); if (v1 > 0) { v4 = v1; return v4; } v4 = 80; return v4; }
em_exchange_mark(EditLine *el, wint_t c __attribute__((__unused__))) { wchar_t *cp; cp = el->el_line.cursor; el->el_line.cursor = el->el_chared.c_kill.mark; el->el_chared.c_kill.mark = cp; return 5; }
long em_exchange_mark(long a1) { long v2; v2 = *(_QWORD *)(a1 + 88); *(_QWORD *)(a1 + 88) = *(_QWORD *)(a1 + 912); *(_QWORD *)(a1 + 912) = v2; return 5LL; }
test_code_t test_no_extensions(gnutls_session_t session) { int ret; sprintf(prio_str, "NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%s", protocol_str, rest); { int _ret; if ((_ret=__gnutls_priority_set_direct(session, prio_str, 1082)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); gnutls_record_set_max_size(session, 4096); ret = test_do_handshake(session); if (ret == TEST_SUCCEED) { tls_ext_ok = 1; } else { sprintf(prio_str, "NONE:" "+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+CAMELLIA-256-CBC" ":" "+COMP-NULL" ":+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:-VERS-SSL3.0:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%%NO_EXTENSIONS:%s", rest); { int _ret; if ((_ret=__gnutls_priority_set_direct(session, prio_str, 1093)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); if (ret == TEST_SUCCEED) { tls_ext_ok = 0; strcat(rest, ":%NO_EXTENSIONS"); } else ret = TEST_IGNORE2; } return ret; }
long long test_no_extensions(unsigned long long a0) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v4; sprintf(&prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s", &protocol_str, &rest); v1 = __gnutls_priority_set_direct(a0, &prio_str, 0x43a); if (v1) { v4 = v1; } else { gnutls_credentials_set(a0, 0x1, xcred); gnutls_record_set_max_size(a0, 0x1000); v0 = test_do_handshake(a0); if (!v0) { tls_ext_ok = 1; } else { sprintf(&prio_str, "NONE:+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+CAMELLIA-256-CBC:+COMP-NULL:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:-VERS-SSL3.0:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%%NO_EXTENSIONS:%s", &rest); v2 = __gnutls_priority_set_direct(a0, &prio_str, 0x445); if (v2) { v4 = v2; goto LABEL_4020d9; } else { gnutls_credentials_set(a0, 0x1, xcred); v0 = test_do_handshake(a0); if (v0) { v0 = 4; } else { tls_ext_ok = 0; strcat("%UNSAFE_RENEGOTIATION:+SIGN-ALL:+GROUP-ALL:+SIGN-GOSTR341012-512:+SIGN-GOSTR341012-256:+SIGN-GOSTR341001:+GROUP-GOST-ALL", ":%NO_EXTENSIONS"); } } } v4 = v0; } LABEL_4020d9: return v4; }
static void builtin_error_prolog () { char *name; name = get_name_for_error (); fprintf ( stderr , "%s: ", name); if (interactive_shell == 0) fprintf ( stderr , gettext("line %d: "), executing_line_number ()); if (this_command_name && *this_command_name) fprintf ( stderr , "%s: ", this_command_name); }
void builtin_error_prolog() { unsigned long v0; unsigned long long v2; char *v3; unsigned long long v4; unsigned long long v5; v0 = get_name_for_error(); fprintf(stderr, "%s: ", v0); if (!interactive_shell) { v2 = executing_line_number(); fprintf(stderr, gettext("line %d: ")); } v3 = this_command_name; if (this_command_name) { v4 = *(this_command_name); if (*(this_command_name)) v5 = fprintf(stderr, "%s: ", this_command_name); } return; }
static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod) { const struct cfg *cfg = depmod->cfg; const char *modname, *lastslash; size_t modnamesz; struct mod *mod; int err; modname = kmod_module_get_name(kmod); modnamesz = strlen(modname) + 1; mod = calloc(1, sizeof(struct mod) + modnamesz); if (mod == ((void *)0) ) return - 12 ; mod->kmod = kmod; mod->sort_idx = depmod->modules.count + 1; mod->dep_sort_idx = (2147483647) ; memcpy(mod->modname, modname, modnamesz); mod->modnamesz = modnamesz; array_init(&mod->deps, 4); mod->path = strdup(kmod_module_get_path(kmod)); lastslash = strrchr(mod->path, '/'); mod->baselen = lastslash - mod->path; if (strncmp(mod->path, cfg->dirname, cfg->dirnamelen) == 0 && mod->path[cfg->dirnamelen] == '/') mod->relpath = mod->path + cfg->dirnamelen + 1; else mod->relpath = ((void *)0) ; err = hash_add_unique(depmod->modules_by_name, mod->modname, mod); if (err < 0) { log_printf( 3 , "hash_add_unique %s: %s\n", mod->modname, strerror(-err)); goto fail; } if (mod->relpath != ((void *)0) ) { size_t uncrelpathlen = lastslash - mod->relpath + modnamesz + strlen(".ko"); mod->uncrelpath = memdup(mod->relpath, uncrelpathlen + 1); mod->uncrelpath[uncrelpathlen] = '\0'; err = hash_add_unique(depmod->modules_by_uncrelpath, mod->uncrelpath, mod); if (err < 0) { log_printf( 3 , "hash_add_unique %s: %s\n", mod->uncrelpath, strerror(-err)) ; hash_del(depmod->modules_by_name, mod->modname); goto fail; } } log_printf( 7 , "add %p kmod=%p, path=%s\n", mod, kmod, mod->path); return 0; fail: free(mod->uncrelpath); free(mod); return err; }
long depmod_module_add(long *a1, const void *a2) { size_t v2; const char *path; char *v5; char *v6; int v7; long v8; char *s; size_t n; char *ptr; char *v12; size_t v13; v8 = *a1; s = (char *)kmod_module_get_name(a2); v2 = strlen(s); n = v2 + 1; ptr = (char *)calloc(1uLL, v2 + 121); if ( !ptr ) return 4294967284LL; *(_QWORD *)ptr = a2; *((_DWORD *)ptr + 24) = a1[3] + 1; *((_DWORD *)ptr + 25) = 0x7FFFFFFF; memcpy(ptr + 120, s, n); *((_QWORD *)ptr + 11) = n; array_init(ptr + 48, 4LL); path = (const char *)kmod_module_get_path(a2); *((_QWORD *)ptr + 1) = strdup(path); v12 = strrchr(*((const char **)ptr + 1), 47); *((_QWORD *)ptr + 10) = &v12[-*((_QWORD *)ptr + 1)]; if ( !strncmp(*((const char **)ptr + 1), (const char *)(v8 + 8), *(_QWORD *)(v8 + 4104)) && *(_BYTE *)(*((_QWORD *)ptr + 1) + *(_QWORD *)(v8 + 4104)) == 47 ) { *((_QWORD *)ptr + 2) = *(_QWORD *)(v8 + 4104) + 1LL + *((_QWORD *)ptr + 1); } else { *((_QWORD *)ptr + 2) = 0LL; } v7 = hash_add_unique(a1[7], ptr + 120, ptr); if ( v7 >= 0 ) { if ( !*((_QWORD *)ptr + 2) || (v13 = (size_t)&v12[n - *((_QWORD *)ptr + 2) + strlen(".ko")], *((_QWORD *)ptr + 3) = memdup(*((_QWORD *)ptr + 2), v13 + 1), *(_BYTE *)(*((_QWORD *)ptr + 3) + v13) = 0, v7 = hash_add_unique(a1[6], *((_QWORD *)ptr + 3), ptr), v7 >= 0) ) { log_printf(7LL, "add %p kmod=%p, path=%s\n", ptr, a2, *((const char **)ptr + 1)); return 0LL; } v6 = strerror(-v7); log_printf(3LL, "hash_add_unique %s: %s\n", *((const char **)ptr + 3), v6); hash_del(a1[7], ptr + 120); } else { v5 = strerror(-v7); log_printf(3LL, "hash_add_unique %s: %s\n", ptr + 120, v5); } free(*((void **)ptr + 3)); free(ptr); return (unsigned int)v7; }
void attrib_to_stat(const Attrib *a, struct stat *st) { memset(st, 0, sizeof(*st)); if (a->flags & 0x00000001) st->st_size = a->size; if (a->flags & 0x00000002) { st->st_uid = a->uid; st->st_gid = a->gid; } if (a->flags & 0x00000004) st->st_mode = a->perm; if (a->flags & 0x00000008) { st-> st_atim.tv_sec = a->atime; st-> st_mtim.tv_sec = a->mtime; } }
long long attrib_to_stat(struct_0 *a0, struct_1 *a1) { struct_1 *v1; memset(a1, 0x0, 0x90); if ((a0->field_0 & 1)) a1->field_30 = a0->field_8; if ((a0->field_0 & 2)) { a1->field_1c = a0->field_10; a1->field_20 = a0->field_14; } if ((a0->field_0 & 4)) a1->field_18 = a0->field_18; v1 = a0->field_0 & 8; if ((a0->field_0 & 8)) { a1->field_48 = a0->field_1c; v1 = a1; a1->field_58 = a0->field_20; } return v1; }