input
stringlengths
28
169k
output
stringlengths
20
317k
static inline void initialize_exit_failure (int status) { if (status != 1 ) exit_failure = status; }
void initialize_exit_failure(int param_1) { if (param_1 != 1) { _exit_failure = param_1; } return; }
gnutls_x509_privkey_t *load_privkey_list(int mand, size_t * privkey_size, common_info_st * info) { static gnutls_x509_privkey_t key[256]; char *ptr; int ret, i; gnutls_datum_t dat, file_data; int ptr_size; unsigned int flags = 0; const char *pass; *privkey_size = 0; fprintf( stderr , "Loading private key list...\n"); if (info->privkey == ((void *)0) ) { if (mand) { fprintf( stderr , "missing --load-privkey"); exit(1); } else return ((void *)0) ; } ret = gnutls_load_file(info->privkey, &file_data); if (ret < 0) { fprintf( stderr , "%s", info->privkey); exit(1); } ptr = (void *) file_data.data; ptr_size = file_data.size; for (i = 0; i < 256; i++) { ret = gnutls_x509_privkey_init(&key[i]); if (ret < 0) { fprintf( stderr , "privkey_init: %s", gnutls_strerror(ret)); exit(1); } dat.data = (void *) ptr; dat.size = ptr_size; ret = gnutls_x509_privkey_import2(key[i], &dat, info->incert_format, ((void *)0) , 0); if (ret == -24) { pass = get_password(info, &flags, 0); ret = gnutls_x509_privkey_import2(key[i], &dat, info-> incert_format, pass, flags); } if (ret < 0 && *privkey_size > 0) break; if (ret < 0) { fprintf( stderr , "privkey_import: %s", gnutls_strerror(ret)); exit(1); } (*privkey_size)++; if (info->incert_format != GNUTLS_X509_FMT_PEM) break; ptr = strstr(ptr, "---END"); if (ptr == ((void *)0) ) break; ptr++; ptr_size = file_data.size; ptr_size -= ((unsigned char *) ptr - (unsigned char *) file_data.data); if (ptr_size < 0) break; } gnutls_free((void *) (file_data.data)), file_data.data= ((void *)0) ; fprintf( stderr , "Loaded %d private keys.\n", (int) *privkey_size); return key; }
undefined1 * load_privkey_list(int param_1,ulong *param_2,long param_3) { undefined1 *puVar1; undefined8 uVar2; long in_FS_OFFSET; undefined4 local_58; int local_54; int local_50; int local_4c; char *local_48; undefined8 local_40; char *local_38; int local_30; char *local_28; int local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_58 = 0; *param_2 = 0; fprintf(stderr,"Loading private key list...\n"); if (*(long *)(param_3 + 8) == 0) { if (param_1 != 0) { fprintf(stderr,"missing --load-privkey"); exit(1); } puVar1 = (undefined1 *)0x0; } else { local_54 = gnutls_load_file(*(undefined8 *)(param_3 + 8),&local_28); if (local_54 < 0) { fprintf(stderr,"%s",*(undefined8 *)(param_3 + 8)); exit(1); } local_48 = local_28; local_4c = local_20; for (local_50 = 0; local_50 < 0x100; local_50 = local_50 + 1) { local_54 = gnutls_x509_privkey_init(key_10161 + (long)local_50 * 8); if (local_54 < 0) { uVar2 = gnutls_strerror(local_54); fprintf(stderr,"privkey_init: %s",uVar2); exit(1); } local_38 = local_48; local_30 = local_4c; local_54 = gnutls_x509_privkey_import2 (*(undefined8 *)(key_10161 + (long)local_50 * 8),&local_38, *(undefined4 *)(param_3 + 0x1c),0,0); if (local_54 == -0x18) { local_40 = get_password(param_3,&local_58,0); local_54 = gnutls_x509_privkey_import2 (*(undefined8 *)(key_10161 + (long)local_50 * 8),&local_38, *(undefined4 *)(param_3 + 0x1c),local_40,local_58); } if ((local_54 < 0) && (*param_2 != 0)) break; if (local_54 < 0) { uVar2 = gnutls_strerror(local_54); fprintf(stderr,"privkey_import: %s",uVar2); exit(1); } *param_2 = *param_2 + 1; if ((*(int *)(param_3 + 0x1c) != 1) || (local_48 = strstr(local_48,"---END"), local_48 == (char *)0x0)) break; local_48 = local_48 + 1; local_4c = local_20 - ((int)local_48 - (int)local_28); if (local_4c < 0) break; } (*gnutls_free)(local_28); local_28 = (char *)0x0; fprintf(stderr,"Loaded %d private keys.\n",*param_2 & 0xffffffff); puVar1 = key_10161; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return puVar1; } __stack_chk_fail(); }
static int channel_cancel_lport_listener_streamlocal(struct ssh *ssh, const char *path) { u_int i; int found = 0; if (path == ((void *)0) ) { sshlog("channels.c", __func__, 3913, 1, SYSLOG_LEVEL_ERROR, ((void *)0) , "no path specified."); return 0; } for (i = 0; i < ssh->chanctxt->channels_alloc; i++) { Channel *c = ssh->chanctxt->channels[i]; if (c == ((void *)0) || c->type != 18) continue; if (c->listening_addr == ((void *)0) ) continue; if (strcmp(c->listening_addr, path) == 0) { sshlog("channels.c", __func__, 3924, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0) , "close channel %d", i); channel_free(ssh, c); found = 1; } } return found; }
void channel_cancel_lport_listener_streamlocal(struct_0 *a0, char *a1) { unsigned long v0; unsigned int v1; unsigned int v2; struct_2 *v3; void* v5; unsigned long long v6; v2 = 0; if (!a1) { sshlog("channels.c", "channel_cancel_lport_listener_streamlocal", 0xf49, 0x1, 0x2, 0x0, "no path specified."); v5 = 0; } else { v1 = 0; while (true) { if (v1 >= a0->field_868->field_8) break; v3 = *((a0->field_868->field_0 + v1 * 8)); if (v3 && v3->field_0 == 18 && v3->field_90 && !strcmp(v3->field_90, a1)) { v0 = v1; sshlog("channels.c", "channel_cancel_lport_listener_streamlocal", 0xf54, 0x1, 0x6, 0x0, "close channel %d"); channel_free(a0, v3); v2 = 1; } v1 += 1; } v6 = v2; } return; }
COMMAND * command_connect (com1, com2, connector) COMMAND *com1, *com2; int connector; { CONNECTION *temp; temp = (CONNECTION *)sh_xmalloc((sizeof (CONNECTION)), "make_cmd.c", 192); temp->connector = connector; temp->first = com1; temp->second = com2; return (make_command (cm_connection, (SIMPLE_COM *)temp)); }
long command_connect(long a1, long a2, int a3) { long v5; v5 = sh_xmalloc(32LL, "make_cmd.c", 192LL); *(_DWORD *)(v5 + 24) = a3; *(_QWORD *)(v5 + 8) = a1; *(_QWORD *)(v5 + 16) = a2; return make_command(6, v5); }
void set_force_option(const struct cmdinfo *cip, const char *value) { _Bool set = cip->arg_int; parse_force(value, set); }
long long set_force_option(struct_0 *a0, char *a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { char v0; v0 = a0->field_28; return parse_force(a1, v0, v0, a3, a4, a5); }
int _rl_next_macro_key (void) { int c; if (rl_executing_macro == 0) return (0); if (rl_executing_macro[executing_macro_index] == 0) { _rl_pop_executing_macro (); return (_rl_next_macro_key ()); } c = rl_executing_macro[executing_macro_index++]; if ((rl_readline_state & (0x0080000)) && (rl_readline_state & (0x0000008|0x0000040)) && rl_executing_macro[executing_macro_index] == 0) _rl_pop_executing_macro (); return c; }
void _rl_next_macro_key() { int tmp_17; unsigned int v0; void* v2; unsigned long long v4; unsigned long long v5; if (!rl_executing_macro) { v2 = 0; return; } else if (*((executing_macro_index + rl_executing_macro))) { tmp_17 = executing_macro_index; executing_macro_index = executing_macro_index + 1; v0 = *((tmp_17 + rl_executing_macro)); if ((rl_readline_state & 0x80000) && (rl_readline_state & 72) && !*((executing_macro_index + rl_executing_macro))) _rl_pop_executing_macro(); v5 = v0; return; } else { _rl_pop_executing_macro(); v4 = _rl_next_macro_key(); return; } }
struct umac128_ctx *umac128_new(const u_char key[]) { struct umac128_ctx *ctx, *octx; size_t bytes_to_add; aes_int_key prf_key; octx = ctx = xcalloc(1, sizeof(*ctx) + 16); if (ctx) { if (16) { bytes_to_add = 16 - ((ptrdiff_t)ctx & (16 - 1)); ctx = (struct umac128_ctx *)((u_char *)ctx + bytes_to_add); } ctx->free_ptr = octx; AES_set_encrypt_key((const u_char *)(key),16*8,prf_key); pdf_init(&ctx->pdf, prf_key); uhash_init(&ctx->hash, prf_key); explicit_bzero(prf_key, sizeof(prf_key)); } return (ctx); }
long umac128_new(long a1) { long v2; long v3; char v4[248]; unsigned long v5; v5 = __readfsqword(0x28u); v2 = xcalloc(1LL, 1696LL); v3 = v2; if ( v2 ) { v2 += 16 - (v2 & 0xF); *(_QWORD *)(v2 + 1672) = v3; AES_set_encrypt_key(a1, 128LL, v4); pdf_init(v2 + 1392, (long)v4); uhash_init(v2, (long)v4); explicit_bzero(v4, 244LL); } return v2; }
static void channel_post_x11_listener(struct ssh *ssh, Channel *c) { Channel *nc; struct sockaddr_storage addr; int r, newsock, oerrno, remote_port; socklen_t addrlen; char buf[16384], *remote_ipaddr; if ((c->io_ready & 0x10) == 0) return; sshlog("channels.c", __func__, 1672, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "X11 connection requested."); addrlen = sizeof(addr); newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen); if (c->single_connection) { oerrno = (*__errno_location ()) ; sshlog("channels.c", __func__, 1677, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0) , "single_connection: closing X11 listener."); channel_close_fd(ssh, c, &c->sock); chan_mark_dead(ssh, c); (*__errno_location ()) = oerrno; } if (newsock == -1) { if ( (*__errno_location ()) != 4 && (*__errno_location ()) != 11 && (*__errno_location ()) != 103 ) sshlog("channels.c", __func__, 1685, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "accept: %.100s", strerror( (*__errno_location ()) )); if ( (*__errno_location ()) == 24 || (*__errno_location ()) == 23 ) c->notbefore = monotime() + 1; return; } set_nodelay(newsock); remote_ipaddr = get_peer_ipaddr(newsock); remote_port = get_peer_port(newsock); snprintf(buf, sizeof buf, "X11 connection from %.200s port %d", remote_ipaddr, remote_port); nc = channel_new(ssh, "accepted x11 socket", 3, newsock, newsock, -1, c->local_window_max, c->local_maxpacket, 0, buf, 1); open_preamble(ssh, __func__, nc, "x11"); if ((r = sshpkt_put_cstring(ssh, remote_ipaddr)) != 0 || (r = sshpkt_put_u32(ssh, remote_port)) != 0) { sshfatal("channels.c", __func__, 1702, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i: reply", c->self); } if ((r = sshpkt_send(ssh)) != 0) sshfatal("channels.c", __func__, 1705, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i: send", c->self); free(remote_ipaddr); }
void channel_post_x11_listener(undefined8 param_1,long param_2) { int iVar1; uint uVar2; uint uVar3; int *piVar4; char *pcVar5; undefined8 uVar6; undefined *puVar7; undefined *puVar8; undefined *puVar9; long in_FS_OFFSET; socklen_t local_40cc; int local_40c8; int local_40c4; int local_40c0; uint local_40bc; void *local_40b8; undefined8 local_40b0; sockaddr local_40a8 [8]; char local_4028 [24]; undefined local_4010 [16368]; long local_20; puVar8 = &stack0xfffffffffffffff0; do { puVar7 = puVar8; *(undefined8 *)(puVar7 + -0x1000) = *(undefined8 *)(puVar7 + -0x1000); puVar8 = puVar7 + -0x1000; } while (puVar7 + -0x1000 != local_4010); puVar8 = puVar7 + -0x10d8; local_20 = *(long *)(in_FS_OFFSET + 0x28); if ((*(uint *)(param_2 + 0x30) & 0x10) == 0) goto LAB_00105053; *(char **)(puVar7 + -0x10e8) = "X11 connection requested."; *(undefined8 *)(puVar7 + -0x10f0) = 0x104cac; sshlog("channels.c","channel_post_x11_listener",0x688,0,5,0); puVar9 = puVar7 + -0x10d8; local_40cc = 0x80; iVar1 = *(int *)(param_2 + 0x28); *(undefined8 *)(puVar7 + -0x10e0) = 0x104cdf; local_40c4 = accept(iVar1,local_40a8,&local_40cc); if (*(int *)(param_2 + 0xc4) != 0) { *(undefined8 *)(puVar7 + -0x10e0) = 0x104cff; piVar4 = __errno_location(); local_40c0 = *piVar4; *(char **)(puVar7 + -0x10e8) = "single_connection: closing X11 listener."; *(undefined8 *)(puVar7 + -0x10f0) = 0x104d41; sshlog("channels.c","channel_post_x11_listener",0x68d,0,6,0); *(undefined8 *)(puVar7 + -0x10e0) = 0x104d69; channel_close_fd(param_1,param_2,param_2 + 0x28); *(undefined8 *)(puVar7 + -0x10e0) = 0x104d82; chan_mark_dead(param_1,param_2); *(undefined8 *)(puVar7 + -0x10e0) = 0x104d87; piVar4 = __errno_location(); *piVar4 = local_40c0; } if (local_40c4 == -1) { *(undefined8 *)(puVar7 + -0x10e0) = 0x104da1; piVar4 = __errno_location(); if (*piVar4 != 4) { *(undefined8 *)(puVar7 + -0x10e0) = 0x104dad; piVar4 = __errno_location(); if (*piVar4 != 0xb) { *(undefined8 *)(puVar7 + -0x10e0) = 0x104db9; piVar4 = __errno_location(); if (*piVar4 != 0x67) { *(undefined8 *)(puVar7 + -0x10e0) = 0x104dc5; piVar4 = __errno_location(); iVar1 = *piVar4; *(undefined8 *)(puVar7 + -0x10e0) = 0x104dce; pcVar5 = strerror(iVar1); *(char **)(puVar7 + -0x10e0) = pcVar5; *(char **)(puVar7 + -0x10e8) = "accept: %.100s"; *(undefined8 *)(puVar7 + -0x10f0) = 0x104e05; sshlog("channels.c","channel_post_x11_listener",0x695,0,2,0); } } } *(undefined8 *)(puVar7 + -0x10e0) = 0x104e0e; piVar4 = __errno_location(); if (*piVar4 != 0x18) { *(undefined8 *)(puVar7 + -0x10e0) = 0x104e1a; piVar4 = __errno_location(); puVar8 = puVar7 + -0x10d8; if (*piVar4 != 0x17) goto LAB_00105053; } *(undefined8 *)(puVar7 + -0x10e0) = 0x104e2a; uVar6 = monotime(); *(undefined8 *)(puVar7 + -0x10e0) = 0x104e37; uVar6 = __addvdi3(uVar6,1); *(undefined8 *)(param_2 + 0x58) = uVar6; puVar8 = puVar7 + -0x10d8; goto LAB_00105053; } *(undefined8 *)(puVar7 + -0x10e0) = 0x104e57; set_nodelay(local_40c4); *(undefined8 *)(puVar7 + -0x10e0) = 0x104e64; local_40b8 = (void *)get_peer_ipaddr(local_40c4); *(undefined8 *)(puVar7 + -0x10e0) = 0x104e78; local_40bc = get_peer_port(local_40c4); *(undefined8 *)(puVar7 + -0x10e0) = 0x104eb1; snprintf(local_4028,0x4000,"X11 connection from %.200s port %d",local_40b8,(ulong)local_40bc); uVar2 = *(uint *)(param_2 + 0xbc); uVar3 = *(uint *)(param_2 + 0xb4); *(undefined8 *)(puVar7 + -0x10e8) = 1; *(char **)(puVar7 + -0x10f0) = local_4028; *(undefined8 *)(puVar7 + -0x10f8) = 0; *(ulong *)(puVar7 + -0x1100) = (ulong)uVar2; *(ulong *)(puVar7 + -0x1108) = (ulong)uVar3; *(undefined8 *)(puVar7 + -0x1110) = 0x104f0d; local_40b0 = channel_new(param_1,"accepted x11 socket",3,local_40c4,local_40c4,0xffffffff); *(undefined8 *)(puVar7 + -0x10e0) = 0x104f3c; open_preamble(param_1,"channel_post_x11_listener",local_40b0,&DAT_00111a57); *(undefined8 *)(puVar7 + -0x10e0) = 0x104f55; local_40c8 = sshpkt_put_cstring(param_1,local_40b8); if (local_40c8 == 0) { *(undefined8 *)(puVar7 + -0x10e0) = 0x104f7b; local_40c8 = sshpkt_put_u32(param_1,local_40bc); if (local_40c8 != 0) goto LAB_00104f8a; } else { LAB_00104f8a: uVar2 = *(uint *)(param_2 + 4); *(undefined8 *)(puVar7 + -0x10e0) = 0x104fa1; uVar6 = ssh_err(local_40c8); *(ulong *)(puVar7 + -0x10e0) = (ulong)uVar2; puVar9 = puVar7 + -0x10e8; *(char **)(puVar7 + -0x10e8) = "channel %i: reply"; *(undefined8 *)(puVar7 + -0x10f0) = 0x104fd5; sshfatal("channels.c","channel_post_x11_listener",0x6a6,1,1,uVar6); } *(undefined8 *)(puVar9 + -8) = 0x104fe4; local_40c8 = sshpkt_send(param_1); puVar8 = puVar9; if (local_40c8 != 0) { uVar2 = *(uint *)(param_2 + 4); *(undefined8 *)(puVar9 + -8) = 0x10500a; uVar6 = ssh_err(local_40c8); *(ulong *)(puVar9 + -8) = (ulong)uVar2; puVar8 = puVar9 + -0x10; *(char **)(puVar9 + -0x10) = "channel %i: send"; *(undefined8 *)(puVar9 + -0x18) = 0x10503e; sshfatal("channels.c","channel_post_x11_listener",0x6a9,1,1,uVar6); } *(undefined8 *)(puVar8 + -8) = 0x10504d; free(local_40b8); LAB_00105053: if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return; } *(undefined8 *)(puVar8 + -8) = 0x105067; __stack_chk_fail(); }
static inline __be16 rta_getattr_be16(const struct rtattr *rta) { return ntohs(rta_getattr_u16(rta)); }
uint16_t rta_getattr_be16(long a1) { uint16_t v1; v1 = rta_getattr_u16(a1); return ntohs(v1); }
int rl_maybe_unsave_line (void) { if (_rl_saved_line_for_history) { rl_replace_line (_rl_saved_line_for_history->line, 0); rl_undo_list = (UNDO_LIST *)_rl_saved_line_for_history->data; _rl_free_history_entry (_rl_saved_line_for_history); _rl_saved_line_for_history = (HIST_ENTRY *) ((void *)0) ; rl_point = rl_end; } else rl_ding (); return 0; }
undefined8 rl_maybe_unsave_line(void) { if (_rl_saved_line_for_history == (undefined8 *)0x0) { rl_ding(); } else { rl_replace_line(*_rl_saved_line_for_history,0); rl_undo_list = _rl_saved_line_for_history[2]; _rl_free_history_entry(_rl_saved_line_for_history); _rl_saved_line_for_history = (undefined8 *)0x0; rl_point = rl_end; } return 0; }
HASH_TABLE * assoc_dequote_escapes (h) HASH_TABLE *h; { int i; BUCKET_CONTENTS *tlist; char *t; if (h == 0 || ((h)->nentries == 0)) return ((HASH_TABLE *) ((void *)0) ); for (i = 0; i < h->nbuckets; i++) for (tlist = ((h && (i < h->nbuckets)) ? h->bucket_array[i] : (BUCKET_CONTENTS *) ((void *)0) ); tlist; tlist = tlist->next) { t = dequote_escapes ((char *)tlist->data); do { if (tlist->data) sh_xfree((tlist->data), "assoc.c", 228); } while (0); tlist->data = t; } return h; }
long long assoc_dequote_escapes(void* a0) { unsigned int v0; void* v1; unsigned long v2; void* v4; void* v5; if (a0 && a0[12]) { for (v0 = 0; v0 < a0[8]; v0 += 1) { if (a0 && v0 < a0[8]) v5 = *((*(a0) + v0 * 8)); if (!a0 || v0 >= a0[8]) v5 = 0; for (v1 = v5; v1; v1 = *(v1)) { v2 = dequote_escapes(v1[16]); if (v1[16]) sh_xfree(v1[16], "assoc.c", 0xe4); *(&v1[16]) = v2; } } v4 = a0; } if (!a0 || !a0[12]) v4 = 0; return v4; }
static _Bool parse_old_offset (char const *s, uintmax_t *offset) { int radix; if (*s == '\0') return 0 ; if (s[0] == '+') ++s; if (strchr (s, '.') != ((void *)0) ) radix = 10; else { if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) radix = 16; else radix = 8; } return xstrtoumax (s, ((void *)0) , radix, offset, "Bb") == LONGINT_OK; }
int parse_old_offset(char *a0, unsigned long long a1) { char v0[2]; unsigned int v1; unsigned int v3; *(&v0) = a0; if (!v0[0]) { v3 = 0; } else { if (v0[0] == 43) *(&v0) = &v0[1]; if (strchr(v0, 0x2e)) { v1 = 10; } else { if (v0[0] == 48) { if (v0[1] == 120) { LABEL_402bb5: v1 = 16; goto LABEL_402bc5; } else if (v0[1] == 88) { goto LABEL_402bb5; } } v1 = 8; } LABEL_402bc5: v3 = xstrtoumax(v0, 0x0, v1, a1, "Bb"); *(&v3) = !v3; } return v3; }
static int bash_dabbrev_expand (count, key) int count, key; { int r, orig_suppress, orig_sort; rl_compentry_func_t *orig_func; rl_completion_func_t *orig_attempt_func; rl_compignore_func_t *orig_ignore_func; orig_func = rl_menu_completion_entry_function; orig_attempt_func = rl_attempted_completion_function; orig_ignore_func = rl_ignore_some_completions_function; orig_suppress = rl_completion_suppress_append; orig_sort = rl_sort_completion_matches; rl_menu_completion_entry_function = history_completion_generator; rl_attempted_completion_function = (rl_completion_func_t *) ((void *)0) ; rl_ignore_some_completions_function = filename_completion_ignore; rl_filename_completion_desired = 0; rl_completion_suppress_append = 1; rl_sort_completion_matches = 0; dabbrev_expand_active = 1; if (rl_last_func == bash_dabbrev_expand) rl_last_func = rl_menu_complete; r = rl_menu_complete (count, key); dabbrev_expand_active = 0; rl_last_func = bash_dabbrev_expand; rl_menu_completion_entry_function = orig_func; rl_attempted_completion_function = orig_attempt_func; rl_ignore_some_completions_function = orig_ignore_func; rl_completion_suppress_append = orig_suppress; rl_sort_completion_matches = orig_sort; return r; }
undefined4 bash_dabbrev_expand(undefined4 param_1,undefined4 param_2) { undefined8 uVar1; undefined8 uVar2; undefined4 uVar3; undefined4 uVar4; undefined8 uVar5; undefined4 uVar6; uVar5 = rl_menu_completion_entry_function; uVar4 = rl_completion_suppress_append; uVar3 = rl_sort_completion_matches; uVar2 = rl_ignore_some_completions_function; uVar1 = rl_attempted_completion_function; rl_menu_completion_entry_function = history_completion_generator; rl_attempted_completion_function = 0; rl_ignore_some_completions_function = filename_completion_ignore; _rl_filename_completion_desired = 0; rl_completion_suppress_append = 1; rl_sort_completion_matches = 0; dabbrev_expand_active = 1; if (rl_last_func == bash_dabbrev_expand) { rl_last_func = pcRam0000000000107cba; } uVar6 = rl_menu_complete(param_1,param_2); dabbrev_expand_active = 0; rl_attempted_completion_function = uVar1; rl_ignore_some_completions_function = (code *)uVar2; rl_sort_completion_matches = uVar3; rl_completion_suppress_append = uVar4; rl_last_func = bash_dabbrev_expand; rl_menu_completion_entry_function = (code *)uVar5; return uVar6; }
void BZ2_bsInitWrite ( EState* s ) { s->bsLive = 0; s->bsBuff = 0; }
void BZ2_bsInitWrite(unsigned int a0[162]) { char v0; unsigned int v2[162]; unsigned long long v3; a0[161] = 0; v2 = a0; a0[160] = 0; v3 = *(&v0); return; }
int main(int argc, char **argv) { struct stat st; unsigned int ttymode, st_mode_old; int ht; int it; int e; if (!isatty(0)) { fprintf( stderr , "stdin: is not a tty\n"); return(1); } if (fstat(0, &st) < 0) { perror("fstat"); return(1); } ht = hasttygrp(); it = tty_in_ttygrp(&st); if (argc < 2) { ttymode = (ht && it) ? 020 : 002; printf("is %s\n", (st.st_mode & ttymode) ? "y" : "n"); return 0; } if (argc > 2 || (argv[1][0] != 'y' && argv[1][0] != 'n')) { fprintf( stderr , "Usage: mesg [y|n]\n"); return 1; } ttymode = ht ? 020 : 022; if (ht && !it && argv[1][0] == 'y') { fprintf( stderr , "mesg: error: tty device is not owned " "by group `%s'\n", "tty"); exit(1); } st_mode_old = st.st_mode; if (argv[1][0] == 'y') st.st_mode |= ttymode; else st.st_mode &= ~(ttymode); if (st_mode_old != st.st_mode && fchmod(0, st.st_mode) != 0) { e = (*__errno_location ()) ; fprintf( stderr , "mesg: %s: %s\n", ttyname(0), strerror(e)); exit(1); } return 0; }
int main(unsigned long a0, struct_0 *a1) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; char v5; unsigned int v6; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; if (!isatty(0x0)) { fprintf(*(&stderr), "stdin: is not a tty\n"); v8 = 1; goto LABEL_4002e9; } if (fstat(0x0, &v5) < 0) { perror("fstat"); v8 = 1; goto LABEL_4002e9; } v0 = hasttygrp(); v1 = tty_in_ttygrp(&v5); if (a0 <= 1) { if (v0 && v1) { v9 = 16; goto LABEL_40014f; } v9 = 2; LABEL_40014f: v2 = v9; if (!(*(&v6) & v2)) v10 = &g_40035f; else v10 = "y"; printf("is %s\n", v10); v8 = 0; goto LABEL_4002e9; } if (a0 <= 2) { if (a1->field_8->field_0 == 121) { LABEL_4001dd: if (!v0) v11 = 18; else v11 = 16; v2 = v11; if (v0 && !v1 && a1->field_8->field_0 == 121) { fprintf(*(&stderr), "mesg: error: tty device is not owned by group `%s'\n", &g_40033e); exit(0x1); } v3 = *(&v6); if (a1->field_8->field_0 == 121) v6 = *(&v6) | v2; else v6 = *(&v6) & !(v2); if (v3 != v6 && fchmod(0x0, v6)) { v4 = *(__errno_location()); fprintf(*(&stderr), "mesg: %s: %s\n", ttyname(0x0), strerror(v4)); exit(0x1); } v8 = 0; LABEL_4002e9: return v8; } else if (a1->field_8->field_0 == 110) { goto LABEL_4001dd; } } fprintf(*(&stderr), "Usage: mesg [y|n]\n"); v8 = 1; goto LABEL_4002e9; }
int main (int argc, char **argv) { _Bool ok = 1 ; int can_mode = CAN_ALL_BUT_LAST; char const *relative_to = ((void *)0) ; char const *relative_base = ((void *)0) ; ; set_program_name (argv[0]); setlocale ( 6 , ""); bindtextdomain ("coreutils", "/usr/local/share/locale"); textdomain ("coreutils"); atexit (close_stdout); while ( 1 ) { int c = getopt_long (argc, argv, "eLmPqsz", longopts, ((void *)0) ); if (c == -1) break; switch (c) { case 'e': can_mode &= ~(CAN_EXISTING | CAN_ALL_BUT_LAST | CAN_MISSING); can_mode |= CAN_EXISTING; break; case 'm': can_mode &= ~(CAN_EXISTING | CAN_ALL_BUT_LAST | CAN_MISSING); can_mode |= CAN_MISSING; break; case 'L': can_mode |= CAN_NOLINKS; logical = 1 ; break; case 's': can_mode |= CAN_NOLINKS; logical = 0 ; break; case 'P': can_mode &= ~CAN_NOLINKS; logical = 0 ; break; case 'q': verbose = 0 ; break; case 'z': use_nuls = 1 ; break; case RELATIVE_TO_OPTION: relative_to = optarg; break; case RELATIVE_BASE_OPTION: relative_base = optarg; break; case GETOPT_HELP_CHAR: usage ( 0 ); break;; case GETOPT_VERSION_CHAR: version_etc ( stdout , "realpath", "GNU coreutils", Version, ("Padraig Brady"), (char *) ((void *)0) ); exit ( 0 ); break;; default: usage ( 1 ); } } if (optind >= argc) { error (0, 0, gettext ("missing operand")); usage ( 1 ); } if (relative_base && !relative_to) relative_to = relative_base; _Bool need_dir = (can_mode & (CAN_EXISTING | CAN_ALL_BUT_LAST | CAN_MISSING)) == CAN_EXISTING; if (relative_to) { can_relative_to = realpath_canon (relative_to, can_mode); if (!can_relative_to) ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_to)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_to)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_to)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); if (need_dir && !isdir (can_relative_to)) ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 20, \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_to)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 20 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_to)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 20 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_to)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); } if (relative_base == relative_to) can_relative_base = can_relative_to; else if (relative_base) { char *base = realpath_canon (relative_base, can_mode); if (!base) ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_base)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_base)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_base)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); if (need_dir && !isdir (base)) ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 20, \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_base)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 20 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_base)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 20 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, relative_base)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); if (path_prefix (base, can_relative_to)) can_relative_base = base; else { free (base); can_relative_base = can_relative_to; can_relative_to = ((void *)0) ; } } for (; optind < argc; ++optind) ok &= process_path (argv[optind], can_mode); return ok ? 0 : 1 ; }
int main(unsigned long a0, unsigned long long *a1) { char v0; char v1; unsigned int v2; unsigned int v3; void* v4; void* v5; unsigned long v6; unsigned long long v8; unsigned long long v10; v0 = 1; v2 = 1; v4 = 0; v5 = 0; set_program_name(*(a1)); setlocale(0x6, &g_400c5b); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); atexit(got.close_stdout); while (true) { v3 = getopt_long(a0, a1, "eLmPqsz", &longopts, NULL); if (v3 == -1) break; if (!(v3 <= 129)) goto LABEL_400865; if (v3 >= 76) { switch (v3) { case 76: v2 |= 4; logical = 1; break; case 80: v2 &= -5; logical = 0; break; case 101: v2 &= -0x4; break; case 109: v2 &= -0x4; v2 |= 2; break; case 113: verbose = 0; break; case 115: v2 |= 4; logical = 0; break; case 122: use_nuls = 1; break; case 128: v4 = *(&optarg); break; case 129: v5 = *(&optarg); break; default: LABEL_400865: usage(0x1); } } else if (v3 == -131) { version_etc(stdout, "realpath", "GNU coreutils", Version, "Padraig Brady", 0x0); exit(0x0); } else if (v3 == -130) { usage(0x0); } } if (a0 <= optind) { error(0x0, 0x0, gettext("missing operand")); usage(0x1); } else if (v5 && !v4) { v4 = v5; } v1 = !(v2 & 3); if (v4) { can_relative_to = realpath_canon(v4, v2); if (!can_relative_to) { v8 = quotearg_n_style_colon(0x0, 0x3, v4); error(0x1, *(__errno_location()), "%s"); } else if (v1 && (isdir(can_relative_to) ^ 1)) { quotearg_n_style_colon(0x0, 0x3, v4); error(0x1, 0x14, "%s"); } } if (v5 == v4) { can_relative_base = can_relative_to; } else if (v5) { v6 = realpath_canon(v5, v2); if (!v6) { v10 = quotearg_n_style_colon(0x0, 0x3, v5); error(0x1, *(__errno_location()), "%s"); } if (v1 && (isdir(v6) ^ 1)) { quotearg_n_style_colon(0x0, 0x3, v5); error(0x1, 0x14, "%s"); } if (path_prefix(v6, can_relative_to)) { can_relative_base = v6; } else { free(v6); can_relative_base = can_relative_to; can_relative_to = 0; } } for (; a0 > optind; optind = optind + 1) { v0 = (process_path(a1[optind], v2) & v0); } return v0 ^ 1; }
int _rl_current_display_line (void) { int ret, nleft; if (rl_display_prompt == rl_prompt) nleft = _rl_last_c_pos - _rl_screenwidth - rl_visible_prompt_length; else nleft = _rl_last_c_pos - _rl_screenwidth; if (nleft > 0) ret = 1 + nleft / _rl_screenwidth; else ret = 0; return ret; }
long long _rl_current_display_line() { unsigned int v0; unsigned int v1; if (rl_display_prompt == rl_prompt) v1 = *(&_rl_last_c_pos) - *(&_rl_screenwidth) - rl_visible_prompt_length; else v1 = *(&_rl_last_c_pos) - *(&_rl_screenwidth); if (v1 > 0) v0 = (v1 >> 31 CONCAT v1) /m *(&_rl_screenwidth) + 1; else v0 = 0; return v0; }
static void generate_signed_crl(common_info_st * cinfo) { gnutls_x509_crl_t crl; int result; gnutls_privkey_t ca_key; gnutls_x509_crt_t ca_crt; fprintf(stdlog, "Generating a signed CRL...\n"); ca_key = load_ca_private_key(cinfo); ca_crt = load_ca_cert(1, cinfo); crl = generate_crl(ca_crt, cinfo); fprintf(stdlog, "\n"); result = gnutls_x509_crl_privkey_sign(crl, ca_crt, ca_key, get_dig(ca_crt, cinfo), 0); if (result < 0) { fprintf( stderr , "crl_privkey_sign: %s\n", gnutls_strerror(result)); app_exit(1); } print_crl_info(crl, stdlog, cinfo); gnutls_privkey_deinit(ca_key); gnutls_x509_crl_deinit(crl); gnutls_x509_crt_deinit(ca_crt); }
void generate_signed_crl(void* a0, unsigned long a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; unsigned long long v1; unsigned long long v2; unsigned long long v3; unsigned long long v5; fprintf(stdlog, "Generating a signed CRL...\n"); v1 = load_ca_private_key(a0); v2 = load_ca_cert(0x1, a0); v3 = generate_crl(v2, a0, a0, a3, a4, a5); fprintf(stdlog, "\n"); v0 = gnutls_x509_crl_privkey_sign(v3, v2, v1, get_dig(v2, a0), 0x0); if (v0 >= 0) { print_crl_info(v3, stdlog, a0); gnutls_privkey_deinit(v1); gnutls_x509_crl_deinit(v3); v5 = gnutls_x509_crt_deinit(v2); return; } fprintf(stderr, "crl_privkey_sign: %s\n", gnutls_strerror(v0)); app_exit(0x1); }
static size_t ck_fread (char *buf, size_t size, FILE *f) { size_t r = fread_unlocked (buf,sizeof (char),size,f); if (r == 0 && ferror_unlocked (f)) perror_fatal (gettext ("read failed")); return r; }
int ck_fread(void* a0, unsigned int a1, void* a2) { unsigned long v0; v0 = fread_unlocked(a0, 0x1, a1, a2); if (v0) { return v0; } else if (!ferror_unlocked(a2)) { return v0; } else { perror_fatal(gettext("read failed")); } }
static void move_mailbox (void) { const char *maildir; char* mailfile; char* newmailfile; int fd; struct stat st; size_t len; maildir = getdef_str ("MAIL_DIR"); if (( ((void *)0) == maildir) && (getdef_str ("MAIL_FILE") == ((void *)0) )) { maildir = "/var/mail"; } if ( ((void *)0) == maildir) { return; } len = strlen (prefix) + strlen (maildir) + strlen (user_name) + 2; mailfile = __builtin_alloca ( len ) ; if (prefix[0]) { (void) snprintf (mailfile, len, "%s/%s/%s", prefix, maildir, user_name); } else { (void) snprintf (mailfile, len, "%s/%s", maildir, user_name); } mailfile[len-1] = '\0'; fd = open (mailfile, 00 | 04000 , 0); if (fd < 0) { if ( (*__errno_location ()) != 2 ) { perror (mailfile); } return; } if (fstat (fd, &st) < 0) { perror ("fstat"); (void) close (fd); return; } if (st.st_uid != user_id) { fprintf ( stderr , gettext ("%s: warning: %s not owned by %s\n"), Prog, mailfile, user_name); (void) close (fd); return; } if (uflg) { if (fchown (fd, user_newid, (gid_t) -1) < 0) { perror (gettext ("failed to change mailbox owner")); } } (void) close (fd); if (lflg) { len = strlen (prefix) + strlen (maildir) + strlen (user_newname) + 2; newmailfile = __builtin_alloca ( len ) ; if (prefix[0]) { (void) snprintf (newmailfile, len, "%s/%s/%s", prefix, maildir, user_newname); } else { (void) snprintf (newmailfile, len, "%s/%s", maildir, user_newname); } newmailfile[len - 1] = '\0'; if ( (link (mailfile, newmailfile) != 0) || (unlink (mailfile) != 0)) { perror (gettext ("failed to rename mailbox")); } } }
unsigned long move_mailbox() { size_t v0; size_t v1; size_t v2; unsigned long v3; void *v4; char *v5; long v6; char *v7; char *v8; size_t v9; size_t v10; size_t v11; unsigned long v12; void *v13; char *v14; _BYTE v16[12]; int fd; char *s; size_t maxlen; char *file; char *to; struct stat v22; unsigned long v23; v23 = __readfsqword(0x28u); s = (char *)getdef_str("MAIL_DIR"); if ( !s && !getdef_str("MAIL_FILE") ) s = "/var/mail"; if ( s ) { v0 = strlen(prefix); v1 = strlen(s) + v0; v2 = strlen(user_name); maxlen = v1 + v2 + 2; v3 = 16 * ((v1 + v2 + 25) / 0x10); while ( v16 != &v16[-(v3 & 0xFFFFFFFFFFFFF000LL)] ) ; v4 = alloca(v3 & 0xFFF); if ( (v3 & 0xFFF) != 0 ) *(_QWORD *)&v16[(v3 & 0xFFF) - 8] = *(_QWORD *)&v16[(v3 & 0xFFF) - 8]; file = v16; if ( *prefix ) snprintf(file, maxlen, "%s/%s/%s", prefix, s, user_name); else snprintf(file, maxlen, "%s/%s", s, user_name); file[maxlen - 1] = 0; fd = open(file, 2048, 0LL); if ( fd >= 0 ) { if ( fstat(fd, &v22) >= 0 ) { if ( v22.st_uid == user_id ) { if ( uflg && fchown(fd, user_newid, 0xFFFFFFFF) < 0 ) { v8 = gettext("failed to change mailbox owner"); perror(v8); } close(fd); if ( lflg ) { v9 = strlen(prefix); v10 = strlen(s) + v9; v11 = strlen(user_newname); maxlen = v10 + v11 + 2; v12 = 16 * ((v10 + v11 + 25) / 0x10); while ( v16 != &v16[-(v12 & 0xFFFFFFFFFFFFF000LL)] ) ; v13 = alloca(v12 & 0xFFF); if ( (v12 & 0xFFF) != 0 ) *(_QWORD *)&v16[(v12 & 0xFFF) - 8] = *(_QWORD *)&v16[(v12 & 0xFFF) - 8]; to = v16; if ( *prefix ) snprintf(to, maxlen, "%s/%s/%s", prefix, s, user_newname); else snprintf(to, maxlen, "%s/%s", s, user_newname); to[maxlen - 1] = 0; if ( link(file, to) || unlink(file) ) { v14 = gettext("failed to rename mailbox"); perror(v14); } } } else { v5 = user_name; v6 = Prog; v7 = gettext("%s: warning: %s not owned by %s\n"); fprintf(stderr, v7, v6, file, v5); close(fd); } } else { perror("fstat"); close(fd); } } else if ( *_errno_location() != 2 ) { perror(file); } } return __readfsqword(0x28u) ^ v23; }
static int ipstats_print_moo(enum output_type t, const char *key, const char *fmt, enum ipstats_maybe_on_off moo) { if (!moo) return 0; return print_on_off(t, key, fmt, ipstats_moo_to_bool(moo)); }
long ipstats_print_moo(unsigned int a1, long a2, long a3, int a4) { bool v5; if ( !a4 ) return 0LL; v5 = ipstats_moo_to_bool(a4); return print_on_off(a1, a2, a3, v5); }
void printflags(char *indent, int flags) { size_t f; int first = 1; printf("%s flagnames:", indent); for (f = 0; f < sizeof(flagname)/sizeof(char *); f++) if (flags & (int)1 << f) { printf("%s%s", first ? " " : "|", flagname[f]); first = 0; } printf("\n"); }
void printflags(unsigned long a0, unsigned long a1) { unsigned int v0; void* v1; unsigned int v3; unsigned long long v4; v0 = 1; printf("%s flagnames:", a0); for (v1 = 0; v1 <= 5; v1 += 1) { if (((a1 >> (v1 & 31)) & 1)) { if (v0) v3 = " "; else v3 = &g_40118e; printf("%s%s", v3, *((0x8 * v1 + &flagname))); v0 = 0; } } v4 = printf("\n"); return; }
static char * expand_string_for_patsub (string, quoted) char *string; int quoted; { WORD_LIST *value; char *ret, *t; if (string == 0 || *string == '\0') return (char *) ((void *)0) ; value = expand_string_for_pat (string, quoted, (int *)0, (int *)0); if (value && value->word) { remove_quoted_nulls (value->word->word); value->word->flags &= ~(1 << 18); } if (value) { t = (value->next) ? string_list (value) : value->word->word; ret = quote_string_for_repl (t, quoted); if (t != value->word->word) sh_xfree((t), "subst.c", 3997); dispose_words (value); } else ret = (char *) ((void *)0) ; return (ret); }
int expand_string_for_patsub(char *a0, unsigned long a1) { void* v0; struct_0 *v1; unsigned int v2; unsigned int v4; if (!a0) { v4 = 0; return v4; } else if (!*(a0)) { v4 = 0; return v4; } else { v1 = expand_string_for_pat(a0, a1, 0x0, 0x0); if (v1 && v1->field_8) { remove_quoted_nulls(v1->field_8->field_0); v1->field_8->field_8 = v1->field_8->field_8 & -262145; } if (!v1) { v0 = 0; } else { if (!v1->field_0) v4 = v1->field_8->field_0; else v4 = string_list(v1); v2 = v4; v0 = quote_string_for_repl(*(&v2), a1); if (*(&v2) != v1->field_8->field_0) sh_xfree(*(&v2), "subst.c", 0xf9d); dispose_words(v1); } v4 = v0; return v4; } }
int main (int argc, char **argv) { char buf[ 8192 ]; char *name; char *newpwd; char *cp; const char *salt; int errors = 0; int line = 0; Prog = Basename (argv[0]); log_set_progname(Prog); log_set_logfd( stderr ); (void) setlocale ( 6 , ""); (void) bindtextdomain ("shadow", "/usr/share/locale"); (void) textdomain ("shadow"); process_flags (argc, argv); salt = get_salt(); process_root_flag ("-R", argc, argv); openlog("chpasswd", ( 0x01 ), (10<<3) ); check_perms (); { is_shadow_pwd = spw_file_present (); open_files (); } while (fgets (buf, (int) sizeof buf, stdin ) != (char *) 0) { line++; cp = strrchr (buf, '\n'); if ( ((void *)0) != cp) { *cp = '\0'; } else { if (feof ( stdin ) == 0) { while (fgets (buf, (int) sizeof buf, stdin ) != (char *) 0) { cp = strchr (buf, '\n'); if (cp != ((void *)0) ) { break; } } fprintf ( stderr , gettext ("%s: line %d: line too long\n"), Prog, line); errors++; continue; } } name = buf; cp = strchr (name, ':'); if ( ((void *)0) != cp) { *cp = '\0'; cp++; } else { fprintf ( stderr , gettext ("%s: line %d: missing new password\n"), Prog, line); errors++; continue; } newpwd = cp; { const struct spwd *sp; struct spwd newsp; const struct passwd *pw; struct passwd newpw; if (salt) { cp = pw_encrypt (newpwd, salt); if ( ((void *)0) == cp) { fprintf ( stderr , gettext ("%s: failed to crypt password with salt '%s': %s\n"), Prog, salt, strerror ( (*__errno_location ()) )); fail_exit (1); } } pw = pw_locate (name); if ( ((void *)0) == pw) { fprintf ( stderr , gettext ("%s: line %d: user '%s' does not exist\n"), Prog, line, name); errors++; continue; } if (is_shadow_pwd) { sp = spw_locate (name); if ( ( ((void *)0) == sp) && (strcmp (pw->pw_passwd, "x") == 0)) { newsp.sp_namp = name; newsp.sp_min = getdef_num ("PASS_MIN_DAYS", -1); newsp.sp_max = getdef_num ("PASS_MAX_DAYS", -1); newsp.sp_warn = getdef_num ("PASS_WARN_AGE", -1); newsp.sp_inact = -1; newsp.sp_expire= -1; newsp.sp_flag = ((unsigned long int)-1); sp = &newsp; } } else { sp = ((void *)0) ; } if ( ((void *)0) != sp) { newsp = *sp; newsp.sp_pwdp = cp; newsp.sp_lstchg = (long) gettime () / (24L*3600L); if (0 == newsp.sp_lstchg) { newsp.sp_lstchg = -1; } } if ( ( ((void *)0) == sp) || (strcmp (pw->pw_passwd, "x") != 0)) { newpw = *pw; newpw.pw_passwd = cp; } if ( ((void *)0) != sp) { if (spw_update (&newsp) == 0) { fprintf ( stderr , gettext ("%s: line %d: failed to prepare the new %s entry '%s'\n"), Prog, line, spw_dbname (), newsp.sp_namp); errors++; continue; } } if ( ( ((void *)0) == sp) || (strcmp (pw->pw_passwd, "x") != 0)) { if (pw_update (&newpw) == 0) { fprintf ( stderr , gettext ("%s: line %d: failed to prepare the new %s entry '%s'\n"), Prog, line, pw_dbname (), newpw.pw_name); errors++; continue; } } } } if (0 != errors) { { fprintf ( stderr , gettext ("%s: error detected, changes ignored\n"), Prog); } fail_exit (1); } { close_files (); } nscd_flush_cache ("passwd"); sssd_flush_cache (0x001); return (0); }
undefined8 main(undefined4 param_1,undefined8 *param_2) { undefined8 uVar1; int iVar2; long lVar3; int *piVar4; char *pcVar5; undefined8 *puVar6; long lVar7; undefined8 uVar8; undefined8 uVar9; char *pcVar10; long in_FS_OFFSET; int local_20f0; uint local_20ec; char *local_20e8; char **local_20e0; undefined8 local_20b8; char *local_20b0; undefined8 local_20a8; undefined8 local_20a0; undefined8 local_2098; undefined8 local_2090; char *local_2088; char *local_2080; char *local_2078; char *local_2070; char *local_2068; char *local_2060; char *local_2058; char *local_2050; char *local_2048; char local_2038 [8200]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); local_20f0 = 0; local_20ec = 0; Prog = Basename(*param_2); log_set_progname(Prog); log_set_logfd(stderr); setlocale(6,""); bindtextdomain("shadow","/usr/share/locale"); textdomain("shadow"); process_flags(param_1,param_2); lVar3 = get_salt(); process_root_flag(&DAT_001018be,param_1,param_2); openlog("chpasswd",1,0x50); check_perms(); is_shadow_pwd = spw_file_present(); open_files(); LAB_00101350: do { pcVar10 = fgets(local_2038,0x2000,stdin); uVar1 = Prog; if (pcVar10 == (char *)0x0) { if (local_20f0 != 0) { pcVar10 = (char *)gettext("%s: error detected, changes ignored\n"); fprintf(stderr,pcVar10,uVar1); fail_exit(1); } close_files(); nscd_flush_cache("passwd"); sssd_flush_cache(1); if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return 0; } __stack_chk_fail(); } local_20ec = local_20ec + 1; pcVar10 = strrchr(local_2038,10); if (pcVar10 == (char *)0x0) { iVar2 = feof(stdin); if (iVar2 == 0) { do { pcVar10 = fgets(local_2038,0x2000,stdin); if (pcVar10 == (char *)0x0) break; pcVar10 = strchr(local_2038,10); } while (pcVar10 == (char *)0x0); uVar1 = Prog; pcVar10 = (char *)gettext("%s: line %d: line too long\n"); fprintf(stderr,pcVar10,uVar1,(ulong)local_20ec); local_20f0 = local_20f0 + 1; goto LAB_00101350; } } else { *pcVar10 = '\0'; } local_20e8 = strchr(local_2038,0x3a); uVar1 = Prog; if (local_20e8 == (char *)0x0) { pcVar10 = (char *)gettext("%s: line %d: missing new password\n"); fprintf(stderr,pcVar10,uVar1,(ulong)local_20ec); local_20f0 = local_20f0 + 1; } else { *local_20e8 = '\0'; local_20e8 = local_20e8 + 1; if ((lVar3 != 0) && (local_20e8 = (char *)pw_encrypt(local_20e8,lVar3), local_20e8 == (char *)0x0)) { piVar4 = __errno_location(); pcVar10 = strerror(*piVar4); uVar1 = Prog; pcVar5 = (char *)gettext("%s: failed to crypt password with salt \'%s\': %s\n"); fprintf(stderr,pcVar5,uVar1,lVar3,pcVar10); fail_exit(1); } puVar6 = (undefined8 *)pw_locate(local_2038); uVar1 = Prog; if (puVar6 == (undefined8 *)0x0) { pcVar10 = (char *)gettext("%s: line %d: user \'%s\' does not exist\n"); fprintf(stderr,pcVar10,uVar1,(ulong)local_20ec,local_2038); local_20f0 = local_20f0 + 1; } else { if (is_shadow_pwd == '\0') { local_20e0 = (char **)0x0; } else { local_20e0 = (char **)spw_locate(local_2038); if ((local_20e0 == (char **)0x0) && (iVar2 = strcmp((char *)puVar6[1],"x"), iVar2 == 0)) { local_2088 = local_2038; iVar2 = getdef_num("PASS_MIN_DAYS",0xffffffff); local_2070 = (char *)(long)iVar2; iVar2 = getdef_num("PASS_MAX_DAYS",0xffffffff); local_2068 = (char *)(long)iVar2; iVar2 = getdef_num("PASS_WARN_AGE",0xffffffff); local_2060 = (char *)(long)iVar2; local_2058 = (char *)0xffffffffffffffff; local_2050 = (char *)0xffffffffffffffff; local_2048 = (char *)0xffffffffffffffff; local_20e0 = &local_2088; } } if (local_20e0 != (char **)0x0) { local_2088 = *local_20e0; local_2078 = local_20e0[2]; local_2070 = local_20e0[3]; local_2068 = local_20e0[4]; local_2060 = local_20e0[5]; local_2058 = local_20e0[6]; local_2050 = local_20e0[7]; local_2048 = local_20e0[8]; local_2080 = local_20e8; lVar7 = gettime(); local_2078 = (char *)(lVar7 / 0x15180); if (local_2078 == (char *)0x0) { local_2078 = (char *)0xffffffffffffffff; } } if ((local_20e0 == (char **)0x0) || (iVar2 = strcmp((char *)puVar6[1],"x"), iVar2 != 0)) { local_20b8 = *puVar6; local_20a8 = puVar6[2]; local_20a0 = puVar6[3]; local_2090 = puVar6[5]; local_2098 = puVar6[4]; local_20b0 = local_20e8; } if ((local_20e0 == (char **)0x0) || (iVar2 = spw_update(&local_2088), pcVar10 = local_2088, iVar2 != 0)) { if (((local_20e0 == (char **)0x0) || (iVar2 = strcmp((char *)puVar6[1],"x"), iVar2 != 0)) && (iVar2 = pw_update(&local_20b8), uVar1 = local_20b8, iVar2 == 0)) { uVar9 = pw_dbname(); uVar8 = Prog; pcVar10 = (char *)gettext("%s: line %d: failed to prepare the new %s entry \'%s\'\n"); fprintf(stderr,pcVar10,uVar8,(ulong)local_20ec,uVar9,uVar1); local_20f0 = local_20f0 + 1; } } else { uVar8 = spw_dbname(); uVar1 = Prog; pcVar5 = (char *)gettext("%s: line %d: failed to prepare the new %s entry \'%s\'\n"); fprintf(stderr,pcVar5,uVar1,(ulong)local_20ec,uVar8,pcVar10); local_20f0 = local_20f0 + 1; } } } } while( true ); }
static void bind_arrow_keys_internal (Keymap map) { Keymap xkeymap; xkeymap = _rl_keymap; _rl_keymap = map; rl_bind_keyseq_if_unbound ("\033[A", rl_get_previous_history); rl_bind_keyseq_if_unbound ("\033[B", rl_get_next_history); rl_bind_keyseq_if_unbound ("\033[C", rl_forward_char); rl_bind_keyseq_if_unbound ("\033[D", rl_backward_char); rl_bind_keyseq_if_unbound ("\033[H", rl_beg_of_line); rl_bind_keyseq_if_unbound ("\033[F", rl_end_of_line); rl_bind_keyseq_if_unbound ("\033OA", rl_get_previous_history); rl_bind_keyseq_if_unbound ("\033OB", rl_get_next_history); rl_bind_keyseq_if_unbound ("\033OC", rl_forward_char); rl_bind_keyseq_if_unbound ("\033OD", rl_backward_char); rl_bind_keyseq_if_unbound ("\033OH", rl_beg_of_line); rl_bind_keyseq_if_unbound ("\033OF", rl_end_of_line); rl_bind_keyseq_if_unbound ("\033[1;5C", rl_forward_word); rl_bind_keyseq_if_unbound ("\033[1;5D", rl_backward_word); rl_bind_keyseq_if_unbound ("\033[3;5~", rl_kill_word); rl_bind_keyseq_if_unbound ("\033[1;3C", rl_forward_word); rl_bind_keyseq_if_unbound ("\033[1;3D", rl_backward_word); _rl_keymap = xkeymap; }
long long bind_arrow_keys_internal(unsigned long long a0) { unsigned long long v0; v0 = _rl_keymap; _rl_keymap = a0; rl_bind_keyseq_if_unbound(&g_402265, got.rl_get_previous_history); rl_bind_keyseq_if_unbound(&g_402269, got.rl_get_next_history); rl_bind_keyseq_if_unbound(&g_40226d, got.rl_forward_char); rl_bind_keyseq_if_unbound(&g_402271, got.rl_backward_char); rl_bind_keyseq_if_unbound(&g_402275, got.rl_beg_of_line); rl_bind_keyseq_if_unbound(&g_402279, got.rl_end_of_line); rl_bind_keyseq_if_unbound(&g_40227d, got.rl_get_previous_history); rl_bind_keyseq_if_unbound(&g_402281, got.rl_get_next_history); rl_bind_keyseq_if_unbound(&g_402285, got.rl_forward_char); rl_bind_keyseq_if_unbound(&g_402289, got.rl_backward_char); rl_bind_keyseq_if_unbound(&g_40228d, got.rl_beg_of_line); rl_bind_keyseq_if_unbound(&g_402291, got.rl_end_of_line); rl_bind_keyseq_if_unbound(&g_402295, got.rl_forward_word); rl_bind_keyseq_if_unbound(&g_40229c, got.rl_backward_word); rl_bind_keyseq_if_unbound(&g_4022a3, got.rl_kill_word); rl_bind_keyseq_if_unbound(&g_4022aa, got.rl_forward_word); rl_bind_keyseq_if_unbound(&g_4022b1, got.rl_backward_word); _rl_keymap = v0; return v0; }
int main (int argc, char *argv[]) { errcode_t retval = 0, retval2 = 0, orig_retval = 0; int exit_value = 0; ext2_filsys fs = 0; io_manager io_ptr; struct ext2_super_block *sb; const char *lib_ver_date; int my_ver, lib_ver; e2fsck_t ctx; blk64_t orig_superblock = ~(blk64_t)0; struct problem_context pctx; int flags, run_result, was_changed; int journal_size; int sysval, sys_page_size = 4096; int old_bitmaps; __u32 features[3]; char *cp; enum quota_type qtype; struct ext2fs_journal_params jparams; clear_problem_context(&pctx); sigcatcher_setup(); setlocale( 5 , ""); setlocale( 0 , ""); bindtextdomain("e2fsprogs", "/usr/share/locale"); textdomain("e2fsprogs"); set_com_err_gettext(gettext); my_ver = ext2fs_parse_version_string(my_ver_string); lib_ver = ext2fs_get_library_version(0, &lib_ver_date); if (my_ver > lib_ver) { fprintf( stderr , "%s", (gettext ("Error: ext2fs library version out of date!\n"))); show_version_only++; } retval = PRS(argc, argv, &ctx); if (retval) { com_err("e2fsck", retval, "%s", (gettext ("while trying to initialize program"))); exit(8); } reserve_stdio_fds(); set_up_logging(ctx); if (ctx->logf) { int i; fputs("E2fsck run: ", ctx->logf); for (i = 0; i < argc; i++) { if (i) fputc(' ', ctx->logf); fputs(argv[i], ctx->logf); } fputc('\n', ctx->logf); } if (ctx->problem_logf) { int i; fputs("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", ctx->problem_logf); fprintf(ctx->problem_logf, "<problem_log time=\"%lu\">\n", (unsigned long) ctx->now); fprintf(ctx->problem_logf, "<invocation prog=\"%s\"", argv[0]); for (i = 1; i < argc; i++) fprintf(ctx->problem_logf, " arg%d=\"%s\"", i, argv[i]); fputs("/>\n", ctx->problem_logf); } init_resource_track(&ctx->global_rtrack, ((void *)0) ); if (!(ctx->options & 0x0002) || show_version_only) log_err(ctx, "e2fsck %s (%s)\n", my_ver_string, my_ver_date); if (show_version_only) { log_err(ctx, (gettext ("\tUsing %s, %s\n")), error_message((2133571328L)), lib_ver_date); exit(0); } check_mount(ctx); if (!(ctx->options & 0x0002) && !(ctx->options & 0x0008) && !(ctx->options & 0x0004)) { if (!ctx->interactive) fatal_error(ctx, (gettext ("need terminal for interactive repairs"))); } ctx->superblock = ctx->use_superblock; flags = 0x100000 | 0x4000000; restart: if (getenv("TEST_IO_FLAGS") || getenv("TEST_IO_BLOCK")) { io_ptr = test_io_manager; test_io_backing_manager = unix_io_manager; } else io_ptr = unix_io_manager; flags |= 0x10000; profile_get_boolean(ctx->profile, "options", "old_bitmaps", 0, 0, &old_bitmaps); if (!old_bitmaps) flags |= 0x20000; if ((ctx->options & 0x0001) == 0) { flags |= 0x01; if (!(ctx->mount_flags & 2 && ctx->mount_flags & 4)) flags |= 0x4000; if ((ctx->mount_flags & 4) && (ctx->options & 0x0100)) flags &= ~0x4000; } if (ctx->undo_file) { retval = e2fsck_setup_tdb(ctx, &io_ptr); if (retval) exit(8); } ctx->openfs_flags = flags; retval = try_open_fs(ctx, flags, io_ptr, &fs); if (!ctx->superblock && !(ctx->options & 0x0002) && !(ctx->flags & 0x0100) && ((retval == (2133571347L)) || (retval == (2133571480L)) || (retval == (2133571388L)) || ((retval == 0) && (retval2 = ext2fs_check_desc(fs))))) { if (retval) { pctx.errcode = retval; fix_problem(ctx, 0x000044, &pctx); } if (retval2) { pctx.errcode = retval2; fix_problem(ctx, 0x000045, &pctx); } pctx.errcode = 0; if (retval2 == 12 || retval2 == (2133571398L)) { retval = retval2; goto failure; } if (fs->flags & 0x10000) { ext2fs_free(fs); fs = ((void *)0) ; } if (!fs || (fs->group_desc_count > 1)) { log_out(ctx, (gettext ("%s: %s trying backup blocks...\n")), ctx->program_name, retval ? (gettext ("Superblock invalid,")) : (gettext ("Group descriptors look bad..."))); orig_superblock = ctx->superblock; get_backup_sb(ctx, fs, ctx->filesystem_name, io_ptr); if (fs) ext2fs_close_free(&fs); orig_retval = retval; retval = try_open_fs(ctx, flags, io_ptr, &fs); if ((orig_retval == 0) && retval != 0) { if (fs) ext2fs_close_free(&fs); log_out(ctx, (gettext ("%s: %s while using the " "backup blocks")) , ctx->program_name, error_message(retval)); log_out(ctx, (gettext ("%s: going back to original " "superblock\n")) , ctx->program_name); ctx->superblock = orig_superblock; retval = try_open_fs(ctx, flags, io_ptr, &fs); } } } if (((retval == (2133571395L)) || (retval == (2133571396L))) && fs && fs->super) { sb = fs->super; features[0] = (sb->s_feature_compat & ~(0x0001| 0x0002| 0x0004| 0x0010| 0x0020| 0x0008| 0x0200| 0x0400| 0x0800)); features[1] = (sb->s_feature_incompat & ~(0x0002| 0x0008| 0x0010| 0x0004| 0x0040| 0x0200| 0x0400| 0x0100| 0x0080| 0x8000| 0x10000| 0x20000| 0x2000| 0x4000)); features[2] = (sb->s_feature_ro_compat & ~(0x0001| 0x0008| 0x0002| 0x0020| 0x0040| 0x0010| 0x0200| 0x0100| 0x0400| 0x1000 | 0x2000 | 0x4000 | 0x8000)); if (features[0] || features[1] || features[2]) goto print_unsupp_features; } failure: if (retval) { if (orig_retval) retval = orig_retval; com_err(ctx->program_name, retval, (gettext ("while trying to open %s")), ctx->filesystem_name); if (retval == (2133571348L)) { log_out(ctx, "%s", (gettext ("The filesystem revision is apparently " "too high for this version of e2fsck.\n" "(Or the filesystem superblock " "is corrupt)\n\n")) ); fix_problem(ctx, 0x000004, &pctx); } else if (retval == (2133571364L)) log_out(ctx, "%s", (gettext ("Could this be a zero-length partition?\n"))); else if ((retval == 1 ) || (retval == 13 )) log_out(ctx, (gettext ("You must have %s access to the " "filesystem or be root\n")) , (ctx->options & 0x0001) ? "r/o" : "r/w"); else if (retval == 6 ) log_out(ctx, "%s", (gettext ("Possibly non-existent or swap device?\n"))); else if (retval == 16 ) log_out(ctx, "%s", (gettext ("Filesystem mounted or opened " "exclusively by another program?\n")) ); else if (retval == 2 ) log_out(ctx, "%s", (gettext ("Possibly non-existent device?\n"))); else if (retval == 30 ) log_out(ctx, "%s", (gettext ("Disk write-protected; use the " "-n option to do a read-only\n" "check of the device.\n")) ); else { if ((retval == (2133571388L)) && !(flags & 0x800000)) { if (fs) ext2fs_close_free(&fs); log_out(ctx, (gettext ("%s: Trying to load superblock " "despite errors...\n")) , ctx->program_name); flags |= 0x800000; if (orig_superblock != ~(blk64_t)0) ctx->superblock = orig_superblock; goto restart; } fix_problem(ctx, 0x000004, &pctx); if (retval == (2133571347L)) check_plausibility(ctx->filesystem_name, 0x0004, ((void *)0) ); } fatal_error(ctx, 0); } fs->flags |= 0x200; if (!(ctx->flags & 0x0800)) { __u32 blocksize = ((1 << 10) << (fs->super)->s_log_block_size); int need_restart = 0; pctx.errcode = ext2fs_get_device_size2(ctx->filesystem_name, blocksize, &ctx->num_blocks); if (pctx.errcode == 16 ) { ext2fs_close_free(&fs); need_restart++; pctx.errcode = ext2fs_get_device_size2(ctx->filesystem_name, blocksize, &ctx->num_blocks); } if (pctx.errcode == (2133571408L)) ctx->num_blocks = 0; else if (pctx.errcode) { fix_problem(ctx, 0x00000C, &pctx); ctx->flags |= 0x0001; fatal_error(ctx, 0); } ctx->flags |= 0x0800; if (need_restart) goto restart; } ctx->fs = fs; fs->now = ctx->now; sb = fs->super; if (sb->s_rev_level > 1) { com_err(ctx->program_name, (2133571348L), (gettext ("while trying to open %s")), ctx->filesystem_name); get_newer: fatal_error(ctx, (gettext ("Get a newer version of e2fsck!"))); } if (ctx->device_name == 0 && sb->s_volume_name[0]) ctx->device_name = string_copy(ctx, (char *) sb->s_volume_name, sizeof(sb->s_volume_name)); if (ctx->device_name == 0) ctx->device_name = string_copy(ctx, ctx->filesystem_name, 0); for (cp = ctx->device_name; *cp; cp++) if ( ((*__ctype_b_loc ())[(int) (( *cp ))] & (unsigned short int) _ISspace) || *cp == ':') *cp = '_'; if (ctx->problem_logf) { fprintf(ctx->problem_logf, "<filesystem dev=\"%s\"", ctx->filesystem_name); if (!uuid_is_null(sb->s_uuid)) { char buf[48]; uuid_unparse(sb->s_uuid, buf); fprintf(ctx->problem_logf, " uuid=\"%s\"", buf); } if (sb->s_volume_name[0]) fprintf(ctx->problem_logf, " label=\"%.*s\"", (int)sizeof(sb->s_volume_name), (char *)sb->s_volume_name); fputs("/>\n", ctx->problem_logf); } ehandler_init(fs->io); if (ext2fs_has_feature_mmp(fs->super) && (flags & 0x100000)) { if (e2fsck_check_mmp(fs, ctx)) fatal_error(ctx, 0); ext2fs_close_free(&ctx->fs); flags &= ~0x100000; goto restart; } if (ctx->logf) fprintf(ctx->logf, "Filesystem UUID: %s\n", e2p_uuid2str(sb->s_uuid)); if ((ctx->mount_flags & (1 | 16)) == 0) { retval = e2fsck_check_ext3_journal(ctx); if (retval) { com_err(ctx->program_name, retval, (gettext ("while checking journal for %s")), ctx->device_name); fatal_error(ctx, (gettext ("Cannot proceed with file system check"))); } } if (ext2fs_has_feature_journal_needs_recovery(sb)) { if (ctx->options & 0x0001) { log_out(ctx, "%s", (gettext ("Warning: skipping journal recovery because " "doing a read-only filesystem check.\n")) ); ((ctx->fs->io)->manager->flush((ctx->fs->io))); } else { if (ctx->flags & 0x0200) { com_err(ctx->program_name, 0, (gettext ("unable to set superblock flags " "on %s\n")) , ctx->device_name); fatal_error(ctx, 0); } retval = e2fsck_run_ext3_journal(ctx); if (retval == (2133571503L)) { log_out(ctx, (gettext ("Journal checksum error " "found in %s\n")) , ctx->device_name); } else if (retval == (2133571502L)) { log_out(ctx, (gettext ("Journal corrupted in %s\n")), ctx->device_name); } else if (retval) { com_err(ctx->program_name, retval, (gettext ("while recovering journal of %s")), ctx->device_name); } ext2fs_close_free(&ctx->fs); ctx->flags |= 0x0200; goto restart; } } features[0] = sb->s_feature_compat & ~(0x0001| 0x0002| 0x0004| 0x0010| 0x0020| 0x0008| 0x0200| 0x0400| 0x0800); features[1] = sb->s_feature_incompat & ~(0x0002| 0x0008| 0x0010| 0x0004| 0x0040| 0x0200| 0x0400| 0x0100| 0x0080| 0x8000| 0x10000| 0x20000| 0x2000| 0x4000); features[2] = (sb->s_feature_ro_compat & ~(0x0001| 0x0008| 0x0002| 0x0020| 0x0040| 0x0010| 0x0200| 0x0100| 0x0400| 0x1000 | 0x2000 | 0x4000 | 0x8000)); print_unsupp_features: if (features[0] || features[1] || features[2]) { int i, j; __u32 *mask = features, m; log_err(ctx, (gettext ("%s has unsupported feature(s):")), ctx->filesystem_name); for (i=0; i <3; i++,mask++) { for (j=0,m=1; j < 32; j++, m<<=1) { if (*mask & m) log_err(ctx, " %s", e2p_feature2string(i, m)); } } log_err(ctx, "\n"); goto get_newer; } if (ext2fs_has_feature_casefold(sb) && !fs->encoding) { log_err(ctx, (gettext ("%s has unsupported encoding: %0x\n")), ctx->filesystem_name, sb->s_encoding); goto get_newer; } if (ctx->superblock && !(ctx->options & 0x0001)) ext2fs_mark_super_dirty(fs); sysval = sysconf( _SC_PAGESIZE ); if (sysval > 0) sys_page_size = sysval; ctx->blocks_per_page = sys_page_size / fs->blocksize; if (ctx->blocks_per_page == 0) ctx->blocks_per_page = 1; if (ctx->superblock) set_latch_flags(0x0050, 0x0004, 0); ext2fs_mark_valid(fs); check_super_block(ctx); if (ctx->flags & (0x0001 | 0x0002)) fatal_error(ctx, 0); check_if_skip(ctx); check_resize_inode(ctx); if (bad_blocks_file) read_bad_blocks_file(ctx, bad_blocks_file, replace_bad_blocks); else if (cflag) read_bad_blocks_file(ctx, 0, !keep_bad_blocks); if (ctx->flags & (0x0001 | 0x0002)) fatal_error(ctx, 0); ext2fs_mark_valid(fs); retval = ext2fs_read_bb_inode(fs, &fs->badblocks); if (retval) { log_out(ctx, (gettext ("%s: %s while reading bad blocks inode\n")), ctx->program_name, error_message(retval)); preenhalt(ctx); log_out(ctx, "%s", (gettext ("This doesn't bode well, " "but we'll try to go on...\n")) ); } if (sb->s_jnl_backup_type == 1 && !ext2fs_has_feature_fast_commit(sb)) journal_size = (sb->s_jnl_blocks[15] << (32 - 20)) | (sb->s_jnl_blocks[16] >> 20); else journal_size = -1; if (ext2fs_has_feature_quota(sb)) { clear_problem_context(&pctx); pctx.errcode = quota_init_context(&ctx->qctx, ctx->fs, 0); if (pctx.errcode) { fix_problem(ctx, 0x00004C, &pctx); fatal_error(ctx, 0); } } run_result = e2fsck_run(ctx); e2fsck_clear_progbar(ctx); if (!ctx->invalid_bitmaps && (ctx->flags & 0x0080)) { if (fix_problem(ctx, 0x060001, &pctx)) { if (journal_size < 1024) { ext2fs_get_journal_params(&jparams, fs); } else { jparams.num_journal_blocks = journal_size; jparams.num_fc_blocks = 0; } log_out(ctx, (gettext ("Creating journal (%d blocks): ")), jparams.num_journal_blocks); fflush( stdout ); retval = ext2fs_add_journal_inode3(fs, &jparams, ~0ULL, 0); if (retval) { log_out(ctx, "%s: while trying to create " "journal\n", error_message(retval)); goto no_journal; } log_out(ctx, "%s", (gettext (" Done.\n"))); log_out(ctx, "%s", (gettext ("\n*** journal has been regenerated ***\n"))); } } no_journal: if (run_result & 0x0001) { fatal_error(ctx, (gettext ("aborted"))); } else if (run_result & 0x0002) { log_out(ctx, (gettext ("%s: e2fsck canceled.\n")), ctx->device_name ? ctx->device_name : ctx->filesystem_name); exit_value |= 32; } else if (ctx->qctx && !ctx->invalid_bitmaps) { int needs_writeout; for (qtype = 0; qtype < MAXQUOTAS; qtype++) { if (*quota_sb_inump(sb, qtype) == 0) continue; needs_writeout = 0; pctx.num = qtype; retval = quota_compare_and_update(ctx->qctx, qtype, &needs_writeout); if ((retval || needs_writeout) && fix_problem(ctx, 0x060002, &pctx)) { pctx.errcode = quota_write_inode(ctx->qctx, 1 << qtype); if (pctx.errcode) (void) fix_problem(ctx, 0x060006, &pctx); } } quota_release_context(&ctx->qctx); } if (run_result == 0x0004) { log_out(ctx, "%s", (gettext ("Restarting e2fsck from the beginning...\n"))); retval = e2fsck_reset_context(ctx); if (retval) { com_err(ctx->program_name, retval, "%s", (gettext ("while resetting context"))); fatal_error(ctx, 0); } ext2fs_close_free(&ctx->fs); goto restart; } was_changed = ext2fs_test_changed(fs); if (!(ctx->flags & ((0x0001 | 0x0002) | 0x0004)) && !(ctx->options & 0x0001)) { if (ext2fs_test_valid(fs)) { if (!(sb->s_state & 0x0001)) exit_value |= 1; sb->s_state = 0x0001; if (check_backup_super_block(ctx)) fs->flags &= ~0x200; } else sb->s_state &= ~0x0001; if (!(ctx->flags & 0x2000)) sb->s_lastcheck = ctx->now; sb->s_mnt_count = 0; memset(((char *) sb) + __builtin_offsetof(struct ext2_super_block,s_error_count), 0, (__builtin_offsetof(struct ext2_super_block,s_mount_opts) - __builtin_offsetof(struct ext2_super_block,s_error_count))); pctx.errcode = ext2fs_set_gdt_csum(ctx->fs); if (pctx.errcode) fix_problem(ctx, 0x060003, &pctx); ext2fs_mark_super_dirty(fs); } if (ext2fs_has_feature_shared_blocks(ctx->fs->super) && (ctx->options & 0x40000) && (ctx->options & 0x0008)) goto skip_write; if (!(ctx->options & 0x0001)) { e2fsck_write_bitmaps(ctx); if (fs->flags & 0x04) { pctx.errcode = ext2fs_flush(ctx->fs); if (pctx.errcode) fix_problem(ctx, 0x060004, &pctx); } pctx.errcode = ((ctx->fs->io)->manager->flush((ctx->fs->io))); if (pctx.errcode) fix_problem(ctx, 0x060005, &pctx); } if (was_changed) { int fs_fixed = (ctx->flags & 0x4000); if (fs_fixed) exit_value |= 1; if (!(ctx->options & 0x0002)) { log_out(ctx, (gettext ("\n%s: ***** FILE SYSTEM WAS MODIFIED *****\n")), ctx->device_name); } if (ctx->mount_flags & 2) { log_out(ctx, (gettext ("%s: ***** REBOOT SYSTEM *****\n")), ctx->device_name); exit_value |= 2; } } skip_write: if (!ext2fs_test_valid(fs) || ((exit_value & 32) && (sb->s_state & 0x0002))) { log_out(ctx, (gettext ("\n%s: ********** WARNING: Filesystem still has " "errors **********\n\n")) , ctx->device_name); exit_value |= 4; exit_value &= ~1; } if (exit_value & 32) { int allow_cancellation; profile_get_boolean(ctx->profile, "options", "allow_cancellation", 0, 0, &allow_cancellation); exit_value &= ~1; if (allow_cancellation && ext2fs_test_valid(fs) && (sb->s_state & 0x0001) && !(sb->s_state & 0x0002)) exit_value = 0; } else show_stats(ctx); print_resource_track(ctx, ((void *)0) , &ctx->global_rtrack, ctx->fs->io); ext2fs_close_free(&ctx->fs); free(ctx->journal_name); if (ctx->logf) fprintf(ctx->logf, "Exit status: %d\n", exit_value); e2fsck_free_context(ctx); remove_error_table(&et_ext2_error_table); remove_error_table(&et_prof_error_table); return exit_value; }
int main(unsigned int a0, unsigned long long *a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { char v0; int tmp_29; int tmp_25; int tmp_21; char v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; unsigned int v12; unsigned int v13; unsigned int v14; unsigned int v15; unsigned int v16; unsigned int v17; unsigned int v18; unsigned int v19; unsigned int v20; void* v21; unsigned long long v22; char v23; unsigned long long v24; void* v25; void* v26; void* v27; struct_0 *v28; unsigned long long v29; char *v30; unsigned int *v31; unsigned int v32; unsigned int v33; unsigned long v34; unsigned long v35; unsigned int v36; unsigned int v37; unsigned int v38; char v39; unsigned long long v42; unsigned long long v43; unsigned long long v44; unsigned long long v49; unsigned long long v51; unsigned long long v52; unsigned long long v57; unsigned long long v59; unsigned long long v60; unsigned long long v62; unsigned long long v63; unsigned long long v68; unsigned long long v70; unsigned long long v73; unsigned long long v74; unsigned long long v75; unsigned long long v76; unsigned long long v77; unsigned long long v81; unsigned long long v84; unsigned long long v86; unsigned long long v89; v25 = 0; v26 = 0; v27 = 0; v3 = 0; v21 = 0; v29 = -1; v6 = 0x1000; clear_problem_context(&v34); sigcatcher_setup(&v34, a1, a2, a3, a4, a5); setlocale(0x5, &g_407ef9); setlocale(0x0, &g_407ef9); bindtextdomain("e2fsprogs", "/usr/share/locale"); textdomain("e2fsprogs"); set_com_err_gettext(got.gettext); v14 = ext2fs_parse_version_string(my_ver_string); v15 = ext2fs_get_library_version(0x0, &v23); if (v14 > v15) { fprintf(stderr, "%s", gettext("Error: ext2fs library version out of date!\n")); show_version_only = show_version_only + 1; } v25 = PRS(a0, a1, &v24); if (v25) { com_err("e2fsck", v25, "%s", gettext("while trying to initialize program")); exit(0x8); } reserve_stdio_fds(a0, a1, &v24); set_up_logging(v24); if (*((v24 + 40))) { fputs("E2fsck run: ", *((v24 + 40))); for (v8 = 0; v8 < a0; v8 += 1) { if (v8) fputc(0x20, *((v24 + 40))); fputs(a1[v8], *((v24 + 40))); } fputc(0xa, *((v24 + 40))); } if (*((v24 + 56))) { fputs("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", *((v24 + 56))); fprintf(*((v24 + 56)), "<problem_log time=\"%lu\">\n", *((v24 + 840))); a2 = *(a1); fprintf(*((v24 + 56)), "<invocation prog=\"%s\"", *(a1)); for (v9 = 1; v9 < a0; v9 += 1) { a3 = a1[v9]; a2 = v9; fprintf(*((v24 + 56)), " arg%d=\"%s\"", v9, a1[v9]); } fputs("/>\n", *((v24 + 56))); } init_resource_track(v24 + 640, 0x0); if (!(*((v24 + 76)) & 2) || show_version_only) log_err(v24, "e2fsck %s (%s)\n", my_ver_string, my_ver_date); if (show_version_only) { log_err(v24, gettext("\tUsing %s, %s\n"), error_message(0x7f2bb700), *(&v23)); exit(0x0); } check_mount(v24, a1, a2, a3, a4, a5); if (!(*((v24 + 76)) & 2) && !(*((v24 + 76)) & 8) && !(*((v24 + 76)) & 4) && !*((v24 + 728))) { v42 = gettext("need terminal for interactive repairs"); fatal_error(v24, v42, v42); } *((v24 + 96)) = *((v24 + 88)); v4 = 0x4100000; while (true) { v43 = getenv("TEST_IO_FLAGS"); if (!v43) { v43 = getenv("TEST_IO_BLOCK"); if (!v43) v22 = *(&unix_io_manager); } if (v43 || v43) { v22 = test_io_manager; test_io_backing_manager = *(&unix_io_manager); } v4 |= 0x10000; profile_get_boolean(*((v24 + 864)), "options", "old_bitmaps", 0x0, 0x0, &v1); if (!*(&v1)) v4 |= 0x20000; if (!(*((v24 + 76)) & 1)) { v4 |= 1; if (!(*((v24 + 124)) & 4) || !(*((v24 + 124)) & 2)) v4 |= 0x4000; if ((*((v24 + 124)) & 4) && (*((v24 + 76)) & 0x100)) v4 &= -16385; } if (*((v24 + 936))) { v25 = e2fsck_setup_tdb(v24, &v22); if (v25) exit(0x8); } if (!v25 || !*((v24 + 936))) { *((v24 + 128)) = v4; v25 = try_open_fs(v24, v4, v22, &v21); if (!*((v24 + 96)) && !(*((v24 + 76)) & 2) && !(*((v24 + 72)) & 0x100)) { if (!v25) v26 = ext2fs_check_desc(v21); if (v25 == 2133571480 || v25 == 2133571347 || v25 == 2133571388 || !v25 && v26) { if (v25) { v34 = v25; fix_problem(v24, 0x44, &v34); } if (v26) { v34 = v26; fix_problem(v24, 0x45, &v34); } v34 = 0; if (v26 != 12 && v26 != 2133571398) { if ((v21[16] & 0x10000)) { ext2fs_free(v21); v21 = 0; } if (!v21 || v21[48] > 1) { if (v25) v44 = gettext("Superblock invalid,"); else v44 = gettext("Group descriptors look bad..."); log_out(v24, gettext("%s: %s trying backup blocks...\n"), *((v24 + 8)), v44, 0x0, &v1, a1, *(&v0)); v29 = *((v24 + 96)); get_backup_sb(v24, v21, *((v24 + 16)), v22); if (v21) ext2fs_close_free(&v21); v27 = v25; v25 = try_open_fs(v24, v4, v22, &v21); if (!v27 && v25) { if (v21) ext2fs_close_free(&v21); log_out(v24, gettext("%s: %s while using the backup blocks"), *((v24 + 8)), error_message(v25), 0x0, &v1, a1, *(&v0)); v43 = gettext("%s: going back to original superblock\n"); log_out(v24, v43, *((v24 + 8)), v43, 0x0, &v1, a1, *(&v0)); *((v24 + 96)) = v29; v25 = try_open_fs(v24, v4, v22, &v21); } } } } } if (!(*((v24 + 72)) & 0x100) && v26 == 12 && !(*((v24 + 76)) & 2) && !*((v24 + 96)) && (v25 == 2133571480 || v25 == 2133571347 || v25 == 2133571388 || !v25) && (v25 == 2133571480 || v25 == 2133571347 || v25 == 2133571388 || v26) || !(*((v24 + 72)) & 0x100) && !(*((v24 + 76)) & 2) && !*((v24 + 96)) && v26 == 2133571398 && v26 != 12 && (v25 == 2133571480 || v25 == 2133571347 || v25 == 2133571388 || !v25) && (v25 == 2133571480 || v25 == 2133571347 || v25 == 2133571388 || v26)) v25 = v26; if (...) { v28 = v21[32]; v36 = v28->field_5c & -3648; v37 = v28->field_60 & -255967; v38 = v28->field_64 & -63356; } if (...) { if (v27) v25 = v27; com_err(*((v24 + 8)), v25, gettext("while trying to open %s"), *((v24 + 16))); if (v25 == 2133571348) { log_out(v24, "%s", gettext("The filesystem revision is apparently too high for this version of e2fsck.\n(Or the filesystem superblock is corrupt)\n\n"), a3, 0x0, &v1, a1, *(&v0)); fix_problem(v24, 0x4, &v34); } else if (v25 != 2133571364 && v25 != 1 && v25 != 13 && v25 != 6 && v25 != 16 && v25 != 2 && v25 != 30 && v25 == 2133571388 && !(v4 & 0x800000)) { if (v21) ext2fs_close_free(&v21); v51 = gettext("%s: Trying to load superblock despite errors...\n"); log_out(v24, v51, *((v24 + 8)), v51, 0x0, &v1, a1, *(&v0)); *(&v4) = v4 | &g_800000; if (v29 == -1) continue; *((v24 + 96)) = v29; continue; } if (v25 == 2133571364) log_out(v24, "%s", gettext("Could this be a zero-length partition?\n"), a3, 0x0, &v1, a1, *(&v0)); if (v25 == 6) log_out(v24, "%s", gettext("Possibly non-existent or swap device?\n"), a3, 0x0, &v1, a1, *(&v0)); if (v25 == 16) log_out(v24, "%s", gettext("Filesystem mounted or opened exclusively by another program?\n"), a3, 0x0, &v1, a1, *(&v0)); if (v25 == 2) log_out(v24, "%s", gettext("Possibly non-existent device?\n"), a3, 0x0, &v1, a1, *(&v0)); if (v25 == 30) log_out(v24, "%s", gettext("Disk write-protected; use the -n option to do a read-only\ncheck of the device.\n"), a3, 0x0, &v1, a1, *(&v0)); } if (...) { if ((*((v24 + 76)) & 1)) v49 = "r/o"; else v49 = "r/w"; v43 = gettext("You must have %s access to the filesystem or be root\n"); log_out(v24, v43, v49, v43, 0x0, &v1, a1, *(&v0)); } if (...) { fix_problem(v24, 0x4, &v34); if (v25 == 2133571347) check_plausibility(*((v24 + 16)), 0x4, 0x0); } if (...) fatal_error(v24, 0x0, a2); if (...) { a2 = v21[16]; *(&a2) = (v21[16] >> 8) | 2; tmp_29 = a2; *(&v21[16]) = tmp_29; if (!(*((v24 + 72)) & 0x800)) { v16 = 0x400 << (*((v21[32] + 24)) & 31); v10 = 0; v34 = ext2fs_get_device_size2(*((v24 + 16)), v16, v24 + 104, v16); if (v34 == 16) { ext2fs_close_free(&v21); v10 += 1; a3 = v16; v34 = ext2fs_get_device_size2(*((v24 + 16)), v16, v24 + 104, v16); } if (v34 == 2133571408) { *((v24 + 104)) = 0; } else if (v34) { fix_problem(v24, 0xc, &v34); v52 = *((v24 + 72)) | 1; *((v24 + 72)) = *((v24 + 72)) | 1; fatal_error(v24, 0x0, v52); } a2 = *((v24 + 72)); *(&a2) = (*((v24 + 72)) >> 8) | 8; tmp_25 = a2; *((v24 + 72)) = tmp_25; continue; } if (!v10) { *(v24) = v21; *(&v21[184]) = *((v24 + 840)); v28 = v21[32]; if (v28->field_4c > 1) com_err(*((v24 + 8)), 0x7f2bb714, gettext("while trying to open %s"), *((v24 + 16))); } } v43 = gettext("Get a newer version of e2fsck!"); fatal_error(v24, v43, v43); if (!*((v24 + 24)) && v28->field_78) *((v24 + 24)) = string_copy(v24, &v28->field_78, 0x10, &v28->field_78); if (!*((v24 + 24))) *((v24 + 24)) = string_copy(v24, *((v24 + 16)), 0x0, *((v24 + 16))); for (v30 = *((v24 + 24)); *(v30); v30 += 1) { *(&v43) = *((*(v30) * 2 + *(__ctype_b_loc()))); *(&v43) = v43 & 0x2000; if (*(v30) == 58 || v43) *(v30) = 95; } if (*((v24 + 56))) { a2 = *((v24 + 16)); fprintf(*((v24 + 56)), "<filesystem dev=\"%s\"", *((v24 + 16))); if (!uuid_is_null(&v28->padding_68)) { uuid_unparse(&v28->padding_68, &v39, &v28->padding_68); a2 = &v39; fprintf(*((v24 + 56)), " uuid=\"%s\"", &v39); } if (v28->field_78) { a3 = &v28->field_78; a2 = 16; fprintf(*((v24 + 56)), " label=\"%.*s\"", 16); } fputs("/>\n", *((v24 + 56))); } ehandler_init(v21[8]); v57 = ext2fs_has_feature_mmp(v21[32]); if (v57 && (v4 & 0x100000)) { if (e2fsck_check_mmp(v21, v24, v24, a3, 0x0, &v1)) fatal_error(v24, 0x0, a2); ext2fs_close_free(v24); v4 &= -1048577; continue; } if (!v57 || !(v4 & 0x100000)) { if (*((v24 + 40))) { a2 = e2p_uuid2str(&v28->padding_68); fprintf(*((v24 + 40)), "Filesystem UUID: %s\n", a2); } if (!(*((v24 + 124)) & 17)) { v25 = e2fsck_check_ext3_journal(v24); if (v25) { com_err(*((v24 + 8)), v25, gettext("while checking journal for %s"), *((v24 + 24))); v59 = gettext("Cannot proceed with file system check"); fatal_error(v24, v59, v59); } } v60 = ext2fs_has_feature_journal_needs_recovery(v28); if (v60) { if ((*((v24 + 76)) & 1)) { log_out(v24, "%s", gettext("Warning: skipping journal recovery because doing a read-only filesystem check.\n"), a3, 0x0, &v1, a1, *(&v0)); a2 = *((*((*((*(v24) + 8)) + 8)) + 56)); *((*((*((*(v24) + 8)) + 8)) + 56))(*((*(v24) + 8))); } else { if ((*((v24 + 72)) & 0x200)) { com_err(*((v24 + 8)), 0x0, gettext("unable to set superblock flags on %s\n"), *((v24 + 24))); fatal_error(v24, 0x0, a2); } v25 = e2fsck_run_ext3_journal(v24); if (v25 == 2133571503) { v68 = gettext("Journal checksum error found in %s\n"); log_out(v24, v68, *((v24 + 24)), v68, 0x0, &v1, a1, *(&v0)); } else if (v25 == 2133571502) { v70 = gettext("Journal corrupted in %s\n"); log_out(v24, v70, *((v24 + 24)), v70, 0x0, &v1, a1, *(&v0)); } else if (v25) { com_err(*((v24 + 8)), v25, gettext("while recovering journal of %s"), *((v24 + 24))); } ext2fs_close_free(v24); a2 = *((v24 + 72)); *(&a2) = (*((v24 + 72)) >> 8) | 2; tmp_21 = a2; *((v24 + 72)) = tmp_21; continue; } } } if (!v57 && !v60 || !(v4 & 0x100000) && !v60 || !v57 && (*((v24 + 76)) & 1) || !(v4 & 0x100000) && (*((v24 + 76)) & 1)) { v36 = v28->field_5c & -3648; v37 = v28->field_60 & -255967; v38 = v28->field_64 & -63356; } if (...) { v63 = ext2fs_has_feature_casefold(v28); if (v63 && !v21[360]) log_err(v24, gettext("%s has unsupported encoding: %0x\n"), *((v24 + 16)), v28->field_27c); } if (...) { v31 = &v36; v62 = gettext("%s has unsupported feature(s):"); log_err(v24, v62, *((v24 + 16)), v62); for (v11 = 0; v11 <= 2; v31 += 1) { v12 = 0; for (v13 = 1; v12 <= 31; v13 *= 2) { if ((*(v31) & v13)) log_err(v24, " %s", e2p_feature2string(v11, v13, v13), a3); v12 += 1; } v11 += 1; } log_err(v24, "\n", a2, a3); } if (...) { if (*((v24 + 96)) && !(*((v24 + 76)) & 1)) ext2fs_mark_super_dirty(v21); v17 = sysconf(0x1e); if (v17 > 0) v6 = v17; *((v24 + 872)) = (0 CONCAT v6) /m v21[40]; if (!*((v24 + 872))) *((v24 + 872)) = 1; if (*((v24 + 96))) set_latch_flags(0x50, 0x4, 0x0); ext2fs_mark_valid(v21); check_super_block(v24); if ((*((v24 + 72)) & 3)) fatal_error(v24, 0x0, a2); check_if_skip(v24); check_resize_inode(v24); if (bad_blocks_file) { read_bad_blocks_file(v24, bad_blocks_file, replace_bad_blocks, bad_blocks_file); } else if (cflag) { read_bad_blocks_file(v24, 0x0, !keep_bad_blocks, a3); } if ((*((v24 + 72)) & 3)) fatal_error(v24, 0x0, a2); ext2fs_mark_valid(v21); v25 = ext2fs_read_bb_inode(v21, v21 + 136, v21 + 136); if (v25) { log_out(v24, gettext("%s: %s while reading bad blocks inode\n"), *((v24 + 8)), error_message(v25), 0x0, &v1, a1, *(&v0)); preenhalt(v24); log_out(v24, "%s", gettext("This doesn't bode well, but we'll try to go on...\n"), a3, 0x0, &v1, a1, *(&v0)); } if (v28->field_fd == 1) { v73 = ext2fs_has_feature_fast_commit(v28); if (!v73) v5 = (v28->field_14c >> 20) | (v28->field_148 * 0x1000); } if (v73 || v28->field_fd != 1) v5 = -1; v74 = ext2fs_has_feature_quota(v28); if (v74) { clear_problem_context(&v34); v34 = quota_init_context(v24 + 632, *(v24), 0x0, v24 + 632); if (v34) { fix_problem(v24, 0x4c, &v34); fatal_error(v24, 0x0, &v34); } } v18 = e2fsck_run(v24); e2fsck_clear_progbar(v24); if (!*((v24 + 520)) && (*((v24 + 72)) & 128)) { v74 = fix_problem(v24, 0x60001, &v34); if (v74) { if (v5 <= 1023) { ext2fs_get_journal_params(&v32, v21, v21); } else { v32 = v5; v33 = 0; } v74 = gettext("Creating journal (%d blocks): "); log_out(v24, v74, v32, v74, 0x0, &v1, a1, *(&v0)); fflush(stdout); v25 = ext2fs_add_journal_inode3(v21, &v32, 0xffffffffffffffff, 0x0); if (v25) { log_out(v24, "%s: while trying to create journal\n", error_message(v25), 0x0, 0x0, &v1, a1, *(&v0)); } else { log_out(v24, "%s", gettext(" Done.\n"), 0x0, 0x0, &v1, a1, *(&v0)); log_out(v24, "%s", gettext("\n*** journal has been regenerated ***\n"), 0x0, 0x0, &v1, a1, *(&v0)); } } } if ((v18 & 1)) { v75 = gettext("aborted"); fatal_error(v24, v75, v75); } else if ((v18 & 2)) { if (*((v24 + 24))) v76 = *((v24 + 24)); else v76 = *((v24 + 16)); v77 = gettext("%s: e2fsck canceled.\n"); log_out(v24, v77, v76, v77, 0x0, &v1, a1, *(&v0)); v3 |= 32; } else if (*((v24 + 632)) && !*((v24 + 520))) { for (v7 = 0; v7 <= 2; v7 += 1) { *(&v74) = *(quota_sb_inump(v28, v7)); if (v74) { v2 = 0; v35 = v7; a3 = v7; v25 = quota_compare_and_update(*((v24 + 632)), v7, &v2, v7); if ((v2 || v25) && fix_problem(v24, 0x60002, &v34)) { a3 = v7; v34 = quota_write_inode(*((v24 + 632)), 1 << (v7 & 31), 1 << (v7 & 31), v7); if (v34) fix_problem(v24, 0x60006, &v34); } } } quota_release_context(v24 + 632); } if (v18 != 4) break; if (v18 == 4) { log_out(v24, "%s", gettext("Restarting e2fsck from the beginning...\n"), a3, 0x0, &v1, a1, *(&v0)); v25 = e2fsck_reset_context(v24); if (v25) { com_err(*((v24 + 8)), v25, "%s", gettext("while resetting context")); fatal_error(v24, 0x0, "%s"); } ext2fs_close_free(v24); } } } } v19 = ext2fs_test_changed(v21); if (!(*((v24 + 72)) & 7) && !(*((v24 + 76)) & 1)) { if (ext2fs_test_valid(v21)) { if (!(v28->field_3a & 1)) v3 |= 1; v28->field_3a = 1; if (check_backup_super_block(v24)) { v81 = v21[16]; *(&v81) = (v21[16] >> 8) & 253; tmp_21 = v81; *(&v21[16]) = tmp_21; } } else { v28->field_3a = v28->field_3a & 4294967294; } if (!(*((v24 + 72)) & 0x2000)) v28->field_40 = *((v24 + 840)); v28->field_34 = 0; memset(&v28->padding_150[68], 0x0, 0x6c); v34 = ext2fs_set_gdt_csum(*(v24)); if (v34) fix_problem(v24, 0x60003, &v34); ext2fs_mark_super_dirty(v21); } if (!ext2fs_has_feature_shared_blocks(*((*(v24) + 32))) || !(*((v24 + 76)) & 0x40000) || !(*((v24 + 76)) & 8)) { if (!(*((v24 + 76)) & 1)) { e2fsck_write_bitmaps(v24); if ((v21[16] & 4)) { v34 = ext2fs_flush(*(v24)); if (v34) fix_problem(v24, 0x60004, &v34); } v34 = *((*((*((*(v24) + 8)) + 8)) + 56))(*((*(v24) + 8))); if (v34) fix_problem(v24, 0x60005, &v34); } if (v19) { v20 = *((v24 + 72)) & 0x4000; if (v20) v3 |= 1; if (!(*((v24 + 76)) & 2)) { v84 = gettext("\n%s: ***** FILE SYSTEM WAS MODIFIED *****\n"); log_out(v24, v84, *((v24 + 24)), v84, 0x0, &v1, a1, *(&v0)); } if ((*((v24 + 124)) & 2)) { v86 = gettext("%s: ***** REBOOT SYSTEM *****\n"); log_out(v24, v86, *((v24 + 24)), v86, 0x0, &v1, a1, *(&v0)); v3 |= 2; } } } if (!ext2fs_test_valid(v21) || (v28->field_3a & 2) && (v3 & 32)) { v89 = gettext("\n%s: ********** WARNING: Filesystem still has errors **********\n\n"); log_out(v24, v89, *((v24 + 24)), v89, 0x0, &v1, a1, *(&v0)); v3 |= 4; v3 &= -2; } if ((v3 & 32)) { profile_get_boolean(*((v24 + 864)), "options", "allow_cancellation", 0x0, 0x0, &v2); v3 &= -2; if (v2 && ext2fs_test_valid(v21) && (v28->field_3a & 1) && !(v28->field_3a & 2)) v3 = 0; } else { show_stats(v24); } print_resource_track(v24, 0x0, v24 + 640, *((*(v24) + 8))); ext2fs_close_free(v24); free(*((v24 + 624))); if (*((v24 + 40))) fprintf(*((v24 + 40)), "Exit status: %d\n", v3); e2fsck_free_context(v24); remove_error_table(0x5001c0); remove_error_table(0x5001d0); return v3; }
static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx, struct ea_quota *ea_ibody_quota) { struct ext2_super_block *sb = ctx->fs->super; struct ext2_inode_large *inode; struct ext2_ext_attr_entry *entry; char *start, *header, *end; unsigned int storage_size, remain; problem_t problem = 0; region_t region = 0; ea_ibody_quota->blocks = 0; ea_ibody_quota->inodes = 0; inode = (struct ext2_inode_large *) pctx->inode; storage_size = (((ctx->fs->super)->s_rev_level == 0) ? 128 : (ctx->fs->super)->s_inode_size) - 128 - inode->i_extra_isize; header = ((char *) inode) + 128 + inode->i_extra_isize; end = header + storage_size; start = header + sizeof(__u32); entry = (struct ext2_ext_attr_entry *) start; remain = storage_size - sizeof(__u32); region = region_create(0, storage_size); if (!region) { fix_problem(ctx, 0x01003F, pctx); problem = 0; ctx->flags |= 0x0001; return; } if (region_allocate(region, 0, sizeof(__u32))) { problem = 0x010069; goto fix; } while (remain >= sizeof(struct ext2_ext_attr_entry) && !(*((__u32 *)(entry)) == 0UL)) { __u32 hash; if (region_allocate(region, (char *)entry - (char *)header, (((entry->e_name_len) + (((unsigned) 1<<2)-1) + sizeof(struct ext2_ext_attr_entry)) & ~(((unsigned) 1<<2)-1)))) { problem = 0x010069; goto fix; } remain -= sizeof(struct ext2_ext_attr_entry); if ((((entry->e_name_len) + (((unsigned) 1<<2)-1)) & ~(((unsigned) 1<<2)-1)) > remain) { pctx->num = entry->e_name_len; problem = 0x010050; goto fix; } remain -= (((entry->e_name_len) + (((unsigned) 1<<2)-1)) & ~(((unsigned) 1<<2)-1)); if (entry->e_value_inum == 0) { if (entry->e_value_size > remain) { pctx->num = entry->e_value_size; problem = 0x010053; goto fix; } if (entry->e_value_size && region_allocate(region, sizeof(__u32) + entry->e_value_offs, (((entry->e_value_size) + (((unsigned) 1<<2)-1)) & ~(((unsigned) 1<<2)-1)) )) { problem = 0x010069; goto fix; } hash = ext2fs_ext_attr_hash_entry(entry, start + entry->e_value_offs); if (entry->e_hash != 0 && entry->e_hash != hash) { pctx->num = entry->e_hash; problem = 0x010054; goto fix; } } else { blk64_t quota_blocks; problem = check_large_ea_inode(ctx, entry, pctx, &quota_blocks); if (problem != 0) goto fix; ea_ibody_quota->blocks += quota_blocks; ea_ibody_quota->inodes++; } if (entry->e_value_inum == 0) remain -= entry->e_value_size; entry = ( (struct ext2_ext_attr_entry *)( (char *)(entry) + ((((entry)->e_name_len) + (((unsigned) 1<<2)-1) + sizeof(struct ext2_ext_attr_entry)) & ~(((unsigned) 1<<2)-1))) ); } if (region_allocate(region, (char *)entry - (char *)header, sizeof(__u32))) { problem = 0x010069; goto fix; } fix: if (region) region_free(region); if (problem == 0 || !fix_problem(ctx, problem, pctx)) { inc_ea_inode_refs(ctx, pctx, (struct ext2_ext_attr_entry *)start, end); return; } *((__u32 *)header) = 0UL; e2fsck_write_inode_full(ctx, pctx->ino, pctx->inode, (((sb)->s_rev_level == 0) ? 128 : (sb)->s_inode_size), "pass1"); ea_ibody_quota->blocks = 0; ea_ibody_quota->inodes = 0; }
void check_ea_in_inode(struct_1 *a0, struct_0 *a1, unsigned long long a2[2]) { unsigned long long v0[2]; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; char v5; struct_5 *v6; struct_4 *v7; void* v8; struct_3 *v9; unsigned int *v10; unsigned int v11; void* v12; char v13; unsigned int v15; unsigned long long v18; unsigned long long v19; unsigned long long v20; unsigned long long v21; unsigned long long *v22; unsigned long long v23; v0[0] = a2; v7 = a0->field_0->field_20; v2 = 0; v8 = 0; a2[0] = 0; a2[1] = 0; v9 = a1->field_18; if (*((a0->field_0->field_20 + 76))) v15 = *((a0->field_0->field_20 + 88)) - 128; else v15 = 0; v3 = v15 - v9->field_80; v10 = &v9->padding_0[v9->field_80 + 128]; *(&v11) = v10 + v3; v12 = v10 + 1; v6 = v12; v1 = v3 - 4; v8 = region_create(0x0, v3, v3); if (!v8) { fix_problem(a0, 0x1003f, a1); v2 = 0; a0->field_48 = a0->field_48 | 1; } else { if (region_allocate(v8, 0x0, 0x4)) { v2 = 65641; } else { while (true) { if (v1 > 15 && *(&v6->field_0)) { if (region_allocate(v8, v6 - v10, v6->field_0 + 19 & 0xfffffffc)) { v2 = 65641; break; } else { v1 -= 16; if (v1 < (v6->field_0 + 3 & 0xfffffffc)) { a1->field_50 = v6->field_0; v2 = 65616; break; } else { v1 -= v6->field_0 + 3 & 0xfffffffc; if (v6->field_4) { v2 = check_large_ea_inode(a0, v6, a1, &v5); if (v2) break; if (!v2) { a2[0] = a2[0] + *(&v5); a2[1] = a2[1] + 1; } } else if (v1 < v6->field_8) { a1->field_50 = v6->field_8; v2 = 65619; break; } else { if (v6->field_8) { v18 = region_allocate(v8, v6->field_2 + 4, v6->field_8 + 3 & -0x4); if (v18) { v2 = 65641; break; } } if (!v6->field_8 || !v18) { v4 = ext2fs_ext_attr_hash_entry(v6, v6->field_2 + v12, v6->field_2 + v12); if (v6->field_c && v4 != v6->field_c) { a1->field_50 = v6->field_c; v2 = 65620; break; } } } if (v6->field_4 || !v6->field_8 && v4 == v6->field_c && v1 >= v6->field_8 || !v6->field_8 && !v6->field_c && v1 >= v6->field_8 || !v18 && v4 == v6->field_c && v1 >= v6->field_8 || !v18 && !v6->field_c && v1 >= v6->field_8) { if (!v6->field_4) v1 -= v6->field_8; v6 = &(&v6->field_0)[v6->field_0 + 19 & 0xfffffffc]; continue; } } } } if (!*(&v6->field_0) || v1 <= 15) { v19 = region_allocate(v8, v6 - v10, 0x4); if (!v19) break; if (v19) { v2 = 65641; break; } } } } if (v8) region_free(v8); if (v2) { v20 = fix_problem(a0, v2, a1); if (v20) { *(v10) = 0; if (v7->field_4c) v21 = v7->field_58; else v21 = 128; e2fsck_write_inode_full(a0, a1->field_8, a1->field_18, v21, "pass1"); a2[0] = 0; a2[1] = 0; } } if (!v2 || !v20) inc_ea_inode_refs(a0, a1, v12, *(&v11)); } v23 = *(&v13) ^ v22[5]; return; }
int channel_find_open(struct ssh *ssh) { u_int i; Channel *c; for (i = 0; i < ssh->chanctxt->channels_alloc; i++) { c = ssh->chanctxt->channels[i]; if (c == ((void *)0) || !c->have_remote_id) continue; switch (c->type) { case 5: case 13: case 21: case 22: case 1: case 2: case 11: case 15: case 16: case 20: case 3: case 12: case 14: case 17: case 18: case 19: continue; case 10: case 6: case 4: case 7: return i; default: sshfatal("channels.c", __func__, 843, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "bad channel type %d", c->type); } } return -1; }
uint channel_find_open(long param_1) { undefined *puVar1; undefined *puVar2; char *apcStack64 [2]; ulong uStack48; undefined auStack40 [8]; long local_20; uint local_14; uint *local_10; puVar2 = auStack40; local_20 = param_1; for (local_14 = 0; local_14 < *(uint *)(*(long *)(local_20 + 0x868) + 8); local_14 = local_14 + 1) { local_10 = *(uint **)(**(long **)(local_20 + 0x868) + (ulong)local_14 * 8); puVar1 = puVar2; if ((local_10 != (uint *)0x0) && (local_10[3] != 0)) { switch(*local_10) { default: *(ulong *)(puVar2 + -8) = (ulong)*local_10; puVar1 = puVar2 + -0x10; *(char **)(puVar2 + -0x10) = "bad channel type %d"; *(undefined8 *)(puVar2 + -0x18) = 0x101b2a; sshfatal("channels.c","channel_find_open",0x34b,1,1,0); break; case 1: case 2: case 3: case 5: case 0xb: case 0xc: case 0xd: case 0xe: case 0xf: case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: break; case 4: case 6: case 7: case 10: return local_14; } } puVar2 = puVar1; } return 0xffffffff; }
static void depmod_modules_sort(struct depmod *depmod) { char line[ 4096 ]; const char *order_file = "modules.order"; FILE *fp; unsigned idx = 0, total = 0; fp = dfdopen(depmod->cfg->dirname, order_file, 00 , "r"); if (fp == ((void *)0) ) return; while (fgets(line, sizeof(line), fp) != ((void *)0) ) { size_t len = strlen(line); idx++; if (len == 0) continue; if (line[len - 1] != '\n') { log_printf( 3 , "%s/%s:%u corrupted line misses '\\n'\n", depmod->cfg->dirname, order_file, idx) ; goto corrupted; } } total = idx + 1; idx = 0; fseek(fp, 0, 0 ); while (fgets(line, sizeof(line), fp) != ((void *)0) ) { size_t len = strlen(line); struct mod *mod; idx++; if (len == 0) continue; line[len - 1] = '\0'; mod = hash_find(depmod->modules_by_uncrelpath, line); if (mod == ((void *)0) ) continue; mod->sort_idx = idx - total; } array_sort(&depmod->modules, mod_cmp); for (idx = 0; idx < depmod->modules.count; idx++) { struct mod *m = depmod->modules.array[idx]; m->idx = idx; } corrupted: fclose(fp); }
void depmod_modules_sort(unsigned long long a0[7], unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4) { unsigned int v0; unsigned int v1; unsigned long long v2; void* v3; struct_0 *v4; char *v5; struct_1 *v6; char *v7; char v8; char v9; char v10; unsigned long long *v14; unsigned long long v15; v9 = *(&v9); v2 = "modules."; v0 = 0; v1 = 0; v3 = dfdopen(a0[0] + 8, v2, 0x0, "r", a4); if (v3) { while (true) { if (fgets(&v8, 0x1000, v3)) { v7 = strlen(&v8); v0 += 1; if (!v7) continue; if (*((&v7 + v7)) == 10) continue; log_printf(0x3, "%s/%s:%u corrupted line misses '\\n'\n", a0[0] + 8, v2, v0); break; } else { v1 = v0 + 1; v0 = 0; fseek(v3, 0x0, 0x0); while (true) { if (fgets(&v8, 0x1000, v3)) { v5 = strlen(&v8); v0 += 1; if (!v5) continue; *((&v7 + v5)) = 0; v6 = hash_find(a0[6], &v8, &v8); if (!v6) continue; v6->field_60 = v0 - v1; } else { array_sort(&a0[2], mod_cmp); for (v0 = 0; v0 < a0[3]; v0 += 1) { v4 = *((a0[2] + v0 * 8)); v4->field_68 = v0; } } } } } fclose(v3); } v15 = *(&v10) ^ v14[5]; return; }
static void prepareBackground(const int parentPipeFD) { if(Debug) { r_dbgprintf("rsyslogd.c", "rsyslogd: in child, finalizing initialization\n"); }; dbgTimeoutToStderr = 0; int r = setsid(); if(r == -1) { char err[1024]; char em[2048]; rs_strerror_r( (*__errno_location ()) , err, sizeof(err)); snprintf(em, sizeof(em)-1, "rsyslog: error " "auto-backgrounding: %s\n", err); r_dbgprintf("rsyslogd.c", "%s\n", em); fprintf( stderr , "%s", em); } int beginClose = 3; const int endClose = getdtablesize(); close(0); for(int i = beginClose ; i <= endClose ; ++i) { if((i != dbgGetDbglogFd()) && (i != parentPipeFD)) { close(i); } } seedRandomNumberForChild(); }
unsigned long prepareBackground(int a1) { int *v1; int fd; int v4; char v5[1024]; char s[2056]; unsigned long v7; v7 = __readfsqword(0x28u); if ( Debug ) r_dbgprintf("rsyslogd.c", "rsyslogd: in child, finalizing initialization\n"); dbgTimeoutToStderr = 0; if ( setsid() == -1 ) { v1 = _errno_location(); rs_strerror_r((unsigned int)*v1, v5, 1024LL); snprintf(s, 0x7FFuLL, "rsyslog: error auto-backgrounding: %s\n", v5); r_dbgprintf("rsyslogd.c", "%s\n", s); fprintf(stderr, "%s", s); } v4 = getdtablesize(); close(0); for ( fd = 3; fd <= v4; ++fd ) { if ( fd != (unsigned int)dbgGetDbglogFd() && fd != a1 ) close(fd); } seedRandomNumberForChild(); return __readfsqword(0x28u) ^ v7; }
static void checksigs (void) { int s = signal_received; if (s) { cleanup (0); untrapsig (s); raise (s); exit (2); } }
void checksigs(void) { int __sig; __sig = signal_received; if (signal_received != 0) { cleanup((EVP_PKEY_CTX *)0x0); untrapsig(); raise(__sig); exit(2); } return; }
static int match_principals_file(struct passwd *pw, char *file, struct sshkey_cert *cert, struct sshauthopt **authoptsp) { FILE *f; int success; if (authoptsp != ((void *)0) ) *authoptsp = ((void *)0) ; temporarily_use_uid(pw); sshlog("auth2-pubkey.c", __func__, 333, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "trying authorized principals file %s", file); if ((f = auth_openprincipals(file, pw, options.strict_modes)) == ((void *)0) ) { restore_uid(); return 0; } success = auth_process_principals(f, file, cert, authoptsp); fclose(f); restore_uid(); return success; }
int match_principals_file(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long *a3) { unsigned int v0; void* v1; unsigned int v3; if (a3) *(a3) = 0; temporarily_use_uid(a0); sshlog("auth2-pubkey.c", "match_principals_file", 0x14d, 0x0, 0x5, 0x0, "trying authorized principals file %s", a1, a3, a2, a1); v1 = auth_openprincipals(a1, a0, *(5244072), a0); if (!v1) { restore_uid(); v3 = 0; } else { v0 = auth_process_principals(v1, a1, a2, a3); fclose(v1); restore_uid(); v3 = v0; } return v3; }
int check_command(gnutls_session_t session, const char *str, unsigned no_cli_cert) { size_t len = strnlen(str, 128); int ret; fprintf( stderr , "*** Processing %u bytes command: %s\n", (unsigned)len, str); if (len > 2 && str[0] == str[1] && str[0] == '*') { if (strncmp (str, "**REHANDSHAKE**", sizeof("**REHANDSHAKE**") - 1) == 0) { fprintf( stderr , "*** Sending rehandshake request\n"); gnutls_rehandshake(session); return 1; } else if (strncmp (str, "**REAUTH**", sizeof("**REAUTH**") - 1) == 0) { if (no_cli_cert) gnutls_certificate_server_set_request(session, GNUTLS_CERT_REQUIRE); fprintf( stderr , "*** Sending re-auth request\n"); do { ret = gnutls_reauth(session, 0); } while(ret == -28 || ret == -52); if (ret < 0) { fprintf( stderr , "reauth: %s\n", gnutls_strerror(ret)); return ret; } return 1; } else if (strncmp (str, "**HEARTBEAT**", sizeof("**HEARTBEAT**") - 1) == 0) { ret = gnutls_heartbeat_ping(session, 300, 5, 1); if (ret < 0) { if (ret == -50) { fprintf( stderr , "No heartbeat in this session\n"); } else { fprintf( stderr , "ping: %s\n", gnutls_strerror(ret)); return ret; } } return 2; } } return 0; }
long check_command(long a1, long a2, int a3) { const char *v4; const char *v5; int v7; int v8; size_t v9; v9 = strnlen((const char *)a2, 0x80uLL); fprintf(stderr, "*** Processing %u bytes command: %s\n", (unsigned int)v9, (const char *)a2); if ( v9 <= 2 || *(_BYTE *)a2 != *(_BYTE *)(a2 + 1) || *(_BYTE *)a2 != 42 ) return 0LL; if ( !strncmp((const char *)a2, "**REHANDSHAKE**", 0xFuLL) ) { fprintf(stderr, "*** Sending rehandshake request\n"); gnutls_rehandshake(a1); return 1LL; } if ( !strncmp((const char *)a2, "**REAUTH**", 0xAuLL) ) { if ( a3 ) gnutls_certificate_server_set_request(a1, 2LL); fprintf(stderr, "*** Sending re-auth request\n"); do { do v7 = gnutls_reauth(a1, 0LL); while ( v7 == -28 ); } while ( v7 == -52 ); if ( v7 >= 0 ) return 1LL; v4 = (const char *)gnutls_strerror((unsigned int)v7); fprintf(stderr, "reauth: %s\n", v4); return (unsigned int)v7; } if ( strncmp((const char *)a2, "**HEARTBEAT**", 0xDuLL) ) return 0LL; v8 = gnutls_heartbeat_ping(a1, 300LL, 5LL, 1LL); if ( v8 < 0 ) { if ( v8 != -50 ) { v5 = (const char *)gnutls_strerror((unsigned int)v8); fprintf(stderr, "ping: %s\n", v5); return (unsigned int)v8; } fprintf(stderr, "No heartbeat in this session\n"); } return 2LL; }
static void fill_mount_table (void) { struct mount_entry *mnt_ent = read_file_system_list ( 0 ); while (mnt_ent) { struct mount_entry *mnt_free; if (!mnt_ent->me_remote && !mnt_ent->me_dummy) { struct stat buf; if (!stat (mnt_ent->me_mountdir, &buf)) hash_ins (di_mnt, buf.st_ino, buf.st_dev); else { } } mnt_free = mnt_ent; mnt_ent = mnt_ent->me_next; free_mount_entry (mnt_free); } }
void fill_mount_table() { struct_0 *v0; struct_0 *v1; char v2; char v3; char v4; unsigned long long *v6; unsigned long long v7; v0 = read_file_system_list(0x0); while (v0) { if (!(v0->field_28 & 2) && !(v0->field_28 & 1) && !stat(v0->field_8, &v2)) hash_ins(di_mnt, *(&v3), *(&v2)); v1 = v0; v0 = v0->field_30; free_mount_entry(v1); } v7 = *(&v4) ^ v6[5]; return; }
int _rl_forward_char_internal (int count) { int point; point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, 0x01); if (point >= rl_end && (rl_editing_mode == 0 && _rl_keymap == vi_movement_keymap)) point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, 0x01); if (rl_end < 0) rl_end = 0; if (point > rl_end) point = rl_end; return (point); }
int _rl_forward_char_internal(unsigned long a0) { unsigned int v0; v0 = _rl_find_next_mbchar(rl_line_buffer, rl_point, a0, 0x1); if (v0 >= rl_end && !rl_editing_mode && _rl_keymap == 5243032) v0 = _rl_find_prev_mbchar(rl_line_buffer, rl_end, 0x1, rl_end); if (rl_end < 0) rl_end = 0; if (v0 > rl_end) v0 = rl_end; return v0; }
void assign_string_n (char **string, const char *value, size_t n) { free (*string); if (value) { size_t l = strnlen (value, n); char *p = xmalloc (l + 1); memcpy (p, value, l); p[l] = 0; *string = p; } }
long long assign_string_n(unsigned long long *a0, void* a1, unsigned int a2) { char *v0; char *v1; unsigned long long *v3; v3 = free(*(a0)); if (a1) { v0 = strnlen(a1, a2); v1 = xmalloc(v0 + 1); memcpy(v1, a1, v0); *((v0 + v1)) = 0; v3 = a0; *(a0) = v1; return v3; } return v3; }
void finish_header (struct tar_stat_info *st, union block *header, off_t block_ordinal) { if (verbose_option && header->header.typeflag != 'K' && header->header.typeflag != 'L' && header->header.typeflag != 'x' && header->header.typeflag != 'g') { current_format = archive_format; print_header (st, header, block_ordinal); } header = write_extended ( 0 , st, header); simple_finish_header (header); }
void finish_header(unsigned long long a0, unsigned long long a1, unsigned long long a2) { unsigned long long v0; unsigned long long v2; v0 = a1; if (verbose_option && v0->field_9c != 75 && v0->field_9c != 76 && v0->field_9c != 120 && v0->field_9c != 103) { current_format = archive_format; print_header(a0, v0, a2, v0); } v0 = write_extended(0x0, a0, v0); v2 = simple_finish_header(v0); return; }
static void parse_hex_u64(const char *s, uint64_t *up) { char *ep; unsigned long long ull; (*__errno_location ()) = 0; ull = strtoull(s, &ep, 16); if (*s == '\0' || *ep != '\0') sshfatal("ssh-keygen.c", __func__, 1928, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "Invalid certificate time: not a number"); if ( (*__errno_location ()) == 34 && ull == (0x7fffffffffffffffL * 2UL + 1UL) ) sshfatal("ssh-keygen.c", __func__, 1930, 1, SYSLOG_LEVEL_FATAL, ssh_err(-24), "Invalid certificate time"); *up = (uint64_t)ull; }
unsigned long parse_hex_u64(const char *a1, unsigned long *a2) { long v2; char *endptr; unsigned long v5; unsigned long v6; v6 = __readfsqword(0x28u); *_errno_location() = 0; v5 = strtoull(a1, &endptr, 16); if ( !*a1 || *endptr ) sshfatal("ssh-keygen.c", "parse_hex_u64", 1928LL, 0LL, 1LL, 0LL, "Invalid certificate time: not a number"); if ( *_errno_location() == 34 && v5 == -1LL ) { v2 = ssh_err(4294967272LL); sshfatal("ssh-keygen.c", "parse_hex_u64", 1930LL, 1LL, 1LL, v2, "Invalid certificate time"); } *a2 = v5; return __readfsqword(0x28u) ^ v6; }
sh_timer * shtimer_alloc (void) { sh_timer *t; t = (sh_timer *)sh_xmalloc((sizeof (sh_timer)), "timers.c", 76); shtimer_zero (t); return t; }
long long shtimer_alloc() { void* v0; v0 = sh_xmalloc(0x108, "timers.c", 0x4c); shtimer_zero(v0); return v0; }
static inline int max_int_length(int bytes) { return (bytes * 8 - 1) * 0.30102999566398119521 + 14; }
int max_int_length(unsigned long a0) { unsigned long long v1; int v2; v1 = (a0 * 8) - 1; return (0x402c000000000000 + v2 * 4599094494223104511); }
void * page_aligned_alloc (void **ptr, size_t size) { size_t alignment = getpagesize (); size_t size1 = size + alignment; if (size1 < size) xalloc_die (); *ptr = xmalloc (size1); return ptr_align (*ptr, alignment); }
long long page_aligned_alloc(unsigned long long *a0, unsigned long a1) { unsigned int v0; unsigned long long v1; *(&v0) = getpagesize(); v1 = *(&v0) + a1; if (v1 < a1) xalloc_die(); *(a0) = xmalloc(v1); return ptr_align(*(a0), *(&v0)); }
char * bash_groupname_completion_function (text, state) const char *text; int state; { static char *gname = (char *) ((void *)0) ; static struct group *grent; static int gnamelen; char *value; if (state == 0) { do { if (gname) sh_xfree((gname), "bashline.c", 2658); } while (0); gname = (char *)strcpy (sh_xmalloc((1 + strlen (text)), "bashline.c", 2659), (text)); gnamelen = strlen (gname); setgrent (); } while (grent = getgrent ()) { if (gnamelen == 0 || (((gnamelen == 0) ? (1) : ((gname)[0] == (grent->gr_name)[0] && strncmp(gname, grent->gr_name, gnamelen) == 0)))) break; } if (grent == 0) { endgrent (); return ((char *) ((void *)0) ); } value = (char *)strcpy (sh_xmalloc((1 + strlen (grent->gr_name)), "bashline.c", 2677), (grent->gr_name)); return (value); }
long long bash_groupname_completion_function(char *a0, unsigned long a1) { unsigned long long v0; void* v2; if (!a1) { if (gname.11626) sh_xfree(gname.11626, "bashline.c", 0xa62); gname.11626 = strcpy(sh_xmalloc(strlen(a0) + 1, "bashline.c", 0xa63), a0); gnamelen.11628 = strlen(gname.11626); setgrent(); } while (true) { grent.11627 = getgrent(); if (!(grent.11627) || !(gnamelen.11628)) break; if (!(*(gname.11626) == *(*(grent.11627)))) continue; if (!strncmp(gname.11626, *(grent.11627), gnamelen.11628)) break; } if (!grent.11627) { endgrent(); v2 = 0; return v2; } v0 = strcpy(sh_xmalloc(strlen(*(grent.11627)) + 1, "bashline.c", 0xa75), *(grent.11627)); v2 = v0; return v2; }
void channel_send_window_changes(struct ssh *ssh) { struct ssh_channels *sc = ssh->chanctxt; struct winsize ws; int r; u_int i; for (i = 0; i < sc->channels_alloc; i++) { if (sc->channels[i] == ((void *)0) || !sc->channels[i]->client_tty || sc->channels[i]->type != 4) continue; if (ioctl(sc->channels[i]->rfd, 0x5413 , &ws) == -1) continue; channel_request_start(ssh, i, "window-change", 0); if ((r = sshpkt_put_u32(ssh, (u_int)ws.ws_col)) != 0 || (r = sshpkt_put_u32(ssh, (u_int)ws.ws_row)) != 0 || (r = sshpkt_put_u32(ssh, (u_int)ws.ws_xpixel)) != 0 || (r = sshpkt_put_u32(ssh, (u_int)ws.ws_ypixel)) != 0 || (r = sshpkt_send(ssh)) != 0) sshfatal("channels.c", __func__, 4726, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %u; send window-change", i); } }
unsigned long channel_send_window_changes(long a1) { long v1; unsigned int v3; unsigned int i; long v5; short v6[4]; unsigned long v7; v7 = __readfsqword(0x28u); v5 = *(_QWORD *)(a1 + 2152); for ( i = 0; i < *(_DWORD *)(v5 + 8); ++i ) { if ( *(_QWORD *)(8LL * i + *(_QWORD *)v5) ) { if ( *(_DWORD *)(*(_QWORD *)(8LL * i + *(_QWORD *)v5) + 76LL) ) { if ( **(_DWORD **)(8LL * i + *(_QWORD *)v5) == 4 && ioctl(*(_DWORD *)(*(_QWORD *)(8LL * i + *(_QWORD *)v5) + 28LL), 0x5413uLL, v6) != -1 ) { channel_request_start(a1, i, "window-change", 0); v3 = sshpkt_put_u32(a1, (unsigned short)v6[1]); if ( v3 || (v3 = sshpkt_put_u32(a1, (unsigned short)v6[0])) != 0 || (v3 = sshpkt_put_u32(a1, (unsigned short)v6[2])) != 0 || (v3 = sshpkt_put_u32(a1, (unsigned short)v6[3])) != 0 || (v3 = sshpkt_send(a1)) != 0 ) { v1 = ssh_err(v3); sshfatal( "channels.c", "channel_send_window_changes", 4726LL, 1LL, 1LL, v1, "channel %u; send window-change", i); } } } } } return __readfsqword(0x28u) ^ v7; }
static acl_t perms2acl (int perms) { char val[] = "user::---,group::---,other::---"; if (perms & 0400) val[6] = 'r'; if (perms & 0200) val[7] = 'w'; if (perms & 0100) val[8] = 'x'; if (perms & 0040) val[17] = 'r'; if (perms & 0020) val[18] = 'w'; if (perms & 0010) val[19] = 'x'; if (perms & 0004) val[28] = 'r'; if (perms & 0002) val[29] = 'w'; if (perms & 0001) val[30] = 'x'; return acl_from_text (val); }
int perms2acl(unsigned long a0) { unsigned long long v0; char v1; char v2; char v3; unsigned long long v4; char v5; char v6; char v7; unsigned long long v8; char v9; char v10; char v11; v0 = 3255322128360502133; v3 = 4210994773112597549; v4 = 7526763112770121018; v8 = 12716046225666661; if ((a0 & 0x100)) v1 = 114; if ((a0 & 128)) v2 = 119; if ((a0 & 64)) v3 = 120; if ((a0 & 32)) v5 = 114; if ((a0 & 16)) v6 = 119; if ((a0 & 8)) v7 = 120; if ((a0 & 4)) v9 = 114; if ((a0 & 2)) v10 = 119; if ((a0 & 1)) v11 = 120; return acl_from_text(&v0); }
static int do_modify_nl(enum cmd c, enum macsec_nl_commands cmd, int ifindex, struct rxsc_desc *rxsc, struct sa_desc *sa) { struct rtattr *attr_sa; struct { struct nlmsghdr n; struct genlmsghdr g; char buf[( ((0)+4U -1) & ~(4U -1) ) + (1024)]; } req = { .n = { .nlmsg_type = (genl_family), .nlmsg_flags = (0x01), .nlmsg_len = ((( ((sizeof(struct genlmsghdr))+4U -1) & ~(4U -1) ) + (0)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))), }, .g = { .cmd = (cmd), .version = (1), }, }; addattr32(&req.n, 1024, MACSEC_ATTR_IFINDEX, ifindex); if (rxsc) { struct rtattr *attr_rxsc; attr_rxsc = addattr_nest(&req.n, 1024, MACSEC_ATTR_RXSC_CONFIG); addattr64(&req.n, 1024, MACSEC_RXSC_ATTR_SCI, rxsc->sci); if (c != CMD_DEL && rxsc->active != 0xff) addattr8(&req.n, 1024, MACSEC_RXSC_ATTR_ACTIVE, rxsc->active); addattr_nest_end(&req.n, attr_rxsc); } if (sa->an == 0xff) goto talk; attr_sa = addattr_nest(&req.n, 1024, MACSEC_ATTR_SA_CONFIG); addattr8(&req.n, 1024, MACSEC_SA_ATTR_AN, sa->an); if (c != CMD_DEL) { if (sa->pn) addattr32(&req.n, 1024, MACSEC_SA_ATTR_PN, sa->pn); if (sa->key_len) { addattr_l(&req.n, 1024, MACSEC_SA_ATTR_KEYID, sa->key_id, 16); addattr_l(&req.n, 1024, MACSEC_SA_ATTR_KEY, sa->key, sa->key_len); } if (sa->active != 0xff) { addattr8(&req.n, 1024, MACSEC_SA_ATTR_ACTIVE, sa->active); } } addattr_nest_end(&req.n, attr_sa); talk: if (rtnl_talk(&genl_rth, &req.n, ((void *)0) ) < 0) return -2; return 0; }
void do_modify_nl(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, struct_0 *a4) { struct_1 *v0; unsigned int v1; unsigned long long v2; unsigned long long v3; unsigned int v4; unsigned short v5; unsigned short v6; char v7; char v8; unsigned long long v10; void* v11; unsigned long v12; unsigned long long v14; void* v15; v1 = a0; v0 = a3; v10 = 130; for (v11 = &v4; v10; v11 += v12 * 8) { v10 -= 1; v4 = 0; } *(v11) = 0; v4 = 20; v5 = genl_family; v6 = 1; v7 = a1; v8 = 1; addattr32(&v4, 0x400, 0x1, a2); if (v0) { v2 = addattr_nest(&v4, 0x400, 0x2); addattr64(&v4, 0x400, 0x1, v0->field_8); if (v1 != 1 && v0->field_10 != 255) addattr8(&v4, 0x400, 0x2, v0->field_10); addattr_nest_end(&v4, v2, v2); } if (a4->field_0 != 255) { v3 = addattr_nest(&v4, 0x400, 0x3); addattr8(&v4, 0x400, 0x1, a4->field_0); if (v1 != 1) { if (a4->field_4) addattr32(&v4, 0x400, 0x3, a4->field_4); if (a4->field_18) { addattr_l(&v4, 0x400, 0x5, &a4->padding_8, 0x10); addattr_l(&v4, 0x400, 0x4, &a4->padding_1c, a4->field_18); } if (a4->field_9c != 255) addattr8(&v4, 0x400, 0x2, a4->field_9c); } addattr_nest_end(&v4, v3, v3); } if (rtnl_talk(&genl_rth, &v4, 0x0) < 0) v14 = 4294967294; else v15 = 0; return; }
static u_int mux_client_request_alive(int fd) { struct sshbuf *m; char *e; u_int pid, type, rid; int r; sshlog("mux.c", __func__, 1644, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "entering"); if ((m = sshbuf_new()) == ((void *)0) ) sshfatal("mux.c", __func__, 1647, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "sshbuf_new"); if ((r = sshbuf_put_u32(m, 0x10000004)) != 0 || (r = sshbuf_put_u32(m, muxclient_request_id)) != 0) sshfatal("mux.c", __func__, 1650, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble"); if (mux_client_write_packet(fd, m) != 0) sshfatal("mux.c", __func__, 1653, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "write packet: %s", strerror( (*__errno_location ()) )); sshbuf_reset(m); if (mux_client_read_packet(fd, m) != 0) { sshbuf_free(m); return 0; } if ((r = sshbuf_get_u32(m, &type)) != 0) sshfatal("mux.c", __func__, 1664, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse type"); if (type != 0x80000005) { if ((r = sshbuf_get_cstring(m, &e, ((void *)0) )) != 0) sshfatal("mux.c", __func__, 1667, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse error message"); sshfatal("mux.c", __func__, 1668, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "master returned error: %s", e); } if ((r = sshbuf_get_u32(m, &rid)) != 0) sshfatal("mux.c", __func__, 1672, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse remote ID"); if (rid != muxclient_request_id) sshfatal("mux.c", __func__, 1674, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "out of sequence reply: my id %u theirs %u", muxclient_request_id, rid) ; if ((r = sshbuf_get_u32(m, &pid)) != 0) sshfatal("mux.c", __func__, 1677, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse PID"); sshbuf_free(m); sshlog("mux.c", __func__, 1680, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "done pid = %u", pid); muxclient_request_id++; return pid; }
int mux_client_request_alive(unsigned long a0) { char v0; char v1; unsigned int v2; char v3; unsigned long long v4; unsigned long long v5; unsigned long v6; char v7; unsigned long long v9; unsigned long long v10; unsigned int v12; sshlog("mux.c", "mux_client_request_alive", 0x66c, 0x1, 0x7, 0x0, "entering"); v4 = sshbuf_new("mux.c", "mux_client_request_alive", 0x66c, 0x1, 0x7, 0x0); if (!v4) sshfatal("mux.c", "mux_client_request_alive", 0x66f, 0x1, 0x1, 0x0, "sshbuf_new"); v2 = sshbuf_put_u32(v4, 0x10000004); if (!v2) v2 = sshbuf_put_u32(v4, muxclient_request_id); if (v2 || v2) { v5 = "assemble"; sshfatal("mux.c", "mux_client_request_alive", 0x672, 0x1, 0x1, ssh_err(v2), *(&v7)); } if (mux_client_write_packet(a0, v4, v4, 0x1, v9, v10)) { v6 = strerror(*(__errno_location())); v5 = "write packet: %s"; sshfatal("mux.c", "mux_client_request_alive", 0x675, 0x1, 0x1, 0x0, *(&v7)); } sshbuf_reset(v4); v12 = mux_client_read_packet(a0, v4, v4, 0x1, v9, v10); if (v12) { sshbuf_free(v4); v12 = 0; } else { v2 = sshbuf_get_u32(v4, &v1, &v1); if (v2) { v5 = "parse type"; sshfatal("mux.c", "mux_client_request_alive", 0x680, 0x1, 0x1, ssh_err(v2), *(&v7)); } if (*(&v1) != 2147483653) { v2 = sshbuf_get_cstring(v4, &v3, 0x0, &v3); if (v2) { v5 = "parse error message"; sshfatal("mux.c", "mux_client_request_alive", 0x683, 0x1, 0x1, ssh_err(v2), *(&v7)); } v6 = *(&v3); v5 = "master returned error: %s"; sshfatal("mux.c", "mux_client_request_alive", 0x684, 0x1, 0x1, 0x0, *(&v7)); } v2 = sshbuf_get_u32(v4, &v3, &v3); if (v2) { v5 = "parse remote ID"; sshfatal("mux.c", "mux_client_request_alive", 0x688, 0x1, 0x1, ssh_err(v2), *(&v7)); } if (*(&v3) != muxclient_request_id) { v5 = *(&v3); v4 = muxclient_request_id; v3 = "out of sequence reply: my id %u theirs %u"; sshfatal("mux.c", "mux_client_request_alive", 0x68a, 0x1, 0x1, 0x0, *(&v7)); } v2 = sshbuf_get_u32(v4, &v0, &v0); if (v2) { v5 = "parse PID"; sshfatal("mux.c", "mux_client_request_alive", 0x68d, 0x1, 0x1, ssh_err(v2), *(&v7)); } sshbuf_free(v4); v6 = *(&v0); v5 = "done pid = %u"; sshlog("mux.c", "mux_client_request_alive", 0x690, 0x1, 0x7, 0x0, *(&v7)); muxclient_request_id = muxclient_request_id + 1; v12 = *(&v0); } return v12; }
void md5hash(struct pkginfo *pkg, char *hashbuf, const char *fn) { struct dpkg_error err; static int fd; fd = open(fn, 00 ); if (fd >= 0) { push_cleanup(cu_closefd, ehflag_bombout, 1, &fd); if (buffer_copy_IntPtr(fd, 0, hashbuf, 5, ((void *)0) , 3, -1, &err) < 0) ohshit(gettext("cannot compute MD5 hash for file '%s': %s"), fn, err.str); pop_cleanup(ehflag_normaltidy); close(fd); } else if ( (*__errno_location ()) == 2 ) { strcpy(hashbuf, "nonexistent"); } else { warning(gettext("%s: unable to open %s for hash: %s"), pkg_name(pkg, pnaw_nonambig), fn, strerror( (*__errno_location ()) )); strcpy(hashbuf, "-"); } }
void md5hash(unsigned long long a0, char *a1, char *a2) { unsigned long v0; char v1; char v2; unsigned long long *v5; unsigned long long v6; fd.6506 = open(a2, 0x0, a2); if (fd.6506 >= 0) { push_cleanup(got.cu_closefd, 0x2, 0x1, &fd.6506); v0 = &v1; if (buffer_copy_IntPtr(fd.6506, 0x0, a1, 0x5, 0x0, 0x3, 0xffffffffffffffff) < 0) ohshit(gettext("cannot compute MD5 hash for file '%s': %s")); pop_cleanup(0x1); close(fd.6506); } else if (*(__errno_location()) != 2) { warning(gettext("%s: unable to open %s for hash: %s"), pkg_name(a0, 0x1), a2, strerror(*(__errno_location()))); strcpy(a1, "-"); } else { strcpy(a1, "nonexistent"); } v6 = *(&v2) ^ v5[5]; return; }
static ARITH_FOR_COM * copy_arith_for_command (com) ARITH_FOR_COM *com; { ARITH_FOR_COM *new_arith_for; new_arith_for = (ARITH_FOR_COM *)sh_xmalloc((sizeof (ARITH_FOR_COM)), "copy_cmd.c", 201); new_arith_for->flags = com->flags; new_arith_for->line = com->line; new_arith_for->init = copy_word_list (com->init); new_arith_for->test = copy_word_list (com->test); new_arith_for->step = copy_word_list (com->step); new_arith_for->action = copy_command (com->action); return (new_arith_for); }
long copy_arith_for_command(long a1) { long v2; v2 = sh_xmalloc(40LL, "copy_cmd.c", 201LL); *(_DWORD *)v2 = *(_DWORD *)a1; *(_DWORD *)(v2 + 4) = *(_DWORD *)(a1 + 4); *(_QWORD *)(v2 + 8) = copy_word_list(*(_QWORD **)(a1 + 8)); *(_QWORD *)(v2 + 16) = copy_word_list(*(_QWORD **)(a1 + 16)); *(_QWORD *)(v2 + 24) = copy_word_list(*(_QWORD **)(a1 + 24)); *(_QWORD *)(v2 + 32) = copy_command(*(_QWORD *)(a1 + 32)); return v2; }
COMPSPEC * compspec_copy (cs) COMPSPEC *cs; { COMPSPEC *new; new = (COMPSPEC *)sh_xmalloc((sizeof (COMPSPEC)), "pcomplib.c", 97); new->refcount = 1; new->actions = cs->actions; new->options = cs->options; new->globpat = ((cs->globpat) ? (char *)strcpy (sh_xmalloc((1 + strlen (cs->globpat)), "pcomplib.c", 103), (cs->globpat)) : (char *) ((void *)0) ); new->words = ((cs->words) ? (char *)strcpy (sh_xmalloc((1 + strlen (cs->words)), "pcomplib.c", 104), (cs->words)) : (char *) ((void *)0) ); new->prefix = ((cs->prefix) ? (char *)strcpy (sh_xmalloc((1 + strlen (cs->prefix)), "pcomplib.c", 105), (cs->prefix)) : (char *) ((void *)0) ); new->suffix = ((cs->suffix) ? (char *)strcpy (sh_xmalloc((1 + strlen (cs->suffix)), "pcomplib.c", 106), (cs->suffix)) : (char *) ((void *)0) ); new->funcname = ((cs->funcname) ? (char *)strcpy (sh_xmalloc((1 + strlen (cs->funcname)), "pcomplib.c", 107), (cs->funcname)) : (char *) ((void *)0) ); new->command = ((cs->command) ? (char *)strcpy (sh_xmalloc((1 + strlen (cs->command)), "pcomplib.c", 108), (cs->command)) : (char *) ((void *)0) ); new->lcommand = ((cs->lcommand) ? (char *)strcpy (sh_xmalloc((1 + strlen (cs->lcommand)), "pcomplib.c", 109), (cs->lcommand)) : (char *) ((void *)0) ); new->filterpat = ((cs->filterpat) ? (char *)strcpy (sh_xmalloc((1 + strlen (cs->filterpat)), "pcomplib.c", 110), (cs->filterpat)) : (char *) ((void *)0) ); return new; }
long long compspec_copy(unsigned long long a0[11]) { struct_0 *v0; void* v2; void* v3; void* v4; void* v5; void* v6; void* v7; void* v8; void* v9; v0 = sh_xmalloc(0x58, "pcomplib.c", 0x61); v0->field_0 = 1; v0->field_8 = a0[1]; v0->field_10 = a0[2]; if (!a0[3]) v2 = 0; else v2 = strcpy(sh_xmalloc(strlen(a0[3]) + 1, "pcomplib.c", 0x67), a0[3]); v0->field_18 = v2; if (!a0[4]) v3 = 0; else v3 = strcpy(sh_xmalloc(strlen(a0[4]) + 1, "pcomplib.c", 0x68), a0[4]); v0->field_20 = v3; if (!a0[5]) v4 = 0; else v4 = strcpy(sh_xmalloc(strlen(a0[5]) + 1, "pcomplib.c", 0x69), a0[5]); v0->field_28 = v4; if (!a0[6]) v5 = 0; else v5 = strcpy(sh_xmalloc(strlen(a0[6]) + 1, "pcomplib.c", 0x6a), a0[6]); v0->field_30 = v5; if (!a0[7]) v6 = 0; else v6 = strcpy(sh_xmalloc(strlen(a0[7]) + 1, "pcomplib.c", 0x6b), a0[7]); v0->field_38 = v6; if (!a0[8]) v7 = 0; else v7 = strcpy(sh_xmalloc(strlen(a0[8]) + 1, "pcomplib.c", 0x6c), a0[8]); v0->field_40 = v7; if (!a0[9]) v8 = 0; else v8 = strcpy(sh_xmalloc(strlen(a0[9]) + 1, "pcomplib.c", 0x6d), a0[9]); v0->field_48 = v8; if (!a0[10]) v9 = 0; else v9 = strcpy(sh_xmalloc(strlen(a0[10]) + 1, "pcomplib.c", 0x6e), a0[10]); v0->field_50 = v9; return v0; }
static void dbl_p1p1(ge25519_p1p1 *r, const ge25519_p2 *p) { crypto_sign_ed25519_ref_fe25519 a,b,c,d; crypto_sign_ed25519_ref_fe25519_square(&a, &p->x); crypto_sign_ed25519_ref_fe25519_square(&b, &p->y); crypto_sign_ed25519_ref_fe25519_square(&c, &p->z); crypto_sign_ed25519_ref_fe25519_add(&c, &c, &c); crypto_sign_ed25519_ref_fe25519_neg(&d, &a); crypto_sign_ed25519_ref_fe25519_add(&r->x, &p->x, &p->y); crypto_sign_ed25519_ref_fe25519_square(&r->x, &r->x); crypto_sign_ed25519_ref_fe25519_sub(&r->x, &r->x, &a); crypto_sign_ed25519_ref_fe25519_sub(&r->x, &r->x, &b); crypto_sign_ed25519_ref_fe25519_add(&r->z, &d, &b); crypto_sign_ed25519_ref_fe25519_sub(&r->t, &r->z, &c); crypto_sign_ed25519_ref_fe25519_sub(&r->y, &d, &b); }
void dbl_p1p1(unsigned long long a0, unsigned long long a1) { char v0; char v1; char v2; char v3; char v4; unsigned long long *v6; unsigned long long v7; crypto_sign_ed25519_ref_fe25519_square(&v0, a1, a1); crypto_sign_ed25519_ref_fe25519_square(&v1, a1 + 128, a1 + 128); crypto_sign_ed25519_ref_fe25519_square(&v2, a1 + 0x100, a1 + 0x100); crypto_sign_ed25519_ref_fe25519_add(&v2, &v2, &v2, &v2); crypto_sign_ed25519_ref_fe25519_neg(&v3, &v0, &v0); crypto_sign_ed25519_ref_fe25519_add(a0, a1, a1 + 128, a1); crypto_sign_ed25519_ref_fe25519_square(a0, a0, a0); crypto_sign_ed25519_ref_fe25519_sub(a0, a0, &v0, a0); crypto_sign_ed25519_ref_fe25519_sub(a0, a0, &v1, a0); crypto_sign_ed25519_ref_fe25519_add(a0 + 128, &v3, &v1, a0 + 128); crypto_sign_ed25519_ref_fe25519_sub(a0 + 384, a0 + 128, &v2, a0 + 384); crypto_sign_ed25519_ref_fe25519_sub(a0 + 0x100, &v3, &v1, a0 + 0x100); v7 = *(&v4) ^ v6[5]; return; }
static void read_inittab(void) { FILE *fp; FILE *fp_tab; CHILD *ch, *old, *i; CHILD *head = ((void *)0) ; sigset_t nmask, omask; char buf[256]; char err[64]; char *id, *rlevel, *action, *process; char *p; int lineNo = 0; int actionNo; int f; int round; int foundOne = 0; int talk; int done = -1; DIR *tabdir= ((void *)0) ; struct dirent *file_entry; char f_name[272]; if ((fp = fopen("/etc/inittab", "r")) == ((void *)0) ) initlog((1|2), "No inittab file found"); if( (tabdir = opendir("/etc/inittab.d"))== ((void *)0) ) initlog((1|2), "No inittab.d directory found"); while(done!=1) { if(done == -1) { if (fp == ((void *)0) || fgets(buf, sizeof(buf), fp) == ((void *)0) ) { done = 0; for(old = newFamily; old; old = old->next) if (strpbrk(old->rlevel, "S")) break; if (old == ((void *)0) ) snprintf(buf, sizeof(buf), "~~:S:wait:%s\n", "/sbin/sulogin"); else continue; } } else if ( done == 0 ){ if(tabdir!= ((void *)0) ){ if( (file_entry = readdir(tabdir))!= ((void *)0) ){ if (!strcmp(file_entry->d_name, ".") || !strcmp(file_entry->d_name, "..")) continue; if (strlen(file_entry->d_name) < 5 || strcmp(file_entry->d_name + strlen(file_entry->d_name) - 4, ".tab")) continue; memset(f_name,0,sizeof(char)*272); snprintf(f_name,272,"/etc/inittab.d/%s",file_entry->d_name); initlog((1|2), "Reading: %s",f_name); if ((fp_tab = fopen(f_name, "r")) == ((void *)0) ) continue; while( fgets(buf, sizeof(buf), fp_tab) != ((void *)0) ) { for(p = buf; *p == ' ' || *p == '\t'; p++); if (*p != '#' && *p != '\n') break; } fclose(fp_tab); if( strlen( p ) == 0 ) continue; } else { done = 1; continue; } } else { done = 1; continue; } } lineNo++; for(p = buf; *p == ' ' || *p == '\t'; p++) ; if (*p == '#' || *p == '\n') continue; id = strsep(&p, ":"); rlevel = strsep(&p, ":"); action = strsep(&p, ":"); process = strsep(&p, "\n"); err[0] = 0; if (!id || !*id) strcpy(err, "missing id field"); if (!rlevel) strcpy(err, "missing runlevel field"); if (!process) strcpy(err, "missing process field"); if (!action || !*action) strcpy(err, "missing action field"); if (id && strlen(id) > sizeof(utproto.ut_id)) sprintf(err, "id field too long (max %d characters)", (int)sizeof(utproto.ut_id)); if (rlevel && strlen(rlevel) > 11) strcpy(err, "rlevel field too long (max 11 characters)"); if (process && strlen(process) > 127) strcpy(err, "process field too long (max 127 characters)"); if (action && strlen(action) > 32) strcpy(err, "action field too long"); if (err[0] != 0) { initlog((1|2), "%s[%d]: %s", "/etc/inittab", lineNo, err); ; continue; } actionNo = -1; for(f = 0; actions[f].name; f++) if (strcasecmp(action, actions[f].name) == 0) { actionNo = actions[f].act; break; } if (actionNo == -1) { initlog((1|2), "%s[%d]: %s: unknown action field", "/etc/inittab", lineNo, action); continue; } for(old = newFamily; old; old = old->next) { if(strcmp(old->id, id) == 0 && strcmp(id, "~~")) { initlog((1|2), "%s[%d]: duplicate ID field \"%s\"", "/etc/inittab", lineNo, id); break; } } if (old) continue; ch = imalloc(sizeof(CHILD)); ch->action = actionNo; strncpy(ch->id, id, sizeof(utproto.ut_id) + 1); strncpy(ch->process, process, sizeof(ch->process) - 1); if (rlevel[0]) { for(f = 0; f < (int)sizeof(rlevel) - 1 && rlevel[f]; f++) { ch->rlevel[f] = rlevel[f]; if (ch->rlevel[f] == 's') ch->rlevel[f] = 'S'; } strncpy(ch->rlevel, rlevel, sizeof(ch->rlevel) - 1); } else { strcpy(ch->rlevel, "0123456789"); if (((ch->action) == 7 || (ch->action) == 6 || (ch->action) == 8 || (ch->action) == 14 || (ch->action) == 9)) strcpy(ch->rlevel, "S0123456789"); } if (ch->action == 13) strcpy(ch->rlevel, "#"); if (ch->action == 4 || ch->action == 5) strcpy(ch->rlevel, "*"); if (((ch->action) == 7 || (ch->action) == 6 || (ch->action) == 8 || (ch->action) == 14 || (ch->action) == 9)) { ch->flags |= 128; old = ((void *)0) ; for(i = newFamily; i; i = i->next) { if (!((i->action) == 7 || (i->action) == 6 || (i->action) == 8 || (i->action) == 14 || (i->action) == 9)) break; old = i; } if (old) { ch->next = i; old->next = ch; if (i == ((void *)0) ) head = ch; } else { ch->next = newFamily; newFamily = ch; if (ch->next == ((void *)0) ) head = ch; } } else { if (ch->action == 15) ch->flags |= 128; ch->next = ((void *)0) ; if (head) head->next = ch; else newFamily = ch; head = ch; } for(old = family; old; old = old->next) if (strcmp(old->id, ch->id) == 0) { old->new = ch; break; } } if (fp) fclose(fp); if(tabdir) closedir(tabdir); check_kernel_console(); ; for(round = 0; round < 2; round++) { talk = 1; for(ch = family; ch; ch = ch->next) { ch->flags &= ~4; if (ch->new == ((void *)0) ) ch->flags |= 4; if (ch->new && ch->action != ch->new->action) ch->flags |= 4; if (ch->action != 4 && strchr(ch->rlevel, runlevel) == ((void *)0) ) { if (runlevel == 'S' || !(ch->flags & 8)) ch->flags |= 4; } if ((ch->flags & 4) == 0) { ch->new->flags = ch->flags; ch->new->pid = ch->pid; ch->new->exstat = ch->exstat; continue; } if ((ch->flags & 2) == 0) { ch->flags &= ~4; continue; } ; switch(round) { case 0: if (talk) initlog(1, "Sending processes configured via /etc/inittab the TERM signal"); kill(-(ch->pid), 15 ); foundOne = 1; break; case 1: if (talk) initlog(1, "Sending processes configured via /etc/inittab the KILL signal"); kill(-(ch->pid), 9 ); break; } talk = 0; } if (foundOne && round == 0) { for(f = 0; f < 100 * sleep_time; f++) { for(ch = family; ch; ch = ch->next) { if (!(ch->flags & 4)) continue; if ((ch->flags & 2) && !(ch->flags & 64)) break; } if (ch == ((void *)0) ) { round = 1; foundOne = 0; break; } do_msleep(10); } } } if (foundOne) do_msleep(10); for(ch = family; ch; ch = ch->next) if (ch->flags & 4) { if (!(ch->flags & 64)) initlog(1, "Pid %d [id %s] seems to hang", ch->pid, ch->id); else { ; ch->flags &= ~2; if (ch->process[0] != '+') write_utmp_wtmp("", ch->id, ch->pid, 8 , ((void *)0) ); } } sigemptyset(&nmask); sigaddset(&nmask, 17 ); sigprocmask( 0 , &nmask, &omask); for(ch = family; ch; ch = old) { old = ch->next; free(ch); } family = newFamily; for(ch = family; ch; ch = ch->next) ch->new = ((void *)0) ; newFamily = ((void *)0) ; sigprocmask( 2 , &omask, ((void *)0) ); }
void read_inittab(unsigned int a0, unsigned int a1, void* a2, unsigned int a3, unsigned int a4, unsigned int a5) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; char *v7; struct_7 *v8; struct_2 *v9; struct_2 *v10; void* v11; void* v12; void* v13; unsigned long v14; void* v15; char *v16; char *v17; char *v18; char *v19; char v20; char v21; char v22; char v23; char v24; char v25; void* v27; void* v28; unsigned long long v29; unsigned long long *v30; unsigned long long v31; v11 = 0; v0 = 0; v4 = 0; v6 = -1; v12 = 0; v13 = fopen("/etc/inittab", "r"); if (!v13) initlog(0x3, "No inittab file found", a2, a3, a4, a5); v12 = opendir("/etc/inittab.d"); if (!v12) initlog(0x3, "No inittab.d directory found", a2, a3, a4, a5); while (true) { while (true) { while (true) { do { if (v6 == 1) { if (v13) fclose(v13); if (v12) closedir(v12); check_kernel_console(a0, a1, a2, a3, a4, a5); for (v3 = 0; v3 <= 1; v3 += 1) { v5 = 1; v8 = family; while (true) { if (!v8) break; v29 = v8->field_0 & -5; v8->field_0 = v8->field_0 & -5; if (!v8->field_b8) { v29 = v8->field_0 | 4; v8->field_0 = v8->field_0 | 4; } if (v8->field_b8) { v29 = v8->field_30; if (v8->field_30 != v8->field_b8->field_30) { v29 = v8->field_0 | 4; v8->field_0 = v8->field_0 | 4; } } if (v8->field_30 != 4 && !strchr(&v8->padding_c[24], runlevel)) { if (runlevel != 83 && !(!(v8->field_0 & 8))) goto LABEL_403bbf; v29 = v8->field_0 | 4; v8->field_0 = v8->field_0 | 4; } LABEL_403bbf: if (!(v8->field_0 & 4)) { v8->field_b8->field_0 = v8->field_0; v8->field_b8->field_8 = v8->field_8; v8->field_b8->field_4 = v8->field_4; } else if (!(v8->field_0 & 2)) { v8->field_0 = v8->field_0 & -5; } else { if (!v3) { if (v5) initlog(0x1, "Sending processes configured via /etc/inittab the TERM signal", v29, a3, a4, a5); kill(-(v8->field_8), 0xf); v4 = 1; } else if (v3 == 1) { if (v5) initlog(0x1, "Sending processes configured via /etc/inittab the KILL signal", v29, a3, a4, a5); kill(-(v8->field_8), 0x9); } v5 = 0; } v8 = v8->field_c0; } if (v4 && !v3) { v2 = 0; while (true) { if (v2 >= sleep_time * 100) break; v8 = family; while (true) { if (!v8) break; if ((v8->field_0 & 4) && (v8->field_0 & 2) && !(v8->field_0 & 64)) break; v8 = v8->field_c0; } if (v8) { do_msleep(0xa); v2 += 1; } else { v3 = 1; v4 = 0; break; } } } } if (v4) do_msleep(0xa); for (v8 = family; v8; v8 = v8->field_c0) { if ((v8->field_0 & 4)) { if (!(v8->field_0 & 64)) { initlog(0x1, "Pid %d [id %s] seems to hang", v8->field_8, &v8->padding_c[16], a4, a5); } else { v8->field_0 = v8->field_0 & -3; if (v8->field_34 != 43) write_utmp_wtmp(&g_407481, &v8->padding_c[16], v8->field_8, 0x8, 0x0); } } } sigemptyset(&v20); sigaddset(&v20, 0x11); sigprocmask(0x0, &v20, &v21); for (v8 = family; v8; v8 = v9) { v9 = v8->field_c0; free(v8); } family = newFamily; for (v8 = family; v8; v8 = v8->field_c0) { v8->field_b8 = 0; } newFamily = 0; sigprocmask(0x2, &v21, NULL); v31 = *(&v25) ^ v30[5]; return; } if (v6 == -1) { if (v13) { a1 = 0x100; if (!(!fgets(&v23, 0x100, v13))) goto LABEL_4032db; } v6 = 0; v9 = newFamily; while (true) { if (!v9) break; if (strpbrk(&v9->padding_c[24], "S")) break; v9 = v9->field_c0; } if (!(!v9)) continue; a3 = &g_4075bd; snprintf(&v23, 0x100, "~~:S:wait:%s\n", &g_4075bd); } else if (!v6) { if (!v12) { v6 = 1; continue; } else { v14 = readdir(v12); if (!v14) { v6 = 1; continue; } else { if (!strcmp(v14 + 19, ".")) continue; if (!strcmp(v14 + 19, "..")) continue; if (strlen(v14 + 19) <= 4) continue; if (!(!strcmp(strlen(v14 + 19) - 4 + v14 + 19, ".tab"))) continue; memset(&v24, 0x0, 0x110); a3 = v14 + 19; snprintf(&v24, 0x110, "/etc/inittab.d/%s", (v14 + 19)); initlog(0x3, "Reading: %s", &v24, v14 + 19, a4, a5); v15 = fopen(&v24, "r"); if (!v15) continue; while (true) { a1 = 0x100; if (!fgets(&v23, 0x100, v15)) break; v7 = &v23; while (true) { if (*(v7) != 32 && *(v7) != 9) break; v7 += 1; } if (*(v7) == 35) continue; if (*(v7) != 10) break; } fclose(v15); if (!strlen(v7)) continue; } } } LABEL_4032db: v0 += 1; v7 = &v23; while (true) { if (*(v7) != 32 && *(v7) != 9) break; v7 += 1; } if (*(v7) == 35) continue; } while (*(v7) == 10); v16 = strsep(&v7, ":"); v17 = strsep(&v7, ":"); v18 = strsep(&v7, ":"); v19 = strsep(&v7, "\n"); v22 = 0; if (v16 && !(!*(v16))) goto LABEL_4033d3; strcpy(&v22, "missing id field"); LABEL_4033d3: if (!v17) strcpy(&v22, "missing runlevel field"); if (!v19) strcpy(&v22, "missing process field"); if (v18 && !(!*(v18))) goto LABEL_403445; strcpy(&v22, "missing action field"); LABEL_403445: if (v16 && strlen(v16) > 4) sprintf(&v22, "id field too long (max %d characters)", 4); if (v17 && strlen(v17) > 11) strcpy(&v22, "rlevel field too long (max 11 characters)"); if (v19 && strlen(v19) > 127) strcpy(&v22, "process field too long (max 127 characters)"); if (v18 && strlen(v18) > 32) strcpy(&v22, "action field too long"); if (!v22) break; initlog(0x3, "%s[%d]: %s", "/etc/inittab", v0, &v22, a5); } v1 = -1; v2 = 0; while (true) { a2 = v2 * 16; if (!actions[2 * v2]) break; if (strcasecmp(v18, actions[2 * v2])) { v2 += 1; } else { a2 = v2 * 16; v1 = (&g_407c28)[2 * v2]; break; } } if (v1 != -1) { v9 = newFamily; while (true) { if (!v9) break; if (!strcmp(&v9->padding_c[16], v16) && strcmp(v16, "~~")) { initlog(0x3, "%s[%d]: duplicate ID field \"%s\"", "/etc/inittab", v0, v16, a5); break; } v9 = v9->field_c0; } if (!v9) break; } else { initlog(0x3, "%s[%d]: %s: unknown action field", "/etc/inittab", v0, v18, a5); } } v27 = imalloc(0xc8, a1, a2, a3, v16, a5); v8 = v27; *(&v8[48]) = v1; strncpy(v8 + 28, v16, 0x5); strncpy(v8 + 52, v19, 0x7f); if (*(v17)) { v2 = 0; while (true) { if (v2 > 6) break; if (!v17[v2]) break; *(36 + v8 + v2) = v17[v2]; if (*(36 + v8 + v2) == 115) *(36 + v8 + v2) = 83; v2 += 1; } strncpy(v8 + 36, v17, 0xb); } else { strcpy(v8 + 36, "0123456789"); if (v8[48] != 7 && v8[48] != 6 && v8[48] != 8 && v8[48] != 14 && !(v8[48] == 9)) goto LABEL_40381e; strcpy(v8 + 36, "S0123456789"); } LABEL_40381e: if (v8[48] == 13) strcpy(v8 + 36, "#"); if (v8->field_30 != 4 && !(v8[48] == 5)) goto LABEL_403875; strcpy(v8 + 36, "*"); LABEL_403875: if (v8[48] == 7) { LABEL_4038ba: *(&v27) = *(v8); *(&v27) = v8->field_0 | 128; *(v8) = v27; v9 = 0; v10 = newFamily; while (true) { if (!v10) break; if (v10->field_30 != 7 && v10->field_30 != 6 && v10->field_30 != 8 && v10->field_30 != 14 && v10->field_30 != 9) break; v9 = v10; v10 = v10->field_c0; } if (v9) { *(&v8[192]) = v10; a2 = v8; *(&v9[192]) = v8; if (!v10) v11 = v8; } else { a2 = newFamily; *(&v8[192]) = newFamily; newFamily = v8; if (!v8[192]) v11 = v8; } goto LABEL_403a2e; } else { if (v8[48] == 6) goto LABEL_4038ba; if (v8[48] == 8) goto LABEL_4038ba; if (v8[48] == 14) goto LABEL_4038ba; if (v8[48] == 9) goto LABEL_4038ba; if (v8[48] == 15) { v28 = *(v8); *(&v28) = v8->field_0 | 128; a2 = v28; *(v8) = v28; } *(&v8[192]) = 0; if (!v11) { newFamily = v8; } else { a2 = v8; *(&v11[192]) = v8; } v11 = v8; LABEL_403a2e: v9 = family; while (true) { if (!v9) break; if (strcmp(&v9->padding_0[28], v8 + 28)) { v9 = v9->field_c0; } else { a2 = v8; v9->field_b8 = v8; break; } } } } }
int main(int argc, char **argv) { char proc_dir_name[32]; char *target_str; pid_t target; int proc_dir_fd; int ranges; struct map_range *mappings; struct stat st; struct passwd *pw; int written; Prog = Basename (argv[0]); log_set_progname(Prog); log_set_logfd( stderr ); if (argc < 2) usage(); target_str = argv[1]; if (!get_pid(target_str, &target)) usage(); written = snprintf(proc_dir_name, sizeof(proc_dir_name), "/proc/%u/", target); if ((written <= 0) || (written >= sizeof(proc_dir_name))) { fprintf( stderr , "%s: snprintf of proc path failed: %s\n", Prog, strerror( (*__errno_location ()) )); } proc_dir_fd = open(proc_dir_name, 0200000 ); if (proc_dir_fd < 0) { fprintf( stderr , gettext ("%s: Could not open proc directory for target %u\n"), Prog, target); return 1 ; } pw = get_my_pwent (); if ( ((void *)0) == pw) { fprintf ( stderr , gettext ("%s: Cannot determine your user name.\n"), Prog); do { char *old_locale = setlocale ( 6 , ((void *)0) ); char *saved_locale = ((void *)0) ; if ( ((void *)0) != old_locale) { saved_locale = strdup (old_locale); } if ( ((void *)0) != saved_locale) { (void) setlocale ( 6 , "C"); } syslog ( 4 , "Cannot determine the user name of the caller (UID %lu)", (unsigned long) getuid ()) ; if ( ((void *)0) != saved_locale) { (void) setlocale ( 6 , saved_locale); free (saved_locale); } } while ( 0 ) ; return 1 ; } if (fstat(proc_dir_fd, &st) < 0) { fprintf( stderr , gettext ("%s: Could not stat directory for target %u\n"), Prog, target); return 1 ; } if ((getuid() != pw->pw_uid) || (!getdef_bool("GRANT_AUX_GROUP_SUBIDS") && (getgid() != pw->pw_gid)) || (pw->pw_uid != st.st_uid) || (getgid() != st.st_gid)) { fprintf( stderr , gettext ("%s: Target process %u is owned by a different user: uid:%lu pw_uid:%lu st_uid:%lu, gid:%lu pw_gid:%lu st_gid:%lu\n"), Prog, target, (unsigned long int)getuid(), (unsigned long int)pw->pw_uid, (unsigned long int)st.st_uid, (unsigned long int)getgid(), (unsigned long int)pw->pw_gid, (unsigned long int)st.st_gid); return 1 ; } if (!sub_uid_open( 00 )) { return 1 ; } ranges = ((argc - 2) + 2) / 3; mappings = get_map_ranges(ranges, argc - 2, argv + 2); if (!mappings) usage(); verify_ranges(pw, ranges, mappings); write_mapping(proc_dir_fd, ranges, mappings, "uid_map", pw->pw_uid); sub_uid_close(); return 0 ; }
undefined8 main(int param_1,undefined8 *param_2) { uint uVar1; uint uVar2; char cVar3; int iVar4; __uid_t _Var5; __gid_t _Var6; int *piVar7; char *pcVar8; undefined8 uVar9; long in_FS_OFFSET; uint local_130; uint local_12c; int local_128; int local_124; char *local_120; undefined8 local_118; long local_110; long local_108; char *local_100; stat local_f8; char local_68 [40]; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); Prog = Basename(*param_2); log_set_progname(Prog); log_set_logfd(stderr); if (param_1 < 2) { usage(); } local_118 = param_2[1]; iVar4 = get_pid(local_118,&local_130); if (iVar4 == 0) { usage(); } local_12c = snprintf(local_68,0x20,"/proc/%u/"); if (((int)local_12c < 1) || (0x1f < local_12c)) { piVar7 = __errno_location(); strerror(*piVar7); fprintf(stderr,"%s: snprintf of proc path failed: %s\n",Prog); } local_128 = open(local_68,0x10000); uVar9 = Prog; if (local_128 < 0) { pcVar8 = (char *)gettext("%s: Could not open proc directory for target %u\n"); fprintf(stderr,pcVar8,uVar9,(ulong)local_130); uVar9 = 1; goto LAB_0010067c; } local_110 = get_my_pwent(); uVar9 = Prog; if (local_110 == 0) { pcVar8 = (char *)gettext("%s: Cannot determine your user name.\n"); fprintf(stderr,pcVar8,uVar9); local_100 = setlocale(6,(char *)0x0); local_120 = (char *)0x0; if (local_100 != (char *)0x0) { local_120 = strdup(local_100); } if (local_120 != (char *)0x0) { setlocale(6,"C"); } _Var5 = getuid(); syslog(4,"Cannot determine the user name of the caller (UID %lu)",(ulong)_Var5); if (local_120 != (char *)0x0) { setlocale(6,local_120); free(local_120); } uVar9 = 1; goto LAB_0010067c; } iVar4 = fstat(local_128,&local_f8); uVar9 = Prog; if (iVar4 < 0) { pcVar8 = (char *)gettext("%s: Could not stat directory for target %u\n"); fprintf(stderr,pcVar8,uVar9,(ulong)local_130); uVar9 = 1; goto LAB_0010067c; } _Var5 = getuid(); if (_Var5 == *(__uid_t *)(local_110 + 0x10)) { cVar3 = getdef_bool("GRANT_AUX_GROUP_SUBIDS"); if (cVar3 != '\x01') { _Var6 = getgid(); if (_Var6 != *(__gid_t *)(local_110 + 0x14)) goto LAB_00100505; } if (*(uint *)(local_110 + 0x10) == local_f8.st_uid) { _Var6 = getgid(); if (_Var6 == local_f8.st_gid) { iVar4 = sub_uid_open(0); if (iVar4 == 0) { uVar9 = 1; } else { local_124 = param_1 / 3; local_108 = get_map_ranges(local_124,param_1 + -2,param_2 + 2); if (local_108 == 0) { usage(); } verify_ranges(local_110,local_124,local_108); write_mapping(local_128,local_124,local_108,"uid_map",*(undefined4 *)(local_110 + 0x10)); sub_uid_close(); uVar9 = 0; } goto LAB_0010067c; } } } LAB_00100505: uVar1 = *(uint *)(local_110 + 0x14); _Var6 = getgid(); uVar2 = *(uint *)(local_110 + 0x10); _Var5 = getuid(); uVar9 = Prog; pcVar8 = (char *)gettext( "%s: Target process %u is owned by a different user: uid:%lu pw_uid:%lu st_uid:%lu, gid:%lu pw_gid:%lu st_gid:%lu\n" ); fprintf(stderr,pcVar8,uVar9,(ulong)local_130,(ulong)_Var5,(ulong)uVar2,(ulong)local_f8.st_uid, (ulong)_Var6,(ulong)uVar1,(ulong)local_f8.st_gid); uVar9 = 1; LAB_0010067c: if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar9; }
cv_delfini(EditLine *el) { int size; int action = el->el_chared.c_vcmd.action; if (action & 0x02) el->el_map.current = el->el_map.key; if (el->el_chared.c_vcmd.pos == 0) return; size = (int)(el->el_line.cursor - el->el_chared.c_vcmd.pos); if (size == 0) size = 1; el->el_line.cursor = el->el_chared.c_vcmd.pos; if (action & 0x04) { if (size > 0) cv_yank(el, el->el_line.cursor, size); else cv_yank(el, el->el_line.cursor + size, -size); } else { if (size > 0) { c_delafter(el, size); re_refresh_cursor(el); } else { c_delbefore(el, -size); el->el_line.cursor += size; } } el->el_chared.c_vcmd.action = 0x00; }
long cv_delfini(long a1) { long result; int v2; int v3; v3 = *(_DWORD *)(a1 + 960); if ( (v3 & 2) != 0 ) *(_QWORD *)(a1 + 1024) = *(_QWORD *)(a1 + 1016); result = *(_QWORD *)(a1 + 968); if ( result ) { v2 = (long)(*(_QWORD *)(a1 + 88) - *(_QWORD *)(a1 + 968)) >> 2; if ( !v2 ) v2 = 1; *(_QWORD *)(a1 + 88) = *(_QWORD *)(a1 + 968); if ( (v3 & 4) != 0 ) { if ( v2 <= 0 ) cv_yank(a1, (const void *)(*(_QWORD *)(a1 + 88) + 4LL * v2), -v2); else cv_yank(a1, *(const void **)(a1 + 88), v2); } else if ( v2 <= 0 ) { c_delbefore((_QWORD *)a1, -v2); *(_QWORD *)(a1 + 88) += 4LL * v2; } else { c_delafter(a1, v2); re_refresh_cursor(a1); } result = a1; *(_DWORD *)(a1 + 960) = 0; } return result; }
int rl_abort (int count, int key) { return (_rl_abort_internal ()); }
void rl_abort(void) { _rl_abort_internal(); return; }
static const struct ipstats_stat_desc * ipstats_enable_find_stat_desc(struct ipstats_sel *sel) { const struct ipstats_stat_desc *toplev = &ipstats_stat_desc_toplev_group; const struct ipstats_stat_desc *desc = toplev; int i; for (i = 0; i < IPSTATS_LEVELS_COUNT; i++) { const struct ipstats_stat_desc *next_desc; if (sel->sel[i] == ((void *)0) ) break; if (desc->kind == IPSTATS_STAT_DESC_KIND_LEAF) { fprintf( stderr , "Error: %s %s requested inside leaf %s %s\n", ipstats_levels[i], sel->sel[i], ipstats_levels[i - 1], desc->name); return ((void *)0) ; } next_desc = ipstats_stat_desc_find(desc, sel->sel[i]); if (next_desc == ((void *)0) ) { fprintf( stderr , "Error: no %s named %s found inside %s\n", ipstats_levels[i], sel->sel[i], desc->name); return ((void *)0) ; } desc = next_desc; } return desc; }
int ipstats_enable_find_stat_desc(unsigned long long *a0) { unsigned int v0; unsigned long long v1; unsigned long long v2; void* v3; unsigned int v5; v2 = &ipstats_stat_desc_toplev_group; v1 = v2; v0 = 0; while (true) { if (v0 <= 2 && a0[v0]) { if (!*((v1 + 8))) { fprintf(*(&stderr), "Error: %s %s requested inside leaf %s %s\n", *(&(&ipstats_levels)[8 * v0]), a0[v0], *(&(&ipstats_levels)[8 + 8 * v0]), *(v1)); v5 = 0; break; } else { v3 = ipstats_stat_desc_find(v1, a0[v0]); if (!v3) { fprintf(*(&stderr), "Error: no %s named %s found inside %s\n", *(&(&ipstats_levels)[8 * v0]), a0[v0], *(v1)); v5 = 0; break; } else { v1 = v3; v0 += 1; continue; } } } if (!a0[v0] || v0 > 2) { v5 = v1; break; } } return v5; }
static int lwtunnel_parse_erspan_opts(char *str, size_t len, struct rtattr *rta) { struct rtattr *nest; char *token; int i, err; nest = rta_nest(rta, len, LWTUNNEL_IP_OPTS_ERSPAN | (1 << 15)); i = 1; token = strsep(&str, ":"); while (token) { switch (i) { case LWTUNNEL_IP_OPT_ERSPAN_VER: { __u8 opt_type; if (!strlen(token)) break; err = get_u8(&opt_type, token, 0); if (err) return err; rta_addattr8(rta, len, i, opt_type); break; } case LWTUNNEL_IP_OPT_ERSPAN_INDEX: { __be32 opt_class; if (!strlen(token)) break; err = get_be32(&opt_class, token, 0); if (err) return err; rta_addattr32(rta, len, i, opt_class); break; } case LWTUNNEL_IP_OPT_ERSPAN_DIR: { __u8 opt_type; if (!strlen(token)) break; err = get_u8(&opt_type, token, 0); if (err) return err; rta_addattr8(rta, len, i, opt_type); break; } case LWTUNNEL_IP_OPT_ERSPAN_HWID: { __u8 opt_type; if (!strlen(token)) break; err = get_u8(&opt_type, token, 0); if (err) return err; rta_addattr8(rta, len, i, opt_type); break; } default: fprintf( stderr , "Unknown \"geneve_opts\" type\n"); return -1; } token = strsep(&str, ":"); i++; } rta_nest_end(rta, nest); return 0; }
long lwtunnel_parse_erspan_opts(char *a1, unsigned int a2, long a3) { char *stringp[2]; unsigned int v6; unsigned int v7; unsigned int u8; char *s; long v10; unsigned long v11; stringp[0] = a1; v11 = __readfsqword(0x28u); v10 = rta_nest(a3, a2, 32771LL); v7 = 1; s = strsep(stringp, ":"); while ( s ) { if ( v7 == 4 ) { if ( !strlen(s) ) goto LABEL_25; u8 = get_u8(&v6, s, 0LL); if ( u8 ) return u8; goto LABEL_23; } if ( (int)v7 > 4 ) goto LABEL_24; if ( v7 == 3 ) { if ( !strlen(s) ) goto LABEL_25; u8 = get_u8(&v6, s, 0LL); if ( u8 ) return u8; goto LABEL_23; } if ( v7 == 1 ) { if ( !strlen(s) ) goto LABEL_25; u8 = get_u8(&v6, s, 0LL); if ( u8 ) return u8; LABEL_23: rta_addattr8(a3, a2, v7, (unsigned char)v6); goto LABEL_25; } if ( v7 != 2 ) { LABEL_24: fprintf(stderr, "Unknown \"geneve_opts\" type\n"); return 0xFFFFFFFFLL; } if ( strlen(s) ) { u8 = get_be32(&v6, s, 0LL); if ( u8 ) return u8; rta_addattr32(a3, a2, v7, v6); } LABEL_25: s = strsep(stringp, ":"); ++v7; } rta_nest_end(a3, v10); return 0LL; }
int perm_copy_fd (const char *src_path, int src_fd, const char *dst_path, int dst_fd, struct error_context *ctx) { acl_t acl; struct stat st; int ret = 0; ret = fstat(src_fd, &st); if (ret != 0) { const char *qpath = ( (( ctx ) && ( ctx )->quote) ? ( ctx )->quote(( ctx ), ( src_path )) : ( src_path ) ) ; do { if (( ctx ) && ( ctx )->error) ( ctx )->error(( ctx ), "%s", qpath ); } while(0) ; do { if (( ctx ) && ( ctx )->quote_free) ( ctx )->quote_free(( ctx ), ( qpath )); } while(0) ; return -1; } acl = acl_get_fd (src_fd); if (acl == ((void *)0) ) { ret = -1; if ( (*__errno_location ()) == 38 || (*__errno_location ()) == 95 ) ret = set_acl_fd (dst_path, dst_fd, st.st_mode, ctx); else { const char *qpath = ( (( ctx ) && ( ctx )->quote) ? ( ctx )->quote(( ctx ), ( src_path )) : ( src_path ) ) ; do { if (( ctx ) && ( ctx )->error) ( ctx )->error(( ctx ), "%s", qpath ); } while(0) ; do { if (( ctx ) && ( ctx )->quote_free) ( ctx )->quote_free(( ctx ), ( qpath )); } while(0) ; } return ret; } if (acl_set_fd (dst_fd, acl) != 0) { int saved_errno = (*__errno_location ()) ; __apply_mask_to_mode(&st.st_mode, acl); ret = fchmod (dst_fd, st.st_mode); if (( (*__errno_location ()) != 38 && (*__errno_location ()) != 95 ) || acl_entries (acl) != 3) { const char *qpath = ( (( ctx ) && ( ctx )->quote) ? ( ctx )->quote(( ctx ), ( dst_path )) : ( dst_path ) ) ; (*__errno_location ()) = saved_errno; do { if (( ctx ) && ( ctx )->error) ( ctx )->error(( ctx ), gettext("preserving permissions for %s"), qpath ); } while(0) ; do { if (( ctx ) && ( ctx )->quote_free) ( ctx )->quote_free(( ctx ), ( qpath )); } while(0) ; ret = -1; } } (void) acl_free (acl); return ret; }
long long perm_copy_fd(unsigned long long a0, unsigned long a1, unsigned long long a2, unsigned long a3, void* a4) { char v0; unsigned int v1; unsigned int v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; char v7; char v8; unsigned long long v10; unsigned long long v14; unsigned long long v16; unsigned long long v17; unsigned long long v18; v1 = 0; v1 = fstat(a1, &v7); if (v1) { if (a4 && a4[8]) { v10 = a4[8](a4, a0, a0, a4[8]); goto LABEL_4002f0; } v10 = a0; LABEL_4002f0: v6 = v10; if (a4 && *(a4)) *(a4)(a4, "%s", v6, *(a4)); if (a4 && a4[16]) a4[16](a4, v6, v6, a4[16]); v17 = 4294967295; } else { v3 = acl_get_fd(*(&v0)); if (v3) { if (acl_set_fd(a3, v3, v3)) { v2 = *(__errno_location()); __apply_mask_to_mode(&v8, v3, &v8); v1 = fchmod(a3, *(&v8)); if (*(__errno_location()) != 38 && !(*(__errno_location()) == 95)) goto LABEL_400556; if (acl_entries(v3) == 3) goto LABEL_400640; LABEL_400556: if (a4 && a4[8]) { v16 = a4[8](a4, a2, a2, a4[8]); goto LABEL_40059a; } v16 = a2; LABEL_40059a: v4 = v16; *(__errno_location()) = v2; if (a4 && *(a4)) { v18 = gettext("preserving permissions for %s"); *(a4)(a4, v18, v4, v18); } if (a4 && a4[16]) a4[16](a4, v4, v4, a4[16]); v1 = -1; } LABEL_400640: acl_free(v3); v17 = v1; } else { v1 = -1; if (*(__errno_location()) == 38) { LABEL_4003c2: v1 = set_acl_fd(a2, a3, *(&v8), a4); } else { if (*(__errno_location()) == 95) goto LABEL_4003c2; if (a4 && a4[8]) { v14 = a4[8](a4, a0, a0, a4[8]); goto LABEL_400433; } v14 = a0; LABEL_400433: v5 = v14; if (a4 && *(a4)) *(a4)(a4, "%s", v5, *(a4)); if (a4 && a4[16]) a4[16](a4, v5, v5, a4[16]); } v17 = v1; } } return v17; }
int ssh_ecdsa_verify(const struct sshkey *key, const u_char *signature, size_t signaturelen, const u_char *data, size_t datalen, u_int compat) { ECDSA_SIG *sig = ((void *)0) ; BIGNUM *sig_r = ((void *)0) , *sig_s = ((void *)0) ; int hash_alg; u_char digest[64]; size_t dlen; int ret = -1; struct sshbuf *b = ((void *)0) , *sigbuf = ((void *)0) ; char *ktype = ((void *)0) ; if (key == ((void *)0) || key->ecdsa == ((void *)0) || sshkey_type_plain(key->type) != KEY_ECDSA || signature == ((void *)0) || signaturelen == 0) return -10; if ((hash_alg = sshkey_ec_nid_to_hash_alg(key->ecdsa_nid)) == -1 || (dlen = ssh_digest_bytes(hash_alg)) == 0) return -1; if ((b = sshbuf_from(signature, signaturelen)) == ((void *)0) ) return -2; if (sshbuf_get_cstring(b, &ktype, ((void *)0) ) != 0 || sshbuf_froms(b, &sigbuf) != 0) { ret = -4; goto out; } if (strcmp(sshkey_ssh_name_plain(key), ktype) != 0) { ret = -13; goto out; } if (sshbuf_len(b) != 0) { ret = -23; goto out; } if (sshbuf_get_bignum2(sigbuf, &sig_r) != 0 || sshbuf_get_bignum2(sigbuf, &sig_s) != 0) { ret = -4; goto out; } if ((sig = ECDSA_SIG_new()) == ((void *)0) ) { ret = -2; goto out; } if (!ECDSA_SIG_set0(sig, sig_r, sig_s)) { ret = -22; goto out; } sig_r = sig_s = ((void *)0) ; if (sshbuf_len(sigbuf) != 0) { ret = -23; goto out; } if ((ret = ssh_digest_memory(hash_alg, data, datalen, digest, sizeof(digest))) != 0) goto out; switch (ECDSA_do_verify(digest, dlen, sig, key->ecdsa)) { case 1: ret = 0; break; case 0: ret = -21; goto out; default: ret = -22; goto out; } out: explicit_bzero(digest, sizeof(digest)); sshbuf_free(sigbuf); sshbuf_free(b); ECDSA_SIG_free(sig); BN_clear_free(sig_r); BN_clear_free(sig_s); free(ktype); return ret; }
int ssh_ecdsa_verify(undefined4 *param_1,long param_2,long param_3,undefined8 param_4, undefined8 param_5) { char *__s2; int iVar1; int iVar2; char *__s1; long lVar3; long in_FS_OFFSET; int local_a8; BIGNUM *local_a0; BIGNUM *local_98; undefined8 local_90; char *local_88; ECDSA_SIG *local_80; long local_78; long local_70; uchar local_68 [72]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_80 = (ECDSA_SIG *)0x0; local_a0 = (BIGNUM *)0x0; local_98 = (BIGNUM *)0x0; local_78 = 0; local_90 = 0; local_88 = (char *)0x0; if ((param_1 != (undefined4 *)0x0) && (*(long *)(param_1 + 8) != 0)) { iVar1 = sshkey_type_plain(*param_1); if ((iVar1 == 2) && ((param_2 != 0 && (param_3 != 0)))) { iVar1 = sshkey_ec_nid_to_hash_alg(param_1[6]); if (iVar1 != -1) { local_70 = ssh_digest_bytes(iVar1); if (local_70 != 0) { local_78 = sshbuf_from(param_2,param_3); if (local_78 == 0) { local_a8 = -2; goto LAB_00100708; } iVar2 = sshbuf_get_cstring(local_78,&local_88,0); if (iVar2 == 0) { iVar2 = sshbuf_froms(local_78,&local_90); __s2 = local_88; if (iVar2 != 0) goto LAB_001004e9; __s1 = (char *)sshkey_ssh_name_plain(param_1); iVar2 = strcmp(__s1,__s2); if (iVar2 == 0) { lVar3 = sshbuf_len(local_78); if (lVar3 == 0) { iVar2 = sshbuf_get_bignum2(local_90,&local_a0); if (iVar2 == 0) { iVar2 = sshbuf_get_bignum2(local_90,&local_98); if (iVar2 == 0) { local_80 = ECDSA_SIG_new(); if (local_80 == (ECDSA_SIG *)0x0) { local_a8 = -2; } else { iVar2 = ECDSA_SIG_set0(local_80,local_a0,local_98); if (iVar2 == 0) { local_a8 = -0x16; } else { local_98 = (BIGNUM *)0x0; local_a0 = (BIGNUM *)0x0; lVar3 = sshbuf_len(local_90); if (lVar3 == 0) { local_a8 = ssh_digest_memory(iVar1,param_4,param_5,local_68,0x40); if (local_a8 == 0) { iVar1 = ECDSA_do_verify(local_68,(int)local_70,local_80, *(EC_KEY **)(param_1 + 8)); if (iVar1 == 0) { local_a8 = -0x15; } else if (iVar1 == 1) { local_a8 = 0; } else { local_a8 = -0x16; } } } else { local_a8 = -0x17; } } } goto LAB_001006a0; } } local_a8 = -4; } else { local_a8 = -0x17; } } else { local_a8 = -0xd; } } else { LAB_001004e9: local_a8 = -4; } LAB_001006a0: explicit_bzero(local_68,0x40); sshbuf_free(local_90); sshbuf_free(local_78); ECDSA_SIG_free(local_80); BN_clear_free(local_a0); BN_clear_free(local_98); free(local_88); goto LAB_00100708; } } local_a8 = -1; goto LAB_00100708; } } local_a8 = -10; LAB_00100708: if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_a8; }
static void debug_mktime_not_ok (struct tm const *tm0, struct tm const *tm1, parser_control const *pc, _Bool time_zone_seen) { char tmp[DBGBUFSIZE]; int i; const _Bool eq_sec = (tm0->tm_sec == tm1->tm_sec); const _Bool eq_min = (tm0->tm_min == tm1->tm_min); const _Bool eq_hour = (tm0->tm_hour == tm1->tm_hour); const _Bool eq_mday = (tm0->tm_mday == tm1->tm_mday); const _Bool eq_month = (tm0->tm_mon == tm1->tm_mon); const _Bool eq_year = (tm0->tm_year == tm1->tm_year); const _Bool dst_shift = eq_sec && eq_min && !eq_hour && eq_mday && eq_month && eq_year; if (!debugging (pc)) return; dbg_printf (gettext ("error: invalid date/time value:\n")); dbg_printf (gettext (" user provided time: '%s'\n"), debug_strfdatetime (tm0, pc, tmp, sizeof tmp)); dbg_printf (gettext (" normalized time: '%s'\n"), debug_strfdatetime (tm1, pc, tmp, sizeof tmp)); i = snprintf (tmp, sizeof tmp, " %4s %2s %2s %2s %2s %2s", eq_year ? "" : "----", eq_month ? "" : "--", eq_mday ? "" : "--", eq_hour ? "" : "--", eq_min ? "" : "--", eq_sec ? "" : "--"); if (0 <= i) { if (sizeof tmp - 1 < i) i = sizeof tmp - 1; while (0 < i && tmp[i - 1] == ' ') --i; tmp[i] = '\0'; } dbg_printf ("%s\n", tmp); dbg_printf (gettext (" possible reasons:\n")); if (dst_shift) dbg_printf (gettext (" non-existing due to daylight-saving time;\n")); if (!eq_mday && !eq_month) dbg_printf (gettext (" invalid day/month combination;\n")); dbg_printf (gettext (" numeric values overflow;\n")); dbg_printf (" %s\n", (time_zone_seen ? gettext ("incorrect timezone") : gettext ("missing timezone"))); }
void debug_mktime_not_ok(undefined8 param_1,undefined8 param_2,undefined8 param_3) { long lVar1; char cVar2; long in_FS_OFFSET; lVar1 = *(long *)(in_FS_OFFSET + 0x28); cVar2 = debugging(param_3); if (cVar2 == '\x01') { gettext("error: invalid date/time value:\n"); } if (lVar1 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
void compat_init_setproctitle(int argc, char *argv[]) { char *lastargv = ((void *)0) ; char **envp = environ; int i; if (argc == 0 || argv[0] == ((void *)0) ) return; for (i = 0; envp[i] != ((void *)0) ; i++) ; if ((environ = calloc(i + 1, sizeof(*environ))) == ((void *)0) ) { environ = envp; return; } for (i = 0; i < argc; i++) { if (lastargv == ((void *)0) || lastargv + 1 == argv[i]) lastargv = argv[i] + strlen(argv[i]); } for (i = 0; envp[i] != ((void *)0) ; i++) { if (lastargv + 1 == envp[i]) lastargv = envp[i] + strlen(envp[i]); } argv[1] = ((void *)0) ; argv_start = argv[0]; argv_env_len = lastargv - argv[0] - 1; for (i = 0; envp[i] != ((void *)0) ; i++) environ[i] = strdup(envp[i]); environ[i] = ((void *)0) ; }
long long compat_init_setproctitle(unsigned long a0, unsigned long long a1[2]) { unsigned int v0; void* v1; unsigned long long *v2; unsigned long long *v4; v1 = 0; v4 = *(got.environ); v2 = *(got.environ); if (!a0) return v4; v4 = a1[0]; if (!a1[0]) return v4; for (v0 = 0; v2[v0]; v0 = __addvsi3(v0, 0x1)); *(got.environ) = calloc(__addvsi3(v0, 0x1), 0x8); if (!*(got.environ)) { v4 = got.environ; *(got.environ) = v2; return v4; } for (v0 = 0; v0 < a0; v0 = __addvsi3(v0, 0x1)) { if (!v1 || v1 + 1 == a1[v0]) v1 = strlen(a1[v0]) + a1[v0]; } for (v0 = 0; v2[v0]; v0 = __addvsi3(v0, 0x1)) { if (v1 + 1 == v2[v0]) v1 = strlen(v2[v0]) + v2[v0]; } a1[1] = 0; argv_start = a1[0]; argv_env_len = __addvdi3(__subvdi3(v1, a1[0]), 0xffffffffffffffff); for (v0 = 0; v2[v0]; v0 = __addvsi3(v0, 0x1)) { *((*(got.environ) + v0 * 8)) = strdup(v2[v0]); } v4 = *(got.environ) + v0 * 8; *((*(got.environ) + v0 * 8)) = 0; return v4; }
static int child_process(entry * e, char **jobenv) { int stdin_pipe[2], stdout_pipe[2]; char *input_data, *usernm, *mailto, *mailfrom; char mailto_expanded[255]; char mailfrom_expanded[255]; int children = 0; pid_t pid = getpid(); struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa. __sigaction_handler.sa_handler = ((__sighandler_t) 1) ; sigaction( 13 , &sa, ((void *)0) ); sa. __sigaction_handler.sa_handler = ((__sighandler_t) 0) ; sigaction( 17 , &sa, ((void *)0) ); if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] child_process('%s')\n", (long) getpid(), e->cmd); { char *pch; for (pch = ProgramName; *pch; pch++) *pch = (char)( ((*__ctype_b_loc ())[(int) (( *pch ))] & (unsigned short int) _ISlower) ? toupper(*pch) : *pch); } usernm = e->pwd->pw_name; mailto = env_get("MAILTO", jobenv); mailfrom = env_get("MAILFROM", e->envp); if (mailto != ((void *)0) ) { if (expand_envvar(mailto, mailto_expanded, sizeof(mailto_expanded))) { mailto = mailto_expanded; } else { log_it("CRON", pid, "WARNING", "The environment variable 'MAILTO' could not be expanded. The non-expanded value will be used." , 0); } } if (mailfrom != ((void *)0) ) { if (expand_envvar(mailfrom, mailfrom_expanded, sizeof(mailfrom_expanded))) { mailfrom = mailfrom_expanded; } else { log_it("CRON", pid, "WARNING", "The environment variable 'MAILFROM' could not be expanded. The non-expanded value will be used." , 0); } } if (pipe(stdin_pipe) == -1) { log_it("CRON", pid, "PIPE() FAILED", "stdin_pipe", (*__errno_location ()) ); return 1; } if (pipe(stdout_pipe) == -1) { log_it("CRON", pid, "PIPE() FAILED", "stdout_pipe", (*__errno_location ()) ); return 1; } { int escaped = 0; int ch; char *p; for (input_data = p = e->cmd; (ch = *input_data) != '\0'; input_data++, p++) { if (p != input_data) *p = (char)ch; if (escaped) { if (ch == '%') *--p = (char)ch; escaped = 0; continue; } if (ch == '\\') { escaped = 1; continue; } if (ch == '%') { *input_data++ = '\0'; break; } } *p = '\0'; } switch (fork()) { case -1: log_it("CRON", pid, "CAN'T FORK", "child_process", (*__errno_location ()) ); return 1; case 0: if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] grandchild process fork()'ed\n", (long) getpid()); if ((e->flags & 0x20) == 0) { char *x = mkprints((u_char *) e->cmd, strlen(e->cmd)); if (x == ((void *)0) ) _exit(1); log_it(usernm, getpid(), "CMD", x, 0); free(x); } if (cron_change_user_permanently(e->pwd, env_get("HOME", jobenv)) < 0) _exit(1); (void) setsid(); sa. __sigaction_handler.sa_handler = ((__sighandler_t) 0) ; sigaction( 13 , &sa, ((void *)0) ); close(stdin_pipe[1]); close(stdout_pipe[0]); if (stdin_pipe[0] != 0) { dup2(stdin_pipe[0], 0); close(stdin_pipe[0]); } if (stdout_pipe[1] != 1) { dup2(stdout_pipe[1], 1); close(stdout_pipe[1]); } dup2(1, 2); { char *shell = env_get("SHELL", jobenv); int fd, fdmax = ((getdtablesize())<(10000)?(getdtablesize()):(10000)); for(fd = 2 + 1; fd < fdmax; fd++) { close(fd); } if (DebugFlags & 0x0040) { fprintf( stderr , "debug DTEST is on, not exec'ing command.\n"); fprintf( stderr , "\tcmd='%s' shell='%s'\n", e->cmd, shell); _exit(0); } execle(shell, shell, "-c", e->cmd, (char *) 0, jobenv); fprintf( stderr , "execl: couldn't exec `%s'\n", shell); perror("execl"); _exit(1); } break; default: cron_restore_default_security_context(); break; } children++; if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] child continues, closing pipes\n", (long) getpid()); close(stdin_pipe[0]); close(stdout_pipe[1]); if (*input_data && fork() == 0) { FILE *out = fdopen(stdin_pipe[1], "w"); int need_newline = 0; int escaped = 0; int ch; if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] child2 sending data to grandchild\n", (long) getpid()) ; sa. __sigaction_handler.sa_handler = ((__sighandler_t) 0) ; sigaction( 13 , &sa, ((void *)0) ); close(stdout_pipe[0]); if (cron_change_user_permanently(e->pwd, env_get("HOME", jobenv)) < 0) _exit(1); while ((ch = *input_data++) != '\0') { if (escaped) { if (ch != '%') putc('\\', out); } else { if (ch == '%') ch = '\n'; } if (!(escaped = (ch == '\\'))) { putc(ch, out); need_newline = (ch != '\n'); } } if (escaped) putc('\\', out); if (need_newline) putc('\n', out); fclose(out); if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] child2 done sending to grandchild\n", (long) getpid()) ; _exit(0); } close(stdin_pipe[1]); children++; if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] child reading output from grandchild\n", (long) getpid()) ; { FILE *in = fdopen(stdout_pipe[0], "r"); int ch = getc(in); if (ch != (-1) ) { FILE *mail = ((void *)0) ; int bytes = 1; int status = 0; char logbuf[1024]; int bufidx = 0; if (SyslogOutput) { if (ch != '\n') logbuf[bufidx++] = (char)ch; } if ((DebugFlags & (0x0004 | 0x0001)) != 0) printf ("[%ld] got data (%x:%c) from grandchild\n", (long) getpid(), ch, ch) ; if (mailto) { if (!*mailto) { mailto = ((void *)0) ; } } else { mailto = usernm; } if (!mailfrom || !*mailfrom || !safe_p(usernm, mailfrom)) { mailfrom = e->pwd->pw_name; } if (mailto && safe_p(usernm, mailto) && strncmp(MailCmd,"off",3) && !SyslogOutput) { char **env; char mailcmd[131072 +1]; char hostname[64]; char *content_type = env_get("CONTENT_TYPE", jobenv), *content_transfer_encoding = env_get("CONTENT_TRANSFER_ENCODING", jobenv); gethostname(hostname, 64); if (MailCmd[0] == '\0') { int len; len = snprintf(mailcmd, sizeof mailcmd, "%s -FCronDaemon -i -odi -oem -oi -t -f %s", "/usr/sbin/sendmail", mailfrom); if (len < 0) { fprintf( stderr , "mailcmd snprintf failed\n"); (void) _exit(1); } if (sizeof mailcmd <= (size_t) len) { fprintf( stderr , "mailcmd too long\n"); (void) _exit(1); } } else { strncpy(mailcmd, MailCmd, 131072 +1); } if (!(mail = cron_popen(mailcmd, "w", e->pwd, jobenv))) { perror(mailcmd); (void) _exit(1); } fprintf(mail, "From: \"(Cron Daemon)\" <%s>\n", mailfrom); fprintf(mail, "To: %s\n", mailto); fprintf(mail, "Subject: Cron <%s@%s> %s\n", usernm, first_word(hostname, "."), e->cmd); fprintf(mail, "MIME-Version: 1.0\n"); if (content_type == ((void *)0) ) { fprintf(mail, "Content-Type: text/plain; charset=%s\n", cron_default_mail_charset); } else { char *nl = content_type; size_t ctlen = strlen(content_type); while ((*nl != '\0') && ((nl = strchr(nl, '\n')) != ((void *)0) ) && (nl < (content_type + ctlen)) ) *nl = ' '; fprintf(mail, "Content-Type: %s\n", content_type); } if (content_transfer_encoding == ((void *)0) ) { fprintf(mail, "Content-Transfer-Encoding: 8bit\n"); } else { char *nl = content_transfer_encoding; size_t ctlen = strlen(content_transfer_encoding); while ((*nl != '\0') && ((nl = strchr(nl, '\n')) != ((void *)0) ) && (nl < (content_transfer_encoding + ctlen)) ) *nl = ' '; fprintf(mail, "Content-Transfer-Encoding: %s\n", content_transfer_encoding); } fprintf(mail, "Auto-Submitted: auto-generated\n"); fprintf(mail, "Precedence: bulk\n"); for (env = jobenv; *env; env++) fprintf(mail, "X-Cron-Env: <%s>\n", *env); fprintf(mail, "\n"); putc(ch, mail); } while ( (-1) != (ch = getc(in))) { if (ch == '\r') continue; bytes++; if (mail) putc(ch, mail); if (SyslogOutput) { logbuf[bufidx++] = (char)ch; if ((ch == '\n') || (bufidx == sizeof(logbuf)-1)) { if (ch == '\n') logbuf[bufidx-1] = '\0'; else logbuf[bufidx] = '\0'; log_it(usernm, getpid(), "CMDOUT", logbuf, 0); bufidx = 0; } } } if (mail) { if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] closing pipe to mail\n", (long) getpid()); status = cron_pclose(mail); } if (SyslogOutput) { if (bufidx) { logbuf[bufidx] = '\0'; log_it(usernm, getpid(), "CMDOUT", logbuf, 0); } } if (mail && status && !SyslogOutput) { char buf[131072]; sprintf(buf, "mailed %d byte%s of output but got status 0x%04x\n", bytes, (bytes == 1) ? "" : "s", status); log_it(usernm, getpid(), "MAIL", buf, 0); } } if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] got EOF from grandchild\n", (long) getpid()); fclose(in); } for (; children > 0; children--) { int waiter; pid_t child; if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] waiting for grandchild #%d to finish\n", (long) getpid(), children) ; while ((child = wait(&waiter)) < 0 && (*__errno_location ()) == 4 ) ; if (child < 0) { if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] no more grandchildren--mail written?\n", (long) getpid()) ; break; } if ((DebugFlags & (0x0004)) != 0) printf ("[%ld] grandchild #%ld finished, status=%04x", (long) getpid(), (long) child, ((( waiter ) & 0xff00) >> 8) ) ; if ( (((signed char) ((( waiter ) & 0x7f) + 1) >> 1) > 0) && (( waiter ) & 0x80) ) if ((DebugFlags & (0x0004)) != 0) printf (", dumped core"); if ((DebugFlags & (0x0004)) != 0) printf ("\n"); } if ((e->flags & 0x20) == 0) { char *x = mkprints((u_char *) e->cmd, strlen(e->cmd)); log_it(usernm, getpid(), "CMDEND", x ? x : "**Unknown command**" , 0); free(x); } return 0; }
int child_process() { unsigned long long v0; int tmp_11; int tmp_7; char v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; unsigned int v12; unsigned int v13; unsigned int v14; unsigned int v15; unsigned int v16; char *v17; void* v18; char *v19; char *v20; char *v21; void* v22; unsigned long long *v23; char *v24; char *v25; unsigned long long v26; void* v27; unsigned long v28; void* v29; void* v30; char *v31; char *v32; unsigned long v33; unsigned long v34; void* v35; char v36; char v37; char v38; char v39; void* v40; char v41; char v42; char v43; char v44; char v45; char v46; unsigned long long v47; unsigned long v48; unsigned long v49; unsigned long v50; char v52; char v53; char v54; unsigned long v55; unsigned long v56; unsigned long long v57; unsigned long long *v58; struct_0 *v59; unsigned long v61; char *v62; unsigned int v63; unsigned long long v64; unsigned int v65; unsigned long long v66; unsigned long long v67; unsigned long long v68; unsigned long long v69; unsigned long long v71; unsigned long long v73; unsigned long long v74; unsigned long long v75; v50 = v55; v49 = v56; do { v47 = v47; } while (&v47 != &v46); v0 = v57; v48 = v58[5]; v2 = 0; v11 = getpid(); memset(&v40, 0x0, 0x98); v40 = 1; sigaction(0xd, &v40, 0x0); v40 = 0; sigaction(0x11, &v40, 0x0); if ((DebugFlags & 4)) printf("[%ld] child_process('%s')\n", getpid(), v59->field_18); for (v20 = ProgramName; *(v20); v20 += 1) { v61 = *((*(v20) * 2 + *(__ctype_b_loc()))) & 0x200; if (!v61) *(&v61) = *(v20); else v61 = toupper(*(v20)); *(v20) = v61; } v26 = v59->field_8->field_0; v18 = env_get("MAILTO", v0); v19 = env_get("MAILFROM", v59->field_10); if (v18) { if (expand_envvar(v18, &v42, 0xff, &v42)) v18 = &v42; else log_it("CRON", v11, "WARNING", "The environment variable 'MAILTO' could not be expanded. The non-expanded value will be used.", 0x0); } if (v19) { if (expand_envvar(v19, &v43, 0xff, &v43)) v19 = &v43; else log_it("CRON", v11, "WARNING", "The environment variable 'MAILFROM' could not be expanded. The non-expanded value will be used.", 0x0); } if (pipe(&v36) == -1) { log_it("CRON", v11, "PIPE() FAILED", "stdin_pipe", *(__errno_location())); } else if (pipe(&v38) == -1) { log_it("CRON", v11, "PIPE() FAILED", "stdout_pipe", *(__errno_location())); } else { v3 = 0; v21 = v59->field_18; v17 = v21; while (true) { v12 = *(v17); if (!v12) break; if (v21 != v17) *(v21) = v12; if (v3) { if (v12 == 37) { v21 += 1; *(v21) = v12; } v3 = 0; v17 += 1; v21 += 1; } else { switch (v12) { case 92: v3 = 1; break; case 37: v62 = v17; v17 += 1; *(v62) = 0; goto LABEL_400593; default: v17 += 1; v21 += 1; continue; } } } LABEL_400593: *(v21) = 0; v63 = fork(); if (v63 == -1) { log_it("CRON", v11, "CAN'T FORK", "child_process", *(__errno_location())); } else if (!v63) { if ((DebugFlags & 4)) printf("[%ld] grandchild process fork()'ed\n", getpid()); if (!(v59->field_34 & 32)) { v64 = strlen(v59->field_18); v27 = mkprints(v59->field_18, v64, v64); if (!v27) _exit(0x1); log_it(v26, getpid(), "CMD", v27, 0x0); free(v27); } v65 = env_get("HOME", v0); if (cron_change_user_permanently(v59->field_8, v65, v65) < 0) _exit(0x1); setsid(); v40 = 0; sigaction(0xd, &v40, 0x0); close(*(&v37)); close(*(&v38)); if (*(&v36)) { dup2(*(&v36), 0x0); close(*(&v36)); } if (*(&v39) != 1) { dup2(*(&v39), 0x1); close(*(&v39)); } dup2(0x1, 0x2); v28 = env_get("SHELL", v0); if (getdtablesize("SHELL", v57, 0x0, v67, v68, v69) > 9999) v65 = 10000; else v65 = getdtablesize("SHELL", v57, 0x0, v67, v68, v69); v13 = v65; for (v4 = 3; v4 < v13; v4 += 1) { close(v4); } if ((DebugFlags & 64)) { fprintf(*(&stderr), "debug DTEST is on, not exec'ing command.\n"); fprintf(*(&stderr), "\tcmd='%s' shell='%s'\n", v59->field_18, v28); _exit(0x0); } execle(v28, v28); fprintf(*(&stderr), "execl: couldn't exec `%s'\n", v28); perror("execl"); _exit(0x1); } else { cron_restore_default_security_context(); v2 += 1; if ((DebugFlags & 4)) printf("[%ld] child continues, closing pipes\n", getpid()); close(*(&v36)); close(*(&v39)); if (*(v17) && !fork()) { v29 = fdopen(*(&v37), "w"); v5 = 0; v6 = 0; if ((DebugFlags & 4)) printf("[%ld] child2 sending data to grandchild\n", getpid()); v40 = 0; sigaction(0xd, &v40, 0x0); close(*(&v38)); v66 = env_get("HOME", v0); if (cron_change_user_permanently(v59->field_8, v66, v66) < 0) _exit(0x1); while (true) { tmp_11 = v17; v17 += 1; *(&v66) = *(tmp_11); v7 = v66; if (!v7) break; if (!v6) { if (v7 == 37) v7 = 10; } else { if (v7 != 37) putc(0x5c, v29); } v6 = v7 == 92; if (!(!v6)) continue; putc(v7, v29); v5 = v7 != 10; } if (v6) putc(0x5c, v29); if (v5) putc(0xa, v29); fclose(v29); if ((DebugFlags & 4)) printf("[%ld] child2 done sending to grandchild\n", getpid()); _exit(0x0); } close(*(&v37)); v2 += 1; if ((DebugFlags & 4)) printf("[%ld] child reading output from grandchild\n", getpid()); v30 = fdopen(*(&v38), "r"); v14 = getc(v30); if (v14 != -1) { v22 = 0; v8 = 1; v9 = 0; v10 = 0; if (SyslogOutput && v14 != 10) { tmp_7 = v10; v10 += 1; (&v44)[tmp_7] = v14; } if ((DebugFlags & 5)) printf("[%ld] got data (%x:%c) from grandchild\n", getpid(), v14, v14); if (!v18) { v18 = v26; } else if (!*(v18)) { v18 = 0; } if (!v19 || !*(v19) || !safe_p(v26, v19)) v19 = v59->field_8->field_0; if (v18 && safe_p(v26, v18) && strncmp(&MailCmd, "off", 0x3) && !SyslogOutput) { v31 = env_get("CONTENT_TYPE", v0); v32 = env_get("CONTENT_TRANSFER_ENCODING", v0); gethostname(&v41, 0x40); if (MailCmd) { strncpy(&v45, &MailCmd, 0x20001); } else { v15 = snprintf(&v45, 0x20001, "%s -FCronDaemon -i -odi -oem -oi -t -f %s", &g_401a2b, v19); if (v15 < 0) { fprintf(*(&stderr), "mailcmd snprintf failed\n"); _exit(0x1); } else if (v15 > 0x20000) { fprintf(*(&stderr), "mailcmd too long\n"); _exit(0x1); } } v22 = cron_popen(&v45, "w", v59->field_8, v0); if (!v22) { perror(&v45); _exit(0x1); } fprintf(v22, "From: \"(Cron Daemon)\" <%s>\n", v19); fprintf(v22, "To: %s\n", v18); fprintf(v22, "Subject: Cron <%s@%s> %s\n", v26, first_word(&v41, "."), v59->field_18); fprintf(v22, "MIME-Version: 1.0\n"); if (!v31) { fprintf(v22, "Content-Type: text/plain; charset=%s\n", &cron_default_mail_charset); } else { v24 = v31; for (v33 = strlen(v31); *(v24) && v24 && v24 < &v31[v33]; *(v24) = 32); fprintf(v22, "Content-Type: %s\n", v31); } if (!v32) { fprintf(v22, "Content-Transfer-Encoding: 8bit\n"); } else { v25 = v32; for (v34 = strlen(v32); *(v25) && v25 && v25 < &v32[v34]; *(v25) = 32); fprintf(v22, "Content-Transfer-Encoding: %s\n", v32); } fprintf(v22, "Auto-Submitted: auto-generated\n"); fprintf(v22, "Precedence: bulk\n"); for (v23 = v0; *(v23); v23 += 1) { fprintf(v22, "X-Cron-Env: <%s>\n", *(v23)); } fprintf(v22, "\n"); putc(v14, v22); } while (true) { v14 = getc(v30); if (v14 == -1) break; if (v14 != 13) { v8 += 1; if (v22) putc(v14, v22); if (SyslogOutput) { tmp_11 = v10; v10 += 1; (&v44)[tmp_11] = v14; if (v14 == 10 || v10 == 1023) { if (v14 == 10) (&v44)[1 + v10] = 0; else (&v44)[v10] = 0; log_it(v26, getpid(), "CMDOUT", &v44, 0x0); v10 = 0; } } } } if (v22) { if ((DebugFlags & 4)) printf("[%ld] closing pipe to mail\n", getpid()); v9 = cron_pclose(v22); } if (SyslogOutput && v10) { (&v44)[v10] = 0; log_it(v26, getpid(), "CMDOUT", &v44, 0x0); } if (v22 && v9 && !SyslogOutput) { if (v8 != 1) v63 = &g_401bd2; else v63 = &g_401bd1; sprintf(&v45, "mailed %d byte%s of output but got status 0x%04x\n", v8, v63, v9); log_it(v26, getpid(), "MAIL", &v45, 0x0); } } if ((DebugFlags & 4)) printf("[%ld] got EOF from grandchild\n", getpid()); fclose(v30); while (true) { if (v2 <= 0) break; if ((DebugFlags & 4)) printf("[%ld] waiting for grandchild #%d to finish\n", getpid(), v2); do { v16 = wait(&v1); } while (v16 < 0 && (v63 = *(__errno_location()), v63 == 4)); if (v16 >= 0) { if ((DebugFlags & 4)) printf("[%ld] grandchild #%ld finished, status=%04x", getpid(), v16, (*(&v1) >> 8)); if (((*(&v1) & 127) + 1 >> 1) > 0 && (*(&v1) & 128) && (DebugFlags & 4)) printf(", dumped core"); if ((DebugFlags & 4)) printf("\n"); v2 -= 1; } else if ((DebugFlags & 4)) { printf("[%ld] no more grandchildren--mail written?\n", getpid()); break; } } if (!(v59->field_34 & 32)) { v71 = strlen(v59->field_18); v35 = mkprints(v59->field_18, v71, v71); log_it(v26, getpid(), "CMDEND", (!v35 ? v35 : "**Unknown command**"), 0x0); free(v35); } } } if ((v48 ^ v58[5])) __stack_chk_fail(); v73 = *(&v52); v74 = *(&v53); v75 = *(&v54); return; }
BUCKET_CONTENTS * hash_search (string, table, flags) const char *string; HASH_TABLE *table; int flags; { BUCKET_CONTENTS *list; int bucket; unsigned int hv; if (table == 0 || ((flags & 0x02) == 0 && ((table) ? (table)->nentries : 0) == 0)) return (BUCKET_CONTENTS *) ((void *)0) ; bucket = (((hv) = hash_string (string)) & ((table)->nbuckets - 1)); for (list = table->bucket_array ? table->bucket_array[bucket] : 0; list; list = list->next) { if (hv == list->khash && ((list->key)[0] == (string)[0] && strcmp(list->key, string) == 0)) { list->times_found++; return (list); } } if (flags & 0x02) { if (((table)->nentries >= (table)->nbuckets * 2)) { hash_grow (table); bucket = (((hv) = hash_string (string)) & ((table)->nbuckets - 1)); } list = (BUCKET_CONTENTS *)sh_xmalloc((sizeof (BUCKET_CONTENTS)), "hashlib.c", 280); list->next = table->bucket_array[bucket]; table->bucket_array[bucket] = list; list->data = ((void *)0) ; list->key = (char *)string; list->khash = hv; list->times_found = 0; table->nentries++; return (list); } return (BUCKET_CONTENTS *) ((void *)0) ; }
undefined8 * hash_search(char *param_1,long *param_2,uint param_3) { int iVar1; undefined8 *puVar2; uint local_18; uint local_14; undefined8 *local_10; if ((param_2 == (long *)0x0) || (((param_3 & 2) == 0 && ((param_2 == (long *)0x0 || (*(int *)((long)param_2 + 0xc) == 0)))))) { puVar2 = (undefined8 *)0x0; } else { local_14 = hash_string(param_1); local_18 = *(int *)(param_2 + 1) - 1U & local_14; if (*param_2 == 0) { local_10 = (undefined8 *)0x0; } else { local_10 = *(undefined8 **)(*param_2 + (long)(int)local_18 * 8); } for (; local_10 != (undefined8 *)0x0; local_10 = (undefined8 *)*local_10) { if (((local_14 == *(uint *)(local_10 + 3)) && (*(char *)local_10[1] == *param_1)) && (iVar1 = strcmp((char *)local_10[1],param_1), iVar1 == 0)) { *(int *)((long)local_10 + 0x1c) = *(int *)((long)local_10 + 0x1c) + 1; return local_10; } } if ((param_3 & 2) == 0) { puVar2 = (undefined8 *)0x0; } else { if (*(int *)(param_2 + 1) * 2 <= *(int *)((long)param_2 + 0xc)) { hash_grow(param_2); local_14 = hash_string(param_1); local_18 = *(int *)(param_2 + 1) - 1U & local_14; } puVar2 = (undefined8 *)sh_xmalloc(0x20,"hashlib.c",0x118); *puVar2 = *(undefined8 *)(*param_2 + (long)(int)local_18 * 8); *(undefined8 **)((long)(int)local_18 * 8 + *param_2) = puVar2; puVar2[2] = 0; puVar2[1] = param_1; *(uint *)(puVar2 + 3) = local_14; *(undefined4 *)((long)puVar2 + 0x1c) = 0; *(int *)((long)param_2 + 0xc) = *(int *)((long)param_2 + 0xc) + 1; } } return puVar2; }
const char *strxf_xfrmproto(__u8 proto) { static char str[16]; int i; for (i = 0; ; i++) { const struct typeent *t = &xfrmproto_types[i]; if (!t->t_name || t->t_type == -1) break; if (t->t_type == proto) return t->t_name; } sprintf(str, "%u", proto); return str; }
int strxf_xfrmproto(unsigned long a0) { unsigned int v0; struct_0 *v1; unsigned int v3; v0 = 0; while (true) { v1 = &(&xfrmproto_types)[2 * v0]; if (!v1->field_0) { LABEL_400295: sprintf(&str.9239, "%u", a0); v3 = &str.9239; break; } else { if (v1->field_8 == -1) goto LABEL_400295; if (v1->field_8 != a0) { v0 += 1; } else { v3 = v1->field_0; break; } } } return v3; }
static SHELL_VAR * get_comp_wordbreaks (var) SHELL_VAR *var; { if (rl_completer_word_break_characters == 0 && bash_readline_initialized == 0) enable_hostname_completion (perform_hostname_completion); return (set_string_value (var, rl_completer_word_break_characters, 0)); }
void get_comp_wordbreaks(undefined8 param_1) { if ((rl_completer_word_break_characters == 0) && (bash_readline_initialized == 0)) { enable_hostname_completion(perform_hostname_completion); } set_string_value(param_1,rl_completer_word_break_characters,0); return; }
void usage (int status) { if (status != 0 ) do { fprintf ( stderr , gettext ("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf (gettext ("Usage: %s [OPTION]... [FILE]...\n"), program_name); fputs_unlocked (gettext ("List information about the FILEs (the current directory by default).\nSort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n"), stdout ) ; emit_mandatory_arg_note (); fputs_unlocked (gettext (" -a, --all do not ignore entries starting with .\n -A, --almost-all do not list implied . and ..\n --author with -l, print the author of each file\n -b, --escape print C-style escapes for nongraphic characters\n"), stdout ) ; fputs_unlocked (gettext (" --block-size=SIZE with -l, scale sizes by SIZE when printing them;\n e.g., '--block-size=M'; see SIZE format below\n\n"), stdout ) ; fputs_unlocked (gettext (" -B, --ignore-backups do not list implied entries ending with ~\n"), stdout ) ; fputs_unlocked (gettext (" -c with -lt: sort by, and show, ctime (time of last\n modification of file status information);\n with -l: show ctime and sort by name;\n otherwise: sort by ctime, newest first\n\n"), stdout ) ; fputs_unlocked (gettext (" -C list entries by columns\n --color[=WHEN] color the output WHEN; more info below\n -d, --directory list directories themselves, not their contents\n -D, --dired generate output designed for Emacs' dired mode\n"), stdout ) ; fputs_unlocked (gettext (" -f list all entries in directory order\n -F, --classify[=WHEN] append indicator (one of */=>@|) to entries WHEN\n --file-type likewise, except do not append '*'\n"), stdout ) ; fputs_unlocked (gettext (" --format=WORD across -x, commas -m, horizontal -x, long -l,\n single-column -1, verbose -l, vertical -C\n\n"), stdout ) ; fputs_unlocked (gettext (" --full-time like -l --time-style=full-iso\n"), stdout ) ; fputs_unlocked (gettext (" -g like -l, but do not list owner\n"), stdout ) ; fputs_unlocked (gettext (" --group-directories-first\n group directories before files;\n can be augmented with a --sort option, but any\n use of --sort=none (-U) disables grouping\n\n"), stdout ) ; fputs_unlocked (gettext (" -G, --no-group in a long listing, don't print group names\n"), stdout ) ; fputs_unlocked (gettext (" -h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc.\n --si likewise, but use powers of 1000 not 1024\n"), stdout ) ; fputs_unlocked (gettext (" -H, --dereference-command-line\n follow symbolic links listed on the command line\n"), stdout ) ; fputs_unlocked (gettext (" --dereference-command-line-symlink-to-dir\n follow each command line symbolic link\n that points to a directory\n\n"), stdout ) ; fputs_unlocked (gettext (" --hide=PATTERN do not list implied entries matching shell PATTERN\n (overridden by -a or -A)\n\n"), stdout ) ; fputs_unlocked (gettext (" --hyperlink[=WHEN] hyperlink file names WHEN\n"), stdout ) ; fputs_unlocked (gettext (" --indicator-style=WORD\n append indicator with style WORD to entry names:\n none (default), slash (-p),\n file-type (--file-type), classify (-F)\n\n"), stdout ) ; fputs_unlocked (gettext (" -i, --inode print the index number of each file\n -I, --ignore=PATTERN do not list implied entries matching shell PATTERN\n"), stdout ) ; fputs_unlocked (gettext (" -k, --kibibytes default to 1024-byte blocks for file system usage;\n used only with -s and per directory totals\n\n"), stdout ) ; fputs_unlocked (gettext (" -l use a long listing format\n"), stdout ) ; fputs_unlocked (gettext (" -L, --dereference when showing file information for a symbolic\n link, show information for the file the link\n references rather than for the link itself\n\n"), stdout ) ; fputs_unlocked (gettext (" -m fill width with a comma separated list of entries\n"), stdout ) ; fputs_unlocked (gettext (" -n, --numeric-uid-gid like -l, but list numeric user and group IDs\n -N, --literal print entry names without quoting\n -o like -l, but do not list group information\n -p, --indicator-style=slash\n append / indicator to directories\n"), stdout ) ; fputs_unlocked (gettext (" -q, --hide-control-chars print ? instead of nongraphic characters\n"), stdout ) ; fputs_unlocked (gettext (" --show-control-chars show nongraphic characters as-is (the default,\n unless program is 'ls' and output is a terminal)\n\n"), stdout ) ; fputs_unlocked (gettext (" -Q, --quote-name enclose entry names in double quotes\n"), stdout ) ; fputs_unlocked (gettext (" --quoting-style=WORD use quoting style WORD for entry names:\n literal, locale, shell, shell-always,\n shell-escape, shell-escape-always, c, escape\n (overrides QUOTING_STYLE environment variable)\n\n"), stdout ) ; fputs_unlocked (gettext (" -r, --reverse reverse order while sorting\n -R, --recursive list subdirectories recursively\n -s, --size print the allocated size of each file, in blocks\n"), stdout ) ; fputs_unlocked (gettext (" -S sort by file size, largest first\n"), stdout ) ; fputs_unlocked (gettext (" --sort=WORD sort by WORD instead of name: none (-U), size (-S),\n time (-t), version (-v), extension (-X), width\n\n"), stdout ) ; fputs_unlocked (gettext (" --time=WORD change the default of using modification times;\n access time (-u): atime, access, use;\n change time (-c): ctime, status;\n birth time: birth, creation;\n with -l, WORD determines which time to show;\n with --sort=time, sort by WORD (newest first)\n\n"), stdout ) ; fputs_unlocked (gettext (" --time-style=TIME_STYLE\n time/date format with -l; see TIME_STYLE below\n"), stdout ) ; fputs_unlocked (gettext (" -t sort by time, newest first; see --time\n -T, --tabsize=COLS assume tab stops at each COLS instead of 8\n"), stdout ) ; fputs_unlocked (gettext (" -u with -lt: sort by, and show, access time;\n with -l: show access time and sort by name;\n otherwise: sort by access time, newest first\n\n"), stdout ) ; fputs_unlocked (gettext (" -U do not sort; list entries in directory order\n"), stdout ) ; fputs_unlocked (gettext (" -v natural sort of (version) numbers within text\n"), stdout ) ; fputs_unlocked (gettext (" -w, --width=COLS set output width to COLS. 0 means no limit\n -x list entries by lines instead of by columns\n -X sort alphabetically by entry extension\n -Z, --context print any security context of each file\n --zero end each output line with NUL, not newline\n -1 list one file per line\n"), stdout ) ; fputs_unlocked (gettext (" --help display this help and exit\n"), stdout ); fputs_unlocked (gettext (" --version output version information and exit\n"), stdout ); emit_size_note (); fputs_unlocked (gettext ("\nThe TIME_STYLE argument can be full-iso, long-iso, iso, locale, or +FORMAT.\nFORMAT is interpreted like in date(1). If FORMAT is FORMAT1<newline>FORMAT2,\nthen FORMAT1 applies to non-recent files and FORMAT2 to recent files.\nTIME_STYLE prefixed with 'posix-' takes effect only outside the POSIX locale.\nAlso the TIME_STYLE environment variable sets the default style to use.\n"), stdout ) ; fputs_unlocked (gettext ("\nThe WHEN argument defaults to 'always' and can also be 'auto' or 'never'.\n"), stdout ) ; fputs_unlocked (gettext ("\nUsing color to distinguish file types is disabled both by default and\nwith --color=never. With --color=auto, ls emits color codes only when\nstandard output is connected to a terminal. The LS_COLORS environment\nvariable can change the settings. Use the dircolors(1) command to set it.\n"), stdout ) ; fputs_unlocked (gettext ("\nExit status:\n 0 if OK,\n 1 if minor problems (e.g., cannot access subdirectory),\n 2 if serious trouble (e.g., cannot access command-line argument).\n"), stdout ) ; emit_ancillary_info ((ls_mode == 1 ? "ls" : (ls_mode == 2 ? "dir" : "vdir"))); } exit (status); }
void usage(int a1) { long v1; char *v2; long v3; char *v4; FILE *v5; char *v6; FILE *v7; char *v8; FILE *v9; char *v10; FILE *v11; char *v12; FILE *v13; char *v14; FILE *v15; char *v16; FILE *v17; char *v18; FILE *v19; char *v20; FILE *v21; char *v22; FILE *v23; char *v24; FILE *v25; char *v26; FILE *v27; char *v28; FILE *v29; char *v30; FILE *v31; char *v32; FILE *v33; char *v34; FILE *v35; char *v36; FILE *v37; char *v38; FILE *v39; char *v40; FILE *v41; char *v42; FILE *v43; char *v44; FILE *v45; char *v46; FILE *v47; char *v48; FILE *v49; char *v50; FILE *v51; char *v52; FILE *v53; char *v54; FILE *v55; char *v56; FILE *v57; char *v58; FILE *v59; char *v60; FILE *v61; char *v62; FILE *v63; char *v64; FILE *v65; char *v66; FILE *v67; char *v68; FILE *v69; char *v70; FILE *v71; char *v72; FILE *v73; char *v74; FILE *v75; char *v76; FILE *v77; char *v78; FILE *v79; char *v80; FILE *v81; char *v82; FILE *v83; char *v84; FILE *v85; char *v86; FILE *v87; char *v88; FILE *v89; char *v90; FILE *v91; char *v92; const char *v93; if ( a1 ) { v1 = program_name; v2 = gettext("Try '%s --help' for more information.\n"); fprintf(stderr, v2, v1); } else { v3 = program_name; v4 = gettext("Usage: %s [OPTION]... [FILE]...\n"); printf(v4, v3); v5 = stdout; v6 = gettext( "List information about the FILEs (the current directory by default).\n" "Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n"); fputs_unlocked(v6, v5); emit_mandatory_arg_note(); v7 = stdout; v8 = gettext( " -a, --all do not ignore entries starting with .\n" " -A, --almost-all do not list implied . and ..\n" " --author with -l, print the author of each file\n" " -b, --escape print C-style escapes for nongraphic characters\n"); fputs_unlocked(v8, v7); v9 = stdout; v10 = gettext( " --block-size=SIZE with -l, scale sizes by SIZE when printing them;\n" " e.g., '--block-size=M'; see SIZE format below\n" "\n"); fputs_unlocked(v10, v9); v11 = stdout; v12 = gettext(" -B, --ignore-backups do not list implied entries ending with ~\n"); fputs_unlocked(v12, v11); v13 = stdout; v14 = gettext( " -c with -lt: sort by, and show, ctime (time of last\n" " modification of file status information);\n" " with -l: show ctime and sort by name;\n" " otherwise: sort by ctime, newest first\n" "\n"); fputs_unlocked(v14, v13); v15 = stdout; v16 = gettext( " -C list entries by columns\n" " --color[=WHEN] color the output WHEN; more info below\n" " -d, --directory list directories themselves, not their contents\n" " -D, --dired generate output designed for Emacs' dired mode\n"); fputs_unlocked(v16, v15); v17 = stdout; v18 = gettext( " -f list all entries in directory order\n" " -F, --classify[=WHEN] append indicator (one of */=>@|) to entries WHEN\n" " --file-type likewise, except do not append '*'\n"); fputs_unlocked(v18, v17); v19 = stdout; v20 = gettext( " --format=WORD across -x, commas -m, horizontal -x, long -l,\n" " single-column -1, verbose -l, vertical -C\n" "\n"); fputs_unlocked(v20, v19); v21 = stdout; v22 = gettext(" --full-time like -l --time-style=full-iso\n"); fputs_unlocked(v22, v21); v23 = stdout; v24 = gettext(" -g like -l, but do not list owner\n"); fputs_unlocked(v24, v23); v25 = stdout; v26 = gettext( " --group-directories-first\n" " group directories before files;\n" " can be augmented with a --sort option, but any\n" " use of --sort=none (-U) disables grouping\n" "\n"); fputs_unlocked(v26, v25); v27 = stdout; v28 = gettext(" -G, --no-group in a long listing, don't print group names\n"); fputs_unlocked(v28, v27); v29 = stdout; v30 = gettext( " -h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc.\n" " --si likewise, but use powers of 1000 not 1024\n"); fputs_unlocked(v30, v29); v31 = stdout; v32 = gettext( " -H, --dereference-command-line\n" " follow symbolic links listed on the command line\n"); fputs_unlocked(v32, v31); v33 = stdout; v34 = gettext( " --dereference-command-line-symlink-to-dir\n" " follow each command line symbolic link\n" " that points to a directory\n" "\n"); fputs_unlocked(v34, v33); v35 = stdout; v36 = gettext( " --hide=PATTERN do not list implied entries matching shell PATTERN\n" " (overridden by -a or -A)\n" "\n"); fputs_unlocked(v36, v35); v37 = stdout; v38 = gettext(" --hyperlink[=WHEN] hyperlink file names WHEN\n"); fputs_unlocked(v38, v37); v39 = stdout; v40 = gettext( " --indicator-style=WORD\n" " append indicator with style WORD to entry names:\n" " none (default), slash (-p),\n" " file-type (--file-type), classify (-F)\n" "\n"); fputs_unlocked(v40, v39); v41 = stdout; v42 = gettext( " -i, --inode print the index number of each file\n" " -I, --ignore=PATTERN do not list implied entries matching shell PATTERN\n"); fputs_unlocked(v42, v41); v43 = stdout; v44 = gettext( " -k, --kibibytes default to 1024-byte blocks for file system usage;\n" " used only with -s and per directory totals\n" "\n"); fputs_unlocked(v44, v43); v45 = stdout; v46 = gettext(" -l use a long listing format\n"); fputs_unlocked(v46, v45); v47 = stdout; v48 = gettext( " -L, --dereference when showing file information for a symbolic\n" " link, show information for the file the link\n" " references rather than for the link itself\n" "\n"); fputs_unlocked(v48, v47); v49 = stdout; v50 = gettext(" -m fill width with a comma separated list of entries\n"); fputs_unlocked(v50, v49); v51 = stdout; v52 = gettext( " -n, --numeric-uid-gid like -l, but list numeric user and group IDs\n" " -N, --literal print entry names without quoting\n" " -o like -l, but do not list group information\n" " -p, --indicator-style=slash\n" " append / indicator to directories\n"); fputs_unlocked(v52, v51); v53 = stdout; v54 = gettext(" -q, --hide-control-chars print ? instead of nongraphic characters\n"); fputs_unlocked(v54, v53); v55 = stdout; v56 = gettext( " --show-control-chars show nongraphic characters as-is (the default,\n" " unless program is 'ls' and output is a terminal)\n" "\n"); fputs_unlocked(v56, v55); v57 = stdout; v58 = gettext(" -Q, --quote-name enclose entry names in double quotes\n"); fputs_unlocked(v58, v57); v59 = stdout; v60 = gettext( " --quoting-style=WORD use quoting style WORD for entry names:\n" " literal, locale, shell, shell-always,\n" " shell-escape, shell-escape-always, c, escape\n" " (overrides QUOTING_STYLE environment variable)\n" "\n"); fputs_unlocked(v60, v59); v61 = stdout; v62 = gettext( " -r, --reverse reverse order while sorting\n" " -R, --recursive list subdirectories recursively\n" " -s, --size print the allocated size of each file, in blocks\n"); fputs_unlocked(v62, v61); v63 = stdout; v64 = gettext(" -S sort by file size, largest first\n"); fputs_unlocked(v64, v63); v65 = stdout; v66 = gettext( " --sort=WORD sort by WORD instead of name: none (-U), size (-S),\n" " time (-t), version (-v), extension (-X), width\n" "\n"); fputs_unlocked(v66, v65); v67 = stdout; v68 = gettext( " --time=WORD change the default of using modification times;\n" " access time (-u): atime, access, use;\n" " change time (-c): ctime, status;\n" " birth time: birth, creation;\n" " with -l, WORD determines which time to show;\n" " with --sort=time, sort by WORD (newest first)\n" "\n"); fputs_unlocked(v68, v67); v69 = stdout; v70 = gettext( " --time-style=TIME_STYLE\n" " time/date format with -l; see TIME_STYLE below\n"); fputs_unlocked(v70, v69); v71 = stdout; v72 = gettext( " -t sort by time, newest first; see --time\n" " -T, --tabsize=COLS assume tab stops at each COLS instead of 8\n"); fputs_unlocked(v72, v71); v73 = stdout; v74 = gettext( " -u with -lt: sort by, and show, access time;\n" " with -l: show access time and sort by name;\n" " otherwise: sort by access time, newest first\n" "\n"); fputs_unlocked(v74, v73); v75 = stdout; v76 = gettext(" -U do not sort; list entries in directory order\n"); fputs_unlocked(v76, v75); v77 = stdout; v78 = gettext(" -v natural sort of (version) numbers within text\n"); fputs_unlocked(v78, v77); v79 = stdout; v80 = gettext( " -w, --width=COLS set output width to COLS. 0 means no limit\n" " -x list entries by lines instead of by columns\n" " -X sort alphabetically by entry extension\n" " -Z, --context print any security context of each file\n" " --zero end each output line with NUL, not newline\n" " -1 list one file per line\n"); fputs_unlocked(v80, v79); v81 = stdout; v82 = gettext(" --help display this help and exit\n"); fputs_unlocked(v82, v81); v83 = stdout; v84 = gettext(" --version output version information and exit\n"); fputs_unlocked(v84, v83); emit_size_note(); v85 = stdout; v86 = gettext( "\n" "The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or +FORMAT.\n" "FORMAT is interpreted like in date(1). If FORMAT is FORMAT1<newline>FORMAT2,\n" "then FORMAT1 applies to non-recent files and FORMAT2 to recent files.\n" "TIME_STYLE prefixed with 'posix-' takes effect only outside the POSIX locale.\n" "Also the TIME_STYLE environment variable sets the default style to use.\n"); fputs_unlocked(v86, v85); v87 = stdout; v88 = gettext("\nThe WHEN argument defaults to 'always' and can also be 'auto' or 'never'.\n"); fputs_unlocked(v88, v87); v89 = stdout; v90 = gettext( "\n" "Using color to distinguish file types is disabled both by default and\n" "with --color=never. With --color=auto, ls emits color codes only when\n" "standard output is connected to a terminal. The LS_COLORS environment\n" "variable can change the settings. Use the dircolors(1) command to set it.\n"); fputs_unlocked(v90, v89); v91 = stdout; v92 = gettext( "\n" "Exit status:\n" " 0 if OK,\n" " 1 if minor problems (e.g., cannot access subdirectory),\n" " 2 if serious trouble (e.g., cannot access command-line argument).\n"); fputs_unlocked(v92, v91); if ( ls_mode == 1 ) { v93 = "ls"; } else if ( ls_mode == 2 ) { v93 = "dir"; } else { v93 = "vdir"; } emit_ancillary_info(v93); } exit(a1); }
static void node__put(EditLine *el, keymacro_node_t *ptr) { if (ptr == ((void *)0) ) return; if (ptr->next != ((void *)0) ) { node__put(el, ptr->next); ptr->next = ((void *)0) ; } node__put(el, ptr->sibling); switch (ptr->type) { case 0: case 2: break; case 1: if (ptr->val.str != ((void *)0) ) free(ptr->val.str); break; default: abort(); break; } free(ptr); }
void node__put(undefined8 param_1,void *param_2) { int iVar1; if (param_2 != (void *)0x0) { if (*(long *)((long)param_2 + 0x10) != 0) { node__put(param_1,*(undefined8 *)((long)param_2 + 0x10)); *(undefined8 *)((long)param_2 + 0x10) = 0; } node__put(param_1,*(undefined8 *)((long)param_2 + 0x18)); iVar1 = *(int *)((long)param_2 + 4); if (iVar1 != 2) { if (2 < iVar1) { LAB_001008df: abort(); } if (iVar1 != 0) { if (iVar1 != 1) goto LAB_001008df; if (*(long *)((long)param_2 + 8) != 0) { free(*(void **)((long)param_2 + 8)); } } } free(param_2); } return; }
static int safe_p(const char *usernm, const char *s) { static const char safe_delim[] = "@!:%-.,_+"; const char *t; int ch, first; for (t = s, first = 1; (ch = *t++) != '\0'; first = 0) { if ( ((( ch ) & ~0x7f) == 0) && ((*__ctype_b_loc ())[(int) (( ch ))] & (unsigned short int) _ISprint) && ( ((*__ctype_b_loc ())[(int) (( ch ))] & (unsigned short int) _ISalnum) || (!first && strchr(safe_delim, ch)))) continue; log_it(usernm, getpid(), "UNSAFE", s, 0); return (0); } return (1); }
long safe_p(long a1, _BYTE *a2) { unsigned int v2; _BYTE *v4; int i; int c; _BYTE *v7; v7 = a2; for ( i = 1; ; i = 0 ) { v4 = v7++; c = (char)*v4; if ( !*v4 ) break; if ( (c & 0xFFFFFF80) != 0 || ((*_ctype_b_loc())[c] & 0x4000) == 0 || ((*_ctype_b_loc())[c] & 8) == 0 && (i || !strchr("@!:%-.,_+", c)) ) { v2 = getpid(); log_it(a1, v2, "UNSAFE", a2, 0LL); return 0LL; } } return 1LL; }
static int input_service_request(int type, u_int32_t seq, struct ssh *ssh) { Authctxt *authctxt = ssh->authctxt; char *service = ((void *)0) ; int r, acceptit = 0; if ((r = sshpkt_get_cstring(ssh, &service, ((void *)0) )) != 0 || (r = sshpkt_get_end(ssh)) != 0) goto out; if (authctxt == ((void *)0) ) sshfatal("auth2.c", __func__, 194, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "input_service_request: no authctxt"); if (strcmp(service, "ssh-userauth") == 0) { if (!authctxt->success) { acceptit = 1; ssh_dispatch_set(ssh, 50, &input_userauth_request); } } if (acceptit) { if ((r = sshpkt_start(ssh, 6)) != 0 || (r = sshpkt_put_cstring(ssh, service)) != 0 || (r = sshpkt_send(ssh)) != 0 || (r = ssh_packet_write_wait(ssh)) != 0) goto out; } else { sshlog("auth2.c", __func__, 213, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "bad service request %s", service); ssh_packet_disconnect(ssh, "bad service request %s", service); } r = 0; out: free(service); return r; }
int input_service_request(undefined4 param_1,undefined4 param_2,long param_3) { long lVar1; int iVar2; char **ppcVar3; long in_FS_OFFSET; char *pcStack72; undefined8 uStack64; long local_38; undefined4 local_30; undefined4 local_2c; int local_28; int local_24; char *local_20; int *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_18 = *(int **)(param_3 + 0x860); local_20 = (char *)0x0; local_24 = 0; uStack64 = 0x1003ab; local_38 = param_3; local_30 = param_2; local_2c = param_1; local_28 = sshpkt_get_cstring(param_3,&local_20,0); ppcVar3 = (char **)&local_38; if (local_28 == 0) { uStack64 = 0x1003c4; local_28 = sshpkt_get_end(local_38); ppcVar3 = (char **)&local_38; if (local_28 == 0) { ppcVar3 = (char **)&local_38; if (local_18 == (int *)0x0) { ppcVar3 = &pcStack72; pcStack72 = "input_service_request: no authctxt"; sshfatal("auth2.c","input_service_request",0xc2,0,1,0); } *(undefined8 *)((long)ppcVar3 + -8) = 0x100425; iVar2 = strcmp(local_20,"ssh-userauth"); lVar1 = local_38; if ((iVar2 == 0) && (*local_18 == 0)) { local_24 = 1; *(undefined8 *)((long)ppcVar3 + -8) = 0x100452; ssh_dispatch_set(lVar1,0x32,input_userauth_request); } lVar1 = local_38; if (local_24 == 0) { *(char **)((long)ppcVar3 + -8) = local_20; *(char **)((long)ppcVar3 + -0x10) = "bad service request %s"; *(undefined8 *)((long)ppcVar3 + -0x18) = 0x1004fd; sshlog("auth2.c","input_service_request",0xd5,0,5,0); lVar1 = local_38; *(undefined8 *)((long)ppcVar3 + -8) = 0x10051d; ssh_packet_disconnect(lVar1,"bad service request %s",local_20); } else { *(undefined8 *)((long)ppcVar3 + -8) = 0x100469; local_28 = sshpkt_start(lVar1,6); lVar1 = local_38; if (local_28 != 0) goto LAB_0010052a; *(undefined8 *)((long)ppcVar3 + -8) = 0x100489; local_28 = sshpkt_put_cstring(lVar1,local_20); lVar1 = local_38; if (local_28 != 0) goto LAB_0010052a; *(undefined8 *)((long)ppcVar3 + -8) = 0x1004a2; local_28 = sshpkt_send(lVar1); lVar1 = local_38; if (local_28 != 0) goto LAB_0010052a; *(undefined8 *)((long)ppcVar3 + -8) = 0x1004b7; local_28 = ssh_packet_write_wait(lVar1); if (local_28 != 0) goto LAB_0010052a; } local_28 = 0; } } LAB_0010052a: *(undefined8 *)((long)ppcVar3 + -8) = 0x100536; free(local_20); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_28; } *(undefined8 *)((long)ppcVar3 + -8) = 0x10054d; __stack_chk_fail(); }
static int get_lcm (void) { int l_c_m = 1; for (size_t i = 0; i < n_specs; i++) l_c_m = lcm (l_c_m, width_bytes[spec[i].size]); return l_c_m; }
long get_lcm() { int v1; unsigned long i; v1 = 1; for ( i = 0LL; i < n_specs; ++i ) v1 = lcm(v1, (int)width_bytes[*(unsigned int *)(spec + 40 * i + 4)]); return (unsigned int)v1; }
static inline int ila_ident_name2type(char *name) { if (!strcmp(name, "luid")) return ILA_ATYPE_LUID; else if (!strcmp(name, "use-format")) return ILA_ATYPE_USE_FORMAT; else return -1; }
int ila_ident_name2type(char *a0) { unsigned int v1; if (!strcmp(a0, "luid")) { v1 = 1; } else if (!strcmp(a0, "use-format")) { v1 = 32; } else { v1 = -1; } return v1; }
static int handle_conn_write(u_int socknum) { ssize_t len; int r; if (sshbuf_len(sockets[socknum].output) == 0) return 0; if ((len = write(sockets[socknum].fd, sshbuf_ptr(sockets[socknum].output), sshbuf_len(sockets[socknum].output))) <= 0) { if (len == -1) { if ( (*__errno_location ()) == 11 || (*__errno_location ()) == 4 ) return 0; sshlog("ssh-agent.c", __func__, 1804, 1, SYSLOG_LEVEL_ERROR, ((void *)0) , "read error on socket %u (fd %d): %s", socknum, sockets[socknum].fd, strerror( (*__errno_location ()) )) ; } return -1; } if ((r = sshbuf_consume(sockets[socknum].output, len)) != 0) sshfatal("ssh-agent.c", __func__, 1810, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "consume"); return 0; }
int handle_conn_write(unsigned long a0) { char v0; unsigned int v1; unsigned long long v2; unsigned int v4; if (!sshbuf_len(*((((a0 << 1) + a0 << 4) + sockets + 16)))) { v4 = 0; return v4; } v2 = write(*((a0 * 48 + sockets)), sshbuf_ptr(*((a0 * 48 + sockets + 16))), sshbuf_len(*((a0 * 48 + sockets + 16)))); if (v2 > 0) { v1 = sshbuf_consume(*((a0 * 48 + sockets + 16)), v2); if (v1) { sshfatal("ssh-agent.c", "handle_conn_write", 0x712, 0x1, 0x1, ssh_err(v1)); v4 = 0; return v4; } v4 = 0; return v4; } else if (v2 != -1) { v4 = -1; return v4; } else if (*(__errno_location()) == 11) { v4 = 0; return v4; } else if (*(__errno_location()) == 4) { v4 = 0; return v4; } else { sshlog("ssh-agent.c", "handle_conn_write", 0x70c, 0x1, 0x2, 0x0, "read error on socket %u (fd %d): %s", a0, *((a0 * 48 + sockets)), strerror(*(__errno_location())), *(&v0)); v4 = -1; return v4; } }
(*__errno_location ()) )); } else {
int * __errno_location(void) { halt_baddata(); }
static char const *const license_msg[] = { "Copyright (C) 2018 Free Software Foundation, Inc.", "Copyright (C) 1993 Jean-loup Gailly.", "This is free software. You may redistribute copies of it under the terms of", "the GNU General Public License <https: "There is NO WARRANTY, to the extent permitted by law.", 0};
char *license_msg[5] = { "Copyright (C) 2018 Free Software Foundation, Inc.", "Copyright (C) 1993 Jean-loup Gailly.", "This is free software. You may redistribute copies of it under the terms of", "the GNU General Public License <https: "There is NO WARRANTY, to the extent permitted by law." };
static int set_saved_history () { int absolute_offset, count; if (saved_history_logical_offset >= 0) { absolute_offset = saved_history_logical_offset - history_base; count = where_history () - absolute_offset; rl_get_previous_history (count, 0); } saved_history_logical_offset = -1; _rl_internal_startup_hook = _rl_saved_internal_startup_hook; return (0); }
long set_saved_history() { int v1; int v2; if ( saved_history_logical_offset >= 0 ) { v1 = saved_history_logical_offset - history_base; v2 = where_history() - v1; rl_get_previous_history(v2, 0); } saved_history_logical_offset = -1; rl_internal_startup_hook = rl_saved_internal_startup_hook; return 0LL; }
int wait_for_connection(void) { fd_set rd, wr; int n, sock = -1; gl_list_iterator_t iter; const void *elt; do { unsigned int __i; fd_set *__arr = ( &rd ); for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) ((__arr)->fds_bits)[__i] = 0; } while (0) ; do { unsigned int __i; fd_set *__arr = ( &wr ); for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) ((__arr)->fds_bits)[__i] = 0; } while (0) ; n = 0; iter = gl_list_iterator(listener_list); while (gl_list_iterator_next(&iter, &elt, ((void *)0) )) { const listener_item *j = elt; if (j->listen_socket) { ((void) ((( &rd )->fds_bits)[(( j->fd ) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << (( j->fd ) % (8 * (int) sizeof (__fd_mask))))))) ; n = ((( n )>( j->fd ))?( n ):( j->fd )) ; } } gl_list_iterator_free(&iter); n = select(n + 1, &rd, &wr, ((void *)0) , ((void *)0) ); if (n == -1 && (*__errno_location ()) == 4 ) return -1; if (n < 0) { perror("select()"); exit(1); } iter = gl_list_iterator(listener_list); while (gl_list_iterator_next(&iter, &elt, ((void *)0) )) { const listener_item *j = elt; if ( (((( &rd )->fds_bits)[(( j->fd ) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << (( j->fd ) % (8 * (int) sizeof (__fd_mask)))))) != 0) && j->listen_socket) { sock = j->fd; break; } } gl_list_iterator_free(&iter); return sock; }
long long wait_for_connection() { char v0; char v1; char v2; char v3; char v4; char v5; char v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; char v11; unsigned long long *v12; unsigned long long *v13; unsigned long long v14; unsigned long long v15; unsigned long long v16; unsigned long long v17; unsigned long long v18; unsigned long long v19; unsigned long long v20; unsigned long long v21; unsigned long long v22; char v23; char v24; unsigned long long v26; unsigned long long v27; v8 = -1; v12 = &v23; for (v9 = 0; v9 <= 15; v9 += 1) { v12[v9] = 0; } v13 = &v24; for (v10 = 0; v10 <= 15; v10 += 1) { v13[v10] = 0; } v7 = 0; gl_list_iterator(&v0, listener_list, listener_list); v16 = *(&v0); v17 = *(&v1); v18 = *(&v2); v19 = *(&v3); v20 = *(&v4); v21 = *(&v5); v22 = *(&v6); while (true) { v26 = gl_list_iterator_next(&v16, &v11, 0x0, &v11); if (!v26) break; v15 = *(&v11); if (!*((v15 + 32))) continue; *(&(&v23)[8 * ((*((v15 + 36)) < 0 ? *((v15 + 36)) + 63 : *((v15 + 36))) >> 6)]) = *(&(&v23)[8 * ((*((v15 + 36)) < 0 ? *((v15 + 36)) + 63 : *((v15 + 36))) >> 6)]) | 1 << (((*((v15 + 36)) + (*((v15 + 36)) >> 31 >> 26) & 63) - (*((v15 + 36)) >> 31 >> 26)) & 63); v7 = (*((v15 + 36)) <= v7 ? v7 : *((v15 + 36))); } gl_list_iterator_free(&v16); v7 = select(v7 + 1, &v23, &v24, NULL, NULL); if (v7 == -1) { *(&v26) = *(__errno_location()); if (v26 == 4) v27 = 4294967295; } if (v26 != 4 || v7 != -1) { if (v7 < 0) { perror("select()"); exit(0x1); } gl_list_iterator(&v0, listener_list, listener_list); v16 = *(&v0); v17 = *(&v1); v18 = *(&v2); v19 = *(&v3); v20 = *(&v4); v21 = *(&v5); v22 = *(&v6); while (true) { if (!gl_list_iterator_next(&v16, &v11, 0x0, &v11)) break; v14 = *(&v11); if (...) continue; if (!*((v14 + 32))) continue; v8 = *((v14 + 36)); break; } gl_list_iterator_free(&v16); v27 = v8; } if (v7 >= 0 || v26 == 4 && v7 == -1) return v27; }
static void clearcmdentry(void) { struct tblentry **tblp; struct tblentry **pp; struct tblentry *cmdp; ({ suppressint++; ({ __asm__ __volatile__ ("": : :"memory"); }); 0; }); for (tblp = cmdtable ; tblp < &cmdtable[31] ; tblp++) { pp = tblp; while ((cmdp = *pp) != ((void *)0) ) { if (cmdp->cmdtype == 0 || (cmdp->cmdtype == 2 && !(cmdp->param.cmd->flags & 0x2) && builtinloc > 0)) { *pp = cmdp->next; free((pointer)(cmdp)); } else { pp = &cmdp->next; } } } ({ ({ __asm__ __volatile__ ("": : :"memory"); }); if (--suppressint == 0 && intpending) onint(); 0; }); }
void clearcmdentry() { unsigned long long v0; unsigned long long v1; unsigned long long v2; unsigned long long v4; unsigned long long v5; unsigned long long v6; suppressint = suppressint + 1; for (v0 = &cmdtable; v0 < "%s: %s"; v0 += 8) { v1 = v0; while (true) { v2 = *(v1); if (!v2) break; switch (*((v2 + 16))) { case 0: LABEL_400f47: *(v1) = *(v2); free(v2); break; case 2: if (!(*((*((v2 + 8)) + 16)) & 2) && builtinloc > 0) goto LABEL_400f47; else goto LABEL_400f63; default: LABEL_400f63: v1 = v2; break; } } } suppressint = suppressint - 1; v4 = suppressint; if (!suppressint) { v5 = intpending; if (intpending) v6 = onint(); } return; }
int ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp, const struct sshkey **sign_ca_keys, size_t nsign_ca_keys) { struct sshbuf *copy = ((void *)0) , *sect = ((void *)0) ; struct ssh_krl *krl = ((void *)0) ; char timestamp[64]; int r = -1, sig_seen; struct sshkey *key = ((void *)0) , **ca_used = ((void *)0) , **tmp_ca_used; u_char type; const u_char *blob; size_t i, j, sig_off, sects_off, blen, nca_used; u_int format_version; nca_used = 0; *krlp = ((void *)0) ; if (sshbuf_len(buf) < sizeof("SSHKRL\n\0") - 1 || memcmp(sshbuf_ptr(buf), "SSHKRL\n\0", sizeof("SSHKRL\n\0") - 1) != 0) { sshlog("krl.c", __func__, 998, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "not a KRL"); return -50; } if ((copy = sshbuf_fromb(buf)) == ((void *)0) ) { r = -2; goto out; } if ((r = sshbuf_consume(copy, sizeof("SSHKRL\n\0") - 1)) != 0) goto out; if ((krl = ssh_krl_init()) == ((void *)0) ) { sshlog("krl.c", __func__, 1011, 1, SYSLOG_LEVEL_ERROR, ((void *)0) , "alloc failed"); goto out; } if ((r = sshbuf_get_u32(copy, &format_version)) != 0) goto out; if (format_version != 1) { r = -4; goto out; } if ((r = sshbuf_get_u64(copy, &krl->krl_version)) != 0 || (r = sshbuf_get_u64(copy, &krl->generated_date)) != 0 || (r = sshbuf_get_u64(copy, &krl->flags)) != 0 || (r = sshbuf_get_string_direct(copy, ((void *)0) , ((void *)0) )) != 0 || (r = sshbuf_get_cstring(copy, &krl->comment, ((void *)0) )) != 0) goto out; format_timestamp(krl->generated_date, timestamp, sizeof(timestamp)); sshlog("krl.c", __func__, 1029, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "KRL version %llu generated at %s%s%s", (long long unsigned)krl->krl_version, timestamp, *krl->comment ? ": " : "", krl->comment) ; sig_seen = 0; if (sshbuf_len(buf) < sshbuf_len(copy)) { r = -1; goto out; } sects_off = sshbuf_len(buf) - sshbuf_len(copy); while (sshbuf_len(copy) > 0) { if ((r = sshbuf_get_u8(copy, &type)) != 0 || (r = sshbuf_get_string_direct(copy, &blob, &blen)) != 0) goto out; ; if (type != 4) { if (sig_seen) { sshlog("krl.c", __func__, 1051, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "KRL contains non-signature section " "after signature") ; r = -4; goto out; } continue; } sig_seen = 1; if ((r = sshkey_from_blob(blob, blen, &key)) != 0) { r = -4; goto out; } if (sshbuf_len(buf) < sshbuf_len(copy)) { r = -1; goto out; } sig_off = sshbuf_len(buf) - sshbuf_len(copy); if ((r = sshbuf_get_string_direct(copy, &blob, &blen)) != 0) { r = -4; goto out; } if ((r = sshkey_verify(key, blob, blen, sshbuf_ptr(buf), sig_off, ((void *)0) , 0, ((void *)0) )) != 0) goto out; for (i = 0; i < nca_used; i++) { if (sshkey_equal(ca_used[i], key)) { sshlog("krl.c", __func__, 1083, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "KRL signed more than once with " "the same key") ; r = -4; goto out; } } tmp_ca_used = recallocarray(ca_used, nca_used, nca_used + 1, sizeof(*ca_used)); if (tmp_ca_used == ((void *)0) ) { r = -2; goto out; } ca_used = tmp_ca_used; ca_used[nca_used++] = key; key = ((void *)0) ; } if (sshbuf_len(copy) != 0) { r = -1; goto out; } sshbuf_free(copy); if ((copy = sshbuf_fromb(buf)) == ((void *)0) ) { r = -2; goto out; } if ((r = sshbuf_consume(copy, sects_off)) != 0) goto out; while (sshbuf_len(copy) > 0) { sshbuf_free(sect); sect = ((void *)0) ; if ((r = sshbuf_get_u8(copy, &type)) != 0 || (r = sshbuf_froms(copy, &sect)) != 0) goto out; ; switch (type) { case 1: if ((r = parse_revoked_certs(sect, krl)) != 0) goto out; break; case 2: if ((r = blob_section(sect, &krl->revoked_keys, 0)) != 0) goto out; break; case 3: if ((r = blob_section(sect, &krl->revoked_sha1s, 20)) != 0) goto out; break; case 5: if ((r = blob_section(sect, &krl->revoked_sha256s, 32)) != 0) goto out; break; case 4: sshbuf_free(sect); sect = ((void *)0) ; if ((r = sshbuf_get_string_direct(copy, ((void *)0) , ((void *)0) )) != 0) goto out; break; default: sshlog("krl.c", __func__, 1154, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "Unsupported KRL section %u", type); r = -4; goto out; } if (sect != ((void *)0) && sshbuf_len(sect) > 0) { sshlog("krl.c", __func__, 1159, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "KRL section contains unparsed data"); r = -4; goto out; } } sig_seen = 0; for (i = 0; i < nca_used; i++) { if (ssh_krl_check_key(krl, ca_used[i]) == 0) sig_seen = 1; else { sshkey_free(ca_used[i]); ca_used[i] = ((void *)0) ; } } if (nca_used && !sig_seen) { sshlog("krl.c", __func__, 1176, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "All keys used to sign KRL were revoked"); r = -51; goto out; } if (sig_seen && nsign_ca_keys != 0) { sig_seen = 0; for (i = 0; !sig_seen && i < nsign_ca_keys; i++) { for (j = 0; j < nca_used; j++) { if (ca_used[j] == ((void *)0) ) continue; if (sshkey_equal(ca_used[j], sign_ca_keys[i])) { sig_seen = 1; break; } } } if (!sig_seen) { r = -21; sshlog("krl.c", __func__, 1196, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "KRL not signed with any trusted key"); goto out; } } *krlp = krl; r = 0; out: if (r != 0) ssh_krl_free(krl); for (i = 0; i < nca_used; i++) sshkey_free(ca_used[i]); free(ca_used); sshkey_free(key); sshbuf_free(copy); sshbuf_free(sect); return r; }
int ssh_krl_from_blob(undefined8 param_1,undefined8 *param_2,long param_3,ulong param_4) { int iVar1; ulong uVar2; void *__s1; undefined *puVar3; ulong uVar4; long lVar5; long in_FS_OFFSET; undefined8 uVar6; char local_dd; int local_dc; int local_d8; int local_d4; long local_d0; undefined8 local_c8; undefined8 local_c0; undefined8 local_b8; long local_b0; undefined8 *local_a8; void *local_a0; ulong local_98; ulong local_90; ulong local_88; long local_80; long local_78; void *local_70; undefined local_68 [72]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_b0 = 0; local_d0 = 0; local_a8 = (undefined8 *)0x0; local_d8 = -1; local_c8 = 0; local_a0 = (void *)0x0; local_88 = 0; *param_2 = 0; uVar6 = 0x105824; uVar2 = sshbuf_len(param_1); if (7 < uVar2) { __s1 = (void *)sshbuf_ptr(param_1); uVar6 = 0x10584d; iVar1 = memcmp(__s1,"SSHKRL\n",8); if (iVar1 == 0) { local_b0 = sshbuf_fromb(param_1); if (local_b0 == 0) { local_d8 = -2; } else { local_d8 = sshbuf_consume(local_b0,8); if (local_d8 == 0) { uVar6 = 0x1058f4; local_a8 = (undefined8 *)ssh_krl_init(); if (local_a8 == (undefined8 *)0x0) { sshlog("krl.c","ssh_krl_from_blob",0x3f3,1,2,0,"alloc failed",uVar6); } else { local_d8 = sshbuf_get_u32(local_b0,&local_dc); if (local_d8 == 0) { if (local_dc == 1) { local_d8 = sshbuf_get_u64(local_b0,local_a8); if ((((local_d8 == 0) && (local_d8 = sshbuf_get_u64(local_b0,local_a8 + 1), local_d8 == 0)) && (local_d8 = sshbuf_get_u64(local_b0,local_a8 + 2), local_d8 == 0)) && ((local_d8 = sshbuf_get_string_direct(local_b0,0,0), local_d8 == 0 && (local_d8 = sshbuf_get_cstring(local_b0,local_a8 + 3,0), local_d8 == 0)))) { uVar6 = 0x105a9a; format_timestamp(local_a8[1],local_68,0x40); if (*(char *)local_a8[3] == '\0') { puVar3 = &DAT_0010722c; } else { puVar3 = &DAT_00107229; } sshlog("krl.c","ssh_krl_from_blob",0x405,0,5,0, "KRL version %llu generated at %s%s%s",*local_a8,local_68,puVar3, local_a8[3],uVar6); local_d4 = 0; uVar2 = sshbuf_len(param_1); uVar4 = sshbuf_len(local_b0); if (uVar2 < uVar4) { local_d8 = -1; } else { local_80 = sshbuf_len(param_1); lVar5 = sshbuf_len(local_b0); local_80 = local_80 - lVar5; do { while( true ) { lVar5 = sshbuf_len(local_b0); if (lVar5 == 0) { lVar5 = sshbuf_len(local_b0); if (lVar5 != 0) { local_d8 = -1; goto LAB_0010648c; } sshbuf_free(local_b0); local_b0 = sshbuf_fromb(param_1); if (local_b0 == 0) { local_d8 = -2; goto LAB_0010648c; } local_d8 = sshbuf_consume(local_b0,local_80); if (local_d8 == 0) goto LAB_001061ea; goto LAB_0010648c; } local_d8 = sshbuf_get_u8(local_b0,&local_dd); if (local_d8 != 0) goto LAB_0010648c; uVar6 = 0x105bd2; local_d8 = sshbuf_get_string_direct(local_b0,&local_c0,&local_b8); if (local_d8 != 0) goto LAB_0010648c; if (local_dd != '\x04') break; local_d4 = 1; local_d8 = sshkey_from_blob(local_c0,local_b8,&local_c8); if (local_d8 != 0) { local_d8 = -4; goto LAB_0010648c; } uVar2 = sshbuf_len(param_1); uVar4 = sshbuf_len(local_b0); if (uVar2 < uVar4) { local_d8 = -1; goto LAB_0010648c; } lVar5 = sshbuf_len(param_1); local_78 = sshbuf_len(local_b0); local_78 = lVar5 - local_78; local_d8 = sshbuf_get_string_direct(local_b0,&local_c0,&local_b8); if (local_d8 != 0) { local_d8 = -4; goto LAB_0010648c; } uVar6 = sshbuf_ptr(param_1); local_d8 = sshkey_verify(local_c8,local_c0,local_b8,uVar6,local_78,0,0,0); if (local_d8 != 0) goto LAB_0010648c; for (local_98 = 0; local_98 < local_88; local_98 = local_98 + 1) { uVar6 = 0x105dc5; iVar1 = sshkey_equal(*(undefined8 *)((long)local_a0 + local_98 * 8), local_c8); if (iVar1 != 0) { sshlog("krl.c","ssh_krl_from_blob",0x43b,0,2,0, "KRL signed more than once with the same key",uVar6); local_d8 = -4; goto LAB_0010648c; } } local_70 = (void *)recallocarray(local_a0,local_88,local_88 + 1,8); if (local_70 == (void *)0x0) { local_d8 = -2; goto LAB_0010648c; } *(undefined8 *)(local_88 * 8 + (long)local_70) = local_c8; local_c8 = 0; local_a0 = local_70; local_88 = local_88 + 1; } } while (local_d4 == 0); sshlog("krl.c","ssh_krl_from_blob",0x41b,0,2,0, "KRL contains non-signature section after signature",uVar6); local_d8 = -4; } } } else { local_d8 = -4; } } } } } goto LAB_0010648c; } } sshlog("krl.c","ssh_krl_from_blob",0x3e6,1,7,0,"not a KRL",uVar6); iVar1 = -0x32; goto LAB_0010652c; while( true ) { uVar6 = 0x106198; lVar5 = sshbuf_len(local_d0); if (lVar5 != 0) break; LAB_001061ea: do { uVar6 = 0x1061f9; lVar5 = sshbuf_len(local_b0); if (lVar5 == 0) { local_d4 = 0; for (local_98 = 0; local_98 < local_88; local_98 = local_98 + 1) { uVar6 = 0x10624a; iVar1 = ssh_krl_check_key(local_a8,*(undefined8 *)((long)local_a0 + local_98 * 8)); if (iVar1 == 0) { local_d4 = 1; } else { uVar6 = 0x10627e; sshkey_free(*(undefined8 *)((long)local_a0 + local_98 * 8)); *(undefined8 *)((long)local_a0 + local_98 * 8) = 0; } } if ((local_88 == 0) || (local_d4 != 0)) { if ((local_d4 != 0) && (param_4 != 0)) { local_d4 = 0; for (local_98 = 0; (local_d4 == 0 && (local_98 < param_4)); local_98 = local_98 + 1) { for (local_90 = 0; local_90 < local_88; local_90 = local_90 + 1) { if (*(long *)((long)local_a0 + local_90 * 8) != 0) { uVar6 = 0x1063ba; iVar1 = sshkey_equal(*(undefined8 *)((long)local_a0 + local_90 * 8), *(undefined8 *)(param_3 + local_98 * 8)); if (iVar1 != 0) { local_d4 = 1; break; } } } } if (local_d4 == 0) { local_d8 = -0x15; sshlog("krl.c","ssh_krl_from_blob",0x4ac,0,2,0,"KRL not signed with any trusted key", uVar6); goto LAB_0010648c; } } *param_2 = local_a8; local_d8 = 0; } else { sshlog("krl.c","ssh_krl_from_blob",0x498,0,2,0,"All keys used to sign KRL were revoked", uVar6); local_d8 = -0x33; } goto LAB_0010648c; } sshbuf_free(local_d0); local_d0 = 0; local_d8 = sshbuf_get_u8(local_b0,&local_dd); if ((local_d8 != 0) || (local_d8 = sshbuf_froms(local_b0,&local_d0), local_d8 != 0)) goto LAB_0010648c; switch(local_dd) { default: sshlog("krl.c","ssh_krl_from_blob",0x482,0,2,0,"Unsupported KRL section %u",local_dd); local_d8 = -4; goto LAB_0010648c; case '\x01': local_d8 = parse_revoked_certs(local_d0,local_a8); break; case '\x02': local_d8 = blob_section(local_d0,local_a8 + 4,0); goto joined_r0x00106090; case '\x03': local_d8 = blob_section(local_d0,local_a8 + 5,0x14); joined_r0x00106090: if (local_d8 == 0) goto LAB_0010617d; goto LAB_0010648c; case '\x04': sshbuf_free(local_d0); local_d0 = 0; local_d8 = sshbuf_get_string_direct(local_b0,0,0); break; case '\x05': local_d8 = blob_section(local_d0,local_a8 + 6,0x20); } if (local_d8 != 0) goto LAB_0010648c; LAB_0010617d: } while (local_d0 == 0); } sshlog("krl.c","ssh_krl_from_blob",0x487,0,2,0,"KRL section contains unparsed data",uVar6); local_d8 = -4; LAB_0010648c: if (local_d8 != 0) { ssh_krl_free(local_a8); } for (local_98 = 0; local_98 < local_88; local_98 = local_98 + 1) { sshkey_free(*(undefined8 *)((long)local_a0 + local_98 * 8)); } free(local_a0); sshkey_free(local_c8); sshbuf_free(local_b0); sshbuf_free(local_d0); iVar1 = local_d8; LAB_0010652c: if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return iVar1; }
static void close_output_file (void) { if (output_stream) { if (ferror_unlocked (output_stream)) { error (0, 0, gettext ("write error for %s"), quotearg_style (shell_escape_always_quoting_style, output_filename)); output_stream = ((void *)0) ; cleanup_fatal (); } if ( rpl_fclose (output_stream) != 0) { error (0, (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, output_filename)); output_stream = ((void *)0) ; cleanup_fatal (); } if (bytes_written == 0 && elide_empty_files) { sigset_t oldset; _Bool unlink_ok; int unlink_errno; sigprocmask ( 0 , &caught_signals, &oldset); unlink_ok = (unlink (output_filename) == 0); unlink_errno = (*__errno_location ()) ; files_created--; sigprocmask ( 2 , &oldset, ((void *)0) ); if (! unlink_ok && unlink_errno != 2 ) error (0, unlink_errno, "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, output_filename)); } else { if (!suppress_count) { char buf[((((((sizeof (intmax_t) * 8) - (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (intmax_t)) 0 < (__typeof__ (intmax_t)) -1))) + 1)]; fprintf ( stdout , "%s\n", imaxtostr (bytes_written, buf)); } } output_stream = ((void *)0) ; } }
void close_output_file(void) { int iVar1; int iVar2; undefined8 uVar3; undefined8 uVar4; int *piVar5; long in_FS_OFFSET; sigset_t local_b8; undefined local_38 [24]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); if (output_stream != (FILE *)0x0) { iVar1 = ferror_unlocked(output_stream); if (iVar1 != 0) { uVar3 = quotearg_style(4,output_filename); uVar4 = gettext("write error for %s"); error(0,0,uVar4,uVar3); output_stream = (FILE *)0x0; cleanup_fatal(); } iVar1 = rpl_fclose(output_stream); if (iVar1 != 0) { uVar3 = quotearg_n_style_colon(0,3,output_filename); piVar5 = __errno_location(); error(0,*piVar5,&DAT_001031f0,uVar3); output_stream = (FILE *)0x0; cleanup_fatal(); } if ((bytes_written == 0) && (elide_empty_files != '\0')) { sigprocmask(0,(sigset_t *)caught_signals,&local_b8); iVar2 = unlink(output_filename); piVar5 = __errno_location(); iVar1 = *piVar5; files_created = files_created + -1; sigprocmask(2,&local_b8,(sigset_t *)0x0); if ((iVar2 != 0) && (iVar1 != 2)) { uVar3 = quotearg_n_style_colon(0,3,output_filename); error(0,iVar1,&DAT_001031f0,uVar3); } } else if (suppress_count != '\x01') { uVar3 = imaxtostr(bytes_written,local_38); fprintf(stdout,"%s\n",uVar3); } output_stream = (FILE *)0x0; } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
static int compare_dirnames (const void *first, const void *second) { char const *const *name1 = first; char const *const *name2 = second; return strcmp (*name1, *name2); }
long long compare_dirnames(unsigned long long *a0, unsigned long long *a1) { return strcmp(*(a0), *(a1)); }
static unsigned long count_lines(FILE *f) { unsigned long count = 0; char lp[(100+8192) + 1]; if (fseek(f, 0, 0 ) != 0) { sshlog("moduli.c", __func__, 504, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "input file is not seekable"); return (0x7fffffffffffffffL * 2UL + 1UL) ; } while (fgets(lp, (100+8192) + 1, f) != ((void *)0) ) count++; rewind(f); sshlog("moduli.c", __func__, 510, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "input file has %lu lines", count); return count; }
long count_lines(FILE *param_1) { int iVar1; char *pcVar2; long in_FS_OFFSET; undefined8 uVar3; long local_2080; char local_2078 [8296]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_2080 = 0; uVar3 = 0x1012bb; iVar1 = fseek(param_1,0,0); if (iVar1 == 0) { while( true ) { pcVar2 = fgets(local_2078,0x2065,param_1); if (pcVar2 == (char *)0x0) break; local_2080 = local_2080 + 1; } rewind(param_1); sshlog("moduli.c","count_lines",0x1fe,0,5,0,"input file has %lu lines",local_2080); } else { sshlog("moduli.c","count_lines",0x1f8,0,5,0,"input file is not seekable",uVar3); local_2080 = -1; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_2080; }
static void Rounded_decode(Fq *r,const unsigned char *s) { crypto_uint16 R[761],M[761]; int i; for (i = 0;i < 761;++i) M[i] = (4591 +2)/3; Decode(R,s,M,761); for (i = 0;i < 761;++i) r[i] = R[i]*3-((4591 -1)/2); }
void Rounded_decode(unsigned short *a0, unsigned long long a1, unsigned long long a2) { unsigned int v0; char v1; char v2; char v3; unsigned long long *v5; unsigned long long v6; for (v0 = 0; v0 <= 760; v0 = __addvsi3(v0, 0x1, a2)) { *(&(&v2)[2 * v0]) = 1531; } Decode(&v1, a1, &v2, 0x2f9); for (v0 = 0; v0 <= 760; v0 = __addvsi3(v0, 0x1, *(&(&v1)[2 * v0]) * 3 - 2295)) { a0[v0] = *(&(&v1)[2 * v0]) * 3 - 2295; } v6 = *(&v3) ^ v5[5]; return; }
GENERIC_LIST * list_reverse (list) GENERIC_LIST *list; { register GENERIC_LIST *next, *prev; for (prev = (GENERIC_LIST *) ((void *)0) ; list; ) { next = list->next; list->next = prev; prev = list; list = next; } return (prev); }
long long list_reverse(unsigned long long a0) { void* v0; void* v2; unsigned long long v3; v0 = a0; for (v2 = 0; v0; v0 = v3) { v3 = *(v0); *(v0) = v2; v2 = v0; } return v2; }
static void checked_print_quoted (struct format_val *dest, const char *format, const char *s) { int rv = print_quoted (dest->stream, dest->quote_opts, dest->dest_is_tty, format, s); if (rv < 0) nonfatal_nontarget_file_error ( (*__errno_location ()) , dest->filename); }
long checked_print_quoted(long a1, long a2, long a3) { long result; long v4; int *v5; result = print_quoted(*(_QWORD *)(a1 + 8), *(_QWORD *)(a1 + 32), *(unsigned char *)(a1 + 24), a2, a3); if ( (int)result < 0 ) { v4 = *(_QWORD *)(a1 + 16); v5 = _errno_location(); return nonfatal_nontarget_file_error((unsigned int)*v5, v4); } return result; }
int sshbuf_cmp(const struct sshbuf *b, size_t offset, const void *s, size_t len) { if (sshbuf_ptr(b) == ((void *)0) ) return -1; if (offset > 0x8000000 || len > 0x8000000 || len == 0) return -10; if (offset + len > sshbuf_len(b)) return -3; if (timingsafe_bcmp(sshbuf_ptr(b) + offset, s, len) != 0) return -4; return 0; }
undefined8 sshbuf_cmp(undefined8 param_1,ulong param_2,undefined8 param_3,ulong param_4) { int iVar1; long lVar2; undefined8 uVar3; ulong uVar4; lVar2 = sshbuf_ptr(param_1); if (lVar2 == 0) { uVar3 = 0xffffffff; } else if (((param_2 < 0x8000001) && (param_4 < 0x8000001)) && (param_4 != 0)) { uVar4 = sshbuf_len(param_1); if (uVar4 < param_2 + param_4) { uVar3 = 0xfffffffd; } else { lVar2 = sshbuf_ptr(param_1); iVar1 = timingsafe_bcmp(lVar2 + param_2,param_3,param_4); if (iVar1 == 0) { uVar3 = 0; } else { uVar3 = 0xfffffffc; } } } else { uVar3 = 0xfffffff6; } return uVar3; }
!pkg->archives && pkg->want == PKG_WANT_UNKNOWN && !pkg_is_informative(pkg, &pkg->installed)) { notice(gettext("package '%s' is not installed and no information is available"), pkg_name(pkg, pnaw_nonambig)); failures++; } else {
void pkg_is_informative(void) { halt_baddata(); }
SHELL_VAR ** all_shell_functions () { return (fapply ((sh_var_map_func_t *) ((void *)0) )); }
void *all_shell_functions() { return fapply(0LL); }
static void open_files (void) { if (!list) { if (gr_lock () == 0) { fprintf ( stderr , gettext ("%s: cannot lock %s; try again later.\n"), Prog, gr_dbname ()); fail_exit (2); } gr_locked = 1 ; if (is_shadowgrp) { if (sgr_lock () == 0) { fprintf ( stderr , gettext ("%s: cannot lock %s; try again later.\n"), Prog, sgr_dbname ()); fail_exit (2); } sgr_locked = 1 ; } } if (gr_open (list ? 00 : 0100 | 02 ) == 0) { fprintf ( stderr , gettext ("%s: cannot open %s\n"), Prog, gr_dbname ()); fail_exit (2); } if (is_shadowgrp) { if (sgr_open (list ? 00 : 0100 | 02 ) == 0) { fprintf ( stderr , gettext ("%s: cannot open %s\n"), Prog, sgr_dbname ()); fail_exit (2); } } }
void open_files() { unsigned long long v1; unsigned long long v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; if ((list ^ 1)) { v1 = gr_lock(); if (!v1) { v3 = gr_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x2); } gr_locked = 1; if (is_shadowgrp) { v2 = sgr_lock(); if (!v2) { v4 = sgr_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x2); } sgr_locked = 1; } } if (!(list ^ 1) || !is_shadowgrp && v1 || v1 && v2) { if (list) v5 = 0; else v5 = 66; v6 = gr_open(v5); if (!v6) { v8 = gr_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x2); } v7 = is_shadowgrp; if (is_shadowgrp) { if (list) v9 = 0; else v9 = 66; v10 = sgr_open(v9); if (!v10) { v11 = sgr_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x2); } } if (!is_shadowgrp || v10) return; } }
static char * make_link_name (char const *name, char const *linkname) { if (!linkname) return ((void *)0) ; if ((((linkname)[0]) == '/')) return xstrdup (linkname); size_t prefix_len = dir_len (name); if (prefix_len == 0) return xstrdup (linkname); char *p = xmalloc (prefix_len + 1 + strlen (linkname) + 1); if ( ! ((name[prefix_len - 1]) == '/')) ++prefix_len; stpcpy (stpncpy (p, name, prefix_len), linkname); return p; }
int make_link_name(char *a0, char *a1) { unsigned int v0; char *v1; unsigned int v3; if (!a1) { v3 = 0; } else if (*(a1) == 47) { v3 = xstrdup(a1); } else { *(&v0) = dir_len(a0); if (!*(&v0)) { v3 = xstrdup(a1); } else { v1 = xmalloc(strlen(a1) + *(&v0) + 2); if (a0[1 + *(&v0)] != 47) *(&v0) = *(&v0) + 1; stpcpy(stpncpy(v1, a0, *(&v0)), a1); v3 = v1; } } return v3; }
static void synexpect(int token) { char msg[64]; if (token >= 0) { fmtstr(msg, 64, "%s unexpected (expecting %s)", tokname[lasttoken], tokname[token]); } else { fmtstr(msg, 64, "%s unexpected", tokname[lasttoken]); } synerror(msg); }
void synexpect(unsigned long a0) { char v0; unsigned long v1; unsigned long long *v3; unsigned long long v4; v1 = v3[5]; if (a0 >= 0) fmtstr(&v0, 0x40, "%s unexpected (expecting %s)", *(14117740572913717056), (&tokname)[a0]); else fmtstr(&v0, 0x40, "%s unexpected", *(14117740572913717056), v4); synerror(&v0); }
static int parse_ioam6_freq(char *buf, __u32 *freq_k, __u32 *freq_n) { char *s; int i; s = buf; for (i = 0; *s; *s++ == '/' ? i++ : *s); if (i != 1) return 1; s = strtok(buf, "/"); if (!s || get_u32(freq_k, s, 10)) return 1; s = strtok( ((void *)0) , "/"); if (!s || get_u32(freq_n, s, 10)) return 1; s = strtok( ((void *)0) , "/"); if (s) return 1; return 0; }
undefined8 parse_ioam6_freq(char *param_1,undefined8 param_2,undefined8 param_3) { char cVar1; int iVar2; char *pcVar3; int local_14; char *local_10; local_14 = 0; local_10 = param_1; while (*local_10 != '\0') { pcVar3 = local_10 + 1; cVar1 = *local_10; local_10 = pcVar3; if (cVar1 == '/') { local_14 = local_14 + 1; } } if (((local_14 == 1) && (pcVar3 = strtok(param_1,"/"), pcVar3 != (char *)0x0)) && (iVar2 = get_u32(param_2,pcVar3,10), iVar2 == 0)) { pcVar3 = strtok((char *)0x0,"/"); if ((pcVar3 != (char *)0x0) && (iVar2 = get_u32(param_3,pcVar3,10), iVar2 == 0)) { pcVar3 = strtok((char *)0x0,"/"); if (pcVar3 == (char *)0x0) { return 0; } return 1; } return 1; } return 1; }
char * hpdelim(char **cp) { char *r, delim = '\0'; r = hpdelim2(cp, &delim); if (delim == '/') return ((void *)0) ; return r; }
int hpdelim(unsigned long long *a0) { char v0; unsigned long v1; unsigned int v3; v0 = 0; v1 = hpdelim2(a0, &v0); if (v0 == 47) v3 = 0; else v3 = v1; return v3; }
int number_of_args () { return posparam_count; }
undefined4 number_of_args(void) { return posparam_count; }
int rl_maybe_unsave_line (void) { if (_rl_saved_line_for_history) { rl_replace_line (_rl_saved_line_for_history->line, 0); rl_undo_list = (UNDO_LIST *)_rl_saved_line_for_history->data; _rl_free_history_entry (_rl_saved_line_for_history); _rl_saved_line_for_history = (HIST_ENTRY *) ((void *)0) ; rl_point = rl_end; } else rl_ding (); return 0; }
void rl_maybe_unsave_line() { void* v1; if (!_rl_saved_line_for_history) { rl_ding(); } else { rl_replace_line(*(_rl_saved_line_for_history), 0x0); rl_undo_list = _rl_saved_line_for_history[16]; _rl_free_history_entry(_rl_saved_line_for_history); _rl_saved_line_for_history = 0; rl_point = rl_end; } v1 = 0; return; }
static int channel_decode_socks4(Channel *c, struct sshbuf *input, struct sshbuf *output) { const u_char *p; char *host; u_int len, have, i, found, need; char username[256]; struct { u_int8_t version; u_int8_t command; u_int16_t dest_port; struct in_addr dest_addr; } s4_req, s4_rsp; int r; sshlog("channels.c", __func__, 1287, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0) , "channel %d: decode socks4", c->self); have = sshbuf_len(input); len = sizeof(s4_req); if (have < len) return 0; p = sshbuf_ptr(input); need = 1; if (p[4] == 0 && p[5] == 0 && p[6] == 0 && p[7] != 0) { sshlog("channels.c", __func__, 1298, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0) , "channel %d: socks4a request", c->self); need = 2; } for (found = 0, i = len; i < have; i++) { if (p[i] == '\0') { found++; if (found == need) break; } if (i > 1024) { sshlog("channels.c", __func__, 1311, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "channel %d: decode socks4: too long", c->self) ; return -1; } } if (found < need) return 0; if ((r = sshbuf_get(input, &s4_req.version, 1)) != 0 || (r = sshbuf_get(input, &s4_req.command, 1)) != 0 || (r = sshbuf_get(input, &s4_req.dest_port, 2)) != 0 || (r = sshbuf_get(input, &s4_req.dest_addr, 4)) != 0) { sshlog("channels.c", __func__, 1322, 0, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "channels %d: decode socks4", c->self); return -1; } have = sshbuf_len(input); p = sshbuf_ptr(input); if (memchr(p, '\0', have) == ((void *)0) ) { sshlog("channels.c", __func__, 1328, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "channel %d: decode socks4: unterminated user", c->self); return -1; } len = strlen(p); sshlog("channels.c", __func__, 1332, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0) , "channel %d: decode socks4: user %s/%d", c->self, p, len); len++; strlcpy(username, p, sizeof(username)); if ((r = sshbuf_consume(input, len)) != 0) sshfatal("channels.c", __func__, 1336, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %d: consume", c->self); free(c->path); c->path = ((void *)0) ; if (need == 1) { host = inet_ntoa(s4_req.dest_addr); c->path = xstrdup(host); } else { have = sshbuf_len(input); p = sshbuf_ptr(input); if (memchr(p, '\0', have) == ((void *)0) ) { sshlog("channels.c", __func__, 1346, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "channel %d: decode socks4a: host not nul " "terminated", c->self) ; return -1; } len = strlen(p); sshlog("channels.c", __func__, 1351, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0) , "channel %d: decode socks4a: host %s/%d", c->self, p, len) ; len++; if (len > 1025 ) { sshlog("channels.c", __func__, 1355, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "channel %d: hostname \"%.100s\" too long", c->self, p) ; return -1; } c->path = xstrdup(p); if ((r = sshbuf_consume(input, len)) != 0) sshfatal("channels.c", __func__, 1361, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %d: consume", c->self); } c->host_port = ntohs(s4_req.dest_port); sshlog("channels.c", __func__, 1365, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0) , "channel %d: dynamic request: socks4 host %s port %u command %u", c->self, c->path, c->host_port, s4_req.command) ; if (s4_req.command != 1) { sshlog("channels.c", __func__, 1369, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "channel %d: cannot handle: %s cn %d", c->self, need == 1 ? "SOCKS4" : "SOCKS4A", s4_req.command) ; return -1; } s4_rsp.version = 0; s4_rsp.command = 90; s4_rsp.dest_port = 0; s4_rsp.dest_addr.s_addr = ((in_addr_t) 0x00000000) ; if ((r = sshbuf_put(output, &s4_rsp, sizeof(s4_rsp))) != 0) sshfatal("channels.c", __func__, 1378, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %d: append reply", c->self); return 1; }
undefined8 channel_decode_socks4(long param_1,undefined8 param_2,undefined8 param_3) { uint uVar1; uint uVar2; uint16_t uVar3; undefined8 uVar4; void *pvVar5; size_t sVar6; char *pcVar7; undefined *puVar8; char **ppcVar9; long in_FS_OFFSET; char *apcStackY480 [2]; ulong uStackY464; char *pcStackY456; ulong uStackY448; char *pcStackY440; ulong uStackY432; char *pcStack408; ulong uStack400; undefined auStack392 [8]; undefined8 local_180; undefined8 local_178; long local_170; uint local_160; uint local_15c; uint local_158; int local_154; uint local_150; uint local_14c; char *local_148; char *local_140; undefined local_138; byte local_137; uint16_t local_136; in_addr local_134; undefined local_130; undefined local_12f; undefined2 local_12e; undefined4 local_12c; undefined local_128 [264]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); uStack400 = (ulong)*(uint *)(param_1 + 4); pcStack408 = "channel %d: decode socks4"; local_180 = param_3; local_178 = param_2; local_170 = param_1; sshlog("channels.c","channel_decode_socks4",0x507,0,6,0); ppcVar9 = (char **)auStack392; uStack400 = 0x1032f1; local_150 = sshbuf_len(local_178); local_14c = 8; if (local_150 < 8) { uVar4 = 0; ppcVar9 = (char **)auStack392; } else { uStack400 = 0x103328; local_148 = (char *)sshbuf_ptr(local_178); local_158 = 1; if ((((local_148[4] == '\0') && (local_148[5] == '\0')) && (local_148[6] == '\0')) && (local_148[7] != '\0')) { uStack400 = (ulong)*(uint *)(local_170 + 4); pcStack408 = "channel %d: socks4a request"; sshlog("channels.c","channel_decode_socks4",0x512,0,6,0); local_158 = 2; } local_15c = 0; local_160 = local_14c; while ((local_160 < local_150 && ((local_148[local_160] != '\0' || (local_15c = local_15c + 1, local_15c != local_158))))) { if (0x400 < local_160) { uStack400 = (ulong)*(uint *)(local_170 + 4); pcStack408 = "channel %d: decode socks4: too long"; sshlog("channels.c","channel_decode_socks4",0x51f,0,5,0); uVar4 = 0xffffffff; goto LAB_00103b6f; } local_160 = local_160 + 1; } if (local_15c < local_158) { uVar4 = 0; ppcVar9 = (char **)auStack392; } else { uStack400 = 0x1034c8; local_154 = sshbuf_get(local_178,&local_138,1); if (local_154 == 0) { uStack400 = 0x1034fd; local_154 = sshbuf_get(local_178,&local_137,1); if (local_154 == 0) { uStack400 = 0x10352e; local_154 = sshbuf_get(local_178,&local_136,2); if (local_154 == 0) { uStack400 = 0x10355f; local_154 = sshbuf_get(local_178,&local_134,4); if (local_154 == 0) { uStack400 = 0x1035d6; local_150 = sshbuf_len(local_178); uStack400 = 0x1035eb; local_148 = (char *)sshbuf_ptr(local_178); uStack400 = 0x10360c; pvVar5 = memchr(local_148,0,(ulong)local_150); if (pvVar5 == (void *)0x0) { uStack400 = (ulong)*(uint *)(local_170 + 4); pcStack408 = "channel %d: decode socks4: unterminated user"; sshlog("channels.c","channel_decode_socks4",0x530,0,2,0); uVar4 = 0xffffffff; ppcVar9 = (char **)auStack392; goto LAB_00103b6f; } uStack400 = 0x10366f; sVar6 = strlen(local_148); local_14c = (uint)sVar6; uStack400 = sVar6 & 0xffffffff; pcStack408 = local_148; sshlog("channels.c","channel_decode_socks4",0x534,0,6,0, "channel %d: decode socks4: user %s/%d",*(undefined4 *)(local_170 + 4)); local_14c = local_14c + 1; uStack400 = 0x1036ec; strlcpy(local_128,local_148,0x100); uStack400 = 0x103704; local_154 = sshbuf_consume(local_178); ppcVar9 = (char **)auStack392; if (local_154 != 0) { uVar1 = *(uint *)(local_170 + 4); uStack400 = 0x10372a; uVar4 = ssh_err(local_154); ppcVar9 = &pcStack408; pcStack408 = "channel %d: consume"; uStack400 = (ulong)uVar1; sshfatal("channels.c","channel_decode_socks4",0x538,1,1,uVar4); } pvVar5 = *(void **)(local_170 + 0x80); *(undefined8 *)((long)ppcVar9 + -8) = 0x103774; free(pvVar5); *(undefined8 *)(local_170 + 0x80) = 0; puVar8 = (undefined *)ppcVar9; if (local_158 == 1) { *(undefined8 *)((long)ppcVar9 + -8) = 0x10379c; local_140 = inet_ntoa((in_addr)local_134); *(undefined8 *)((long)ppcVar9 + -8) = 0x1037b2; uVar4 = xstrdup(); *(undefined8 *)(local_170 + 0x80) = uVar4; } else { *(undefined8 *)((long)ppcVar9 + -8) = 0x1037d4; local_150 = sshbuf_len(local_178); *(undefined8 *)((long)ppcVar9 + -8) = 0x1037e9; local_148 = (char *)sshbuf_ptr(local_178); *(undefined8 *)((long)ppcVar9 + -8) = 0x10380a; pvVar5 = memchr(local_148,0,(ulong)local_150); if (pvVar5 == (void *)0x0) { *(ulong *)((long)ppcVar9 + -8) = (ulong)*(uint *)(local_170 + 4); *(char **)((long)ppcVar9 + -0x10) = "channel %d: decode socks4a: host not nul terminated"; *(undefined8 *)((long)ppcVar9 + -0x18) = 0x103850; sshlog("channels.c","channel_decode_socks4",0x542,0,2,0); uVar4 = 0xffffffff; goto LAB_00103b6f; } *(undefined8 *)((long)ppcVar9 + -8) = 0x10386d; sVar6 = strlen(local_148); local_14c = (uint)sVar6; uVar1 = *(uint *)(local_170 + 4); *(size_t *)((long)ppcVar9 + -8) = sVar6 & 0xffffffff; *(char **)((long)ppcVar9 + -0x10) = local_148; *(ulong *)((long)ppcVar9 + -0x18) = (ulong)uVar1; *(char **)((long)ppcVar9 + -0x20) = "channel %d: decode socks4a: host %s/%d"; *(undefined8 *)((long)ppcVar9 + -0x28) = 0x1038c1; sshlog("channels.c","channel_decode_socks4",0x547,0,6,0); local_14c = local_14c + 1; if (0x401 < local_14c) { uVar1 = *(uint *)(local_170 + 4); *(char **)((long)ppcVar9 + -0x10) = local_148; *(ulong *)((long)ppcVar9 + -0x18) = (ulong)uVar1; *(char **)((long)ppcVar9 + -0x20) = "channel %d: hostname \"%.100s\" too long"; *(undefined8 *)((long)ppcVar9 + -0x28) = 0x103923; sshlog("channels.c","channel_decode_socks4",0x54b,0,2,0); uVar4 = 0xffffffff; goto LAB_00103b6f; } *(undefined8 *)((long)ppcVar9 + -8) = 0x103940; uVar4 = xstrdup(local_148); *(undefined8 *)(local_170 + 0x80) = uVar4; *(undefined8 *)((long)ppcVar9 + -8) = 0x103966; local_154 = sshbuf_consume(); if (local_154 != 0) { uVar1 = *(uint *)(local_170 + 4); *(undefined8 *)((long)ppcVar9 + -8) = 0x10398c; uVar4 = ssh_err(local_154); *(ulong *)((long)ppcVar9 + -8) = (ulong)uVar1; puVar8 = (undefined *)((long)ppcVar9 + -0x10); *(char **)((long)ppcVar9 + -0x10) = "channel %d: consume"; *(undefined8 *)((long)ppcVar9 + -0x18) = 0x1039c0; sshfatal("channels.c","channel_decode_socks4",0x551,1,1,uVar4); } } *(undefined8 *)(puVar8 + -8) = 0x1039d1; uVar3 = ntohs(local_136); *(uint *)(local_170 + 0x98) = (uint)uVar3; uVar1 = *(uint *)(local_170 + 0x98); uVar4 = *(undefined8 *)(local_170 + 0x80); uVar2 = *(uint *)(local_170 + 4); *(ulong *)(puVar8 + -0x10) = (ulong)local_137; *(ulong *)(puVar8 + -0x18) = (ulong)uVar1; *(undefined8 *)(puVar8 + -0x20) = uVar4; *(ulong *)(puVar8 + -0x28) = (ulong)uVar2; *(char **)(puVar8 + -0x30) = "channel %d: dynamic request: socks4 host %s port %u command %u"; *(undefined8 *)(puVar8 + -0x38) = 0x103a4e; sshlog("channels.c","channel_decode_socks4",0x555,0,6,0); ppcVar9 = (char **)puVar8; if (local_137 == 1) { local_130 = 0; local_12f = 0x5a; local_12e = 0; local_12c = 0; *(undefined8 *)(puVar8 + -8) = 0x103b10; local_154 = sshbuf_put(local_180,&local_130,8); if (local_154 != 0) { uVar1 = *(uint *)(local_170 + 4); *(undefined8 *)(puVar8 + -8) = 0x103b36; uVar4 = ssh_err(local_154); *(ulong *)(puVar8 + -8) = (ulong)uVar1; ppcVar9 = (char **)(puVar8 + -0x10); *(char **)(puVar8 + -0x10) = "channel %d: append reply"; *(undefined8 *)(puVar8 + -0x18) = 0x103b6a; sshfatal("channels.c","channel_decode_socks4",0x562,1,1,uVar4); } uVar4 = 1; } else { if (local_158 == 1) { pcVar7 = "SOCKS4"; } else { pcVar7 = "SOCKS4A"; } uVar1 = *(uint *)(local_170 + 4); *(ulong *)(puVar8 + -8) = (ulong)local_137; *(char **)(puVar8 + -0x10) = pcVar7; *(ulong *)(puVar8 + -0x18) = (ulong)uVar1; *(char **)(puVar8 + -0x20) = "channel %d: cannot handle: %s cn %d"; *(undefined8 *)(puVar8 + -0x28) = 0x103ac3; sshlog("channels.c","channel_decode_socks4",0x559,0,5,0); uVar4 = 0xffffffff; } goto LAB_00103b6f; } } } } uVar1 = *(uint *)(local_170 + 4); uStack400 = 0x103585; uVar4 = ssh_err(local_154); pcStack408 = "channels %d: decode socks4"; uStack400 = (ulong)uVar1; sshlog("channels.c","channel_decode_socks4",0x52a,0,5,uVar4); uVar4 = 0xffffffff; ppcVar9 = (char **)auStack392; } } LAB_00103b6f: if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar4; } *(undefined8 *)((long)ppcVar9 + -8) = 0x103b83; __stack_chk_fail(); }
int kex_kem_sntrup761x25519_dec(struct kex *kex, const struct sshbuf *server_blob, struct sshbuf **shared_secretp) { struct sshbuf *buf = ((void *)0) ; u_char *kem_key = ((void *)0) ; const u_char *ciphertext, *server_pub; u_char hash[64]; size_t need; int r, decoded; *shared_secretp = ((void *)0) ; need = 1039 + 32; if (sshbuf_len(server_blob) != need) { r = -21; goto out; } ciphertext = sshbuf_ptr(server_blob); server_pub = ciphertext + 1039; if ((buf = sshbuf_new()) == ((void *)0) ) { r = -2; goto out; } if ((r = sshbuf_reserve(buf, 32, &kem_key)) != 0) goto out; decoded = crypto_kem_sntrup761_dec(kem_key, ciphertext, kex->sntrup761_client_key); if ((r = kexc25519_shared_key_ext(kex->c25519_client_key, server_pub, buf, 1)) < 0) goto out; if ((r = ssh_digest_buffer(kex->hash_alg, buf, hash, sizeof(hash))) != 0) goto out; sshbuf_reset(buf); if ((r = sshbuf_put_string(buf, hash, ssh_digest_bytes(kex->hash_alg))) != 0) goto out; if (decoded != 0) { r = -21; goto out; } *shared_secretp = buf; buf = ((void *)0) ; out: explicit_bzero(hash, sizeof(hash)); sshbuf_free(buf); return r; }
long long kex_kem_sntrup761x25519_dec(struct_0 *a0, unsigned long long a1, unsigned long long *a2, unsigned long long a3) { unsigned int v0; unsigned int v1; void* v2; void* v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; char v7; v3 = 0; v2 = 0; *(a2) = 0; v4 = 1071; if (v4 != sshbuf_len(a1)) { v0 = -21; } else { v5 = sshbuf_ptr(a1); v6 = v5 + 1039; v3 = sshbuf_new(); if (!v3) { v0 = -2; } else { v0 = sshbuf_reserve(v3, 0x20, &v2, a3); if (!v0) { v1 = crypto_kem_sntrup761_dec(v2, v5, &a0[2].padding_0[88], v5); v0 = kexc25519_shared_key_ext(&a0[2].padding_0[24], v6, v3, 0x1); if (v0 >= 0) { v0 = ssh_digest_buffer(a0->field_90, v3, &v7, 0x40); if (!v0) { sshbuf_reset(v3); v0 = sshbuf_put_string(v3, &v7, ssh_digest_bytes(a0->field_90), &v7); if (!v0) { if (v1) { v0 = -21; } else { *(a2) = v3; v3 = 0; } } } } } } } explicit_bzero(&v7, 0x40); sshbuf_free(v3); return v0; }
void message5 (char const *format_msgid, char const *arg1, char const *arg2, char const *arg3, char const *arg4) { if (paginate) { char *p; char const *arg[5]; int i; size_t size[5]; size_t total_size = __builtin_offsetof ( struct msg , args ) ; struct msg *new; arg[0] = format_msgid; arg[1] = arg1; arg[2] = arg2; arg[3] = arg3 ? arg3 : ""; arg[4] = arg4 ? arg4 : ""; for (i = 0; i < 5; i++) total_size += size[i] = strlen (arg[i]) + 1; new = xmalloc (total_size); for (i = 0, p = new->args; i < 5; p += size[i++]) memcpy (p, arg[i], size[i]); *msg_chain_end = new; new->next = 0; msg_chain_end = &new->next; } else { if (sdiff_merge_assist) putchar_unlocked (' '); printf (gettext (format_msgid), arg1, arg2, arg3, arg4); } }
unsigned long message5(char *a1, char *a2, char *a3, char *a4, char *a5) { char *v5; char *v6; int v7; char *v8; int i; int v14; char *dest; long v16; _QWORD *v17; char *s[11]; unsigned long v19; v19 = __readfsqword(0x28u); if ( paginate ) { v16 = 8LL; s[0] = a1; s[1] = a2; s[2] = a3; if ( a4 ) v5 = a4; else v5 = (char *)&unk_28CF; s[3] = v5; if ( a5 ) v6 = a5; else v6 = (char *)&unk_28CF; s[4] = v6; for ( i = 0; i <= 4; ++i ) { s[i + 6] = (char *)(strlen(s[i]) + 1); v16 += (long)s[i + 6]; } v17 = (_QWORD *)xmalloc(v16); v14 = 0; dest = (char *)(v17 + 1); while ( v14 <= 4 ) { memcpy(dest, s[v14], (size_t)s[v14 + 6]); v7 = v14++; dest = &dest[(_QWORD)s[v7 + 6]]; } *(_QWORD *)msg_chain_end = v17; *v17 = 0LL; msg_chain_end = (long)v17; } else { if ( sdiff_merge_assist ) putchar_unlocked(32); v8 = gettext(a1); printf(v8, a2, a3, a4, a5); } return __readfsqword(0x28u) ^ v19; }
((*__ctype_b_loc ())[(int) (( (unsigned char) *ap ))] & (unsigned short int) _ISdigit) ) { new_mask = 0; do { if (*ap >= '8' || *ap < '0') sh_error(illnum, *argptr); new_mask = (new_mask << 3) + (*ap - '0'); } while (*++ap != '\0'); } else {
ushort ** __ctype_b_loc(void) { halt_baddata(); }
void exitshell(void) { struct jmploc loc; char *p; savestatus = exitstatus; ; if ( _setjmp ( loc.loc ) ) goto out; handler = &loc; if ((p = trap[0])) { trap[0] = ((void *)0) ; evalskip = 0; evalstring(p, 0); evalskip = (1 << 3); } out: exitreset(); if (__builtin_expect(!!(! _setjmp ( loc.loc ) ),1)) setjobctl(0); flushall(); _exit(exitstatus); }
long long exitshell() { unsigned long long v0; char v1; unsigned long v2; unsigned long long *v4; v2 = v4[5]; savestatus = exitstatus; if (!_setjmp(&v1)) { handler = &v1; v0 = 5188164362531343176; if (v0) { sigmode = 0; evalskip = 0; evalstring(v0, 0x0); evalskip = 8; } } exitreset(); if (!_setjmp(&v1)) setjobctl(0x0); flushall(); _exit(exitstatus); }
int rl_vi_movement_mode (int count, int key) { if (rl_point > 0) rl_backward_char (1, key); _rl_keymap = vi_movement_keymap; _rl_vi_done_inserting (); if ((rl_readline_state & (0x0400000)) == 0) rl_free_undo_list (); if (_rl_show_mode_in_prompt) _rl_reset_prompt (); (rl_readline_state |= (0x0400000)); return (0); }
long long rl_vi_movement_mode(unsigned long a0, unsigned long a1) { unsigned int v0; v0 = a0; if (rl_point > 0) rl_backward_char(0x1, a1); _rl_keymap = &vi_movement_keymap; _rl_vi_done_inserting(); if (!(rl_readline_state & _rl_vi_initialize_line)) rl_free_undo_list(); if (_rl_show_mode_in_prompt) _rl_reset_prompt(); rl_readline_state = rl_readline_state | _rl_vi_initialize_line; return 0; }
int kex_send_newkeys(struct ssh *ssh) { int r; kex_reset_dispatch(ssh); if ((r = sshpkt_start(ssh, 21)) != 0 || (r = sshpkt_send(ssh)) != 0) return r; sshlog("kex.c", __func__, 465, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "SSH2_MSG_NEWKEYS sent"); ssh_dispatch_set(ssh, 21, &kex_input_newkeys); if (ssh->kex->ext_info_c && (ssh->kex->flags & 0x0002) != 0) if ((r = kex_send_ext_info(ssh)) != 0) return r; sshlog("kex.c", __func__, 470, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "expecting SSH2_MSG_NEWKEYS"); return 0; }
long long kex_send_newkeys(struct_0 *a0) { unsigned int v0; void* v2; kex_reset_dispatch(a0); v0 = sshpkt_start(a0, 0x15); if (!v0) { v0 = sshpkt_send(a0); if (!v0) { sshlog("kex.c", "kex_send_newkeys", 0x1d1, 0x0, 0x5, 0x0, "SSH2_MSG_NEWKEYS sent"); ssh_dispatch_set(a0, 0x15, kex_input_newkeys); if (a0->field_8->field_48 && (a0->field_8->field_8c & 2)) { v0 = kex_send_ext_info(a0); if (v0) v2 = v0; } if (!(a0->field_8->field_8c & 2) || !a0->field_8->field_48 || !v0) { sshlog("kex.c", "kex_send_newkeys", 0x1d6, 0x0, 0x5, 0x0, "expecting SSH2_MSG_NEWKEYS"); v2 = 0; } } } if (v0 || v0) v2 = v0; return v2; }