input
stringlengths
28
169k
output
stringlengths
20
317k
u_int sftp_proto_version(struct sftp_conn *conn) { return conn->version; }
long long sftp_proto_version(struct_0 *a0) { return a0->field_14; }
static char * make_filename (int num) { strcpy (filename_space, prefix); if (suffix) sprintf (filename_space + strlen (prefix), suffix, num); else sprintf (filename_space + strlen (prefix), "%0*d", digits, num); return filename_space; }
int make_filename(unsigned long a0) { unsigned int v0; v0 = a0; strcpy(filename_space, prefix); if (!suffix) { sprintf(filename_space + strlen(prefix), "%0*d"); return filename_space; } sprintf(filename_space + strlen(prefix), suffix); return filename_space; }
static void hdlr_sigttin_ou(void) { }
long long hdlr_sigttin_ou() { unsigned long v1; return v1; }
struct passwd * mm_getpwnamallow(struct ssh *ssh, const char *username) { struct sshbuf *m; struct passwd *pw; size_t len; u_int i; ServerOptions *newopts; int r; u_char ok; const u_char *p; sshlog("monitor_wrap.c", __func__, 267, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "entering"); if ((m = sshbuf_new()) == ((void *)0) ) sshfatal("monitor_wrap.c", __func__, 270, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "sshbuf_new failed"); if ((r = sshbuf_put_cstring(m, username)) != 0) sshfatal("monitor_wrap.c", __func__, 272, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble"); mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PWNAM, m); sshlog("monitor_wrap.c", __func__, 276, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "waiting for MONITOR_ANS_PWNAM"); mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PWNAM, m); if ((r = sshbuf_get_u8(m, &ok)) != 0) sshfatal("monitor_wrap.c", __func__, 280, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse success"); if (ok == 0) { pw = ((void *)0) ; goto out; } pw = xcalloc(sizeof(*pw), 1); do { if ((r = sshbuf_get_string_direct(m, &p, &len)) != 0) sshfatal("monitor_wrap.c", __func__, 288, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse pw %s", "pw_uid"); if (len != sizeof(pw->pw_uid)) sshfatal("monitor_wrap.c", __func__, 288, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "bad length for %s", "pw_uid"); memcpy(&pw->pw_uid, p, len); } while (0); do { if ((r = sshbuf_get_string_direct(m, &p, &len)) != 0) sshfatal("monitor_wrap.c", __func__, 289, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse pw %s", "pw_gid"); if (len != sizeof(pw->pw_gid)) sshfatal("monitor_wrap.c", __func__, 289, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "bad length for %s", "pw_gid"); memcpy(&pw->pw_gid, p, len); } while (0); if ((r = sshbuf_get_cstring(m, &pw->pw_name, ((void *)0) )) != 0 || (r = sshbuf_get_cstring(m, &pw->pw_passwd, ((void *)0) )) != 0 || (r = sshbuf_get_cstring(m, &pw->pw_gecos, ((void *)0) )) != 0 || (r = sshbuf_get_cstring(m, &pw->pw_dir, ((void *)0) )) != 0 || (r = sshbuf_get_cstring(m, &pw->pw_shell, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 306, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse pw"); out: if ((r = sshbuf_get_string_direct(m, &p, &len)) != 0) sshfatal("monitor_wrap.c", __func__, 311, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse opts"); if (len != sizeof(*newopts)) sshfatal("monitor_wrap.c", __func__, 313, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "option block size mismatch"); newopts = xcalloc(sizeof(*newopts), 1); memcpy(newopts, p, sizeof(*newopts)); do { do { if (newopts->banner != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->banner, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "banner"); } while (0); do { if (newopts->trusted_user_ca_keys != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->trusted_user_ca_keys, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "trusted_user_ca_keys"); } while (0); do { if (newopts->revoked_keys_file != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->revoked_keys_file, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "revoked_keys_file"); } while (0); do { if (newopts->authorized_keys_command != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->authorized_keys_command, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "authorized_keys_command"); } while (0); do { if (newopts->authorized_keys_command_user != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->authorized_keys_command_user, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "authorized_keys_command_user"); } while (0); do { if (newopts->authorized_principals_file != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->authorized_principals_file, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "authorized_principals_file"); } while (0); do { if (newopts->authorized_principals_command != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->authorized_principals_command, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "authorized_principals_command"); } while (0); do { if (newopts->authorized_principals_command_user != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->authorized_principals_command_user, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "authorized_principals_command_user"); } while (0); do { if (newopts->hostbased_accepted_algos != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->hostbased_accepted_algos, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "hostbased_accepted_algos"); } while (0); do { if (newopts->pubkey_accepted_algos != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->pubkey_accepted_algos, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "pubkey_accepted_algos"); } while (0); do { if (newopts->ca_sign_algorithms != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->ca_sign_algorithms, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "ca_sign_algorithms"); } while (0); do { if (newopts->routing_domain != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->routing_domain, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "routing_domain"); } while (0); do { if (newopts->permit_user_env_allowlist != ((void *)0) && (r = sshbuf_get_cstring(m, &newopts->permit_user_env_allowlist, ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "permit_user_env_allowlist"); } while (0); do { newopts->authorized_keys_files = newopts->num_authkeys_files == 0 ? ((void *)0) : xcalloc(newopts->num_authkeys_files, sizeof(*newopts->authorized_keys_files)); for (i = 0; i < newopts->num_authkeys_files; i++) { if ((r = sshbuf_get_cstring(m, &newopts->authorized_keys_files[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "authorized_keys_files"); } } while (0); do { newopts->allow_users = newopts->num_allow_users == 0 ? ((void *)0) : xcalloc(newopts->num_allow_users, sizeof(*newopts->allow_users)); for (i = 0; i < newopts->num_allow_users; i++) { if ((r = sshbuf_get_cstring(m, &newopts->allow_users[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "allow_users"); } } while (0); do { newopts->deny_users = newopts->num_deny_users == 0 ? ((void *)0) : xcalloc(newopts->num_deny_users, sizeof(*newopts->deny_users)); for (i = 0; i < newopts->num_deny_users; i++) { if ((r = sshbuf_get_cstring(m, &newopts->deny_users[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "deny_users"); } } while (0); do { newopts->allow_groups = newopts->num_allow_groups == 0 ? ((void *)0) : xcalloc(newopts->num_allow_groups, sizeof(*newopts->allow_groups)); for (i = 0; i < newopts->num_allow_groups; i++) { if ((r = sshbuf_get_cstring(m, &newopts->allow_groups[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "allow_groups"); } } while (0); do { newopts->deny_groups = newopts->num_deny_groups == 0 ? ((void *)0) : xcalloc(newopts->num_deny_groups, sizeof(*newopts->deny_groups)); for (i = 0; i < newopts->num_deny_groups; i++) { if ((r = sshbuf_get_cstring(m, &newopts->deny_groups[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "deny_groups"); } } while (0); do { newopts->accept_env = newopts->num_accept_env == 0 ? ((void *)0) : xcalloc(newopts->num_accept_env, sizeof(*newopts->accept_env)); for (i = 0; i < newopts->num_accept_env; i++) { if ((r = sshbuf_get_cstring(m, &newopts->accept_env[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "accept_env"); } } while (0); do { newopts->setenv = newopts->num_setenv == 0 ? ((void *)0) : xcalloc(newopts->num_setenv, sizeof(*newopts->setenv)); for (i = 0; i < newopts->num_setenv; i++) { if ((r = sshbuf_get_cstring(m, &newopts->setenv[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "setenv"); } } while (0); do { newopts->auth_methods = newopts->num_auth_methods == 0 ? ((void *)0) : xcalloc(newopts->num_auth_methods, sizeof(*newopts->auth_methods)); for (i = 0; i < newopts->num_auth_methods; i++) { if ((r = sshbuf_get_cstring(m, &newopts->auth_methods[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "auth_methods"); } } while (0); do { newopts->permitted_opens = newopts->num_permitted_opens == 0 ? ((void *)0) : xcalloc(newopts->num_permitted_opens, sizeof(*newopts->permitted_opens)); for (i = 0; i < newopts->num_permitted_opens; i++) { if ((r = sshbuf_get_cstring(m, &newopts->permitted_opens[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "permitted_opens"); } } while (0); do { newopts->permitted_listens = newopts->num_permitted_listens == 0 ? ((void *)0) : xcalloc(newopts->num_permitted_listens, sizeof(*newopts->permitted_listens)); for (i = 0; i < newopts->num_permitted_listens; i++) { if ((r = sshbuf_get_cstring(m, &newopts->permitted_listens[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "permitted_listens"); } } while (0); do { newopts->log_verbose = newopts->num_log_verbose == 0 ? ((void *)0) : xcalloc(newopts->num_log_verbose, sizeof(*newopts->log_verbose)); for (i = 0; i < newopts->num_log_verbose; i++) { if ((r = sshbuf_get_cstring(m, &newopts->log_verbose[i], ((void *)0) )) != 0) sshfatal("monitor_wrap.c", __func__, 332, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse %s", "log_verbose"); } } while (0); } while (0); copy_set_server_options(&options, newopts, 1); log_change_level(options.log_level); log_verbose_reset(); for (i = 0; i < options.num_log_verbose; i++) log_verbose_add(options.log_verbose[i]); process_permitopen(ssh, &options); free(newopts); sshbuf_free(m); return (pw); }
long long mm_getpwnamallow(unsigned long long a0, unsigned long long a1) { char v0; unsigned int v1; unsigned int v2; char v3; char v4; void* v5; unsigned long long v6; struct_0 *v7; unsigned long long v8; unsigned long long v9; char v10; void* v12; void* v13; void* v14; void* v15; void* v16; void* v17; void* v18; void* v19; void* v20; void* v21; void* v22; unsigned long long v23; unsigned long long v24; unsigned long long v25; sshlog("monitor_wrap.c", "mm_getpwnamallow", 0x10b, 0x1, 0x7, 0x0, "entering"); v6 = sshbuf_new(); if (!v6) sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x10e, 0x1, 0x1, 0x0); v2 = sshbuf_put_cstring(v6, a1, a1); if (v2) { v8 = "assemble"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x110, 0x1, 0x1, ssh_err(v2)); } mm_request_send(*(pmonitor), 0x8, v6); v8 = "waiting for MONITOR_ANS_PWNAM"; sshlog("monitor_wrap.c", "mm_getpwnamallow", 0x114, 0x1, 0x7, 0x0, *(&v10)); mm_request_receive_expect(*(pmonitor), 0x9, v6); v2 = sshbuf_get_u8(v6, &v0, &v0); if (v2) { v8 = "parse success"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x118, 0x1, 0x1, ssh_err(v2)); } if (!v0) { v5 = 0; } else { v5 = xcalloc(0x30, 0x1); v2 = sshbuf_get_string_direct(v6, &v4, &v3, &v4); if (v2) { v9 = "pw_uid"; v8 = "parse pw %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x120, 0x1, 0x1, ssh_err(v2)); } if (*(&v3) != 4) { v9 = "pw_uid"; v8 = "bad length for %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x120, 0x1, 0x1, ssh_err(v2)); } memcpy(v5 + 16, *(&v4), *(&v3)); v2 = sshbuf_get_string_direct(v6, &v4, &v3, &v4); if (v2) { v9 = "pw_gid"; v8 = "parse pw %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x121, 0x1, 0x1, ssh_err(v2)); } if (*(&v3) != 4) { v9 = "pw_gid"; v8 = "bad length for %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x121, 0x1, 0x1, ssh_err(v2)); } memcpy(v5 + 20, *(&v4), *(&v3)); v2 = sshbuf_get_cstring(v6, v5, 0x0, v5); if (!v2) { v2 = sshbuf_get_cstring(v6, v5 + 8, 0x0, v5 + 8); if (!v2) { v2 = sshbuf_get_cstring(v6, v5 + 24, 0x0, v5 + 24); if (!v2) { v2 = sshbuf_get_cstring(v6, v5 + 32, 0x0, v5 + 32); if (!v2) { v2 = sshbuf_get_cstring(v6, v5 + 40, 0x0, v5 + 40); if (!v2) goto LABEL_401266; } } } } v8 = "parse pw"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x132, 0x1, 0x1, ssh_err(v2)); LABEL_401266: } v2 = sshbuf_get_string_direct(v6, &v4, &v3, &v4); if (v2) { v8 = "parse opts"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x137, 0x1, 0x1, ssh_err(v2)); } if (*(&v3) != 7880) { v8 = "option block size mismatch"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x139, 0x1, 0x1, 0x0); } v7 = xcalloc(0x1ec8, 0x1); memcpy(v7, *(&v4), 0x1ec8); if (v7->field_1df0) { v2 = sshbuf_get_cstring(v6, &v7->field_1df0, 0x0, &v7->field_1df0); if (v2) { v9 = "banner"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_1e50) { v2 = sshbuf_get_cstring(v6, &v7->field_1e50, 0x0, &v7->field_1e50); if (v2) { v9 = "trusted_user_ca_keys"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_1e48) { v2 = sshbuf_get_cstring(v6, &v7->field_1e48, 0x0, &v7->field_1e48); if (v2) { v9 = "revoked_keys_file"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_1e58) { v2 = sshbuf_get_cstring(v6, &v7->field_1e58, 0x0, &v7->field_1e58); if (v2) { v9 = "authorized_keys_command"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_1e60) { v2 = sshbuf_get_cstring(v6, &v7->field_1e60, 0x0, &v7->field_1e60); if (v2) { v9 = "authorized_keys_command_user"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_1e68) { v2 = sshbuf_get_cstring(v6, &v7->field_1e68, 0x0, &v7->field_1e68); if (v2) { v9 = "authorized_principals_file"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_1e70) { v2 = sshbuf_get_cstring(v6, &v7->field_1e70, 0x0, &v7->field_1e70); if (v2) { v9 = "authorized_principals_command"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_1e78) { v2 = sshbuf_get_cstring(v6, &v7->field_1e78, 0x0, &v7->field_1e78); if (v2) { v9 = "authorized_principals_command_user"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_4f8) { v2 = sshbuf_get_cstring(v6, &v7->field_4f8, 0x0, &v7->field_4f8); if (v2) { v9 = "hostbased_accepted_algos"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_518) { v2 = sshbuf_get_cstring(v6, &v7->field_518, 0x0, &v7->field_518); if (v2) { v9 = "pubkey_accepted_algos"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_508) { v2 = sshbuf_get_cstring(v6, &v7->field_508, 0x0, &v7->field_508); if (v2) { v9 = "ca_sign_algorithms"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_428) { v2 = sshbuf_get_cstring(v6, &v7->field_428, 0x0, &v7->field_428); if (v2) { v9 = "routing_domain"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (v7->field_550) { v2 = sshbuf_get_cstring(v6, &v7->field_550, 0x0, &v7->field_550); if (v2) { v9 = "permit_user_env_allowlist"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_1e04) v12 = 0; else v12 = xcalloc(v7->field_1e04, 0x8); v7->field_1e08 = v12; for (v1 = 0; v1 < v7->field_1e04; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_1e08 + v1 * 8, 0x0, v7->field_1e08 + v1 * 8); if (v2) { v9 = "authorized_keys_files"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_56c) v13 = 0; else v13 = xcalloc(v7->field_56c, 0x8); v7->field_570 = v13; for (v1 = 0; v1 < v7->field_56c; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_570 + v1 * 8, 0x0, v7->field_570 + v1 * 8); if (v2) { v9 = "allow_users"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_578) v14 = 0; else v14 = xcalloc(v7->field_578, 0x8); v7->field_580 = v14; for (v1 = 0; v1 < v7->field_578; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_580 + v1 * 8, 0x0, v7->field_580 + v1 * 8); if (v2) { v9 = "deny_users"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_588) v15 = 0; else v15 = xcalloc(v7->field_588, 0x8); v7->field_590 = v15; for (v1 = 0; v1 < v7->field_588; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_590 + v1 * 8, 0x0, v7->field_590 + v1 * 8); if (v2) { v9 = "allow_groups"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_598) v16 = 0; else v16 = xcalloc(v7->field_598, 0x8); v7->field_5a0 = v16; for (v1 = 0; v1 < v7->field_598; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_5a0 + v1 * 8, 0x0, v7->field_5a0 + v1 * 8); if (v2) { v9 = "deny_groups"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_1db0) v17 = 0; else v17 = xcalloc(v7->field_1db0, 0x8); v7->field_1db8 = v17; for (v1 = 0; v1 < v7->field_1db0; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_1db8 + v1 * 8, 0x0, v7->field_1db8 + v1 * 8); if (v2) { v9 = "accept_env"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_1dc0) v18 = 0; else v18 = xcalloc(v7->field_1dc0, 0x8); v7->field_1dc8 = v18; for (v1 = 0; v1 < v7->field_1dc0; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_1dc8 + v1 * 8, 0x0, v7->field_1dc8 + v1 * 8); if (v2) { v9 = "setenv"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_1e98) v19 = 0; else v19 = xcalloc(v7->field_1e98, 0x8); v7->field_1ea0 = v19; for (v1 = 0; v1 < v7->field_1e98; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_1ea0 + v1 * 8, 0x0, v7->field_1ea0 + v1 * 8); if (v2) { v9 = "auth_methods"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_1e28) v20 = 0; else v20 = xcalloc(v7->field_1e28, 0x8); v7->field_1e20 = v20; for (v1 = 0; v1 < v7->field_1e28; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_1e20 + v1 * 8, 0x0, v7->field_1e20 + v1 * 8); if (v2) { v9 = "permitted_opens"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_1e38) v21 = 0; else v21 = xcalloc(v7->field_1e38, 0x8); v7->field_1e30 = v21; for (v1 = 0; v1 < v7->field_1e38; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_1e30 + v1 * 8, 0x0, v7->field_1e30 + v1 * 8); if (v2) { v9 = "permitted_listens"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } if (!v7->field_4e4) v22 = 0; else v22 = xcalloc(v7->field_4e4, 0x8); v7->field_4e8 = v22; for (v1 = 0; v1 < v7->field_4e4; v1 += 1) { v2 = sshbuf_get_cstring(v6, v7->field_4e8 + v1 * 8, 0x0, v7->field_4e8 + v1 * 8); if (v2) { v9 = "log_verbose"; v8 = "parse %s"; sshfatal("monitor_wrap.c", "mm_getpwnamallow", 0x14c, 0x1, 0x1, ssh_err(v2)); } } copy_set_server_options(0x5000f0, v7, 0x1); log_change_level(*(5244368)); log_verbose_reset(*(pmonitor), a1, 0x1, v23, v24, v25); for (v1 = 0; v1 < *(5244372); v1 += 1) { log_verbose_add(*((*(5244376) + v1 * 8))); } process_permitopen(a0, 0x5000f0); free(v7); sshbuf_free(v6); return v5; }
pid_t xfork (void) { pid_t p = fork (); if (p == (pid_t) -1) call_arg_fatal ("fork", gettext ("child process")); return p; }
long long xfork() { unsigned int v0; v0 = fork(); if (v0 == -1) { call_arg_fatal("fork", gettext("child process")); return v0; } return v0; }
char * sh_un_double_quote (string) char *string; { register int c, pass_next; char *result, *r, *s; r = result = (char *)sh_xmalloc((strlen (string) + 1), "shquote.c", 229); for (pass_next = 0, s = string; s && (c = *s); s++) { if (pass_next) { *r++ = c; pass_next = 0; continue; } if (c == '\\' && (sh_syntaxtab[(unsigned char) s[1]] & 0x0040)) { pass_next = 1; continue; } *r++ = c; } *r = '\0'; return result; }
long long sh_un_double_quote(char *a0) { char *v0; char v1[2]; char *v2; unsigned int v4; char *v5; char *v6; v2 = sh_xmalloc(strlen(a0) + 1, "shquote.c", 0xe5); v0 = v2; v4 = 0; *(&v1) = a0; while (true) { if (!v1) break; if (!v1[0]) break; if (v4) { v5 = v0; v0 += 1; *(v5) = v1[0]; v4 = 0; goto LABEL_400743; } if (v1[0] == 92 && (sh_syntaxtab[v1[1]] & 64)) { v4 = 1; goto LABEL_400743; } v6 = v0; v0 += 1; *(v6) = v1[0]; LABEL_400743: *(&v1) = &v1[1]; } *(v0) = 0; return v2; }
static char const * pretty_name (struct File_spec const *f) { return ((strcmp (f->name, "-") == 0) ? gettext ("standard input") : f->name); }
int pretty_name(unsigned long long *a0) { unsigned long long v1; v1 = strcmp(*(a0), "-"); if (!v1) v1 = gettext("standard input"); else *(&v1) = *(a0); return v1; }
size_t sshbuf_len(const struct sshbuf *buf) { if (sshbuf_check_sanity(buf) != 0) return 0; return buf->size - buf->off; }
long sshbuf_len(long param_1) { int iVar1; long lVar2; iVar1 = sshbuf_check_sanity(param_1); if (iVar1 == 0) { lVar2 = *(long *)(param_1 + 0x18) - *(long *)(param_1 + 0x10); } else { lVar2 = 0; } return lVar2; }
int rl_forced_update_display (void) { register char *temp; if ((line_state_visible->line)) { temp = (line_state_visible->line); while (*temp) *temp++ = '\0'; } rl_on_new_line (); forced_display++; (*rl_redisplay_function) (); return 0; }
long long rl_forced_update_display() { char *v1; char *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; if (*(line_state_visible)) { for (v1 = *(line_state_visible); *(v1); *(v2) = 0) { v2 = v1; v1 += 1; } } rl_on_new_line(); forced_display = forced_display + 1; rl_redisplay(v3, v4, v5, v6, v7, v8); return 0; }
char * get_rdomain(int fd) { return sys_get_rdomain(fd); }
void get_rdomain(undefined4 param_1) { sys_get_rdomain(param_1); return; }
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; }
static void buffer_get_bignum_bits(struct sshbuf *b, BIGNUM *value) { u_int bytes, bignum_bits; int r; if ((r = sshbuf_get_u32(b, &bignum_bits)) != 0) sshfatal("ssh-keygen.c", __func__, 463, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); bytes = (bignum_bits + 7) / 8; if (sshbuf_len(b) < bytes) sshfatal("ssh-keygen.c", __func__, 466, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "input buffer too small: need %d have %zu", bytes, sshbuf_len(b)) ; if (BN_bin2bn(sshbuf_ptr(b), bytes, value) == ((void *)0) ) sshfatal("ssh-keygen.c", __func__, 469, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "BN_bin2bn failed"); if ((r = sshbuf_consume(b, bytes)) != 0) sshfatal("ssh-keygen.c", __func__, 471, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "consume"); }
void buffer_get_bignum_bits(unsigned long long a0, unsigned long long a1) { char v0; unsigned int v1; unsigned int v2; unsigned long long v3; unsigned long v4; unsigned long long v5; char v6; unsigned long long *v9; unsigned long long v10; v1 = sshbuf_get_u32(a0, &v0, &v0); if (v1) sshfatal("ssh-keygen.c", "buffer_get_bignum_bits", 0x1cf, 0x1, 0x1, ssh_err(v1), "parse"); v2 = *(&v0) + 7 >> 3; if (sshbuf_len(a0) < v2) { v5 = sshbuf_len(a0); v4 = v2; v3 = "input buffer too small: need %d have %zu"; sshfatal("ssh-keygen.c", "buffer_get_bignum_bits", 0x1d2, 0x1, 0x1, 0x0, *(&v6)); } if (!BN_bin2bn(sshbuf_ptr(a0), v2, a1, sshbuf_ptr(a0))) { v5 = "BN_bin2bn failed"; sshfatal("ssh-keygen.c", "buffer_get_bignum_bits", 0x1d5, 0x1, 0x1, 0x0, *(&v6)); } v1 = sshbuf_consume(a0, v2, v2); if (v1) { v5 = "consume"; sshfatal("ssh-keygen.c", "buffer_get_bignum_bits", 0x1d7, 0x1, 0x1, ssh_err(v1), *(&v6)); } v10 = v3 ^ v9[5]; return; }
static void usr_update (void) { struct passwd pwent; const struct passwd *pwd; struct spwd spent; const struct spwd *spwd = ((void *)0) ; pwd = pw_locate (user_name); if ( ((void *)0) == pwd) { fprintf ( stderr , gettext ("%s: user '%s' does not exist in %s\n"), Prog, user_name, pw_dbname ()); fail_exit (6); } pwent = *pwd; new_pwent (&pwent); if (is_shadow_pwd) { spwd = spw_locate (user_name); if ( ((void *)0) != spwd) { spent = *spwd; new_spent (&spent); } else if ( ( pflg && (strcmp (pwent.pw_passwd, "x") == 0)) || eflg || fflg) { memset (&spent, 0, sizeof spent); spent.sp_namp = user_name; spent.sp_pwdp = xstrdup (pwent.pw_passwd); pwent.pw_passwd = xstrdup ("x"); spent.sp_lstchg = (long) gettime () / (24L*3600L); if (0 == spent.sp_lstchg) { spent.sp_lstchg = -1; } spent.sp_min = getdef_num ("PASS_MIN_DAYS", -1); spent.sp_max = getdef_num ("PASS_MAX_DAYS", -1); spent.sp_warn = getdef_num ("PASS_WARN_AGE", -1); spent.sp_inact = -1; spent.sp_expire = -1; spent.sp_flag = ((unsigned long int)-1); new_spent (&spent); spwd = &spent; } } if (lflg || uflg || gflg || cflg || dflg || sflg || pflg || Lflg || Uflg) { if (pw_update (&pwent) == 0) { fprintf ( stderr , gettext ("%s: failed to prepare the new %s entry '%s'\n"), Prog, pw_dbname (), pwent.pw_name); fail_exit (1); } if (lflg && (pw_remove (user_name) == 0)) { fprintf ( stderr , gettext ("%s: cannot remove entry '%s' from %s\n"), Prog, user_name, pw_dbname ()); fail_exit (1); } } if (( ((void *)0) != spwd) && (lflg || eflg || fflg || pflg || Lflg || Uflg)) { if (spw_update (&spent) == 0) { fprintf ( stderr , gettext ("%s: failed to prepare the new %s entry '%s'\n"), Prog, spw_dbname (), spent.sp_namp); fail_exit (1); } if (lflg && (spw_remove (user_name) == 0)) { fprintf ( stderr , gettext ("%s: cannot remove entry '%s' from %s\n"), Prog, user_name, spw_dbname ()); fail_exit (1); } } }
void usr_update(unsigned long a0, unsigned long long a1) { void* v0; unsigned long long v1[6]; unsigned long v2; unsigned long v3; unsigned long v4; unsigned long v5; unsigned long v6; unsigned long v7; unsigned long v8; unsigned long v9; unsigned long v10; unsigned long v11; unsigned long v12; unsigned long v13; unsigned long v14; unsigned long v15; unsigned long long v16; char v17; unsigned long long v19; unsigned long long v20; unsigned int v22; unsigned long long v23; unsigned long long v26; unsigned long long v27; unsigned long long v28; unsigned long long v29; unsigned long long v30; unsigned long long v31; unsigned long long v32; unsigned long long *v33; unsigned long long v34; unsigned long long v35; v0 = 0; v1[0] = pw_locate(user_name); if (!v1) { v19 = pw_dbname(); fprintf(*(&stderr), gettext("%s: user '%s' does not exist in %s\n")); fail_exit(0x6); } v2 = v1[0]; v3 = v1[1]; v4 = v1[2]; v5 = v1[3]; v6 = v1[4]; v7 = v1[5]; new_pwent(&v2); if (is_shadow_pwd) { v0 = spw_locate(user_name); if (v0) { v8 = *(v0); v9 = v0[8]; v10 = v0[16]; v11 = v0[24]; v12 = v0[32]; v13 = v0[40]; v14 = v0[48]; v15 = v0[56]; v16 = v0[64]; new_spent(&v8, a1, v20, v0[48]); } else if (eflg || fflg || !strcmp(v3, "x") && pflg) { v22 = 0; memset(&v8, 0x0, 0x48); v8 = user_name; v9 = xstrdup(v3, 0x0, 0x48, v23); *(&v3) = xstrdup("x", reg_64, 0x48, v23); v10 = (gettime() * 1749024623285053783 >> 64 >> 13) - (gettime() >> 63); if (!v10) v10 = -1; v11 = getdef_num("PASS_MIN_DAYS", 0xffffffff); v12 = getdef_num("PASS_MAX_DAYS", 0xffffffff); v13 = getdef_num("PASS_WARN_AGE", 0xffffffff); v14 = -1; v15 = -1; v16 = -1; new_spent(&v8, 0xffffffff, 0x48, v23); v0 = &v8; } } if (...) { v26 = pw_update(&v2); if (!v26) { v28 = pw_dbname(); fprintf(*(&stderr), gettext("%s: failed to prepare the new %s entry '%s'\n")); fail_exit(0x1); } else if (lflg) { v27 = pw_remove(user_name); if (!v27) { v29 = pw_dbname(); fprintf(*(&stderr), gettext("%s: cannot remove entry '%s' from %s\n")); fail_exit(0x1); } } } if (...) { if (v0) { if (eflg || Lflg || fflg || Uflg || pflg || lflg) { v30 = spw_update(&v8); if (!v30) { v32 = spw_dbname(); fprintf(*(&stderr), gettext("%s: failed to prepare the new %s entry '%s'\n")); fail_exit(0x1); } } if (v30) { v31 = spw_remove(user_name); if (!v31) { v35 = spw_dbname(); fprintf(*(&stderr), gettext("%s: cannot remove entry '%s' from %s\n")); fail_exit(0x1); } } } if (!eflg && !Lflg && !fflg && !pflg && !lflg && v0 && !Uflg || v0 && lflg && v30 && v31 || v0 && v30 && (eflg || Lflg || fflg || Uflg || pflg || lflg) && !lflg || !v0) { v34 = *(&v17) ^ v33[5]; return; } } }
int sshkey_private_serialize(struct sshkey *key, struct sshbuf *b) { return sshkey_private_serialize_opt(key, b, SSHKEY_SERIALIZE_DEFAULT); }
long long sshkey_private_serialize(void* a0, unsigned long long a1) { return sshkey_private_serialize_opt(a0, a1, 0x0, a1); }
static int ipaddrlabel_modify(int cmd, int argc, char **argv) { struct { struct nlmsghdr n; struct ifaddrlblmsg ifal; char buf[1024]; } req = { .n.nlmsg_type = cmd, .n.nlmsg_len = ((sizeof(struct ifaddrlblmsg)) + ((int) ( ((sizeof(struct nlmsghdr))+4U -1) & ~(4U -1) ))), .n.nlmsg_flags = 0x01, .ifal.ifal_family = preferred_family, }; inet_prefix prefix = {}; uint32_t label = 0xffffffffUL; char *p = ((void *)0) ; char *l = ((void *)0) ; if (cmd == RTM_NEWADDRLABEL) { req.n.nlmsg_flags |= 0x400|0x200; } while (argc > 0) { if (strcmp(*argv, "prefix") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while(0); p = *argv; get_prefix(&prefix, *argv, preferred_family); } else if (strcmp(*argv, "dev") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while(0); if ((req.ifal.ifal_index = ll_name_to_index(*argv)) == 0) invarg("dev is invalid\n", *argv); } else if (strcmp(*argv, "label") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while(0); l = *argv; if (get_u32(&label, *argv, 0) || label == 0xffffffffUL) invarg("label is invalid\n", *argv); } argc--; argv++; } if (p == ((void *)0) ) { fprintf( stderr , "Not enough information: \"prefix\" argument is required.\n"); return -1; } if (l == ((void *)0) ) { fprintf( stderr , "Not enough information: \"label\" argument is required.\n"); return -1; } addattr32(&req.n, sizeof(req), IFAL_LABEL, label); addattr_l(&req.n, sizeof(req), IFAL_ADDRESS, &prefix.data, prefix.bytelen); req.ifal.ifal_prefixlen = prefix.bitlen; if (req.ifal.ifal_family == 0 ) req.ifal.ifal_family = 10 ; if (rtnl_talk(&rth, &req.n, ((void *)0) ) < 0) return -2; return 0; }
void ipaddrlabel_modify(unsigned long a0, unsigned long a1, unsigned long a2) { unsigned long long *v0; int tmp_13; unsigned int v1; unsigned int v2; unsigned int v3; void* v4; void* v5; char v6; char v7; unsigned int v8; unsigned short v9; unsigned short v10; char v11; char v12; unsigned int v13; unsigned long long v15; void* v16; unsigned long v17; unsigned long long *v18; unsigned long long v19; unsigned long long v20; unsigned long long v21; unsigned long long v22; unsigned long long v23; void* v24; v2 = a0; v1 = a1; v0 = a2; v15 = 131; for (v16 = &v8; v15; v16 += v17 * 8) { v15 -= 1; v8 = 0; } *(v16) = 0; v8 = 28; v9 = v2; v10 = 1; v11 = preferred_family; v19 = 33; for (v18 = &v6; v19; v18 = &v18[v17]) { v19 -= 1; v6 = 0; } v3 = -1; v4 = 0; v5 = 0; if (v2 == 72) { v20 = v10; *(&v20) = (v10 >> 8) | 6; tmp_13 = v20; v10 = tmp_13; } while (true) { if (v1 <= 0) break; if (!strcmp(*(v0), "prefix")) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); v4 = *(v0); get_prefix(&v6, *(v0), preferred_family, *(v0)); goto LABEL_400662; } if (!strcmp(*(v0), "dev")) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); v13 = ll_name_to_index(*(v0)); if (!(!v13)) goto LABEL_400662; invarg("dev is invalid\n", *(v0)); } if (!strcmp(*(v0), "label")) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); v5 = *(v0); if (!get_u32(&v3, *(v0), 0x0, *(v0)) && !(v3 == -1)) goto LABEL_400662; invarg("label is invalid\n", *(v0)); } LABEL_400662: v1 -= 1; v0 += 1; } if (!v4) { fprintf(*(&stderr), "Not enough information: \"prefix\" argument is required.\n"); v21 = 4294967295; } else if (!v5) { fprintf(*(&stderr), "Not enough information: \"label\" argument is required.\n"); v22 = 4294967295; } else { addattr32(&v8, 0x41c, 0x2, v3); addattr_l(&v8, 0x41c, 0x1, &v7, *((&v6 + 2))); v12 = *((&v6 + 4)); if (!v11) v11 = 10; if (rtnl_talk(0x500070, &v8, 0x0) < 0) v23 = 4294967294; else v24 = 0; } return; }
static int private2_decrypt(struct sshbuf *decoded, const char *passphrase, struct sshbuf **decryptedp, struct sshkey **pubkeyp) { char *ciphername = ((void *)0) , *kdfname = ((void *)0) ; const struct sshcipher *cipher = ((void *)0) ; int r = -1; size_t keylen = 0, ivlen = 0, authlen = 0, slen = 0; struct sshbuf *kdf = ((void *)0) , *decrypted = ((void *)0) ; struct sshcipher_ctx *ciphercontext = ((void *)0) ; struct sshkey *pubkey = ((void *)0) ; u_char *key = ((void *)0) , *salt = ((void *)0) , *dp; u_int blocksize, rounds, nkeys, encrypted_len, check1, check2; if (decoded == ((void *)0) || decryptedp == ((void *)0) || pubkeyp == ((void *)0) ) return -10; *decryptedp = ((void *)0) ; *pubkeyp = ((void *)0) ; if ((decrypted = sshbuf_new()) == ((void *)0) ) { r = -2; goto out; } if ((r = sshbuf_consume(decoded, sizeof("openssh-key-v1"))) != 0 || (r = sshbuf_get_cstring(decoded, &ciphername, ((void *)0) )) != 0 || (r = sshbuf_get_cstring(decoded, &kdfname, ((void *)0) )) != 0 || (r = sshbuf_froms(decoded, &kdf)) != 0 || (r = sshbuf_get_u32(decoded, &nkeys)) != 0) goto out; if (nkeys != 1) { r = -4; goto out; } if ((r = sshkey_froms(decoded, &pubkey)) != 0 || (r = sshbuf_get_u32(decoded, &encrypted_len)) != 0) goto out; if ((cipher = cipher_by_name(ciphername)) == ((void *)0) ) { r = -42; goto out; } if (strcmp(kdfname, "none") != 0 && strcmp(kdfname, "bcrypt") != 0) { r = -42; goto out; } if (strcmp(kdfname, "none") == 0 && strcmp(ciphername, "none") != 0) { r = -4; goto out; } if ((passphrase == ((void *)0) || strlen(passphrase) == 0) && strcmp(kdfname, "none") != 0) { r = -43; goto out; } blocksize = cipher_blocksize(cipher); if (encrypted_len < blocksize || (encrypted_len % blocksize) != 0) { r = -4; goto out; } keylen = cipher_keylen(cipher); ivlen = cipher_ivlen(cipher); authlen = cipher_authlen(cipher); if ((key = calloc(1, keylen + ivlen)) == ((void *)0) ) { r = -2; goto out; } if (strcmp(kdfname, "bcrypt") == 0) { if ((r = sshbuf_get_string(kdf, &salt, &slen)) != 0 || (r = sshbuf_get_u32(kdf, &rounds)) != 0) goto out; if (bcrypt_pbkdf(passphrase, strlen(passphrase), salt, slen, key, keylen + ivlen, rounds) < 0) { r = -4; goto out; } } if (sshbuf_len(decoded) < authlen || sshbuf_len(decoded) - authlen < encrypted_len) { r = -4; goto out; } if ((r = sshbuf_reserve(decrypted, encrypted_len, &dp)) != 0 || (r = cipher_init(&ciphercontext, cipher, key, keylen, key + keylen, ivlen, 0)) != 0) goto out; if ((r = cipher_crypt(ciphercontext, 0, dp, sshbuf_ptr(decoded), encrypted_len, 0, authlen)) != 0) { if (r == -30) r = -43; goto out; } if ((r = sshbuf_consume(decoded, encrypted_len + authlen)) != 0) goto out; if (sshbuf_len(decoded) != 0) { r = -4; goto out; } if ((r = sshbuf_get_u32(decrypted, &check1)) != 0 || (r = sshbuf_get_u32(decrypted, &check2)) != 0) goto out; if (check1 != check2) { r = -43; goto out; } *decryptedp = decrypted; decrypted = ((void *)0) ; *pubkeyp = pubkey; pubkey = ((void *)0) ; r = 0; out: cipher_free(ciphercontext); free(ciphername); free(kdfname); sshkey_free(pubkey); if (salt != ((void *)0) ) { explicit_bzero(salt, slen); free(salt); } if (key != ((void *)0) ) { explicit_bzero(key, keylen + ivlen); free(key); } sshbuf_free(kdf); sshbuf_free(decrypted); return r; }
long private2_decrypt(long a1, const char *a2, _QWORD *a3, _QWORD *a4) { size_t v5; unsigned long v6; long v7; long v8; unsigned int v9; long v10; unsigned int v13; int v14; unsigned int v15; int v16; int v17; unsigned int cstring; unsigned int v19; char *v20; char *s1; long v22; long v23; long v24; long v25; void *ptr; long v27; long v28; long v29; long v30; void *v31; long v32; unsigned long v33; unsigned long v34; v34 = __readfsqword(0x28u); v20 = 0LL; s1 = 0LL; v32 = 0LL; cstring = -1; v28 = 0LL; v29 = 0LL; v33 = 0LL; v22 = 0LL; v23 = 0LL; v30 = 0LL; v24 = 0LL; v25 = 0LL; v31 = 0LL; ptr = 0LL; if ( !a1 || !a3 || !a4 ) return 4294967286LL; *a3 = 0LL; *a4 = 0LL; v30 = sshbuf_new(a1); if ( v30 ) { cstring = sshbuf_consume(a1, 15LL); if ( cstring ) goto LABEL_54; cstring = sshbuf_get_cstring(a1, &v20, 0LL); if ( cstring ) goto LABEL_54; cstring = sshbuf_get_cstring(a1, &s1, 0LL); if ( cstring ) goto LABEL_54; cstring = sshbuf_froms(a1, &v23); if ( cstring ) goto LABEL_54; cstring = sshbuf_get_u32(a1, &v14); if ( cstring ) goto LABEL_54; if ( v14 == 1 ) { cstring = sshkey_froms(a1, &v25); if ( cstring ) goto LABEL_54; cstring = sshbuf_get_u32(a1, &v15); if ( cstring ) goto LABEL_54; v32 = cipher_by_name(v20); if ( v32 ) { if ( !strcmp(s1, "none") || !strcmp(s1, "bcrypt") ) { if ( strcmp(s1, "none") || !strcmp(v20, "none") ) { if ( a2 && strlen(a2) || !strcmp(s1, "none") ) { v19 = cipher_blocksize(v32); if ( v19 > v15 || v15 % v19 ) { cstring = -4; } else { v28 = (unsigned int)cipher_keylen(v32); v29 = (unsigned int)cipher_ivlen(v32); v33 = (unsigned int)cipher_authlen(v32); v31 = calloc(1uLL, v28 + v29); if ( v31 ) { if ( strcmp(s1, "bcrypt") ) goto LABEL_38; cstring = sshbuf_get_string(v23, &ptr, &v22); if ( cstring ) goto LABEL_54; cstring = sshbuf_get_u32(v23, &v13); if ( cstring ) goto LABEL_54; v5 = strlen(a2); if ( (int)bcrypt_pbkdf(a2, v5, ptr, v22, v31, v28 + v29, v13) >= 0 ) { LABEL_38: v6 = sshbuf_len(a1); if ( v33 <= v6 && (v7 = sshbuf_len(a1), v7 - v33 >= v15) ) { cstring = sshbuf_reserve(v30, v15, &v27); if ( !cstring ) { cstring = cipher_init( &v24, v32, v31, (unsigned int)v28, (char *)v31 + v28, (unsigned int)v29, 0LL); if ( !cstring ) { v8 = (unsigned int)v33; v9 = v15; v10 = sshbuf_ptr(a1); cstring = cipher_crypt(v24, 0LL, v27, v10, v9, 0LL, v8); if ( cstring ) { if ( cstring == -30 ) cstring = -43; } else { cstring = sshbuf_consume(a1, v33 + v15); if ( !cstring ) { if ( sshbuf_len(a1) ) { cstring = -4; } else { cstring = sshbuf_get_u32(v30, &v16); if ( !cstring ) { cstring = sshbuf_get_u32(v30, &v17); if ( !cstring ) { if ( v16 == v17 ) { *a3 = v30; v30 = 0LL; *a4 = v25; v25 = 0LL; cstring = 0; } else { cstring = -43; } } } } } } } } } else { cstring = -4; } goto LABEL_54; } cstring = -4; } else { cstring = -2; } } } else { cstring = -43; } } else { cstring = -4; } } else { cstring = -42; } } else { cstring = -42; } } else { cstring = -4; } } else { cstring = -2; } LABEL_54: cipher_free(v24); free(v20); free(s1); sshkey_free(v25); if ( ptr ) { explicit_bzero(ptr, v22); free(ptr); } if ( v31 ) { explicit_bzero(v31, v29 + v28); free(v31); } sshbuf_free(v23); sshbuf_free(v30); return cstring; }
void read_diag_details (char const *name, off_t offset, size_t size) { if (ignore_failed_read_option) { if ((warning_option & (0x00800000))) read_warn_details (name, offset, size); } else read_error_details (name, offset, size); }
long read_diag_details(long a1, long a2, long a3) { long result; if ( !ignore_failed_read_option ) return read_error_details(a1, a2, a3); result = warning_option & 0x800000; if ( (_DWORD)result ) return read_warn_details(a1, a2, a3); return result; }
_Bool pred_delete (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pred_ptr; (void) stat_buf; if (strcmp (state.rel_pathname, ".")) { int flags=0; if (state.have_stat && (((( stat_buf->st_mode )) & 0170000) == (0040000)) ) flags |= 0x200 ; if (perform_delete (flags)) { return 1 ; } else { if ( 2 == (*__errno_location ()) && options.ignore_readdir_race) { (*__errno_location ()) = 0; return 1 ; } if ( 21 == (*__errno_location ()) ) { if ((flags & 0x200 ) == 0) { flags |= 0x200 ; if (perform_delete (flags)) return 1 ; } } } error (0, (*__errno_location ()) , gettext ("cannot delete %s"), safely_quote_err_filename (0, pathname)); state.exit_status = 1 ; return 0 ; } else { return 1 ; } }
long long pred_delete(unsigned long long a0, struct_0 *a1, unsigned long a2) { unsigned long v0; unsigned int v1; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; v0 = a2; if (strcmp(strcmp, ".")) { v1 = 0; if (g_50002c && (a1->field_18 & 0xf000) == 0x4000) v1 |= 0x200; v5 = perform_delete(v1); if (v5) { v4 = 1; } else { *(&v5) = *(__errno_location()); if (v5 == 2 && g_500056) { *(__errno_location()) = 0; v4 = 1; } if (!g_500056 || v5 != 2) { *(&v5) = *(__errno_location()); if (v5 == 21 && !(v1 & 0x200)) { v1 |= 0x200; v6 = perform_delete(v1); if (v6) v4 = 1; } if (!v6 || (v1 & 0x200) || v5 != 21) { v7 = safely_quote_err_filename(0x0, a0); error(0x0, *(__errno_location()), gettext("cannot delete %s")); g_50004c = 1; v4 = 0; } } } } else { v4 = 1; } return v4; }
static void get_spec_stats (struct Spec_list *s) { struct List_element *p; count length = 0; s->n_indefinite_repeats = 0; s->has_equiv_class = 0 ; s->has_restricted_char_class = 0 ; s->has_char_class = 0 ; for (p = s->head->next; p; p = p->next) { count len = 0; count new_length; switch (p->type) { case RE_NORMAL_CHAR: len = 1; break; case RE_RANGE: ((void) sizeof (( p->u.range.last_char >= p->u.range.first_char ) ? 1 : 0), __extension__ ({ if ( p->u.range.last_char >= p->u.range.first_char ) ; else __assert_fail ( "p->u.range.last_char >= p->u.range.first_char" , "src/tr.c", 1265, __extension__ __PRETTY_FUNCTION__); })) ; len = p->u.range.last_char - p->u.range.first_char + 1; break; case RE_CHAR_CLASS: s->has_char_class = 1 ; for (int i = 0; i < N_CHARS; i++) if (is_char_class_member (p->u.char_class, i)) ++len; switch (p->u.char_class) { case CC_UPPER: case CC_LOWER: break; default: s->has_restricted_char_class = 1 ; break; } break; case RE_EQUIV_CLASS: for (int i = 0; i < N_CHARS; i++) if (is_equiv_class_member (p->u.equiv_code, i)) ++len; s->has_equiv_class = 1 ; break; case RE_REPEATED_CHAR: if (p->u.repeated_char.repeat_count > 0) len = p->u.repeated_char.repeat_count; else { s->indefinite_repeat_element = p; ++(s->n_indefinite_repeats); } break; default: abort (); } new_length = length + len; if (! (length <= new_length && new_length <= ( (18446744073709551615UL) - 1))) ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, gettext (\"too many characters in set\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, gettext ("too many characters in set")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, gettext ("too many characters in set")), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); length = new_length; } s->length = length; }
void get_spec_stats(struct_0 *a0) { unsigned int v0; unsigned int v1; struct_3 *v2; void* v3; unsigned long long v4; unsigned long v5; struct_2 *v7; v3 = 0; a0->field_20 = 0; a0->field_30 = 0; a0->field_32 = 0; a0->field_31 = 0; v2 = a0->field_0->field_8; while (true) { if (!v2) { v7 = a0; a0->field_18 = v3; return; } v4 = 0; switch (v2->field_0) { case 0: v4 = 1; break; case 1: if (v2->field_11 >= v2->field_10) { v4 = v2->field_11 - v2->field_10 + 1; break; } else { __assert_fail(); } case 2: a0->field_31 = 1; for (v0 = 0; v0 <= 255; v0 += 1) { if (is_char_class_member(*(&v2->field_10), v0)) v4 += 1; } if (*(&v2->field_10) != 6 && *(&v2->field_10) != 10) a0->field_32 = 1; break; case 3: for (v1 = 0; v1 <= 255; v1 += 1) { if (is_equiv_class_member(v2->field_10, v1)) v4 += 1; } a0->field_30 = 1; break; case 4: if (v2->field_18) { v4 = v2->field_18; break; } else { a0->field_28 = v2; a0->field_20 = a0->field_20 + 1; break; } default: abort(); } v5 = v4 + v3; if (v3 > v5) break; if (v5 == -1) break; v3 = v5; v2 = v2->field_8; } error(0x1, 0x0, gettext("too many characters in set")); }
static void check_perms (void) { }
void check_perms() { char v0; unsigned long long v2; v2 = *(&v0); return; }
_Bool pred_negate (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { return !apply_predicate (pathname, stat_buf, pred_ptr->pred_right); }
_BOOL8 pred_negate(long a1, long a2, long a3) { return (unsigned char)apply_predicate(a1, a2, *(_QWORD *)(a3 + 280)) == 0; }
int ssh_packet_set_log_preamble(struct ssh *ssh, const char *fmt, ...) { va_list args; int r; free(ssh->log_preamble); if (fmt == ((void *)0) ) ssh->log_preamble = ((void *)0) ; else { __builtin_va_start( args , fmt ) ; r = vasprintf(&ssh->log_preamble, fmt, args); __builtin_va_end( args ) ; if (r < 0 || ssh->log_preamble == ((void *)0) ) return -2; } return 0; }
long long ssh_packet_set_log_preamble() { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long v3; unsigned long v4; unsigned long v5; char v6; unsigned long v7; unsigned long v8; unsigned long v9; unsigned long v10; int v11; int v12; int v13; int v14; int v15; int v16; int v17; int v18; unsigned long v19; unsigned long v20; unsigned long v21; unsigned long v22; unsigned long v23; char v24; int v25; int v26; int v27; int v28; int v29; int v30; int v31; int v32; unsigned long long *v33; struct_0 *v34; char *v35; unsigned long long v36; v7 = v20; v8 = v21; v9 = v22; v10 = v23; if (v24) { v11 = v25; v12 = v26; v13 = v27; v14 = v28; v15 = v29; v16 = v30; v17 = v31; v18 = v32; } v5 = v33[5]; free(v34->field_38); if (v35) { v1 = 16; v2 = 48; v3 = &v19; v4 = &v6; v0 = vasprintf(&v34->field_38, v35, &v1); if (v0 < 0 || !v34->field_38) v36 = 4294967294; else v36 = 0; } else { v34->field_38 = 0; v36 = 0; } if ((v5 ^ v33[5])) __stack_chk_fail(); return v36; }
static void tostring (VALUE *v) { switch (v->type) { case integer: { char *s = __gmpz_get_str ( ((void *)0) , 10, v->u.i); __gmpz_clear (v->u.i); v->u.s = s; v->type = string; } break; case string: break; default: abort (); } }
void tostring(struct_0 *a0) { unsigned long v0; unsigned long long v2; struct_0 *v3; v2 = a0->field_0; if (!a0->field_0) { v0 = __gmpz_get_str(0x0, 0xa, &a0->field_8); __gmpz_clear(&a0->field_8); a0->field_8 = v0; v3 = a0; a0->field_0 = 1; } else if (a0->field_0 != 1) { abort(); } return; }
int do_hardlink(struct sftp_conn *conn, const char *oldpath, const char *newpath) { struct sshbuf *msg; u_int status, id; int r; if ((conn->exts & 0x00000008) == 0) { sshlog("sftp-client.c", __func__, 1260, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "Server does not support hardlink@openssh.com extension"); return -1; } sshlog("sftp-client.c", __func__, 1263, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0) , "Sending SSH2_FXP_EXTENDED(hardlink@openssh.com) " "\"%s\" to \"%s\"", oldpath, newpath) ; if ((msg = sshbuf_new()) == ((void *)0) ) sshfatal("sftp-client.c", __func__, 1267, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "sshbuf_new failed"); id = conn->msg_id++; if ((r = sshbuf_put_u8(msg, 200)) != 0 || (r = sshbuf_put_u32(msg, id)) != 0 || (r = sshbuf_put_cstring(msg, "hardlink@openssh.com")) != 0 || (r = sshbuf_put_cstring(msg, oldpath)) != 0 || (r = sshbuf_put_cstring(msg, newpath)) != 0) sshfatal("sftp-client.c", __func__, 1276, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose"); send_msg(conn, msg); sshlog("sftp-client.c", __func__, 1278, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0) , "Sent message hardlink@openssh.com \"%s\" -> \"%s\"", oldpath, newpath) ; sshbuf_free(msg); status = get_status(conn, id); if (status != 0) sshlog("sftp-client.c", __func__, 1284, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "remote link \"%s\" to \"%s\": %s", oldpath, newpath, fx2txt(status)) ; return status == 0 ? 0 : -1; }
undefined8 do_hardlink(long param_1,undefined8 param_2,char *param_3) { undefined8 uVar1; undefined *puVar2; undefined *puVar3; char *apcStackY144 [5]; char *pcStack88; undefined8 uStack80; undefined auStack72 [8]; char *local_40; undefined8 local_38; long local_30; int local_1c; int local_18; int local_14; long local_10; local_40 = param_3; local_38 = param_2; local_30 = param_1; if ((*(uint *)(param_1 + 0x1c) & 8) == 0) { pcStack88 = "Server does not support hardlink@openssh.com extension"; sshlog("sftp-client.c","do_hardlink",0x4ec,0,2,0); return 0xffffffff; } pcStack88 = param_3; sshlog("sftp-client.c","do_hardlink",0x4ef,0,6,0, "Sending SSH2_FXP_EXTENDED(hardlink@openssh.com) \"%s\" to \"%s\"",param_2); puVar2 = auStack72; uStack80 = 0x104de7; local_10 = sshbuf_new(); if (local_10 == 0) { puVar2 = (undefined *)&pcStack88; pcStack88 = "sshbuf_new failed"; sshfatal("sftp-client.c","do_hardlink",0x4f3,1,1,0); } local_18 = *(int *)(local_30 + 0x18); *(int *)(local_30 + 0x18) = local_18 + 1; *(undefined8 *)(puVar2 + -8) = 0x104e51; local_1c = sshbuf_put_u8(local_10,200); if (local_1c == 0) { *(undefined8 *)(puVar2 + -8) = 0x104e6b; local_1c = sshbuf_put_u32(local_10,local_18); if (local_1c == 0) { *(undefined8 *)(puVar2 + -8) = 0x104e87; local_1c = sshbuf_put_cstring(local_10,"hardlink@openssh.com"); if (local_1c == 0) { *(undefined8 *)(puVar2 + -8) = 0x104ea3; local_1c = sshbuf_put_cstring(local_10,local_38); if (local_1c == 0) { *(undefined8 *)(puVar2 + -8) = 0x104ebf; local_1c = sshbuf_put_cstring(local_10,local_40); puVar3 = puVar2; if (local_1c == 0) goto LAB_00104f09; } } } } *(undefined8 *)(puVar2 + -8) = 0x104ed2; uVar1 = ssh_err(local_1c); puVar3 = puVar2 + -0x10; *(char **)(puVar2 + -0x10) = "compose"; *(undefined8 *)(puVar2 + -0x18) = 0x104f09; sshfatal("sftp-client.c","do_hardlink",0x4fc,1,1,uVar1); LAB_00104f09: *(undefined8 *)(puVar3 + -8) = 0x104f1c; send_msg(local_30,local_10); *(char **)(puVar3 + -0x10) = local_40; *(undefined8 *)(puVar3 + -0x18) = local_38; *(char **)(puVar3 + -0x20) = "Sent message hardlink@openssh.com \"%s\" -> \"%s\""; *(undefined8 *)(puVar3 + -0x28) = 0x104f5c; sshlog("sftp-client.c","do_hardlink",0x4fe,0,7,0); *(undefined8 *)(puVar3 + -8) = 0x104f6c; sshbuf_free(local_10); *(undefined8 *)(puVar3 + -8) = 0x104f7d; local_14 = get_status(local_30,local_18); if (local_14 != 0) { *(undefined8 *)(puVar3 + -8) = 0x104f90; uVar1 = fx2txt(local_14); *(undefined8 *)(puVar3 + -8) = uVar1; *(char **)(puVar3 + -0x10) = local_40; *(undefined8 *)(puVar3 + -0x18) = local_38; *(char **)(puVar3 + -0x20) = "remote link \"%s\" to \"%s\": %s"; *(undefined8 *)(puVar3 + -0x28) = 0x104fcd; sshlog("sftp-client.c","do_hardlink",0x504,0,2,0); } if (local_14 == 0) { uVar1 = 0; } else { uVar1 = 0xffffffff; } return uVar1; }
el_init_internal(const char *prog, FILE *fin, FILE *fout, FILE *ferr, int fdin, int fdout, int fderr, int flags) { EditLine *el = calloc(1, sizeof(*el)); if (el == ((void *)0) ) return ((void *)0) ; el->el_infile = fin; el->el_outfile = fout; el->el_errfile = ferr; el->el_infd = fdin; el->el_outfd = fdout; el->el_errfd = fderr; el->el_prog = wcsdup(ct_decode_string(prog, &el->el_scratch)); if (el->el_prog == ((void *)0) ) { free(el); return ((void *)0) ; } el->el_flags = flags; if (terminal_init(el) == -1) { free(el->el_prog); free(el); return ((void *)0) ; } (void) keymacro_init(el); (void) map_init(el); if (tty_init(el) == -1) el->el_flags |= 0x002; (void) ch_init(el); (void) search_init(el); (void) hist_init(el); (void) prompt_init(el); (void) sig_init(el); (void) literal_init(el); if (read_init(el) == -1) { el_end(el); return ((void *)0) ; } return el; }
void el_init_internal(unsigned long long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5, unsigned int v1, unsigned int a6) { struct_0 *v0; void* v2; void* v3; void* v4; struct_0 *v5; void* v6; v0 = calloc(0x1, 0x540); if (!v0) { v2 = 0; } else { v0->field_8 = a1; v0->field_10 = a2; v0->field_18 = a3; v0->field_20 = a4; v0->field_24 = a5; v0->field_28 = v1; v0->field_0 = wcsdup(ct_decode_string(a0, &v0[26].field_8, &v0[26].field_8)); if (!v0->field_0) { free(v0); v3 = 0; } else { v0->field_2c = a6; if (terminal_init(v0) == -1) { free(v0->field_0); free(v0); v4 = 0; } else { keymacro_init(v0); map_init(v0); if (tty_init(v0) == -1) v0->field_2c = v0->field_2c | 2; ch_init(v0); search_init(v0); hist_init(v0); prompt_init(v0); sig_init(v0); literal_init(v0); if (read_init(v0) != -1) { v5 = v0; } else { el_end(v0); v6 = 0; } } } } return; }
literal_end(EditLine *el) { literal_clear(el); }
long long literal_end(unsigned int a0) { return literal_clear(a0); }
static int encoded_check_name(e2fsck_t ctx, struct ext2_dir_entry *dirent, struct problem_context *pctx) { const struct ext2fs_nls_table *tbl = ctx->fs->encoding; int ret; int len = ext2fs_dirent_name_len(dirent); char *pos, *end; ret = ext2fs_check_encoded_name(tbl, dirent->name, len, &pos); if (ret < 0) { fatal_error(ctx, (gettext ("NLS is broken."))); } else if(ret > 0) { ret = fix_problem(ctx, 0x020053, pctx); if (ret) { end = &dirent->name[len]; for (; *pos && pos != end; pos++) *pos = '.'; } } return (ret || check_name(ctx, dirent, pctx)); }
undefined8 encoded_check_name(long *param_1,long param_2,undefined8 param_3) { int iVar1; undefined8 uVar2; long in_FS_OFFSET; int local_30; char *local_28; undefined8 local_20; char *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = *(undefined8 *)(*param_1 + 0x168); iVar1 = ext2fs_dirent_name_len(param_2); local_30 = ext2fs_check_encoded_name(local_20,param_2 + 8,(long)iVar1,&local_28); if (local_30 < 0) { uVar2 = gettext("NLS is broken."); fatal_error(param_1,uVar2); } else if (0 < local_30) { local_30 = fix_problem(param_1,0x20053,param_3); if (local_30 != 0) { local_18 = (char *)(param_2 + iVar1 + 8); for (; (*local_28 != '\0' && (local_18 != local_28)); local_28 = local_28 + 1) { *local_28 = '.'; } } } if (local_30 == 0) { iVar1 = check_name(param_1,param_2,param_3); if (iVar1 == 0) { uVar2 = 0; goto LAB_00101491; } } uVar2 = 1; LAB_00101491: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar2; }
static _Bool dump_zeros (struct tar_sparse_file *file, off_t offset) { static char const zero_buf[512]; if (offset < file->offset) { (*__errno_location ()) = 22 ; return 0 ; } while (file->offset < offset) { size_t size = (512 < offset - file->offset ? 512 : offset - file->offset); ssize_t wrbytes; wrbytes = write (file->fd, zero_buf, size); if (wrbytes <= 0) { if (wrbytes == 0) (*__errno_location ()) = 22 ; return 0 ; } file->offset += wrbytes; } return 1 ; }
undefined8 dump_zeros(int *param_1,long param_2) { int *piVar1; undefined8 uVar2; ssize_t sVar3; size_t __n; if (param_2 < *(long *)(param_1 + 2)) { piVar1 = __errno_location(); *piVar1 = 0x16; uVar2 = 0; } else { while (*(long *)(param_1 + 2) < param_2) { __n = param_2 - *(long *)(param_1 + 2); if (0x200 < (long)__n) { __n = 0x200; } sVar3 = write(*param_1,zero_buf_6948,__n); if (sVar3 < 1) { if (sVar3 == 0) { piVar1 = __errno_location(); *piVar1 = 0x16; } return 0; } *(long *)(param_1 + 2) = *(long *)(param_1 + 2) + sVar3; } uVar2 = 1; } return uVar2; }
((*__ctype_b_loc ())[(int) (( (unsigned char)ch ))] & (unsigned short int) _ISalpha) ) { if ((flags & 0x04)) ch = (char)tolower((unsigned char)ch); if ((flags & 0x08)) ch = (char)toupper((unsigned char)ch); }
ushort ** __ctype_b_loc(void) { halt_baddata(); }
static void tls_log_func(int level, const char *str) { fprintf( stderr , "%s|<%d>| %s", side, level, str); }
long long tls_log_func(unsigned long a0, unsigned long a1) { return fprintf(stderr, "%s|<%d>| %s", side, a0, a1); }
void sh_nojobs (s) char *s; { if (s) builtin_error (gettext("%s: no job control"), s); else builtin_error (gettext("no job control")); }
long long sh_nojobs(unsigned long a0) { unsigned long long v1; if (!a0) { gettext("no job control"); v1 = builtin_error(); } else { gettext("%s: no job control"); v1 = builtin_error(); } return v1; }
static void print_DBL (double x) { char buf[( (1 + (((((53) * 1) * 146 + 484) / 485) + 1) + 16 + 1 + ( -100 < ((-307)) && (308) < 100 ? 3 : -1000 < ((-307)) && (308) < 1000 ? 4 : -10000 < ((-307)) && (308) < 10000 ? 5 : -100000 < ((-307)) && (308) < 100000 ? 6 : -1000000 < ((-307)) && (308) < 1000000 ? 7 : (((((sizeof (int) * 8) - (! ((__typeof__ (int)) 0 < (__typeof__ (int)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (int)) 0 < (__typeof__ (int)) -1))) )) + 1)]; dtoastr (buf, sizeof buf, FTOASTR_LEFT_JUSTIFY, 0, x); puts (buf); }
void print_DBL() { unsigned long v0; char v1; char v2; unsigned long v4; unsigned long long *v5; unsigned long long v6; v0 = v4; dtoastr(&v1, 0x28, 0x1, 0x0); puts(&v1); v6 = *(&v2) ^ v5[5]; return; }
int e2fsck_fix_ext3_journal_hint(e2fsck_t ctx) { struct ext2_super_block *sb = ctx->fs->super; struct problem_context pctx; char uuid[37], *journal_name; struct stat st; if (!ext2fs_has_feature_journal(sb) || uuid_is_null(sb->s_journal_uuid)) return 0; uuid_unparse(sb->s_journal_uuid, uuid); journal_name = blkid_get_devname(ctx->blkid, "UUID", uuid); if (!journal_name) return 0; if (stat(journal_name, &st) < 0) { free(journal_name); return 0; } if (st.st_rdev != sb->s_journal_dev) { clear_problem_context(&pctx); pctx.num = st.st_rdev; if (fix_problem(ctx, 0x000033, &pctx)) { sb->s_journal_dev = st.st_rdev; ext2fs_mark_super_dirty(ctx->fs); } } free(journal_name); return 0; }
undefined8 e2fsck_fix_ext3_journal_hint(long *param_1) { long lVar1; int iVar2; char *__file; long in_FS_OFFSET; undefined local_138 [80]; ulong local_e8; stat local_c8; undefined local_38 [40]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); lVar1 = *(long *)(*param_1 + 0x20); iVar2 = ext2fs_has_feature_journal(lVar1); if ((iVar2 != 0) && (iVar2 = uuid_is_null(lVar1 + 0xd0), iVar2 == 0)) { uuid_unparse(lVar1 + 0xd0,local_38); __file = (char *)blkid_get_devname(param_1[0x11],&DAT_0010597f,local_38); if (__file != (char *)0x0) { iVar2 = stat(__file,&local_c8); if (iVar2 < 0) { free(__file); } else { if (local_c8.st_rdev != *(uint *)(lVar1 + 0xe4)) { clear_problem_context(local_138); local_e8 = local_c8.st_rdev; iVar2 = fix_problem(param_1,0x33,local_138); if (iVar2 != 0) { *(int *)(lVar1 + 0xe4) = (int)local_c8.st_rdev; ext2fs_mark_super_dirty(*param_1); } } free(__file); } } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return 0; } __stack_chk_fail(); }
int do_seg6(int argc, char **argv) { if (argc < 1 || matches(*argv, "help") == 0) usage(); memset(&opts, 0, sizeof(opts)); if (matches(*argv, "hmac") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while(0); if (matches(*argv, "show") == 0) { opts.cmd = SEG6_CMD_DUMPHMAC; } else if (matches(*argv, "set") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while(0); if (get_u32(&opts.keyid, *argv, 0) || opts.keyid == 0) invarg("hmac KEYID value is invalid", *argv); do { argv++; if (--argc <= 0) incomplete_command(); } while(0); if (strcmp(*argv, "sha1") == 0) { opts.alg_id = SEG6_HMAC_ALGO_SHA1; } else if (strcmp(*argv, "sha256") == 0) { opts.alg_id = SEG6_HMAC_ALGO_SHA256; } else { invarg("hmac ALGO value is invalid", *argv); } opts.cmd = SEG6_CMD_SETHMAC; opts.pass = getpass("Enter secret for HMAC key ID (blank to delete): "); } else { invarg("unknown", *argv); } } else if (matches(*argv, "tunsrc") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while(0); if (matches(*argv, "show") == 0) { opts.cmd = SEG6_CMD_GET_TUNSRC; } else if (matches(*argv, "set") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while(0); opts.cmd = SEG6_CMD_SET_TUNSRC; get_addr(&opts.addr, *argv, 10 ); } else { invarg("unknown", *argv); } } else { invarg("unknown", *argv); } return seg6_do_cmd(); }
long do_seg6(int a1, _QWORD *a2) { long v2; int *v3; long v4; _QWORD *v6; _QWORD *v7; const char **v8; _QWORD *v9; int v10; int v11; int v12; v10 = a1; v6 = a2; if ( a1 <= 0 || (unsigned char)matches(*a2, "help") != 1 ) usage(); memset(&opts, 0, 0x120uLL); if ( (unsigned char)matches(*a2, "hmac") != 1 ) { v6 = a2 + 1; v10 = a1 - 1; if ( a1 - 1 <= 0 ) ((void (*)(void))incomplete_command)(); if ( (unsigned char)matches(*v6, "show") != 1 ) { opts = 2; return seg6_do_cmd(); } v2 = *v6; if ( (unsigned char)matches(*v6, "set") != 1 ) { v7 = a2 + 2; v11 = v10 - 1; if ( v11 <= 0 ) incomplete_command(v2); v3 = &dword_B8C; if ( (unsigned int)get_u32(&dword_B8C, *v7, 0LL) || !dword_B8C ) { v3 = (int *)"hmac KEYID value is invalid"; invarg("hmac KEYID value is invalid", *v7); } v8 = (const char **)(a2 + 3); if ( v11 - 1 <= 0 ) incomplete_command(v3); if ( !strcmp(*v8, "sha1") ) { byte_B98 = 1; } else if ( !strcmp(*v8, "sha256") ) { byte_B98 = 2; } else { invarg("hmac ALGO value is invalid", *v8); } opts = 1; s = getpass("Enter secret for HMAC key ID (blank to delete): "); return seg6_do_cmd(); } invarg("unknown", *v6); } if ( (unsigned char)matches(*v6, "tunsrc") == 1 ) { LABEL_34: invarg("unknown", *v6); return seg6_do_cmd(); } ++v6; v12 = v10 - 1; if ( v12 <= 0 ) ((void (*)(void))incomplete_command)(); if ( (unsigned char)matches(*v6, "show") != 1 ) { opts = 4; return seg6_do_cmd(); } v4 = *v6; if ( (unsigned char)matches(*v6, "set") == 1 ) { invarg("unknown", *v6); goto LABEL_34; } v9 = v6 + 1; if ( v12 - 1 <= 0 ) incomplete_command(v4); opts = 3; get_addr(&unk_A84, *v9, 10LL); return seg6_do_cmd(); }
static inline int patmatch(char *pattern, const char *string) { return !fnmatch((preglob(pattern, 0)), (string), 0); }
int patmatch(unsigned long a0, char *a1) { return !fnmatch(preglob(a0, 0x0), a1, 0x0); }
static int depfile_up_to_date(const char *dirname) { char path[ 4096 ]; DIR *d = opendir(dirname); struct stat st; size_t baselen; int err; if (d == ((void *)0) ) { err = - (*__errno_location ()) ; log_printf( 3 , "could not open directory %s: %m\n", dirname); return err; } if (fstatat(dirfd(d), "modules.dep", &st, 0) != 0) { err = - (*__errno_location ()) ; log_printf( 3 , "could not fstatat(%s, modules.dep): %m\n", dirname); closedir(d); return err; } baselen = strlen(dirname); memcpy(path, dirname, baselen); path[baselen] = '/'; baselen++; path[baselen] = '\0'; err = depfile_up_to_date_dir(d, st. st_mtim.tv_sec , baselen, path); closedir(d); return err; }
int depfile_up_to_date(void* a0, unsigned long a1, unsigned long a2, unsigned long long a3, unsigned int a4) { unsigned int v0; unsigned long long v1; char *v2; char v3; char v4; char v5; unsigned long long v6; unsigned int v8; v6 = *(&v6); v1 = opendir(a0); if (!v1) { v0 = -(*(__errno_location())); log_printf(0x3, "could not open directory %s: %m\n", a0, a3, a4); v8 = v0; } else if (fstatat(dirfd(v1), "modules.dep", &v3, 0x0)) { v0 = -(*(__errno_location())); log_printf(0x3, "could not fstatat(%s, modules.dep): %m\n", a0, 0x0, a4); closedir(v1); v8 = v0; } else { v2 = strlen(a0); memcpy(&v5, a0, v2); *((v2 + &v5)) = 47; v2 += 1; *((v2 + &v5)) = 0; v0 = depfile_up_to_date_dir(v1, *(&v4), v2, &v5, a4); closedir(v1); v8 = v0; } return v8; }
multiSubmitMsg2(multi_submit_t *const pMultiSub) { qqueue_t *pQueue; ruleset_t *pRuleset; rsRetVal iRet = RS_RET_OK; if(pMultiSub->nElem == 0) goto finalize_it;; pRuleset = ((pMultiSub->ppMsgs[0])->pRuleset); pQueue = (pRuleset == ((void *)0) ) ? runConf->pMsgQueue : ruleset.GetRulesetQueue(pRuleset); if(pQueue == ((void *)0) ) { if(Debug) { r_dbgprintf("rsyslogd.c", "multiSubmitMsg() could not submit message - " "queue does (no longer?) exist - ignored\n"); } ; goto finalize_it;; } iRet = pQueue->MultiEnq(pQueue, pMultiSub); pMultiSub->nElem = 0; finalize_it: return iRet; }
undefined4 multiSubmitMsg2(long param_1) { long lVar1; undefined4 local_1c; local_1c = 0; if (*(short *)(param_1 + 2) != 0) { lVar1 = *(long *)(**(long **)(param_1 + 8) + 0x100); if (lVar1 == 0) { lVar1 = *(long *)(runConf + 0x328); } else { lVar1 = (*ruleset._104_8_)(lVar1); } if (lVar1 == 0) { if (Debug != 0) { r_dbgprintf("rsyslogd.c", "multiSubmitMsg() could not submit message - queue does (no longer?) exist - ignored\n" ); } } else { local_1c = (**(code **)(lVar1 + 0xe0))(lVar1,param_1); *(undefined2 *)(param_1 + 2) = 0; } } return local_1c; }
int sshpkt_get_u32(struct ssh *ssh, u_int32_t *valp) { return sshbuf_get_u32(ssh->state->incoming_packet, valp); }
long sshpkt_get_u32(long a1, long a2) { return sshbuf_get_u32(*(_QWORD *)(*(_QWORD *)a1 + 56LL), a2); }
char * percent_dollar_expand(const char *string, ...) { char *ret; int err; va_list ap; __builtin_va_start( ap , string ) ; ret = vdollar_percent_expand(&err, 1, 1, string, ap); __builtin_va_end( ap ) ; if (err) sshfatal("misc.c", __func__, 1384, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "failed"); return ret; }
long long percent_dollar_expand() { char v0; unsigned long v1; unsigned int v2; unsigned int v3; unsigned long v4; unsigned long v5; unsigned long v6; char v7; unsigned long v8; unsigned long v9; unsigned long v10; unsigned long v11; unsigned long v12; int v13; int v14; int v15; int v16; int v17; int v18; int v19; int v20; unsigned long v21; unsigned long v22; unsigned long v23; unsigned long v24; unsigned long v25; unsigned long v26; char v27; int v28; int v29; int v30; int v31; int v32; int v33; int v34; int v35; unsigned long long *v36; unsigned int v37; v8 = v22; v9 = v23; v10 = v24; v11 = v25; v12 = v26; if (v27) { v13 = v28; v14 = v29; v15 = v30; v16 = v31; v17 = v32; v18 = v33; v19 = v34; v20 = v35; } v6 = v36[5]; v2 = 8; v3 = 48; v4 = &v21; v5 = &v7; v1 = vdollar_percent_expand(&v0, 0x1, 0x1, v37, &v2); if (*(&v0)) sshfatal("misc.c", "percent_dollar_expand", 0x568, 0x1, 0x1, 0x0, "failed"); if ((v6 ^ v36[5])) __stack_chk_fail(); return v1; }
static void add_to_grand_total (struct field_values_t *bv, struct field_values_t *iv) { if (known_value (iv->total)) grand_fsu.fsu_files += iv->total; if (known_value (iv->available)) grand_fsu.fsu_ffree += iv->available; if (known_value (bv->total)) grand_fsu.fsu_blocks += bv->input_units * bv->total; if (known_value (bv->available_to_root)) grand_fsu.fsu_bfree += bv->input_units * bv->available_to_root; if (known_value (bv->available)) add_uint_with_neg_flag (&grand_fsu.fsu_bavail, &grand_fsu.fsu_bavail_top_bit_set, bv->input_units * bv->available, bv->negate_available); }
void add_to_grand_total(struct_0 *a0, unsigned long long a1[4]) { unsigned long long v2; if (known_value(a1[2])) g_404068 = a1[2] + g_404068; if (known_value(a1[3])) g_404070 = a1[3] + g_404070; if (known_value(a0->field_10)) g_404048 = a0->field_0 * a0->field_10 + g_404048; if (known_value(a0->field_28)) g_404050 = a0->field_0 * a0->field_28 + g_404050; if (known_value(a0->field_18)) { v2 = add_uint_with_neg_flag(&g_404058, &g_404060, a0->field_0 * a0->field_18, a0->field_20); return; } return; }
static void bind_bracketed_paste_prefix (void) { Keymap xkeymap; xkeymap = _rl_keymap; _rl_keymap = emacs_standard_keymap; rl_bind_keyseq_if_unbound ("\033[200~", rl_bracketed_paste_begin); _rl_keymap = vi_insertion_keymap; rl_bind_keyseq_if_unbound ("\033[200~", rl_bracketed_paste_begin); _rl_keymap = xkeymap; }
long long bind_bracketed_paste_prefix() { unsigned long long v0; v0 = _rl_keymap; _rl_keymap = &emacs_standard_keymap; rl_bind_keyseq_if_unbound(&g_4022ba, got.rl_bracketed_paste_begin); _rl_keymap = &vi_insertion_keymap; rl_bind_keyseq_if_unbound(&g_4022ba, got.rl_bracketed_paste_begin); _rl_keymap = v0; return v0; }
static __inline int _rs_allocate(struct _rs **rsp, struct _rsx **rsxp) { if ((*rsp = mmap( ((void *)0) , sizeof(**rsp), 0x1 | 0x2 , 0x20 | 0x02 , -1, 0)) == ((void *) -1) ) return (-1); if ((*rsxp = mmap( ((void *)0) , sizeof(**rsxp), 0x1 | 0x2 , 0x20 | 0x02 , -1, 0)) == ((void *) -1) ) { munmap(*rsp, sizeof(**rsp)); *rsp = ((void *)0) ; return (-1); } __register_atfork( ((void *)0) , ((void *)0) , (_rs_forkhandler), __dso_handle); return (0); }
undefined8 _rs_allocate(void **param_1,void **param_2) { void *pvVar1; undefined8 uVar2; pvVar1 = mmap((void *)0x0,0x10,3,0x22,-1,0); *param_1 = pvVar1; if (*param_1 == (void *)0xffffffffffffffff) { uVar2 = 0xffffffff; } else { pvVar1 = mmap((void *)0x0,0x440,3,0x22,-1,0); *param_2 = pvVar1; if (*param_2 == (void *)0xffffffffffffffff) { munmap(*param_1,0x10); *param_1 = (void *)0x0; uVar2 = 0xffffffff; } else { __register_atfork(0,0,_rs_forkhandler,*puRam0000000000101371); uVar2 = 0; } } return uVar2; }
_Bool pred_true (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; (void) stat_buf; (void) pred_ptr; return 1 ; }
long long pred_true(unsigned long a0, unsigned long a1, unsigned long a2) { unsigned long v0; unsigned long v1; unsigned long v2; v2 = a0; v1 = a1; v0 = a2; return 1; }
static void list_format_init(struct list_format *fmt, struct pkg_array *array) { int i; if (fmt->nw != 0) return; fmt->nw = 14; fmt->vw = 12; fmt->aw = 12; fmt->dw = 33; for (i = 0; i < array->n_pkgs; i++) { int plen, vlen, alen, dlen; if (array->pkgs[i] == ((void *)0) ) continue; plen = str_width(pkg_name(array->pkgs[i], pnaw_nonambig)); vlen = str_width(versiondescribe(&array->pkgs[i]->installed.version, vdew_nonambig)); alen = str_width(dpkg_arch_describe(array->pkgs[i]->installed.arch)); pkg_synopsis(array->pkgs[i], &dlen); if (plen > fmt->nw) fmt->nw = plen; if (vlen > fmt->vw) fmt->vw = vlen; if (alen > fmt->aw) fmt->aw = alen; if (dlen > fmt->dw) fmt->dw = dlen; } }
void list_format_init(unsigned int a0[5], struct_1 *a1) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; char v5; unsigned long long *v7; unsigned long long v8; if (!a0[1]) { a0[1] = 14; a0[2] = 12; a0[3] = 12; a0[4] = 33; for (v1 = 0; v1 < a1->field_0; v1 += 1) { if (*((a1->field_8 + (v1 << 3)))) { v2 = str_width(pkg_name(*((a1->field_8 + v1 * 8)), 0x1, v1 * 8)); v3 = str_width(versiondescribe(*((a1->field_8 + v1 * 8)) + 152, 0x1, v1 * 8)); v4 = str_width(dpkg_arch_describe(*((*((a1->field_8 + v1 * 8)) + 88)))); pkg_synopsis(*((a1->field_8 + v1 * 8)), &v0, &v0); if (v2 > a0[1]) a0[1] = v2; if (v3 > a0[2]) a0[2] = v3; if (v4 > a0[3]) a0[3] = v4; if (a0[4] < *(&v0)) a0[4] = *(&v0); } } } v8 = *(&v5) ^ v7[5]; return; }
static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb) { __u32 table = r->rtm_table; if (tb[RTA_TABLE]) table = rta_getattr_u32(tb[RTA_TABLE]); return table; }
int rtm_get_table(struct_1 *a0, struct_0 *a1) { unsigned int v0; v0 = a0->field_4; if (a1->field_78) v0 = rta_getattr_u32(a1->field_78); return v0; }
time_t get_crl_next_update(void) { return get_int_date(cfg.next_update_date, cfg.crl_next_update, "The next CRL will be issued in (days): "); }
void get_crl_next_update(void) { get_int_date(*(undefined8 *)(lRam00000000001091dc + 0x200), *(undefined4 *)(lRam00000000001091cf + 0x268), "The next CRL will be issued in (days): "); return; }
static char * fmt_time(time_t seconds) { int day, hr, min; static char buf[128]; min = (seconds / 60) % 60; hr = (seconds / 60 / 60) % 24; day = seconds / 60 / 60 / 24; if (day > 0) snprintf(buf, sizeof buf, "%dd %d:%02d", day, hr, min); else snprintf(buf, sizeof buf, "%d:%02d", hr, min); return buf; }
char * fmt_time(long a1) { unsigned int v2; unsigned int v3; int v4; v2 = a1 / 60 % 60; v3 = a1 / 3600 % 24; v4 = a1 / 86400; if ( v4 <= 0 ) snprintf(buf_17754, 0x80uLL, "%d:%02d", v3, v2); else snprintf(buf_17754, 0x80uLL, "%dd %d:%02d", (unsigned int)v4, v3, v2); return buf_17754; }
static void norm_face (char *face, int n) { memset (face, '0', n); }
long long norm_face(void* a0, unsigned long a1) { return memset(a0, 0x30, a1); }
int auth_password(struct ssh *ssh, const char *password) { Authctxt *authctxt = ssh->authctxt; struct passwd *pw = authctxt->pw; int result, ok = authctxt->valid; static int expire_checked = 0; if (strlen(password) > 1024) return 0; if (pw->pw_uid == 0 && options.permit_root_login != 3) ok = 0; if (*password == '\0' && options.permit_empty_passwd == 0) return 0; if (!expire_checked) { expire_checked = 1; if (auth_shadow_pwexpired(authctxt)) authctxt->force_pwchange = 1; } result = sys_auth_passwd(ssh, password); if (authctxt->force_pwchange) auth_restrict_session(ssh); return (result && ok); }
long long auth_password(struct_0 *a0, char *a1) { unsigned int v0; unsigned int v1; struct_2 *v2; struct_1 *v3; unsigned long long v6; v2 = a0->field_860; v3 = v2->field_30; v0 = v2->field_c; if (strlen(a1) > 0x400) { v6 = 0; } else { if (!v3->field_10 && *(5244028) != 3) v0 = 0; if (!*(a1) && !*(5244240)) v6 = 0; if (*(a1) || *(5244240)) { if (!expire_checked.14898) { expire_checked.14898 = 1; if (auth_shadow_pwexpired(v2)) v2->field_1c = 1; } v1 = sys_auth_passwd(a0, a1); if (v2->field_1c) auth_restrict_session(a0); if (v1 && v0) v6 = 1; if (!v0 || !v1) v6 = 0; } } return v6; }
static size_t format_code_offset (char const *directive) { size_t len = strspn (directive + 1, printf_flags); char const *fmt_char = directive + len + 1; fmt_char += strspn (fmt_char, digits); if (*fmt_char == '.') fmt_char += 1 + strspn (fmt_char + 1, digits); return fmt_char - directive; }
long format_code_offset(long param_1) { size_t sVar1; char *local_18; sVar1 = strspn((char *)(param_1 + 1),"\'-+ #0I"); local_18 = (char *)(param_1 + sVar1 + 1); sVar1 = strspn(local_18,digits); local_18 = local_18 + sVar1; if (*local_18 == '.') { sVar1 = strspn(local_18 + 1,digits); local_18 = local_18 + sVar1 + 1; } return (long)local_18 - param_1; }
static void wrap_db_init(void) { }
void wrap_db_init() { ; }
static void setprompt(int which) { struct stackmark smark; int show; needprompt = 0; whichprompt = which; show = 1; if (show) { pushstackmark(&smark, stacknleft); outstr((getprompt( ((void *)0) )), out2); popstackmark(&smark); } }
void setprompt(unsigned long a0) { unsigned int v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; quoteflag = 0; whichprompt = a0; v0 = 1; if (v0) { pushstackmark(&v1, stacknleft, stacknleft); outstr(getprompt(0x0), out2); popstackmark(&v1); } v5 = *(&v2) ^ v4[5]; return; }
static _Bool any_symlinks (const struct File_spec *f, size_t n_files) { struct stat st; for (size_t i = 0; i < n_files; i++) if (lstat (f[i].name, &st) == 0 && (((( st.st_mode )) & 0170000) == (0120000)) ) return 1 ; return 0 ; }
int any_symlinks(unsigned long long *a0, unsigned long a1) { void* v0; char v1; char v2; unsigned int v4; v0 = 0; while (true) { if (v0 < a1) { if (!lstat(*((a0 + 0x40 * v0 + 0x20 * v0)), &v1) && (*(&v2) & 0xf000) == 0xa000) { v4 = 1; return v4; } v0 += 1; } else { v4 = 0; return v4; } } }
static char ** hostnames_matching (text) char *text; { register int i, len, nmatch, rsize; char **result; if (hostname_list_initialized == 0) initialize_hostname_list (); if (hostname_list_initialized == 0) return ((char **) ((void *)0) ); if (*text == '\0') { result = strvec_create (1 + hostname_list_length); for (i = 0; i < hostname_list_length; i++) result[i] = hostname_list[i]; result[i] = (char *) ((void *)0) ; return (result); } len = strlen (text); result = (char **) ((void *)0) ; for (i = nmatch = rsize = 0; i < hostname_list_length; i++) { if (((len == 0) ? (1) : ((text)[0] == (hostname_list[i])[0] && strncmp(text, hostname_list[i], len) == 0)) == 0) continue; if (nmatch >= (rsize - 1)) { rsize = (rsize + 16) - (rsize % 16); result = strvec_resize (result, rsize); } result[nmatch++] = hostname_list[i]; } if (nmatch) result[nmatch] = (char *) ((void *)0) ; return (result); }
long hostnames_matching(const char *a1) { int j; int v3; int v4; int v5; int i; int v8; long v9; long v10; if ( !hostname_list_initialized ) initialize_hostname_list(); if ( !hostname_list_initialized ) return 0LL; if ( *a1 ) { v3 = strlen(a1); v10 = 0LL; v4 = 0; v5 = 0; for ( i = 0; i < hostname_list_length; ++i ) { if ( !v3 || *a1 == **(_BYTE **)(8LL * i + hostname_list) && !strncmp(a1, *(const char **)(8LL * i + hostname_list), v3) ) { if ( v5 >= v4 - 1 ) { v4 = v4 + 16 - v4 % 16; v10 = strvec_resize(v10, (unsigned int)v4); } v8 = v5++; *(_QWORD *)(v10 + 8LL * v8) = *(_QWORD *)(hostname_list + 8LL * i); } } if ( v5 ) *(_QWORD *)(8LL * v5 + v10) = 0LL; return v10; } else { v9 = strvec_create((unsigned int)(hostname_list_length + 1)); for ( j = 0; j < hostname_list_length; ++j ) *(_QWORD *)(8LL * j + v9) = *(_QWORD *)(8LL * j + hostname_list); *(_QWORD *)(8LL * j + v9) = 0LL; return v9; } }
int main(int argc, char **argv) { FILE *fp; struct rtnl_handle rth; int family = 0 ; unsigned int groups = ~0U; int llink = 0; int laddr = 0; int lroute = 0; char *file = ((void *)0) ; while (argc > 1) { if (matches(argv[1], "-family") == 0) { argc--; argv++; if (argc <= 1) usage(); if (strcmp(argv[1], "inet") == 0) family = 2 ; else if (strcmp(argv[1], "inet6") == 0) family = 10 ; else if (strcmp(argv[1], "link") == 0) family = 10 ; else if (strcmp(argv[1], "help") == 0) usage(); else { fprintf( stderr , "Protocol ID \"%s\" is unknown, try \"rtmon help\".\n", argv[1]); exit(-1); } } else if (strcmp(argv[1], "-4") == 0) { family = 2 ; } else if (strcmp(argv[1], "-6") == 0) { family = 10 ; } else if (strcmp(argv[1], "-0") == 0) { family = 17 ; } else if (matches(argv[1], "-Version") == 0) { printf("rtmon utility, iproute2-%s\n", version); exit(0); } else if (matches(argv[1], "file") == 0) { argc--; argv++; if (argc <= 1) usage(); file = argv[1]; } else if (matches(argv[1], "link") == 0) { llink = 1; groups = 0; } else if (matches(argv[1], "address") == 0) { laddr = 1; groups = 0; } else if (matches(argv[1], "route") == 0) { lroute = 1; groups = 0; } else if (strcmp(argv[1], "all") == 0) { groups = ~0U; } else if (matches(argv[1], "help") == 0) { usage(); } else { fprintf( stderr , "Argument \"%s\" is unknown, try \"rtmon help\".\n", argv[1]); exit(-1); } argc--; argv++; } if (file == ((void *)0) ) { fprintf( stderr , "Not enough information: argument \"file\" is required\n"); exit(-1); } if (llink) groups |= nl_mgrp(RTNLGRP_LINK); if (laddr) { if (!family || family == 2 ) groups |= nl_mgrp(RTNLGRP_IPV4_IFADDR); if (!family || family == 10 ) groups |= nl_mgrp(RTNLGRP_IPV6_IFADDR); } if (lroute) { if (!family || family == 2 ) groups |= nl_mgrp(RTNLGRP_IPV4_ROUTE); if (!family || family == 10 ) groups |= nl_mgrp(RTNLGRP_IPV6_ROUTE); } fp = fopen(file, "w"); if (fp == ((void *)0) ) { perror("Cannot fopen"); exit(-1); } if (rtnl_open(&rth, groups) < 0) exit(1); if (rtnl_linkdump_req(&rth, 0 ) < 0) { perror("Cannot send dump request"); exit(1); } write_stamp(fp); if (rtnl_dump_filter_nc(&rth, dump_msg2, fp, 0) < 0) { fprintf( stderr , "Dump terminated\n"); return 1; } init_phase = 0; if (rtnl_listen(&rth, dump_msg, (void *)fp) < 0) exit(2); exit(0); }
int main(unsigned long a0, unsigned long a1) { struct_0 *v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; void* v7; void* v8; char v9; unsigned long v10; unsigned long long *v12; v1 = a0; v0 = a1; v10 = v12[5]; v2 = 0; v3 = -1; v4 = 0; v5 = 0; v6 = 0; for (v7 = 0; v1 > 1; v0 = &v0->field_8) { if ((matches(v0->field_8, "-family") ^ 1)) { v1 -= 1; v0 = &v0->field_8; if (v1 <= 1) usage(); if (!strcmp(v0->field_8, "inet")) { v2 = 2; } else { if (!strcmp(v0->field_8, "inet6")) { v2 = 10; } else { if (!strcmp(v0->field_8, "link")) { v2 = 10; } else { if (strcmp(v0->field_8, "help")) { fprintf(*(&stderr), "Protocol ID \"%s\" is unknown, try \"rtmon help\".\n", v0->field_8); exit(0xffffffff); } usage(); } } } } else if (!strcmp(v0->field_8, "-4")) { v2 = 2; } else if (!strcmp(v0->field_8, "-6")) { v2 = 10; } else if (!strcmp(v0->field_8, "-0")) { v2 = 17; } else if ((matches(v0->field_8, "-Version") ^ 1)) { printf("rtmon utility, iproute2-%s\n", &version); exit(0x0); } else if ((matches(v0->field_8, "file") ^ 1)) { v1 -= 1; v0 = &v0->field_8; if (v1 > 1) v7 = v0->field_8; else usage(); } else if ((matches(v0->field_8, "link") ^ 1)) { v4 = 1; v3 = 0; } else if ((matches(v0->field_8, "address") ^ 1)) { v5 = 1; v3 = 0; } else if ((matches(v0->field_8, "route") ^ 1)) { v6 = 1; v3 = 0; } else if (!strcmp(v0->field_8, "all")) { v3 = -1; } else if ((matches(v0->field_8, "help") ^ 1)) { usage(); } else { fprintf(*(&stderr), "Argument \"%s\" is unknown, try \"rtmon help\".\n", v0->field_8); exit(0xffffffff); } v1 -= 1; } if (!v7) { fprintf(*(&stderr), "Not enough information: argument \"file\" is required\n"); exit(0xffffffff); } else if (v4) { v3 |= nl_mgrp(0x1); } if (v5) { if (v2 && !(v2 == 2)) goto LABEL_400609; v3 |= nl_mgrp(0x5); LABEL_400609: if (v2 && !(v2 == 10)) goto LABEL_400622; v3 |= nl_mgrp(0x9); } LABEL_400622: if (v6) { if (v2 && !(v2 == 2)) goto LABEL_400641; v3 |= nl_mgrp(0x7); LABEL_400641: if (v2 && !(v2 == 10)) goto LABEL_40065a; v3 |= nl_mgrp(0xb); } LABEL_40065a: v8 = fopen64(v7, "w"); if (!v8) { perror("Cannot fopen"); exit(0xffffffff); } else if (rtnl_open(&v9, v3, v3) < 0) { exit(0x1); } else if (rtnl_linkdump_req(&v9, 0x0) < 0) { perror("Cannot send dump request"); exit(0x1); } else { write_stamp(v8); if (rtnl_dump_filter_nc(&v9, dump_msg2, v8, 0x0) >= 0) { init_phase = 0; if (rtnl_listen(&v9, dump_msg, v8) < 0) exit(0x2); exit(0x0); } else { fprintf(*(&stderr), "Dump terminated\n"); if (!(v10 ^ v12[5])) return 1; __stack_chk_fail(); } } }
static rsRetVal TCPSendPrepRetry(void *pvData) { rsRetVal iRet = RS_RET_OK; wrkrInstanceData_t *pWrkrData = (wrkrInstanceData_t *) pvData; ((void) (0)) ; DestructTCPInstanceData(pWrkrData); return iRet; }
long long TCPSendPrepRetry(void* a0) { unsigned int v0; v0 = 0; DestructTCPInstanceData(a0); return v0; }
static int node_enum(EditLine *el, keymacro_node_t *ptr, size_t cnt) { ssize_t used; if (cnt >= ((size_t)1024) - 5) { el->el_keymacro.buf[++cnt] = '"'; el->el_keymacro.buf[++cnt] = '\0'; (void) fprintf(el->el_errfile, "Some extended keys too long for internal print buffer"); (void) fprintf(el->el_errfile, " \"%ls...\"\n", el->el_keymacro.buf); return 0; } if (ptr == ((void *)0) ) { return -1; } used = ct_visual_char(el->el_keymacro.buf + cnt, ((size_t)1024) - cnt, ptr->ch); if (ptr->next == ((void *)0) ) { el->el_keymacro.buf[cnt + (size_t)used ] = '"'; el->el_keymacro.buf[cnt + (size_t)used + 1] = '\0'; keymacro_kprint(el, el->el_keymacro.buf, &ptr->val, ptr->type); } else (void) node_enum(el, ptr->next, cnt + (size_t)used); if (ptr->sibling) (void) node_enum(el, ptr->sibling, cnt); return 0; }
long node_enum(long a1, unsigned int *a2, unsigned long a3) { long v5; long v6; if ( a3 <= 0x3FA ) { if ( a2 ) { v6 = ct_visual_char(4 * a3 + *(_QWORD *)(a1 + 1088), 1024 - a3, *a2); if ( *((_QWORD *)a2 + 2) ) { node_enum(a1, *((unsigned int **)a2 + 2), a3 + v6); } else { *(_DWORD *)(4 * (v6 + a3) + *(_QWORD *)(a1 + 1088)) = 34; *(_DWORD *)(4 * (v6 + a3 + 1) + *(_QWORD *)(a1 + 1088)) = 0; keymacro_kprint(a1, *(_QWORD *)(a1 + 1088), (unsigned char *)a2 + 8, a2[1]); } if ( *((_QWORD *)a2 + 3) ) node_enum(a1, *((unsigned int **)a2 + 3), a3); return 0LL; } else { return 0xFFFFFFFFLL; } } else { v5 = a3 + 1; *(_DWORD *)(4 * v5 + *(_QWORD *)(a1 + 1088)) = 34; *(_DWORD *)(4 * (v5 + 1) + *(_QWORD *)(a1 + 1088)) = 0; fprintf(*(FILE **)(a1 + 24), "Some extended keys too long for internal print buffer"); fprintf(*(FILE **)(a1 + 24), " \"%ls...\"\n", *(const wchar_t **)(a1 + 1088)); return 0LL; } }
static int try_identity(struct ssh *ssh, Identity *id) { if (!id->key) return (0); if (sshkey_type_plain(id->key->type) == KEY_RSA && (ssh->compat & 0x00002000) != 0) { sshlog("sshconnect2.c", __func__, 1884, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "Skipped %s key %s for RSA/MD5 server", sshkey_type(id->key), id->filename) ; return (0); } return 1; }
long try_identity(long a1, long a2) { const char *v3; const char *v4; if ( !*(_QWORD *)(a2 + 24) ) return 0LL; if ( (unsigned int)sshkey_type_plain(**(unsigned int **)(a2 + 24)) || (*(_DWORD *)(a1 + 2108) & 0x2000) == 0 ) return 1LL; v3 = *(const char **)(a2 + 32); v4 = (const char *)sshkey_type(*(_QWORD *)(a2 + 24)); sshlog("sshconnect2.c", "try_identity", 1884LL, 0LL, 5LL, 0LL, "Skipped %s key %s for RSA/MD5 server", v4, v3); return 0LL; }
static inline char * timetostr (time_t t, char *buf) { return ((! ((time_t) 0 < (time_t) -1)) ? imaxtostr (t, buf) : umaxtostr (t, buf)); }
int timetostr(unsigned long long a0, unsigned long long a1) { return imaxtostr(a0, a1, a1); }
ARRAY_ELEMENT * array_shift(a, n, flags) ARRAY *a; int n, flags; { register ARRAY_ELEMENT *ae, *ret; register int i; if (a == 0 || ((a)->num_elements == 0) || n <= 0) return ((ARRAY_ELEMENT *) ((void *)0) ); a->lastref = 0; for (i = 0, ret = ae = ((a->head)->next); ae != a->head && i < n; ae = ((ae)->next), i++) ; if (ae == a->head) { if (flags & 0x01) { array_flush (a); return ((ARRAY_ELEMENT *) ((void *)0) ); } for (ae = ret; ((ae)->next) != a->head; ae = ((ae)->next)) ; ((ae)->next) = (ARRAY_ELEMENT *) ((void *)0) ; a->head->next = a->head->prev = a->head; a->max_index = -1; a->num_elements = 0; return ret; } ae->prev->next = (ARRAY_ELEMENT *) ((void *)0) ; a->head->next = ae; ae->prev = a->head; for ( ; ae != a->head; ae = ((ae)->next)) ((ae)->ind) -= n; a->num_elements -= n; a->max_index = ((a->head->prev)->ind); if (flags & 0x01) { for (ae = ret; ae; ) { ret = ((ae)->next); array_dispose_element(ae); ae = ret; } return ((ARRAY_ELEMENT *) ((void *)0) ); } return ret; }
void array_shift(struct_0 *a0, unsigned long a1, unsigned long a2) { void* v1; unsigned int v2; struct_4 *v3; struct_4 *v4; struct_3 *v5; void* v6; struct_4 *v7; unsigned long long v8[4]; void* v9; if (a0 && a0->field_8 && a1 > 0) { a0->field_18 = 0; v2 = 0; v5 = a0->field_10->field_10; for (v3 = a0->field_10->field_10; v5 != a0->field_10 && v2 < a1; v2 += 1) { v5 = v5->field_10; } if (v5 != a0->field_10) { v5->field_18->field_10 = 0; a0->field_10->field_10 = v5; for (v5->field_18 = &a0->field_10->padding_0; v5 != a0->field_10; v5 = v5->field_10) { v5->field_0 = v5->field_0 - a1; } a0->field_8 = a0->field_8 - a1; if (!(a2 & 1)) { v8 = v5; return; } for (a0->field_0 = a0->field_10->field_18->field_0; v5; v5 = v5->field_10) { array_dispose_element(v5); } v9 = 0; return; } else if ((a2 & 1)) { array_flush(a0); v6 = 0; return; } else { for (v5 = v3; v4->field_10 != a0->field_10; v4 = v4->field_10); v4->field_10 = 0; a0->field_10->field_18 = &a0->field_10->padding_0[0]; a0->field_10->field_10 = a0->field_10->field_18; a0->field_0 = -1; a0->field_8 = 0; v7 = v5; return; } } v1 = 0; return; }
static int write_human(FILE *out, char modname[], char devname[], char type, unsigned int maj, unsigned int min) { int ret; ret = fprintf(out, "Module: %s\n" "\tDevice node: /dev/%s\n" "\t\tType: %s device\n" "\t\tMajor: %u\n" "\t\tMinor: %u\n", modname, devname, (type == 'c') ? "character" : "block", maj, min); if (ret >= 0) return 0 ; else return 1 ; }
bool write_human(FILE *param_1,undefined8 param_2,undefined8 param_3,char param_4,uint param_5, uint param_6) { int iVar1; char *pcVar2; if (param_4 == 'c') { pcVar2 = "character"; } else { pcVar2 = "block"; } iVar1 = fprintf(param_1, "Module: %s\n\tDevice node: /dev/%s\n\t\tType: %s device\n\t\tMajor: %u\n\t\tMinor: %u\n" ,param_2,param_3,pcVar2,(ulong)param_5,(ulong)param_6); return iVar1 < 0; }
static void _response_info(const gnutls_datum_t * data, unsigned force_print) { gnutls_ocsp_resp_t resp; int ret; gnutls_datum_t buf, rbuf; if (data->size == 0) { fprintf( stderr , "Received empty response\n"); app_exit(1); } ret = gnutls_ocsp_resp_init(&resp); if (ret < 0) { fprintf( stderr , "ocsp_resp_init: %s\n", gnutls_strerror(ret)); app_exit(1); } ret = gnutls_ocsp_resp_import2(resp, data, incert_format); if (ret == -207) { int ret2 = gnutls_ocsp_resp_import(resp, data); if (ret2 >= 0) ret = ret2; } if (ret < 0) { fprintf( stderr , "error importing response: %s\n", gnutls_strerror(ret)); app_exit(1); } if (ocsptool_options.enabled.verbose) ret = gnutls_ocsp_resp_print(resp, GNUTLS_OCSP_PRINT_FULL, &buf); else ret = gnutls_ocsp_resp_print(resp, GNUTLS_OCSP_PRINT_COMPACT, &buf); if (ret != 0) { fprintf( stderr , "ocsp_resp_print: %s\n", gnutls_strerror(ret)); app_exit(1); } if (ocsptool_options.present.outfile) { ret = gnutls_ocsp_resp_export2(resp, &rbuf, outcert_format); if (ret < 0) { fprintf( stderr , "error exporting response: %s\n", gnutls_strerror(ret)); app_exit(1); } if (outcert_format == GNUTLS_X509_FMT_PEM) fprintf(outfile, "%.*s\n", buf.size, buf.data); fwrite(rbuf.data, 1, rbuf.size, outfile); if (outcert_format == GNUTLS_X509_FMT_PEM) fprintf(outfile, "\n"); gnutls_free((void *) (rbuf.data)), rbuf.data= ((void *)0) ; } if (force_print || !ocsptool_options.present.outfile) { ret = gnutls_ocsp_resp_export2(resp, &rbuf, GNUTLS_X509_FMT_PEM); if (ret < 0) { fprintf( stderr , "error exporting response: %s\n", gnutls_strerror(ret)); app_exit(1); } fprintf( stdout , "%.*s\n", buf.size, buf.data); fwrite(rbuf.data, 1, rbuf.size, stdout ); gnutls_free((void *) (rbuf.data)), rbuf.data= ((void *)0) ; } gnutls_free((void *) (buf.data)), buf.data= ((void *)0) ; gnutls_ocsp_resp_deinit(resp); }
void _response_info(long param_1,int param_2) { int iVar1; undefined8 uVar2; long in_FS_OFFSET; int local_48; undefined8 local_40; undefined8 local_38; uint local_30; void *local_28; uint local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (*(int *)(param_1 + 8) == 0) { fprintf(stderr,"Received empty response\n"); app_exit(1); } iVar1 = gnutls_ocsp_resp_init(&local_40); if (iVar1 < 0) { uVar2 = gnutls_strerror(iVar1); fprintf(stderr,"ocsp_resp_init: %s\n",uVar2); app_exit(1); } local_48 = gnutls_ocsp_resp_import2(local_40,param_1,incert_format); if (local_48 == -0xcf) { iVar1 = gnutls_ocsp_resp_import(local_40,param_1); if (-1 < iVar1) { local_48 = iVar1; } } if (local_48 < 0) { uVar2 = gnutls_strerror(local_48); fprintf(stderr,"error importing response: %s\n",uVar2); app_exit(1); } if (DAT_001030bd == '\0') { local_48 = gnutls_ocsp_resp_print(local_40,1,&local_38); } else { local_48 = gnutls_ocsp_resp_print(local_40,0,&local_38); } if (local_48 != 0) { uVar2 = gnutls_strerror(local_48); fprintf(stderr,"ocsp_resp_print: %s\n",uVar2); app_exit(1); } if (DAT_0010303b != '\0') { iVar1 = gnutls_ocsp_resp_export2(local_40,&local_28,outcert_format); if (iVar1 < 0) { uVar2 = gnutls_strerror(iVar1); fprintf(stderr,"error exporting response: %s\n",uVar2); app_exit(1); } if (outcert_format == 1) { fprintf(outfile,"%.*s\n",(ulong)local_30,local_38); } fwrite(local_28,1,(ulong)local_20,outfile); if (outcert_format == 1) { fprintf(outfile,"\n"); } (*gnutls_free)(local_28); local_28 = (void *)0x0; } if ((param_2 != 0) || (DAT_0010303b != '\x01')) { iVar1 = gnutls_ocsp_resp_export2(local_40,&local_28,1); if (iVar1 < 0) { uVar2 = gnutls_strerror(iVar1); fprintf(stderr,"error exporting response: %s\n",uVar2); app_exit(1); } fprintf(stdout,"%.*s\n",(ulong)local_30,local_38); fwrite(local_28,1,(ulong)local_20,stdout); (*gnutls_free)(local_28); local_28 = (void *)0x0; } (*gnutls_free)(local_38); local_38 = 0; gnutls_ocsp_resp_deinit(local_40); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
static char ** build_argv (char const *str, int extra_argc, int *argc) { _Bool dq = 0 , sq = 0 ; struct splitbuf ss; ss.argv = xnmalloc (extra_argc + 2, 2 * sizeof *ss.argv); ss.argc = 1; ss.half_alloc = extra_argc + 2; ss.extra_argc = extra_argc; ss.sep = 1 ; ss.argv[ss.argc] = 0; while (*str) { char newc = *str; switch (*str) { case '\'': if (dq) break; sq = !sq; check_start_new_arg (&ss); ++str; continue; case '"': if (sq) break; dq = !dq; check_start_new_arg (&ss); ++str; continue; case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': if (sq || dq) break; ss.sep = 1 ; str += strspn (str, " \t\n\v\f\r"); continue; case '#': if (!ss.sep) break; goto eos; case '\\': if (sq && str[1] != '\\' && str[1] != '\'') break; newc = *++str; switch (newc) { case '"': case '#': case '$': case '\'': case '\\': break; case '_': if (!dq) { ++str; ss.sep = 1 ; continue; } newc = ' '; break; case 'c': if (dq) ((!!sizeof (struct { _Static_assert (EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, 0, gettext (\"'\\\\c' must not appear in double-quoted -S string\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_CANCELED, 0, gettext ("'\\c' must not appear in double-quoted -S string")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_CANCELED, 0, gettext ("'\\c' must not appear in double-quoted -S string")), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; goto eos; case 'f': newc = '\f'; break; case 'n': newc = '\n'; break; case 'r': newc = '\r'; break; case 't': newc = '\t'; break; case 'v': newc = '\v'; break; case '\0': ((!!sizeof (struct { _Static_assert (EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, 0, gettext (\"invalid backslash at end of string in -S\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_CANCELED, 0, gettext ("invalid backslash at end of string in -S")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_CANCELED, 0, gettext ("invalid backslash at end of string in -S")), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; default: ((!!sizeof (struct { _Static_assert (EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, 0, gettext (\"invalid sequence '\\\\%c' in -S\"), newc), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_CANCELED, 0, gettext ("invalid sequence '\\%c' in -S"), newc), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_CANCELED, 0, gettext ("invalid sequence '\\%c' in -S"), newc), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); } break; case '$': if (sq) break; { char *n = extract_varname (str); if (!n) ((!!sizeof (struct { _Static_assert (EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, 0, gettext (\"only ${VARNAME} expansion is supported, error at: %s\"), str), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_CANCELED, 0, gettext ("only ${VARNAME} expansion is supported, error at: %s"), str), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_CANCELED, 0, gettext ("only ${VARNAME} expansion is supported, error at: %s"), str), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; char *v = getenv (n); if (v) { check_start_new_arg (&ss); do { if (dev_debug) fprintf ( stderr , "expanding ${%s} into %s\n", n, quote (v)); } while (0); for (; *v; v++) splitbuf_append_byte (&ss, *v); } else do { if (dev_debug) fprintf ( stderr , "replacing ${%s} with null string\n", n); } while (0); str = strchr (str, '}') + 1; continue; } } check_start_new_arg (&ss); splitbuf_append_byte (&ss, newc); ++str; }
int build_argv(void* a0, unsigned long a1, unsigned int *a2) { char v0[2]; char v1; char v2; char v3; char *v4; char *v5; unsigned long long *v6; unsigned int v7; unsigned long v8; unsigned int v9; char v10; *(&v0) = a0; v1 = 0; v2 = 0; v6 = xnmalloc(a1 + 2, 0x10); v7 = 1; v8 = a1 + 2; v9 = a1; v10 = 1; v6[v7] = 0; while (true) { if (v0[0]) { v3 = v0[0]; if (v0[0] <= 39) { if (v0[0] >= 9) { switch (v0[0]) { case 9: case 10: case 11: case 12: case 13: case 32: if (!v2) { v10 = 1; *(&v0) = &v0[strspn(v0, &g_402b3f)]; continue; } if (v1 || v2) break; case 34: if (!v2) { v1 = !(v1); v1 &= 1; check_start_new_arg(&v6); *(&v0) = &v0[1]; continue; } case 36: if (!v2) { v5 = extract_varname(v0); if (!v5) error(0x7d, 0x0, gettext("only ${VARNAME} expansion is supported, error at: %s")); v4 = getenv(v5); if (v4) { check_start_new_arg(&v6); if (dev_debug) fprintf(*(&stderr), "expanding ${%s} into %s\n", v5, quote(v4)); for (; *(v4); v4 += 1) { splitbuf_append_byte(&v6, *(v4)); } } else { if (dev_debug) fprintf(*(&stderr), "replacing ${%s} with null string\n", v5); } *(&v0) = strchr(v0, 0x7d) + 1; continue; } case 39: if (!v1) { v2 = !(v2); v2 &= 1; check_start_new_arg(&v6); *(&v0) = &v0[1]; continue; } } } } else { if (v0[0] == 92 && (v0[1] == 39 || v0[1] == 92 || !v2)) { *(&v0) = &v0[1]; v3 = v0[0]; if (v3) { if (v3 >= 0 && v3 <= 118 && v3 >= 34) { switch (v3) { case 34: case 35: case 36: case 39: case 92: break; case 95: if ((v1 ^ 1)) { *(&v0) = &v0[1]; v10 = 1; continue; } else { v3 = 32; break; } case 99: if (v1) error(0x7d, 0x0, gettext("'\\c' must not appear in double-quoted -S string")); case 102: v3 = 12; break; case 110: v3 = 10; break; case 114: v3 = 13; break; case 116: v3 = 9; break; case 118: v3 = 11; break; default: error(0x7d, 0x0, gettext("invalid sequence '\\%c' in -S")); } } } else { error(0x7d, 0x0, gettext("invalid backslash at end of string in -S")); } } } } else if (v2 || v1) { error(0x7d, 0x0, gettext("no terminating quote in -S string")); } if (...) { splitbuf_append_byte(&v6, 0x0); *(a2) = v7; break; } if (...) { check_start_new_arg(&v6); splitbuf_append_byte(&v6, v3); *(&v0) = &v0[1]; } } return splitbuf_finishup(&v6); }
void * malloc (size) size_t size; { return internal_malloc (size, (char *) ((void *)0) , 0, 0); }
long malloc(size_t a1) { return internal_malloc(a1, 0LL, 0); }
static void process_flags (int argc, char **argv) { const struct group *grp; _Bool anyflag = 0 ; char *cp; struct stat st; { int c; static struct option long_options[] = { {"base-dir", 1 , ((void *)0) , 'b'}, {"btrfs-subvolume-home", 0 , ((void *)0) , 200}, {"badname", 0 , ((void *)0) , 201}, {"comment", 1 , ((void *)0) , 'c'}, {"home-dir", 1 , ((void *)0) , 'd'}, {"defaults", 0 , ((void *)0) , 'D'}, {"expiredate", 1 , ((void *)0) , 'e'}, {"inactive", 1 , ((void *)0) , 'f'}, {"add-subids-for-system", 0 , ((void *)0) , 'F'}, {"gid", 1 , ((void *)0) , 'g'}, {"groups", 1 , ((void *)0) , 'G'}, {"help", 0 , ((void *)0) , 'h'}, {"skel", 1 , ((void *)0) , 'k'}, {"key", 1 , ((void *)0) , 'K'}, {"no-log-init", 0 , ((void *)0) , 'l'}, {"create-home", 0 , ((void *)0) , 'm'}, {"no-create-home", 0 , ((void *)0) , 'M'}, {"no-user-group", 0 , ((void *)0) , 'N'}, {"non-unique", 0 , ((void *)0) , 'o'}, {"password", 1 , ((void *)0) , 'p'}, {"system", 0 , ((void *)0) , 'r'}, {"root", 1 , ((void *)0) , 'R'}, {"prefix", 1 , ((void *)0) , 'P'}, {"shell", 1 , ((void *)0) , 's'}, {"uid", 1 , ((void *)0) , 'u'}, {"user-group", 0 , ((void *)0) , 'U'}, { ((void *)0) , 0, ((void *)0) , '\0'} }; while ((c = getopt_long (argc, argv, "b:c:d:De:f:g:G:hk:K:lmMNop:rR:P:s:u:U" "F" "", long_options, ((void *)0) )) != -1) { switch (c) { case 'b': if ( ( !(strcspn (optarg, ":\n") == strlen (optarg)) ) || ( optarg[0] != '/' )) { fprintf ( stderr , gettext ("%s: invalid base directory '%s'\n"), Prog, optarg); exit (3); } def_home = optarg; bflg = 1 ; break; case 200: subvolflg = 1 ; break; case 201: allow_bad_names = 1 ; break; case 'c': if (!(strcspn (optarg, ":\n") == strlen (optarg))) { fprintf ( stderr , gettext ("%s: invalid comment '%s'\n"), Prog, optarg); exit (3); } user_comment = optarg; cflg = 1 ; break; case 'd': if ( ( !(strcspn (optarg, ":\n") == strlen (optarg)) ) || ( optarg[0] != '/' )) { fprintf ( stderr , gettext ("%s: invalid home directory '%s'\n"), Prog, optarg); exit (3); } user_home = optarg; dflg = 1 ; break; case 'D': if (anyflag) { usage (2); } Dflg = 1 ; break; case 'e': if ('\0' != *optarg) { user_expire = strtoday (optarg); if (user_expire < -1) { fprintf ( stderr , gettext ("%s: invalid date '%s'\n"), Prog, optarg); exit (3); } } else { user_expire = -1; } if ((-1 != user_expire) && !is_shadow_pwd) { fprintf ( stderr , gettext ("%s: shadow passwords required for -e\n"), Prog); exit (2); } if (Dflg) { def_expire = optarg; } eflg = 1 ; break; case 'f': if ( (getlong (optarg, &def_inactive) == 0) || (def_inactive < -1)) { fprintf ( stderr , gettext ("%s: invalid numeric argument '%s'\n"), Prog, optarg); exit (3); } if ((-1 != def_inactive) && !is_shadow_pwd) { fprintf ( stderr , gettext ("%s: shadow passwords required for -f\n"), Prog); exit (2); } fflg = 1 ; break; case 'F': Fflg = 1 ; break; case 'g': grp = prefix_getgr_nam_gid (optarg); if ( ((void *)0) == grp) { fprintf ( stderr , gettext ("%s: group '%s' does not exist\n"), Prog, optarg); exit (6); } if (Dflg) { def_group = grp->gr_gid; def_gname = optarg; } else { user_gid = grp->gr_gid; } gflg = 1 ; break; case 'G': if (get_groups (optarg) != 0) { exit (6); } if ( ((void *)0) != user_groups[0]) { do_grp_update = 1 ; } Gflg = 1 ; break; case 'h': usage (0); break; case 'k': def_template = optarg; kflg = 1 ; break; case 'K': cp = strchr (optarg, '='); if ( ((void *)0) == cp) { fprintf ( stderr , gettext ("%s: -K requires KEY=VALUE\n"), Prog); exit (3); } *cp = '\0'; cp++; if (putdef_str (optarg, cp) < 0) { exit (3); } break; case 'l': lflg = 1 ; break; case 'm': mflg = 1 ; break; case 'M': Mflg = 1 ; break; case 'N': Nflg = 1 ; break; case 'o': oflg = 1 ; break; case 'p': if (!(strcspn (optarg, ":\n") == strlen (optarg))) { fprintf ( stderr , gettext ("%s: invalid field '%s'\n"), Prog, optarg); exit (3); } user_pass = optarg; break; case 'r': rflg = 1 ; break; case 'R': break; case 'P': break; case 's': if ( ( !(strcspn (optarg, ":\n") == strlen (optarg)) ) || ( ('\0' != optarg[0]) && ('/' != optarg[0]) && ('*' != optarg[0]) )) { fprintf ( stderr , gettext ("%s: invalid shell '%s'\n"), Prog, optarg); exit (3); } if ( '\0' != optarg[0] && '*' != optarg[0] && strcmp(optarg, "/sbin/nologin") != 0 && ( stat(optarg, &st) != 0 || (((( st.st_mode )) & 0170000) == (0040000)) || access(optarg, 1 ) != 0)) { fprintf ( stderr , gettext ("%s: Warning: missing or non-executable shell '%s'\n"), Prog, optarg); } user_shell = optarg; def_shell = optarg; sflg = 1 ; break; case 'u': if ( (get_uid (optarg, &user_id) == 0) || (user_id == (gid_t)-1)) { fprintf ( stderr , gettext ("%s: invalid user ID '%s'\n"), Prog, optarg); exit (3); } uflg = 1 ; break; case 'U': Uflg = 1 ; break; default: usage (2); } anyflag = 1 ; } } if (!gflg && !Nflg && !Uflg) { Uflg = getdef_bool ("USERGROUPS_ENAB"); } if (oflg && !uflg) { fprintf ( stderr , gettext ("%s: %s flag is only allowed with the %s flag\n"), Prog, "-o", "-u"); usage (2); } if (kflg && !mflg) { fprintf ( stderr , gettext ("%s: %s flag is only allowed with the %s flag\n"), Prog, "-k", "-m"); usage (2); } if (Uflg && gflg) { fprintf ( stderr , gettext ("%s: options %s and %s conflict\n"), Prog, "-U", "-g"); usage (2); } if (Uflg && Nflg) { fprintf ( stderr , gettext ("%s: options %s and %s conflict\n"), Prog, "-U", "-N"); usage (2); } if (mflg && Mflg) { fprintf ( stderr , gettext ("%s: options %s and %s conflict\n"), Prog, "-m", "-M"); usage (2); } if (Dflg) { if (optind != argc) { usage (2); } if (uflg || Gflg || dflg || cflg || mflg) { usage (2); } } else { if (optind != argc - 1) { usage (2); } user_name = argv[optind]; if (!is_valid_user_name (user_name)) { fprintf ( stderr , gettext ("%s: invalid user name '%s': use --badname to ignore\n"), Prog, user_name); exit (3); } if (!dflg) { char *uh; size_t len = strlen (def_home) + strlen (user_name) + 2; int wlen; uh = xmalloc (len); wlen = snprintf (uh, len, "%s/%s", def_home, user_name); ((void) sizeof (( wlen == (int) len -1 ) ? 1 : 0), __extension__ ({ if ( wlen == (int) len -1 ) ; else __assert_fail ( "wlen == (int) len -1" , "useradd.c", 1560, __extension__ __PRETTY_FUNCTION__); })) ; user_home = uh; } if (prefix[0]) { size_t len = strlen(prefix) + strlen(user_home) + 2; int wlen; char* _prefix_user_home; _prefix_user_home = xmalloc(len); wlen = snprintf(_prefix_user_home, len, "%s/%s", prefix, user_home); ((void) sizeof (( wlen == (int) len -1 ) ? 1 : 0), __extension__ ({ if ( wlen == (int) len -1 ) ; else __assert_fail ( "wlen == (int) len -1" , "useradd.c", 1570, __extension__ __PRETTY_FUNCTION__); })) ; prefix_user_home = _prefix_user_home; } else { prefix_user_home = user_home; } } if (!eflg) { user_expire = strtoday (def_expire); } if (!gflg) { user_gid = def_group; } if (!sflg) { user_shell = def_shell; } create_mail_spool = def_create_mail_spool; if (!lflg) { if (strcmp (def_log_init, "no") == 0) { lflg = 1 ; } } if (!rflg) { if (getdef_bool ("CREATE_HOME")) { mflg = 1 ; } } if (Mflg) { mflg = 0 ; } }
void process_flags(unsigned long a0, unsigned long long *a1) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long v4; char *v5; unsigned long v6; char *v7; struct_0 *v8; unsigned long long v9; char v10; char v11; char v12; unsigned long long v14; unsigned long long v15; unsigned long long v18; unsigned long long v19; unsigned long long *v22; unsigned long long v23; v0 = 0; while (true) { v1 = getopt_long(a0, a1, "b:c:d:De:f:g:G:hk:K:lmMNop:rR:P:s:u:UF", &long_options.6172, NULL); if (v1 != -1) { switch (v1) { case 68: if (v0) usage(0x2); Dflg = 1; break; case 70: Fflg = 1; break; case 71: v14 = get_groups(*(&optarg)); if (v14) exit(0x6); if (*(user_groups)) do_grp_update = 1; Gflg = 1; break; case 75: v9 = strchr(*(&optarg), 0x3d); if (!v9) { fprintf(stderr, gettext("%s: -K requires KEY=VALUE\n")); exit(0x3); } *(v9) = 0; v9 += 1; v14 = putdef_str(*(&optarg), v9, v9); if (v14 < 0) exit(0x3); case 77: Mflg = 1; break; case 78: Nflg = 1; break; case 80: case 82: break; case 85: Uflg = 1; break; case 98: v15 = strcspn(*(&optarg), ":\n"); v14 = strlen(*(&optarg)); if (v15 == v14 && *(*(&optarg)) == 47) { def_home = *(&optarg); bflg = 1; break; } if (*(*(&optarg)) != 47 || v15 != v14) { fprintf(stderr, gettext("%s: invalid base directory '%s'\n")); exit(0x3); } case 99: v14 = strlen(*(&optarg)); if (strcspn(*(&optarg), ":\n") != v14) { fprintf(stderr, gettext("%s: invalid comment '%s'\n")); exit(0x3); } user_comment = *(&optarg); cflg = 1; break; case 100: v19 = strcspn(*(&optarg), ":\n"); v14 = strlen(*(&optarg)); if (v19 == v14 && *(*(&optarg)) == 47) { user_home = *(&optarg); dflg = 1; break; } if (*(*(&optarg)) != 47 || v19 != v14) { fprintf(stderr, gettext("%s: invalid home directory '%s'\n")); exit(0x3); } case 101: if (*(*(&optarg))) { user_expire = strtoday(*(&optarg)); if (user_expire < -1) { fprintf(stderr, gettext("%s: invalid date '%s'\n")); exit(0x3); } } else { user_expire = -1; } if (!*(*(&optarg)) || user_expire >= -1) { if (user_expire == -1) { if (Dflg) def_expire = *(&optarg); eflg = 1; break; } else if ((is_shadow_pwd ^ 1)) { fprintf(stderr, gettext("%s: shadow passwords required for -e\n")); exit(0x2); } } case 102: v14 = getlong(*(&optarg), &def_inactive); if (v14 && def_inactive >= -1) { if (def_inactive == -1) { fflg = 1; break; } else if ((is_shadow_pwd ^ 1)) { fprintf(stderr, gettext("%s: shadow passwords required for -f\n")); exit(0x2); } } if (def_inactive < -1 || !v14) { fprintf(stderr, gettext("%s: invalid numeric argument '%s'\n")); exit(0x3); } case 103: v8 = prefix_getgr_nam_gid(*(&optarg)); if (!v8) { fprintf(stderr, gettext("%s: group '%s' does not exist\n")); exit(0x6); } if (Dflg) { def_group = v8->field_10; def_gname = *(&optarg); } else { user_gid = v8->field_10; } gflg = 1; break; case 104: usage(0x0); case 107: def_template = *(&optarg); kflg = 1; break; case 108: lflg = 1; break; case 109: mflg = 1; break; case 111: oflg = 1; break; case 112: v14 = strlen(*(&optarg)); if (strcspn(*(&optarg), ":\n") != v14) { fprintf(stderr, gettext("%s: invalid field '%s'\n")); exit(0x3); } user_pass = *(&optarg); break; case 114: rflg = 1; break; case 115: v18 = strcspn(*(&optarg), ":\n"); v14 = strlen(*(&optarg)); if (v18 == v14 && (!*(*(&optarg)) || *(*(&optarg)) == 47)) { if (*(*(&optarg)) && *(*(&optarg)) != 42) { v14 = strcmp(*(&optarg), "/sbin/nologin"); if (v14) { v14 = stat(*(&optarg), &v10); if (!v14 && (*(&v11) & 0xf000) != 0x4000) v14 = access(*(&optarg), 0x1); if ((*(&v11) & 0xf000) == 0x4000 || v14 || v14) fprintf(stderr, gettext("%s: Warning: missing or non-executable shell '%s'\n")); } } user_shell = *(&optarg); def_shell = *(&optarg); sflg = 1; break; } if ((v18 != v14 || *(*(&optarg)) != 47) && (v18 != v14 || *(*(&optarg)) != 42) && (*(*(&optarg)) || v18 != v14)) { fprintf(stderr, gettext("%s: invalid shell '%s'\n")); exit(0x3); } case 117: v14 = get_uid(*(&optarg), &user_id); if (v14 && user_id != -1) { uflg = 1; break; } if (user_id == -1 || !v14) { fprintf(stderr, gettext("%s: invalid user ID '%s'\n")); exit(0x3); } case 200: subvolflg = 1; break; case 201: allow_bad_names = 1; break; default: usage(0x2); } v0 = 1; } else { if (!(gflg ^ 1)) break; if ((gflg ^ 1)) { if (!(Nflg ^ 1)) break; if ((Nflg ^ 1)) { if (!(Uflg ^ 1)) break; if ((Uflg ^ 1)) { Uflg = getdef_bool("USERGROUPS_ENAB"); break; } } } } } if (oflg && (uflg ^ 1)) { fprintf(stderr, gettext("%s: %s flag is only allowed with the %s flag\n")); usage(0x2); } if (!oflg || !(uflg ^ 1)) { if (kflg && (mflg ^ 1)) { fprintf(stderr, gettext("%s: %s flag is only allowed with the %s flag\n")); usage(0x2); } if (!kflg || !(mflg ^ 1)) { if (Uflg && gflg) { fprintf(stderr, gettext("%s: options %s and %s conflict\n")); usage(0x2); } if (!Uflg || !gflg) { if (Uflg && Nflg) { fprintf(stderr, gettext("%s: options %s and %s conflict\n")); usage(0x2); } if (!Nflg || !Uflg) { if (mflg && Mflg) { fprintf(stderr, gettext("%s: options %s and %s conflict\n")); usage(0x2); } if (!Mflg || !mflg) { if (Dflg) { if (a0 != *(&optind)) { usage(0x2); } else if (dflg || cflg || mflg || uflg || Gflg) { usage(0x2); } } else { if (a0 - 1 != *(&optind)) usage(0x2); user_name = a1[*(&optind)]; *(&v14) = is_valid_user_name(user_name) ^ 1; if (v14) { fprintf(stderr, gettext("%s: invalid user name '%s': use --badname to ignore\n")); exit(0x3); } if ((dflg ^ 1)) { v4 = strlen(user_name) + strlen(def_home) + 2; v5 = xmalloc(v4); v2 = snprintf(v5, v4, "%s/%s", def_home, user_name); if (v2 != v4 - 1) __assert_fail(); user_home = v5; } if (!(dflg ^ 1) || v2 == v4 - 1) { if (*(prefix)) { v6 = strlen(user_home) + strlen(prefix) + 2; v7 = xmalloc(v6); v3 = snprintf(v7, v6, "%s/%s", prefix, user_home); if (v3 != v6 - 1) __assert_fail(); prefix_user_home = v7; } else { prefix_user_home = user_home; } } } if (!Dflg && a0 - 1 == *(&optind) && !v14 && *(prefix) && (!(dflg ^ 1) || v2 == v4 - 1) && v3 == v6 - 1 || !Dflg && a0 - 1 == *(&optind) && !*(prefix) && !v14 && (!(dflg ^ 1) || v2 == v4 - 1) || !dflg && !cflg && !uflg && a0 == *(&optind) && !Gflg && Dflg && !mflg) { if ((eflg ^ 1)) user_expire = strtoday(def_expire); if ((gflg ^ 1)) user_gid = def_group; if ((sflg ^ 1)) user_shell = def_shell; create_mail_spool = def_create_mail_spool; if ((lflg ^ 1) && !strcmp(def_log_init, "no")) lflg = 1; if ((rflg ^ 1) && getdef_bool("CREATE_HOME")) mflg = 1; if (Mflg) mflg = 0; v23 = *(&v12) ^ v22[5]; return; } } } } } } }
void permanently_set_uid(struct passwd *pw) { uid_t old_uid = getuid(); gid_t old_gid = getgid(); if (pw == ((void *)0) ) sshfatal("uidswap.c", __func__, 189, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "permanently_set_uid: no user given"); if (temporarily_use_uid_effective) sshfatal("uidswap.c", __func__, 191, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "permanently_set_uid: temporarily_use_uid effective"); sshlog("uidswap.c", __func__, 192, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "permanently_set_uid: %u/%u", (u_int)pw->pw_uid, (u_int)pw->pw_gid) ; if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) == -1) sshfatal("uidswap.c", __func__, 196, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "setresgid %u: %.100s", (u_int)pw->pw_gid, strerror( (*__errno_location ()) )); if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) == -1) sshfatal("uidswap.c", __func__, 209, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "setresuid %u: %.100s", (u_int)pw->pw_uid, strerror( (*__errno_location ()) )); if (old_gid != pw->pw_gid && pw->pw_uid != 0 && (setgid(old_gid) != -1 || setegid(old_gid) != -1)) sshfatal("uidswap.c", __func__, 215, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "%s: was able to restore old [e]gid", __func__); if (getgid() != pw->pw_gid || getegid() != pw->pw_gid) { sshfatal("uidswap.c", __func__, 220, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "%s: egid incorrect gid:%u egid:%u (should be %u)", __func__, (u_int)getgid(), (u_int)getegid(), (u_int)pw->pw_gid) ; } if (old_uid != pw->pw_uid && (setuid(old_uid) != -1 || seteuid(old_uid) != -1)) sshfatal("uidswap.c", __func__, 229, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "%s: was able to restore old [e]uid", __func__); if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) { sshfatal("uidswap.c", __func__, 234, 0, SYSLOG_LEVEL_FATAL, ((void *)0) , "%s: euid incorrect uid:%u euid:%u (should be %u)", __func__, (u_int)getuid(), (u_int)geteuid(), (u_int)pw->pw_uid) ; } }
__uid_t permanently_set_uid(long a1) { int *v1; char *v2; int *v3; char *v4; long v5; long v6; long v7; __uid_t result; long v9; long v10; long v11; __uid_t uid; __gid_t gid; uid = getuid(); gid = getgid(); if ( !a1 ) sshfatal("uidswap.c", "permanently_set_uid", 189LL, 0LL, 1LL, 0LL, "permanently_set_uid: no user given"); if ( temporarily_use_uid_effective ) sshfatal( "uidswap.c", "permanently_set_uid", 191LL, 0LL, 1LL, 0LL, "permanently_set_uid: temporarily_use_uid effective"); sshlog( "uidswap.c", "permanently_set_uid", 192LL, 0LL, 5LL, 0LL, "permanently_set_uid: %u/%u", *(unsigned int *)(a1 + 16), *(unsigned int *)(a1 + 20)); if ( setresgid(*(_DWORD *)(a1 + 20), *(_DWORD *)(a1 + 20), *(_DWORD *)(a1 + 20)) == -1 ) { v1 = _errno_location(); v2 = strerror(*v1); sshfatal( "uidswap.c", "permanently_set_uid", 196LL, 0LL, 1LL, 0LL, "setresgid %u: %.100s", *(unsigned int *)(a1 + 20), v2); } if ( setresuid(*(_DWORD *)(a1 + 16), *(_DWORD *)(a1 + 16), *(_DWORD *)(a1 + 16)) == -1 ) { v3 = _errno_location(); v4 = strerror(*v3); sshfatal( "uidswap.c", "permanently_set_uid", 209LL, 0LL, 1LL, 0LL, "setresuid %u: %.100s", *(unsigned int *)(a1 + 16), v4); } if ( gid != *(_DWORD *)(a1 + 20) && *(_DWORD *)(a1 + 16) && (setgid(gid) != -1 || setegid(gid) != -1) ) sshfatal( "uidswap.c", "permanently_set_uid", 215LL, 0LL, 1LL, 0LL, "%s: was able to restore old [e]gid", "permanently_set_uid"); if ( getgid() != *(_DWORD *)(a1 + 20) || getegid() != *(_DWORD *)(a1 + 20) ) { v5 = *(unsigned int *)(a1 + 20); v6 = getegid(); LODWORD(v7) = getgid(); sshfatal( "uidswap.c", "permanently_set_uid", 220LL, 0LL, 1LL, 0LL, "%s: egid incorrect gid:%u egid:%u (should be %u)", "permanently_set_uid", v7, v6, v5); } if ( uid != *(_DWORD *)(a1 + 16) && (setuid(uid) != -1 || seteuid(uid) != -1) ) sshfatal( "uidswap.c", "permanently_set_uid", 229LL, 0LL, 1LL, 0LL, "%s: was able to restore old [e]uid", "permanently_set_uid"); if ( getuid() != *(_DWORD *)(a1 + 16) || (result = geteuid(), result != *(_DWORD *)(a1 + 16)) ) { v9 = *(unsigned int *)(a1 + 16); v10 = geteuid(); LODWORD(v11) = getuid(); return sshfatal( "uidswap.c", "permanently_set_uid", 234LL, 0LL, 1LL, 0LL, "%s: euid incorrect uid:%u euid:%u (should be %u)", "permanently_set_uid", v11, v10, v9); } return result; }
static void dane_check(const char *host, const char *proto, const char *service, common_info_st * cinfo) { dane_state_t s; dane_query_t q; int ret, retcode = 1; unsigned entries; unsigned int flags = DANE_F_IGNORE_LOCAL_RESOLVER, i; unsigned int usage, type, match; gnutls_datum_t data, file; size_t size; unsigned del = 0; unsigned vflags = DANE_VFLAG_FAIL_IF_NOT_CHECKED; const char *cstr; char *str; gnutls_x509_crt_t *clist = ((void *)0) ; unsigned int clist_size = 0; gnutls_datum_t certs[32]; int port = service_to_port(service, proto); if (danetool_options.enabled.local_dns) flags = 0; if (danetool_options.present.insecure) flags |= DANE_F_INSECURE; if (danetool_options.present.check_ee) vflags |= DANE_VFLAG_ONLY_CHECK_EE_USAGE; if (danetool_options.present.check_ca) vflags |= DANE_VFLAG_ONLY_CHECK_CA_USAGE; if (!cinfo->cert) { const char *app_proto = ((void *)0) ; if (danetool_options.present.starttls_proto) app_proto = danetool_options.arg.starttls_proto; cinfo->cert = obtain_cert(host, proto, service, app_proto, danetool_options.present.quiet); del = 1; } if (!danetool_options.present.quiet) fprintf( stderr , "Querying DNS for %s (%s:%d)...\n", host, proto, port); ret = dane_state_init(&s, flags); if (ret < 0) { fprintf( stderr , "dane_state_init: %s\n", dane_strerror(ret)); retcode = 1; goto error; } if (danetool_options.present.dlv) { ret = dane_state_set_dlv_file(s, danetool_options.arg.dlv); if (ret < 0) { fprintf( stderr , "dane_state_set_dlv_file: %s\n", dane_strerror(ret)); retcode = 1; goto error; } } ret = dane_query_tlsa(s, &q, host, proto, port); if (ret < 0) { fprintf( stderr , "dane_query_tlsa: %s\n", dane_strerror(ret)); retcode = 1; goto error; } if (danetool_options.enabled.print_raw) { gnutls_datum_t t; char **dane_data; int *dane_data_len; int secure; int bogus; ret = dane_query_to_raw_tlsa(q, &entries, &dane_data, &dane_data_len, &secure, &bogus); if (ret < 0) { fprintf( stderr , "dane_query_to_raw_tlsa: %s\n", dane_strerror(ret)); retcode = 1; goto error; } for (i=0;i<entries;i++) { size_t str_size; t.data = (void*)dane_data[i]; t.size = dane_data_len[i]; str_size = t.size * 2 + 1; str = gnutls_malloc(str_size); ret = gnutls_hex_encode(&t, str, &str_size); if (ret < 0) { fprintf( stderr , "gnutls_hex_encode: %s\n", dane_strerror(ret)); retcode = 1; goto error; } fprintf(outfile, "[%u]: %s\n", i, str); gnutls_free((void *) (str)), str= ((void *)0) ; } fprintf(outfile, "\n"); } if (cinfo->cert) { ret = gnutls_load_file(cinfo->cert, &file); if (ret < 0) { fprintf( stderr , "gnutls_load_file: %s\n", gnutls_strerror(ret)); retcode = 1; goto error; } ret = gnutls_x509_crt_list_import2(&clist, &clist_size, &file, cinfo-> incert_format, 0); if (ret < 0) { fprintf( stderr , "gnutls_x509_crt_list_import2: %s\n", gnutls_strerror(ret)); retcode = 1; goto error; } if (clist_size > 0) { for (i = 0; i < ((( 32 )<( clist_size ))?( 32 ):( clist_size )) ; i++) { ret = gnutls_x509_crt_export2(clist [i], GNUTLS_X509_FMT_DER, &certs [i]); if (ret < 0) { fprintf( stderr , "gnutls_x509_crt_export2: %s\n", gnutls_strerror (ret)); retcode = 1; goto error; } } } } entries = dane_query_entries(q); for (i = 0; i < entries; i++) { ret = dane_query_data(q, i, &usage, &type, &match, &data); if (ret < 0) { fprintf( stderr , "dane_query_data: %s\n", dane_strerror(ret)); retcode = 1; goto error; } size = lbuffer_size; ret = gnutls_hex_encode(&data, (void *) lbuffer, &size); if (ret < 0) { fprintf( stderr , "gnutls_hex_encode: %s\n", dane_strerror(ret)); retcode = 1; goto error; } if (entries > 1 && !danetool_options.present.quiet) fprintf(outfile, "\n==== Entry %d ====\n", i + 1); fprintf(outfile, "_%u._%s.%s. IN TLSA ( %.2x %.2x %.2x %s )\n", port, proto, host, usage, type, match, lbuffer); if (!danetool_options.present.quiet) { cstr = dane_cert_usage_name(usage); if (cstr == ((void *)0) ) cstr= "Unknown"; fprintf(outfile, "Certificate usage: %s (%.2x)\n", cstr, usage); cstr = dane_cert_type_name(type); if (cstr == ((void *)0) ) cstr= "Unknown"; fprintf(outfile, "Certificate type: %s (%.2x)\n", cstr, type); cstr = dane_match_type_name(match); if (cstr == ((void *)0) ) cstr= "Unknown"; fprintf(outfile, "Contents: %s (%.2x)\n", cstr, match); fprintf(outfile, "Data: %s\n", lbuffer); } if (cinfo->cert) { unsigned int status; gnutls_datum_t out; ret = dane_verify_crt(s, certs, clist_size, GNUTLS_CRT_X509, host, proto, port, 0, vflags, &status); if (ret < 0) { fprintf( stderr , "dane_verify_crt: %s\n", dane_strerror(ret)); retcode = 1; goto error; } ret = dane_verification_status_print(status, &out, 0); if (ret < 0) { fprintf( stderr , "dane_verification_status_print: %s\n", dane_strerror(ret)); retcode = 1; goto error; } if (!danetool_options.present.quiet) fprintf(outfile, "\nVerification: %s\n", out.data); gnutls_free((void *) (out.data)), out.data= ((void *)0) ; if (status == 0) retcode = 0; } else { fprintf( stderr , "\nCertificate could not be obtained. You can explicitly load the certificate using --load-certificate.\n"); } } if (clist_size > 0) { for (i = 0; i < clist_size; i++) { gnutls_free((void *) (certs[i].data)), certs[i].data= ((void *)0) ; gnutls_x509_crt_deinit(clist[i]); } gnutls_free((void *) (clist)), clist= ((void *)0) ; } dane_query_deinit(q); dane_state_deinit(s); error: if (del != 0 && cinfo->cert) { (void)remove(cinfo->cert); } app_exit(retcode); }
void dane_check(undefined8 param_1,undefined8 param_2,undefined8 param_3,long param_4) { uint uVar1; undefined8 uVar2; long in_FS_OFFSET; uint local_2b4; uint local_2b0; uint local_2ac; uint local_2a8; uint local_2a4; int local_2a0; undefined4 local_29c; uint local_298; uint local_294; int local_290; uint local_28c; uint local_288; int local_284; undefined8 local_280; undefined8 local_278; long local_270; long local_268; char *local_260; undefined8 local_258; undefined8 local_250; long local_248 [2]; ulong local_238 [2]; undefined8 local_228; int local_220; undefined8 local_218 [65]; undefined8 local_10; local_10 = *(undefined8 *)(in_FS_OFFSET + 0x28); local_29c = 1; local_298 = 1; local_290 = 0; local_28c = 1; local_270 = 0; local_2a8 = 0; local_288 = service_to_port(param_3,param_2); if (DAT_001030de != '\0') { local_298 = 0; } if (DAT_0010305b != '\0') { local_298 = local_298 | 2; } if (safe_open_rw != (code)0x0) { local_28c = local_28c | 2; } if (DAT_00103051 != '\0') { local_28c = local_28c | 4; } if (*(long *)(param_4 + 0x28) == 0) { local_258 = 0; if (DAT_00103056 != '\0') { local_258 = _fclose; } uVar2 = obtain_cert(param_1,param_2,param_3,local_258,DAT_0010305e); *(undefined8 *)(param_4 + 0x28) = uVar2; local_290 = 1; } if (DAT_0010305e != '\x01') { fprintf(stderr,"Querying DNS for %s (%s:%d)...\n",param_1,param_2,(ulong)local_288); } local_284 = dane_state_init(&local_280,local_298); if (local_284 < 0) { uVar2 = dane_strerror(local_284); fprintf(stderr,"dane_state_init: %s\n",uVar2); local_29c = 1; } else { if (DAT_0010304d != '\0') { local_284 = dane_state_set_dlv_file(local_280,_gnutls_strerror); if (local_284 < 0) { uVar2 = dane_strerror(local_284); fprintf(stderr,"dane_state_set_dlv_file: %s\n",uVar2); local_29c = 1; goto LAB_001011b1; } } local_284 = dane_query_tlsa(local_280,&local_278,param_1,param_2,local_288); if (local_284 < 0) { uVar2 = dane_strerror(local_284); fprintf(stderr,"dane_query_tlsa: %s\n",uVar2); local_29c = 1; } else { if (DAT_001030e1 != '\0') { local_284 = dane_query_to_raw_tlsa (local_278,&local_2b4,&local_268,local_248,&local_2a4,&local_2a0); if (local_284 < 0) { uVar2 = dane_strerror(local_284); fprintf(stderr,"dane_query_to_raw_tlsa: %s\n",uVar2); local_29c = 1; goto LAB_001011b1; } for (local_294 = 0; local_294 < local_2b4; local_294 = local_294 + 1) { local_228 = *(undefined8 *)(local_268 + (ulong)local_294 * 8); local_220 = *(int *)(local_248[0] + (ulong)local_294 * 4); local_238[0] = (ulong)(local_220 * 2 + 1); local_250 = (*gnutls_malloc)(local_238[0]); local_284 = gnutls_hex_encode(&local_228,local_250,local_238); if (local_284 < 0) { uVar2 = dane_strerror(local_284); fprintf(stderr,"gnutls_hex_encode: %s\n",uVar2); local_29c = 1; goto LAB_001011b1; } fprintf(outfile,"[%u]: %s\n",(ulong)local_294); (*gnutls_free)(local_250); local_250 = 0; } fprintf(outfile,"\n"); } if (*(long *)(param_4 + 0x28) != 0) { local_284 = gnutls_load_file(*(undefined8 *)(param_4 + 0x28),local_238); if (local_284 < 0) { uVar2 = gnutls_strerror(local_284); fprintf(stderr,"gnutls_load_file: %s\n",uVar2); local_29c = 1; goto LAB_001011b1; } local_284 = gnutls_x509_crt_list_import2 (&local_270,&local_2a8,local_238,*(undefined4 *)(param_4 + 0x1c),0); if (local_284 < 0) { uVar2 = gnutls_strerror(local_284); fprintf(stderr,"gnutls_x509_crt_list_import2: %s\n",uVar2); local_29c = 1; goto LAB_001011b1; } if (local_2a8 != 0) { local_294 = 0; while( true ) { uVar1 = local_2a8; if (0x20 < local_2a8) { uVar1 = 0x20; } if (uVar1 <= local_294) goto LAB_00100c66; local_284 = gnutls_x509_crt_export2 (*(undefined8 *)(local_270 + (ulong)local_294 * 8),0, local_218 + (ulong)local_294 * 2); if (local_284 < 0) break; local_294 = local_294 + 1; } uVar2 = gnutls_strerror(local_284); fprintf(stderr,"gnutls_x509_crt_export2: %s\n",uVar2); local_29c = 1; goto LAB_001011b1; } } LAB_00100c66: local_2b4 = dane_query_entries(local_278); for (local_294 = 0; local_294 < local_2b4; local_294 = local_294 + 1) { local_284 = dane_query_data(local_278,local_294,&local_2b0,&local_2ac,&local_2a4,local_248); if (local_284 < 0) { uVar2 = dane_strerror(local_284); fprintf(stderr,"dane_query_data: %s\n",uVar2); local_29c = 1; goto LAB_001011b1; } local_268 = lbuffer_size; uVar2 = 0x100d38; local_284 = gnutls_hex_encode(local_248,lbuffer,&local_268); if (local_284 < 0) { uVar2 = dane_strerror(local_284); fprintf(stderr,"gnutls_hex_encode: %s\n",uVar2); local_29c = 1; goto LAB_001011b1; } if ((1 < local_2b4) && (DAT_0010305e != '\x01')) { uVar2 = 0x100dbe; fprintf(outfile,"\n==== Entry %d ====\n",(ulong)(local_294 + 1)); } fprintf(outfile,"_%u._%s.%s. IN TLSA ( %.2x %.2x %.2x %s )\n",(ulong)local_288,param_2, param_1,(ulong)local_2b0,(ulong)local_2ac,(ulong)local_2a4,lbuffer,uVar2); if (DAT_0010305e != '\x01') { local_260 = (char *)dane_cert_usage_name(local_2b0); if (local_260 == (char *)0x0) { local_260 = "Unknown"; } fprintf(outfile,"Certificate usage: %s (%.2x)\n",local_260); local_260 = (char *)dane_cert_type_name(local_2ac); if (local_260 == (char *)0x0) { local_260 = "Unknown"; } fprintf(outfile,"Certificate type: %s (%.2x)\n",local_260); local_260 = (char *)dane_match_type_name(local_2a4); if (local_260 == (char *)0x0) { local_260 = "Unknown"; } fprintf(outfile,"Contents:\t %s (%.2x)\n",local_260); fprintf(outfile,"Data:\t %s\n",lbuffer); } if (*(long *)(param_4 + 0x28) == 0) { fprintf(stderr, "\nCertificate could not be obtained. You can explicitly load the certificate using --load-certificate.\n" ); } else { local_284 = dane_verify_crt(local_280,local_218,local_2a8,1,param_1,param_2,local_288,0, local_28c,&local_2a0); if (local_284 < 0) { uVar2 = dane_strerror(local_284); fprintf(stderr,"dane_verify_crt: %s\n",uVar2); local_29c = 1; goto LAB_001011b1; } local_284 = dane_verification_status_print(local_2a0,&local_228,0); if (local_284 < 0) { uVar2 = dane_strerror(local_284); fprintf(stderr,"dane_verification_status_print: %s\n",uVar2); local_29c = 1; goto LAB_001011b1; } if (DAT_0010305e != '\x01') { fprintf(outfile,"\nVerification: %s\n",local_228); } (*gnutls_free)(local_228); local_228 = 0; if (local_2a0 == 0) { local_29c = 0; } } } if (local_2a8 != 0) { for (local_294 = 0; local_294 < local_2a8; local_294 = local_294 + 1) { (*gnutls_free)(local_218[(ulong)local_294 * 2]); local_218[(ulong)local_294 * 2] = 0; gnutls_x509_crt_deinit(*(undefined8 *)(local_270 + (ulong)local_294 * 8)); } (*gnutls_free)(local_270); local_270 = 0; } dane_query_deinit(local_278); dane_state_deinit(local_280); } } LAB_001011b1: if ((local_290 != 0) && (*(long *)(param_4 + 0x28) != 0)) { remove(*(char **)(param_4 + 0x28)); } app_exit(local_29c); }
static void finish_processing_inode(e2fsck_t ctx, ext2_ino_t ino, struct problem_context *pctx, int failed_csum) { if (!failed_csum) return; pctx->errcode = recheck_bad_inode_checksum(ctx->fs, ino, ctx, pctx); if (pctx->errcode) ctx->flags |= 0x0001; }
void finish_processing_inode(struct_0 *a0, unsigned long a1, unsigned long long *a2, unsigned long a3) { unsigned long long v1; struct_0 *v2; if (a3) { *(a2) = recheck_bad_inode_checksum(a0->field_0, a1, a0, a2); v1 = *(a2); if (*(a2)) { v2 = a0; a0->field_48 = a0->field_48 | 1; } } return; }
SHELL_VAR * convert_var_to_array (var) SHELL_VAR *var; { char *oldval; ARRAY *array; oldval = ((var)->value); array = array_create (); if (oldval) array_insert (array, 0, oldval); do { if (((var)->value)) sh_xfree((((var)->value)), "arrayfunc.c", 88); } while (0); ((var)->value = (char *)(array)); var->dynamic_value = (sh_var_value_func_t *) ((void *)0) ; var->assign_func = (sh_var_assign_func_t *) ((void *)0) ; do { if ((var)->exportstr) { sh_xfree(((var)->exportstr), "arrayfunc.c", 95); (var)->exportstr = (char *) ((void *)0) ; } } while (0); if (((((var)->attributes) & (0x0000001)))) array_needs_making++; ((var)->attributes |= (0x0000004)); if (oldval) ((var)->attributes &= ~(0x0001000)); ((var)->attributes &= ~(0x0000040)); ((var)->attributes &= ~(0x0000800)); return var; }
int convert_var_to_array(struct_0 *a0) { unsigned long long v0; int tmp_17; int tmp_51; unsigned long long v1; unsigned long long v3; unsigned long long v4; v0 = a0->field_8; v1 = array_create(); if (v0) array_insert(v1, 0x0, v0); if (a0->field_8) sh_xfree(a0->field_8, "arrayfunc.c", 0x58); a0->field_8 = v1; a0->field_18 = 0; a0->field_20 = 0; if (a0->field_10) { sh_xfree(a0->field_10, "arrayfunc.c", 0x5f); a0->field_10 = 0; } if ((a0->field_28 & 1)) array_needs_making = array_needs_making + 1; a0->field_28 = a0->field_28 | 4; if (v0) { v3 = a0->field_28; *(&v3) = (a0->field_28 >> 8) & 239; tmp_17 = v3; a0->field_28 = tmp_17; } a0->field_28 = a0->field_28 & -65; v4 = a0->field_28; *(&v4) = (a0->field_28 >> 8) & 247; tmp_51 = v4; a0->field_28 = tmp_51; return a0; }
int safe_path(const char *name, struct stat *stp, const char *pw_dir, uid_t uid, char *err, size_t errlen) { char buf[ 4096 ], homedir[ 4096 ]; char *cp; int comparehome = 0; struct stat st; if (realpath(name, buf) == ((void *)0) ) { snprintf(err, errlen, "realpath %s failed: %s", name, strerror( (*__errno_location ()) )); return -1; } if (pw_dir != ((void *)0) && realpath(pw_dir, homedir) != ((void *)0) ) comparehome = 1; if (! (((( stp->st_mode )) & 0170000) == (0100000)) ) { snprintf(err, errlen, "%s is not a regular file", buf); return -1; } if ((!platform_sys_dir_uid(stp->st_uid) && stp->st_uid != uid) || (stp->st_mode & 022) != 0) { snprintf(err, errlen, "bad ownership or modes for file %s", buf); return -1; } for (;;) { if ((cp = dirname(buf)) == ((void *)0) ) { snprintf(err, errlen, "dirname() failed"); return -1; } strlcpy(buf, cp, sizeof(buf)); if (stat(buf, &st) == -1 || (!platform_sys_dir_uid(st.st_uid) && st.st_uid != uid) || (st.st_mode & 022) != 0) { snprintf(err, errlen, "bad ownership or modes for directory %s", buf); return -1; } if (comparehome && strcmp(homedir, buf) == 0) break; if ((strcmp("/", buf) == 0) || (strcmp(".", buf) == 0)) break; } return 0; }
undefined8 safe_path(char *param_1,long param_2,char *param_3,__uid_t param_4,char *param_5,size_t param_6) { bool bVar1; int iVar2; char *pcVar3; int *piVar4; undefined8 uVar5; long in_FS_OFFSET; stat local_20a8; char local_2018 [4096]; char local_1018 [4104]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); bVar1 = false; pcVar3 = realpath(param_1,local_2018); if (pcVar3 == (char *)0x0) { piVar4 = __errno_location(); pcVar3 = strerror(*piVar4); snprintf(param_5,param_6,"realpath %s failed: %s",param_1,pcVar3); uVar5 = 0xffffffff; } else { if ((param_3 != (char *)0x0) && (pcVar3 = realpath(param_3,local_1018), pcVar3 != (char *)0x0)) { bVar1 = true; } if ((*(uint *)(param_2 + 0x18) & 0xf000) == 0x8000) { iVar2 = platform_sys_dir_uid(*(undefined4 *)(param_2 + 0x1c)); if (((iVar2 == 0) && (param_4 != *(__uid_t *)(param_2 + 0x1c))) || ((*(uint *)(param_2 + 0x18) & 0x12) != 0)) { snprintf(param_5,param_6,"bad ownership or modes for file %s",local_2018); uVar5 = 0xffffffff; } else { do { pcVar3 = dirname(local_2018); if (pcVar3 == (char *)0x0) { snprintf(param_5,param_6,"dirname() failed"); uVar5 = 0xffffffff; goto LAB_00105f88; } strlcpy(local_2018,pcVar3,0x1000); iVar2 = stat(local_2018,&local_20a8); if (((iVar2 == -1) || ((iVar2 = platform_sys_dir_uid(local_20a8.st_uid), iVar2 == 0 && (param_4 != local_20a8.st_uid)))) || ((local_20a8.st_mode & 0x12) != 0)) { snprintf(param_5,param_6,"bad ownership or modes for directory %s",local_2018); uVar5 = 0xffffffff; goto LAB_00105f88; } } while (((!bVar1) || (iVar2 = strcmp(local_1018,local_2018), iVar2 != 0)) && ((iVar2 = strcmp("/",local_2018), iVar2 != 0 && (iVar2 = strcmp(".",local_2018), iVar2 != 0)))); uVar5 = 0; } } else { snprintf(param_5,param_6,"%s is not a regular file",local_2018); uVar5 = 0xffffffff; } } LAB_00105f88: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar5; } __stack_chk_fail(); }
static int do_switch(void *arg) { char *vrf = arg; return vrf_switch(vrf); }
void do_switch(undefined8 param_1) { vrf_switch(param_1); return; }
static void client_send_env(struct ssh *ssh, int id, const char *name, const char *val) { int r; sshlog("clientloop.c", __func__, 2457, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "channel %d: setting env %s = \"%s\"", id, name, val); channel_request_start(ssh, id, "env", 0); if ((r = sshpkt_put_cstring(ssh, name)) != 0 || (r = sshpkt_put_cstring(ssh, val)) != 0 || (r = sshpkt_send(ssh)) != 0) sshfatal("clientloop.c", __func__, 2462, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send setenv"); }
void client_send_env(undefined8 param_1,undefined4 param_2,undefined8 param_3,undefined8 param_4) { undefined8 uVar1; undefined8 uVar2; int local_c; sshlog("clientloop.c","client_send_env",0x999,0,5,0,"channel %d: setting env %s = \"%s\"",param_2, param_3,param_4); channel_request_start(param_1,param_2,&DAT_0010a58a,0); local_c = sshpkt_put_cstring(param_1,param_3); if (((local_c == 0) && (local_c = sshpkt_put_cstring(param_1,param_4), local_c == 0)) && (local_c = sshpkt_send(param_1), local_c == 0)) { return; } uVar2 = 0x107b11; uVar1 = ssh_err(local_c); sshfatal("clientloop.c","client_send_env",0x99e,1,1,uVar1,"send setenv",uVar2); return; }
int deflatePrime(strm, bits, value) z_streamp strm; int bits; int value; { deflate_state *s; int put; if (deflateStateCheck(strm)) return (-2); s = strm->state; if (bits < 0 || bits > 16 || s->sym_buf < s->pending_out + ((16 + 7) >> 3)) return (-5); do { put = 16 - s->bi_valid; if (put > bits) put = bits; s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid); s->bi_valid += put; _tr_flush_bits(s); value >>= put; bits -= put; } while (bits); return 0; }
undefined8 deflatePrime(long param_1,int param_2,uint param_3) { long lVar1; int iVar2; undefined8 uVar3; uint local_28; int local_24; int local_14; iVar2 = deflateStateCheck(param_1); if (iVar2 == 0) { lVar1 = *(long *)(param_1 + 0x38); if (((param_2 < 0) || (0x10 < param_2)) || (local_28 = param_3, local_24 = param_2, *(ulong *)(lVar1 + 0x1700) < *(long *)(lVar1 + 0x20) + 2U)) { uVar3 = 0xfffffffb; } else { do { local_14 = 0x10 - *(int *)(lVar1 + 0x1734); if (local_24 < local_14) { local_14 = local_24; } *(ushort *)(lVar1 + 0x1730) = *(ushort *)(lVar1 + 0x1730) | (ushort)(((1 << ((byte)local_14 & 0x1f)) - 1U & local_28) << ((byte)*(undefined4 *)(lVar1 + 0x1734) & 0x1f)); *(int *)(lVar1 + 0x1734) = *(int *)(lVar1 + 0x1734) + local_14; _tr_flush_bits(lVar1); local_28 = (int)local_28 >> ((byte)local_14 & 0x1f); local_24 = local_24 - local_14; } while (local_24 != 0); uVar3 = 0; } } else { uVar3 = 0xfffffffe; } return uVar3; }
static size_t plain_read (char *buf, size_t size) { size_t nr = safe_read ( 0 , buf, size); if (nr == ((size_t) -1)) ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"read error\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ()) , gettext ("read error")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , gettext ("read error")), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); return nr; }
int plain_read(unsigned long long a0, unsigned long long a1) { unsigned long v0; v0 = safe_read(0x0, a0, a1); if (v0 == -1) error(0x1, *(__errno_location()), gettext("read error")); return v0; }
static int alias_expand_line (count, ignore) int count, ignore; { char *new_line; new_line = alias_expand (rl_line_buffer); if (new_line) { set_up_new_line (new_line); return (0); } else { cleanup_expansion_error (); return (1); } }
long long alias_expand_line(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; unsigned long long v2; unsigned long long v4; v1 = a0; v0 = a1; v2 = alias_expand(rl_line_buffer); if (v2) { set_up_new_line(v2); v4 = 0; } else { cleanup_expansion_error(); v4 = 1; } return v4; }
size_t sshbuf_avail(const struct sshbuf *buf) { if (sshbuf_check_sanity(buf) != 0 || buf->readonly || buf->refcount > 1) return 0; return buf->max_size - (buf->size - buf->off); }
long sshbuf_avail(long param_1) { int iVar1; long lVar2; iVar1 = sshbuf_check_sanity(param_1); if (((iVar1 == 0) && (*(int *)(param_1 + 0x30) == 0)) && (*(uint *)(param_1 + 0x38) < 2)) { lVar2 = (*(long *)(param_1 + 0x10) - *(long *)(param_1 + 0x18)) + *(long *)(param_1 + 0x20); } else { lVar2 = 0; } return lVar2; }
static _Bool binop (char const *s) { return (((strcmp (s, "=") == 0)) || ((strcmp (s, "!=") == 0)) || ((strcmp (s, "==") == 0)) || ((strcmp (s, "-nt") == 0)) || ((strcmp (s, "-ot") == 0)) || ((strcmp (s, "-ef") == 0)) || ((strcmp (s, "-eq") == 0)) || ((strcmp (s, "-ne") == 0)) || ((strcmp (s, "-lt") == 0)) || ((strcmp (s, "-le") == 0)) || ((strcmp (s, "-gt") == 0)) || ((strcmp (s, "-ge") == 0))); }
undefined4 binop(char *param_1) { int iVar1; iVar1 = strcmp(param_1,"="); if (((((iVar1 != 0) && (iVar1 = strcmp(param_1,"!="), iVar1 != 0)) && (iVar1 = strcmp(param_1,"=="), iVar1 != 0)) && ((((iVar1 = strcmp(param_1,"-nt"), iVar1 != 0 && (iVar1 = strcmp(param_1,"-ot"), iVar1 != 0)) && ((iVar1 = strcmp(param_1,"-ef"), iVar1 != 0 && ((iVar1 = strcmp(param_1,"-eq"), iVar1 != 0 && (iVar1 = strcmp(param_1,"-ne"), iVar1 != 0)))))) && (iVar1 = strcmp(param_1,"-lt"), iVar1 != 0)))) && (((iVar1 = strcmp(param_1,"-le"), iVar1 != 0 && (iVar1 = strcmp(param_1,"-gt"), iVar1 != 0)) && (iVar1 = strcmp(param_1,"-ge"), iVar1 != 0)))) { return 0; } return 1; }
static int sshsig_parse_preamble(struct sshbuf *buf) { int r = -1; uint32_t sversion; if ((r = sshbuf_cmp(buf, 0, "SSHSIG", (sizeof("SSHSIG") - 1))) != 0 || (r = sshbuf_consume(buf, (sizeof("SSHSIG")-1))) != 0 || (r = sshbuf_get_u32(buf, &sversion)) != 0) { sshlog("sshsig.c", __func__, 234, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "Couldn't verify signature: invalid format"); return r; } if (sversion > 0x01) { sshlog("sshsig.c", __func__, 239, 0, SYSLOG_LEVEL_ERROR, ((void *)0) , "Signature version %lu is larger than supported " "version %u", (unsigned long)sversion, 0x01) ; return -4; } return 0; }
int sshsig_parse_preamble(unsigned long long a0) { unsigned long long v0; unsigned long v1; unsigned long long v2; char v3; unsigned int v4; unsigned int v6; v4 = -1; v4 = sshbuf_cmp(a0, 0x0, "SSHSIG", 0x6); if (!v4) { v4 = sshbuf_consume(a0, 0x6); if (!v4) { v4 = sshbuf_get_u32(a0, &v3, &v3); if (!v4) { if (*(&v3) > 1) { v2 = 1; v1 = *(&v3); v0 = "Signature version %lu is larger than supported version %u"; sshlog("sshsig.c", "sshsig_parse_preamble", 0xef, 0x0, 0x2, 0x0); v6 = -0x4; return v6; } v6 = 0; return v6; } } } v2 = "Couldn't verify signature: invalid format"; sshlog("sshsig.c", "sshsig_parse_preamble", 0xea, 0x0, 0x2, 0x0); v6 = v4; return v6; }
em_delete_next_word(EditLine *el, wint_t c __attribute__((__unused__))) { wchar_t *cp, *p, *kp; if (el->el_line.cursor == el->el_line.lastchar) return 6; cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (p = el->el_line.cursor, kp = el->el_chared.c_kill.buf; p < cp; p++) *kp++ = *p; el->el_chared.c_kill.last = kp; c_delafter(el, (int)(cp - el->el_line.cursor)); if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; return 4; }
long long em_delete_next_word(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned int *v1; unsigned long long v2; unsigned long v3; unsigned long long v5; unsigned int *v6; v0 = a1; if (a0->field_58 == a0->field_60) { v5 = 6; } else { v3 = c__next_word(a0->field_58, a0->field_60, a0->field_78, 0x500020); v1 = a0->field_58; for (v2 = a0->field_380; v1 < v3; v1 += 1) { v6 = v2; v2 += 4; *(v6) = *(v1); } a0->field_388 = v2; c_delafter(a0, v3 - a0->field_58 >> 2, v3 - a0->field_58 >> 2); if (a0->field_58 > a0->field_60) a0->field_58 = a0->field_60; v5 = 4; } return v5; }
static void unconsumed_option_push (struct name_elt *elt) { elt->next = ((void *)0) ; elt->prev = unconsumed_option_tail; if (unconsumed_option_tail) unconsumed_option_tail->next = elt; unconsumed_option_tail = elt; }
_QWORD * unconsumed_option_push(_QWORD *a1) { _QWORD *result; *a1 = 0LL; a1[1] = unconsumed_option_tail; if ( unconsumed_option_tail ) *(_QWORD *)unconsumed_option_tail = a1; result = a1; unconsumed_option_tail = (long)a1; return result; }
static unsigned int cols_ready_to_print (void) { COLUMN *q; unsigned int i; unsigned int n; n = 0; for (q = column_vector, i = 0; i < columns; ++q, ++i) if (q->status == OPEN || q->status == FF_FOUND || (storing_columns && q->lines_stored > 0 && q->lines_to_print > 0)) ++n; return n; }
long cols_ready_to_print() { unsigned int i; unsigned int v2; _DWORD *v3; v2 = 0; v3 = column_vector; for ( i = 0; i < columns; ++i ) { if ( v3[4] < 2u || storing_columns && (int)v3[11] > 0 && (int)v3[12] > 0 ) ++v2; v3 += 16; } return v2; }
static int extract_link (char *file_name, int typeflag) { _Bool interdir_made = 0 ; char const *link_name; int rc; struct delayed_link *dl; link_name = current_stat_info.link_name; if (! absolute_names_option && contains_dot_dot (link_name)) return create_placeholder_file (file_name, 0 , &interdir_made, ((void *)0) ); dl = find_delayed_link_source (link_name); if (dl) return create_placeholder_file (file_name, 0 , &interdir_made, dl); do { struct stat st1, st2; int e; int status = linkat (chdir_fd, link_name, chdir_fd, file_name, 0); e = (*__errno_location ()) ; if (status == 0) { struct delayed_link *ds = delayed_link_head; if (ds && fstatat (chdir_fd, link_name, &st1, 0x100 ) == 0) for (; ds; ds = ds->next) if (ds->change_dir == chdir_current && ds->dev == st1.st_dev && ds->ino == st1.st_ino && (timespec_cmp (ds->birthtime, get_stat_birthtime (&st1)) == 0)) { struct string_list *p = xmalloc ( __builtin_offsetof ( struct string_list , string ) + strlen (file_name) + 1); strcpy (p->string, file_name); p->next = ds->sources; ds->sources = p; break; } return 0; } else if ((e == 17 && strcmp (link_name, file_name) == 0) || ((fstatat (chdir_fd, link_name, &st1, 0x100 ) == 0) && (fstatat (chdir_fd, file_name, &st2, 0x100 ) == 0) && st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino)) return 0; (*__errno_location ()) = e; } while ((rc = maybe_recoverable (file_name, 0 , &interdir_made)) == 1); if (rc == 2) return 0; if (!(incremental_option && (*__errno_location ()) == 17 )) { link_error (link_name, file_name); return 1; } return 0; }
undefined8 extract_link(char *param_1) { char cVar1; int iVar2; undefined8 uVar3; int *piVar4; size_t sVar5; long in_FS_OFFSET; undefined auVar6 [16]; undefined local_165; int local_164; int local_160; int local_15c; undefined8 *local_158; char *local_150; long local_148; undefined8 *local_140; stat local_138; stat local_a8; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_165 = 0; local_150 = _free; if ((absolute_names_option == '\x01') || (cVar1 = contains_dot_dot(_free), cVar1 == '\0')) { local_148 = find_delayed_link_source(); if (local_148 == 0) { do { local_164 = linkat(chdir_fd,local_150,chdir_fd,param_1,0); piVar4 = __errno_location(); local_160 = *piVar4; if (local_164 == 0) { local_158 = delayed_link_head; if ((delayed_link_head == (undefined8 *)0x0) || (iVar2 = fstatat(chdir_fd,local_150,&local_138,0x100), iVar2 != 0)) goto LAB_001030d4; goto LAB_001030c6; } if (((local_160 == 0x11) && (iVar2 = strcmp(local_150,param_1), iVar2 == 0)) || (((iVar2 = fstatat(chdir_fd,local_150,&local_138,0x100), iVar2 == 0 && ((iVar2 = fstatat(chdir_fd,param_1,&local_a8,0x100), iVar2 == 0 && (local_138.st_dev == local_a8.st_dev)))) && (local_138.st_ino == local_a8.st_ino)))) { uVar3 = 0; goto LAB_00103206; } piVar4 = __errno_location(); *piVar4 = local_160; local_15c = maybe_recoverable(param_1,0,&local_165); } while (local_15c == 1); if (local_15c == 2) { uVar3 = 0; } else if ((incremental_option == '\x01') && (piVar4 = __errno_location(), *piVar4 == 0x11)) { uVar3 = 0; } else { link_error(local_150,param_1); uVar3 = 1; } } else { uVar3 = create_placeholder_file(param_1,0,&local_165,local_148); } } else { uVar3 = create_placeholder_file(param_1,0,&local_165,0); } LAB_00103206: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar3; } __stack_chk_fail(); LAB_001030c6: if (local_158 == (undefined8 *)0x0) goto LAB_001030d4; if (((*(int *)(local_158 + 0xb) == chdir_current) && (local_158[1] == local_138.st_dev)) && (local_158[2] == local_138.st_ino)) { auVar6 = get_stat_birthtime(&local_138); iVar2 = timespec_cmp(local_158[3],local_158[4],SUB168(auVar6,0),SUB168(auVar6 >> 0x40,0)); if (iVar2 == 0) { sVar5 = strlen(param_1); local_140 = (undefined8 *)xmalloc(sVar5 + 9); strcpy((char *)(local_140 + 1),param_1); *local_140 = local_158[0xc]; local_158[0xc] = local_140; goto LAB_001030d4; } } local_158 = (undefined8 *)*local_158; goto LAB_001030c6; LAB_001030d4: uVar3 = 0; goto LAB_00103206; }
static int store_nlmsg(struct nlmsghdr *n, void *arg) { struct nlmsg_chain *lchain = (struct nlmsg_chain *)arg; struct nlmsg_list *h; h = malloc(n->nlmsg_len+sizeof(void *)); if (h == ((void *)0) ) return -1; memcpy(&h->h, n, n->nlmsg_len); h->next = ((void *)0) ; if (lchain->tail) lchain->tail->next = h; else lchain->head = h; lchain->tail = h; ll_remember_index(n, ((void *)0) ); return 0; }
int store_nlmsg(unsigned int *a0, struct_0 *a1) { unsigned long long *v0; unsigned int v2; v0 = malloc(*(a0) + 8); if (!v0) { v2 = -1; } else { memcpy(v0 + 1, a0, *(a0)); *(v0) = 0; if (a1->field_8) a1->field_8->field_0 = v0; else a1->field_0 = v0; a1->field_8 = v0; ll_remember_index(a0, 0x0, v0); v2 = 0; } return v2; }
static void print_case_command (case_command) CASE_COM *case_command; { print_case_command_head (case_command); if (case_command->clauses) print_case_clauses (case_command->clauses); newline ("esac"); }
void print_case_command(struct_0 *a0) { unsigned long long v1; print_case_command_head(a0); if (a0->field_10) print_case_clauses(a0->field_10); v1 = newline("esac"); return; }
static void write_volume_label (void) { if (multi_volume_option) add_volume_label (); else _write_volume_label (volume_label_option); }
void write_volume_label() { unsigned long long v1; unsigned long long v2; if (multi_volume_option) v1 = add_volume_label(); else v2 = _write_volume_label(volume_label_option); return; }
static int skip_tag_name(const char **text_p, const char *token) { size_t len = strlen(token); const char *text = *text_p; do { while (*(text)==' ' || *(text)=='\t' || *(text)=='\n' || *(text)=='\r') (text)++; if (*(text)=='#') { while (*(text)!='\n' && *(text)!='\0') (text)++; } } while (0); if (strncmp(text, token, len) == 0) { text += len; goto delimiter; } if (*text == *token) { text++; goto delimiter; } return 0; delimiter: do { while (*(text)==' ' || *(text)=='\t' || *(text)=='\n' || *(text)=='\r') (text)++; if (*(text)=='#') { while (*(text)!='\n' && *(text)!='\0') (text)++; } } while (0); if (*text == ':') text++; *text_p = text; return 1; }
long skip_tag_name(char **a1, const char *a2) { char *s1; char *s1a; size_t n; n = strlen(a2); for ( s1 = *a1; *s1 == 32 || *s1 == 9 || *s1 == 10 || *s1 == 13; ++s1 ) ; if ( *s1 == 35 ) { while ( *s1 != 10 && *s1 ) ++s1; } if ( !strncmp(s1, a2, n) ) { s1a = &s1[n]; } else { if ( *s1 != *a2 ) return 0LL; s1a = s1 + 1; } while ( *s1a == 32 || *s1a == 9 || *s1a == 10 || *s1a == 13 ) ++s1a; if ( *s1a == 35 ) { while ( *s1a != 10 && *s1a ) ++s1a; } if ( *s1a == 58 ) ++s1a; *a1 = s1a; return 1LL; }
int do_handshake(socket_st * socket) { return -1; }
long long do_handshake(unsigned long a0) { unsigned long v0; v0 = a0; return 4294967295; }
static void process_sign_request2(SocketEntry *e) { u_char *signature = ((void *)0) ; size_t slen = 0; u_int compat = 0, flags; int r, ok = -1, retried = 0; char *fp = ((void *)0) , *pin = ((void *)0) , *prompt = ((void *)0) ; char *user = ((void *)0) , *sig_dest = ((void *)0) ; const char *fwd_host = ((void *)0) , *dest_host = ((void *)0) ; struct sshbuf *msg = ((void *)0) , *data = ((void *)0) , *sid = ((void *)0) ; struct sshkey *key = ((void *)0) , *hostkey = ((void *)0) ; struct identity *id; struct notifier_ctx *notifier = ((void *)0) ; sshlog("ssh-agent.c", __func__, 736, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "entering"); if ((msg = sshbuf_new()) == ((void *)0) || (data = sshbuf_new()) == ((void *)0) ) sshfatal("ssh-agent.c", __func__, 739, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "sshbuf_new failed"); if ((r = sshkey_froms(e->request, &key)) != 0 || (r = sshbuf_get_stringb(e->request, data)) != 0 || (r = sshbuf_get_u32(e->request, &flags)) != 0) { sshlog("ssh-agent.c", __func__, 743, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto send; } if ((id = lookup_identity(key)) == ((void *)0) ) { sshlog("ssh-agent.c", __func__, 748, 1, SYSLOG_LEVEL_VERBOSE, ((void *)0) , "%s key not found", sshkey_type(key)); goto send; } if ((fp = sshkey_fingerprint(key, 2, SSH_FP_DEFAULT)) == ((void *)0) ) sshfatal("ssh-agent.c", __func__, 753, 1, SYSLOG_LEVEL_FATAL, ((void *)0) , "fingerprint failed"); if (id->ndest_constraints != 0) { if (e->nsession_ids == 0) { sshlog("ssh-agent.c", __func__, 757, 1, SYSLOG_LEVEL_INFO, ((void *)0) , "refusing use of destination-constrained key " "to sign on unbound connection") ; goto send; } if (parse_userauth_request(data, key, &user, &sid, &hostkey) != 0) { sshlog("ssh-agent.c", __func__, 763, 1, SYSLOG_LEVEL_INFO, ((void *)0) , "refusing use of destination-constrained key " "to sign an unidentified signature") ; goto send; } sshlog("ssh-agent.c", __func__, 768, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "user=%s", user); if (identity_permitted(id, e, user, &fwd_host, &dest_host) != 0) goto send; if (buf_equal(sid, e->session_ids[e->nsession_ids - 1].sid) != 0) { sshlog("ssh-agent.c", __func__, 779, 1, SYSLOG_LEVEL_ERROR, ((void *)0) , "unexpected session ID (%zu listed) on " "signature request for target user %s with " "key %s %s", e->nsession_ids, user, sshkey_type(id->key), fp) ; goto send; } if (e->nsession_ids > 1 && hostkey == ((void *)0) ) { sshlog("ssh-agent.c", __func__, 791, 1, SYSLOG_LEVEL_ERROR, ((void *)0) , "refusing use of destination-constrained key: " "no hostkey recorded in signature for forwarded " "connection") ; goto send; } if (hostkey != ((void *)0) && !sshkey_equal(hostkey, e->session_ids[e->nsession_ids - 1].key)) { sshlog("ssh-agent.c", __func__, 798, 1, SYSLOG_LEVEL_ERROR, ((void *)0) , "refusing use of destination-constrained key: " "mismatch between hostkey in request and most " "recently bound session") ; goto send; } xasprintf(&sig_dest, "public key authentication request for " "user \"%s\" to listed host", user); } if (id->confirm && confirm_key(id, sig_dest) != 0) { sshlog("ssh-agent.c", __func__, 807, 1, SYSLOG_LEVEL_VERBOSE, ((void *)0) , "user refused key"); goto send; } if (sshkey_is_sk(id->key)) { if (restrict_websafe && strncmp(id->key->sk_application, "ssh:", 4) != 0 && !check_websafe_message_contents(key, data)) { goto send; } if (id->key->sk_flags & 0x01) { notifier = notify_start(0, "Confirm user presence for key %s %s%s%s", sshkey_type(id->key), fp, sig_dest == ((void *)0) ? "" : "\n", sig_dest == ((void *)0) ? "" : sig_dest); } } retry_pin: if ((r = sshkey_sign(id->key, &signature, &slen, sshbuf_ptr(data), sshbuf_len(data), agent_decode_alg(key, flags), id->sk_provider, pin, compat)) != 0) { sshlog("ssh-agent.c", __func__, 829, 1, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "sshkey_sign"); if (pin == ((void *)0) && !retried && sshkey_is_sk(id->key) && r == -43) { notify_complete(notifier, ((void *)0) ); notifier = ((void *)0) ; xasprintf(&prompt, "Enter PIN%sfor %s key %s: ", (id->key->sk_flags & 0x01) ? " and confirm user presence " : " ", sshkey_type(id->key), fp); pin = read_passphrase(prompt, 0x0008); retried = 1; goto retry_pin; } sshlog("ssh-agent.c", __func__, 843, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "sshkey_sign"); goto send; } ok = 0; send: sshlog("ssh-agent.c", __func__, 849, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0) , "good signature"); notify_complete(notifier, "User presence confirmed"); if (ok == 0) { if ((r = sshbuf_put_u8(msg, 14)) != 0 || (r = sshbuf_put_string(msg, signature, slen)) != 0) sshfatal("ssh-agent.c", __func__, 855, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose"); } else if ((r = sshbuf_put_u8(msg, 5)) != 0) sshfatal("ssh-agent.c", __func__, 857, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose failure"); if ((r = sshbuf_put_stringb(e->output, msg)) != 0) sshfatal("ssh-agent.c", __func__, 860, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "enqueue"); sshbuf_free(sid); sshbuf_free(data); sshbuf_free(msg); sshkey_free(key); sshkey_free(hostkey); free(fp); free(signature); free(sig_dest); free(user); free(prompt); if (pin != ((void *)0) ) freezero(pin, strlen(pin)); }
void process_sign_request2(unsigned long long a0[6]) { char v0; char v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; void* v7; void* v8; void* v9; void* v10; void* v11; void* v12; void* v13; void* v14; void* v15; void* v16; void* v17; void* v18; void* v19; void* v20; unsigned long long v21; struct_1 *v22; unsigned long long v23; unsigned long v24; unsigned long v25; void* v26; unsigned long long v27; unsigned long v28; char v29; unsigned long long v30; char v31; char v32; char v33; unsigned long long v34; unsigned long long v35; unsigned long long v36; unsigned long long v37; unsigned long long v38; unsigned long long v39; unsigned long long v40; unsigned long long v41; unsigned long long v42; unsigned long long v43; unsigned long long v44; unsigned long long v45; unsigned long long v46; unsigned long long *v47; unsigned long long v48; v7 = 0; v8 = 0; v6 = 0; v4 = -1; v5 = 0; v17 = 0; v18 = 0; v9 = 0; v10 = 0; v11 = 0; v12 = 0; v13 = 0; v20 = 0; v21 = 0; v14 = 0; v15 = 0; v16 = 0; v19 = 0; sshlog("ssh-agent.c", "process_sign_request2", 0x2e0, 0x1, 0x5, 0x0, "entering", *(&v0), *(&v1), a0, *(&v2)); v20 = sshbuf_new("ssh-agent.c", "process_sign_request2", 0x2e0, 0x1, 0x5, 0x0, *(&v29)); if (v20) v21 = sshbuf_new("ssh-agent.c", "process_sign_request2", 0x2e0, 0x1, 0x5, 0x0, *(&v29)); if (!v20 || !v21) sshfatal("ssh-agent.c", "process_sign_request2", 0x2e3, 0x1, 0x1, 0x0); v3 = sshkey_froms(a0[3], &v15, &v15); if (!v3) { v3 = sshbuf_get_stringb(a0[3], v21, v21); if (!v3) { v3 = sshbuf_get_u32(a0[3], &v2, &v2); if (!v3) { v22 = lookup_identity(v15); if (!v22) { v28 = sshkey_type(v15); v27 = "%s key not found"; sshlog("ssh-agent.c", "process_sign_request2", 0x2ec, 0x1, 0x4, 0x0, *(&v29), v30, *(&v31), *(&v32), *(&v33)); } else { v17 = sshkey_fingerprint(v15, 0x2, 0x0); if (!v17) { v27 = "fingerprint failed"; sshfatal("ssh-agent.c", "process_sign_request2", 0x2f1, 0x1, 0x1, 0x0); } if (v22->field_48) { if (!a0[4]) { v27 = "refusing use of destination-constrained key to sign on unbound connection"; sshlog("ssh-agent.c", "process_sign_request2", 0x2f5, 0x1, 0x3, 0x0, *(&v29), v30, *(&v31), *(&v32), *(&v33)); } else { v34 = parse_userauth_request(v21, v15, &v10, &v14, &v16); if (v34) { v27 = "refusing use of destination-constrained key to sign an unidentified signature"; sshlog("ssh-agent.c", "process_sign_request2", 0x2fb, 0x1, 0x3, 0x0, *(&v29), v30, *(&v31), *(&v32), *(&v33)); } else { v28 = v10; v27 = "user=%s"; sshlog("ssh-agent.c", "process_sign_request2", 0x300, 0x1, 0x5, 0x0, *(&v29), v30, *(&v31), *(&v32), *(&v33)); v35 = identity_permitted(v22, a0, v10, &v12, &v13); if (!v35) { v36 = buf_equal(v14, *((a0[4] * 24 - 24 + a0[5] + 8))); if (v36) { v27 = v17; v26 = sshkey_type(v22->field_10); v25 = v10; v24 = a0[4]; v23 = "unexpected session ID (%zu listed) on signature request for target user %s with key %s %s"; sshlog("ssh-agent.c", "process_sign_request2", 0x30b, 0x1, 0x2, 0x0, *(&v29), v30, *(&v31), *(&v32), *(&v33)); } else { if (a0[4] > 1 && !v16) { v27 = "refusing use of destination-constrained key: no hostkey recorded in signature for forwarded connection"; sshlog("ssh-agent.c", "process_sign_request2", 0x317, 0x1, 0x2, 0x0, *(&v29), v30, *(&v31), *(&v32), *(&v33)); } if ((a0[4] <= 1 || v16) && (!v16 || v37)) xasprintf(&v11, "public key authentication request for user \"%s\" to listed host", v10); if (v16) { v37 = sshkey_equal(v16, *((a0[4] * 24 - 24 + a0[5])), *((a0[4] * 24 - 24 + a0[5]))); if (!v37) { v27 = "refusing use of destination-constrained key: mismatch between hostkey in request and most recently bound session"; sshlog("ssh-agent.c", "process_sign_request2", 0x31e, 0x1, 0x2, 0x0, *(&v29), v30, *(&v31), *(&v32), *(&v33)); } } } } } } } if (!v22->field_48 || !v34 && !v36 && !v16 && a0[4] <= 1 && !v35 && a0[4] || !v34 && !v36 && !v35 && v37 && v16 && a0[4]) { if (v22->field_30) { v38 = confirm_key(v22, v11); if (v38) { v27 = "user refused key"; sshlog("ssh-agent.c", "process_sign_request2", 0x327, 0x1, 0x4, 0x0, *(&v29), v30, *(&v31), *(&v32), *(&v33)); } } if (!v38 || !v22->field_30) { v39 = sshkey_is_sk(v22->field_10); if (v39) { if (restrict_websafe) { v40 = strncmp(v22->field_10->field_60, "ssh:", 0x4); if (v40) v41 = check_websafe_message_contents(v15, v21); } if ((!v40 || !restrict_websafe || v41) && (v22->field_10->field_68 & 1)) { if (v11) v42 = v11; else v42 = &g_407fb9; if (!v11) v43 = &g_407fb9; else v43 = "\n"; v19 = notify_start(0x0, "Confirm user presence for key %s %s%s%s", sshkey_type(v22->field_10), v17, v43, v42); } } if (!v39 || !v40 || !restrict_websafe || v41) { while (true) { v27 = v6; v26 = v18; v25 = v22->field_38; v3 = sshkey_sign(v22->field_10, &v7, &v8, sshbuf_ptr(v21), sshbuf_len(v21), agent_decode_alg(v15, *(&(&v2)[4])), *(&v29), v30); if (v3) { v27 = "sshkey_sign"; sshlog("ssh-agent.c", "process_sign_request2", 0x33d, 0x1, 0x5, ssh_err(v3), *(&v29), v30, *(&v31), *(&v32), *(&v33)); if (!v18 && !v5) { v44 = sshkey_is_sk(v22->field_10); if (v44 && v3 == -43) { notify_complete(v19, 0x0); v19 = 0; sshkey_type(v22->field_10); if ((v22->field_10->field_68 & 1)) v45 = " and confirm user presence "; else v45 = " "; xasprintf(&v9, "Enter PIN%sfor %s key %s: ", v45); v18 = read_passphrase(v9, 0x8); v5 = 1; continue; } } if (!v44 || v18 || v5 || v3 != -43) { v27 = "sshkey_sign"; sshlog("ssh-agent.c", "process_sign_request2", 0x34b, 0x1, 0x2, ssh_err(v3), *(&v29), v30, *(&v31), *(&v32), *(&v33)); break; } } else { v4 = 0; break; } } } } } } } } } if (v3 || v3 || v3) { v27 = "parse"; sshlog("ssh-agent.c", "process_sign_request2", 0x2e7, 0x1, 0x2, ssh_err(v3), *(&v29), v30, *(&v31), *(&v32), *(&v33)); } v27 = "good signature"; sshlog("ssh-agent.c", "process_sign_request2", 0x351, 0x1, 0x5, 0x0, *(&v29), v30, *(&v31), *(&v32), *(&v33)); notify_complete(v19, "User presence confirmed"); if (!v4) { v3 = sshbuf_put_u8(v20, 0xe); if (!v3) v3 = sshbuf_put_string(v20, v7, v8, v7); if (v3 || v3) { v27 = "compose"; sshfatal("ssh-agent.c", "process_sign_request2", 0x357, 0x1, 0x1, ssh_err(v3)); } } if (v4 || v3 || v3) { v3 = sshbuf_put_u8(v20, 0x5); if (v3) { v27 = "compose failure"; sshfatal("ssh-agent.c", "process_sign_request2", 0x359, 0x1, 0x1, ssh_err(v3)); } } v3 = sshbuf_put_stringb(a0[2], v20, v20); if (v3) { v27 = "enqueue"; sshfatal("ssh-agent.c", "process_sign_request2", 0x35c, 0x1, 0x1, ssh_err(v3)); } sshbuf_free(v14); sshbuf_free(v21); sshbuf_free(v20); sshkey_free(v15); sshkey_free(v16); free(v17); free(v7); free(v11); free(v10); free(v9); if (v18) { v46 = strlen(v18); freezero(v18, v46, v46); } v48 = v23 ^ v47[5]; return; }
int strsnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags, const char *mbextra) { return istrsenvisxl(&mbdst, &dlen, mbsrc, flags, mbextra, ((void *)0) ); }
void strsnvis(undefined8 param_1,undefined8 param_2,undefined8 param_3,undefined4 param_4, undefined8 param_5) { undefined8 local_18; undefined8 local_10; local_18 = param_2; local_10 = param_1; istrsenvisxl(&local_10,&local_18,param_3,param_4,param_5,0); return; }
int main (int argc, char **argv) { int c; ; set_program_name (argv[0]); setlocale ( 6 , ""); bindtextdomain ("coreutils", "/usr/local/share/locale"); textdomain ("coreutils"); initialize_exit_failure (EXIT_CANCELED); atexit (close_stdout); while ((c = getopt_long (argc, argv, "+i:o:e:", longopts, ((void *)0) )) != -1) { int opt_fileno; switch (c) { case 'e': case 'i': case 'o': opt_fileno = optc_to_fileno (c); ((void) sizeof (( 0 <= opt_fileno && opt_fileno < (sizeof (stdbuf) / sizeof *(stdbuf)) ) ? 1 : 0), __extension__ ({ if ( 0 <= opt_fileno && opt_fileno < (sizeof (stdbuf) / sizeof *(stdbuf)) ) ; else __assert_fail ( "0 <= opt_fileno && opt_fileno < ARRAY_CARDINALITY (stdbuf)" , "src/stdbuf.c", 336, __extension__ __PRETTY_FUNCTION__); })) ; stdbuf[opt_fileno].optc = c; while (c_isspace (*optarg)) optarg++; stdbuf[opt_fileno].optarg = optarg; if (c == 'i' && *optarg == 'L') { error (0, 0, gettext ("line buffering stdin is meaningless")); usage (EXIT_CANCELED); } if (!(strcmp (optarg, "L") == 0) && parse_size (optarg, &stdbuf[opt_fileno].size) == -1) ((!!sizeof (struct { _Static_assert (EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext (\"invalid mode %s\"), quote (optarg)), assume (false))" ")"); int _gl_dummy; })) ? ((error (EXIT_CANCELED, (*__errno_location ()) , gettext ("invalid mode %s"), quote (optarg)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error (EXIT_CANCELED, (*__errno_location ()) , gettext ("invalid mode %s"), quote (optarg)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); break; case GETOPT_HELP_CHAR: usage ( 0 ); break;; case GETOPT_VERSION_CHAR: version_etc ( stdout , "stdbuf", "GNU coreutils", Version, ("Padraig Brady"), (char *) ((void *)0) ); exit ( 0 ); break;; default: usage (EXIT_CANCELED); } } argv += optind; argc -= optind; if (argc < 1) { error (0, 0, gettext ("missing operand")); usage (EXIT_CANCELED); } if (! set_libstdbuf_options ()) { error (0, 0, gettext ("you must specify a buffering mode option")); usage (EXIT_CANCELED); } set_program_path (program_name); if (!program_path) program_path = xstrdup ("/usr/local/lib/coreutils"); set_LD_PRELOAD (); free (program_path); execvp (*argv, argv); int exit_status = (*__errno_location ()) == 2 ? EXIT_ENOENT : EXIT_CANNOT_INVOKE; error (0, (*__errno_location ()) , gettext ("failed to run command %s"), quote (argv[0])); return exit_status; }
int main(unsigned long a0, char **a1) { unsigned long long *v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v7; unsigned long long v8; unsigned long long v9; v1 = a0; v0 = a1; set_program_name(*(v0)); setlocale(0x6, &g_4010ab); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); initialize_exit_failure(0x7d); atexit(got.close_stdout); while (true) { v2 = getopt_long(v1, v0, "+i:o:e:", &longopts, NULL); if (v2 != -1) { if (v2 <= 111) { if (v2 < 101) { if (v2 == -131) { version_etc(stdout, "stdbuf", "GNU coreutils", Version, "Padraig Brady", 0x0); exit(0x0); } if (v2 == -130) usage(0x0); } else if (((1 << ((v2 - 101) & 63)) & 1041)) { v4 = optc_to_fileno(v2); if (v4 >= 0 && v4 <= 2) { *(&(&g_400ee8)[3 * v4]) = v2; while (true) { if (!c_isspace(*(optarg))) break; optarg = optarg + 1; } (&g_400ef0)[3 * v4] = optarg; if (v2 == 105 && *(optarg) == 76) { error(0x0, 0x0, gettext("line buffering stdin is meaningless")); usage(0x7d); } if (v2 != 105 || *(optarg) != 76) { v7 = strcmp(optarg, "L"); if (!v7) continue; v7 = parse_size(optarg, &(&stdbuf)[3 * v4]); if (v7 != -1) continue; v8 = quote(optarg); error(0x7d, *(__errno_location()), gettext("invalid mode %s")); } } if (v4 < 0 || v4 > 2) __assert_fail(); } } if (v2 > 111 || !((1 << ((v2 - 101) & 63)) & 1041) && v2 >= 101 || v2 < 101 && v2 != -130 && v2 != -131) usage(0x7d); } else { v0 = &v0[optind]; v1 -= optind; if (v1 <= 0) { error(0x0, 0x0, gettext("missing operand")); usage(0x7d); } *(&v7) = set_libstdbuf_options() ^ 1; if (v7) { error(0x0, 0x0, gettext("you must specify a buffering mode option")); usage(0x7d); } set_program_path(program_name); if (program_path) break; if (!program_path) { program_path = xstrdup("/usr/local/lib/coreutils"); break; } } } set_LD_PRELOAD(); free(program_path); execvp(*(v0), v0); v7 = *(__errno_location()); if (v7 == 2) v7 = 127; else v7 = 126; v3 = v7; v9 = quote(*(v0)); error(0x0, *(__errno_location()), gettext("failed to run command %s")); return v3; }
static pid_t spawn(CHILD *ch, int *res) { char *args[16]; char buf[136]; int f, st; char *ptr; time_t t; int oldAlarm; char *proc = ch->process; pid_t pid, pgrp; sigset_t nmask, omask; struct sigaction sa; *res = -1; buf[sizeof(buf) - 1] = 0; if (proc[0] == '+') proc++; ch->flags |= 128; if (ch->action == 1 || ch->action == 11) { time(&t); if (ch->tm + 120 > t) { ch->count++; } else { ch->count = 0; ch->tm = t; } if (ch->count >= 10) { initlog((1|2), "Id \"%s\" respawning too fast: disabled for %d minutes", ch->id, 300 / 60); ch->flags &= ~2; ch->flags |= 16; ch->tm = t; oldAlarm = alarm(0); if (oldAlarm > 300 || oldAlarm <= 0) oldAlarm = 300; alarm(oldAlarm); return(-1); } } if (access("/etc/initscript", 4 ) == 0 && runlevel != 'S') { args[1] = "/bin/sh"; args[2] = "/etc/initscript"; args[3] = ch->id; args[4] = ch->rlevel; args[5] = "unknown"; for(f = 0; actions[f].name; f++) { if (ch->action == actions[f].act) { args[5] = actions[f].name; break; } } if (proc[0] == '@') proc++; args[6] = proc; args[7] = ((void *)0) ; } else if ( (strpbrk(proc, "~`!$^&*()=|\\{}[];\"'<>?")) && (proc[0] != '@') ){ args[1] = "/bin/sh"; args[2] = "-c"; strcpy(buf, "exec "); strncat(buf, proc, sizeof(buf) - strlen(buf) - 1); args[3] = buf; args[4] = ((void *)0) ; } else { buf[0] = 0; if (proc[0] == '@') proc++; strncat(buf, proc, sizeof(buf) - 1); ptr = buf; for(f = 1; f < 15; f++) { while(*ptr == ' ' || *ptr == '\t') ptr++; args[f] = ptr; if (*ptr == 0) break; while(*ptr && *ptr != ' ' && *ptr != '\t' && *ptr != '#') ptr++; if (*ptr == '#' || *ptr == 0) { f++; *ptr = 0; break; } *ptr++ = 0; } args[f] = ((void *)0) ; } args[0] = args[1]; while(1) { sigemptyset(&nmask); sigaddset(&nmask, 17 ); sigprocmask( 0 , &nmask, &omask); if ((pid = fork()) == 0) { close(0); close(1); close(2); if (pipe_fd >= 0) { close(pipe_fd); pipe_fd = -1; } sigprocmask( 2 , &omask, ((void *)0) ); if (strchr("*#sS", runlevel) && ch->flags & 32) { int ftty; setsid(); if ((ftty = console_open( 02 | 0400 )) >= 0) { (void)ioctl(ftty, 0x540E , 1); if(dup(ftty) < 0){ initlog((1|2), "cannot duplicate console fd"); } if(dup(ftty) < 0){ initlog((1|2), "cannot duplicate console fd"); } } do { memset(&sa, 0, sizeof(sa)); sa. __sigaction_handler.sa_handler = ((__sighandler_t) 0) ; sa.sa_flags = 0x10000000 ; sigemptyset(&sa.sa_mask); sigaction( 17 , &sa, ((void *)0) ); } while(0); if ((pid = fork()) < 0) { initlog((1|2), "cannot fork: %s", strerror( (*__errno_location ()) )); exit(1); } if (pid > 0) { pid_t rc; do { memset(&sa, 0, sizeof(sa)); sa. __sigaction_handler.sa_handler = ((__sighandler_t) 1) ; sa.sa_flags = 0x10000000 ; sigemptyset(&sa.sa_mask); sigaction( 2 , &sa, ((void *)0) ); } while(0); do { memset(&sa, 0, sizeof(sa)); sa. __sigaction_handler.sa_handler = ((__sighandler_t) 1) ; sa.sa_flags = 0x10000000 ; sigemptyset(&sa.sa_mask); sigaction( 20 , &sa, ((void *)0) ); } while(0); do { memset(&sa, 0, sizeof(sa)); sa. __sigaction_handler.sa_handler = ((__sighandler_t) 1) ; sa.sa_flags = 0x10000000 ; sigemptyset(&sa.sa_mask); sigaction( 3 , &sa, ((void *)0) ); } while(0); while ((rc = waitpid(pid, &st, 0)) != pid) if (rc < 0 && (*__errno_location ()) == 10 ) break; pgrp = tcgetpgrp(ftty); if (pgrp != getpid()) exit(0); if ((pid = fork()) < 0) { initlog((1|2), "cannot fork: %s", strerror( (*__errno_location ()) )); exit(1); } if (pid == 0) { setsid(); (void)ioctl(ftty, 0x540E , 1); exit(0); } while((rc = waitpid(pid, &st, 0)) != pid) if (rc < 0 && (*__errno_location ()) == 10 ) break; exit(0); } console_stty(); } else { int fd; setsid(); if ((fd = console_open( 02 | 0400 )) < 0) { initlog((1|2), "open(%s): %s", console_dev, strerror( (*__errno_location ()) )); fd = open("/dev/null", 02 ); } if(dup(fd) < 0) { initlog((1|2), "cannot duplicate /dev/null fd"); } if(dup(fd) < 0) { initlog((1|2), "cannot duplicate /dev/null fd"); } } if (ch->process[0] != '+') write_utmp_wtmp("", ch->id, getpid(), 5 , ""); for(f = 1; f < (64 + 1) ; f++) do { memset(&sa, 0, sizeof(sa)); sa. __sigaction_handler.sa_handler = ((__sighandler_t) 0) ; sa.sa_flags = 0x10000000 ; sigemptyset(&sa.sa_mask); sigaction(f, &sa, ((void *)0) ); } while(0); environ = init_buildenv(1); execvp(args[1], args + 1); if ( (*__errno_location ()) == 8 ) { args[1] = "/bin/sh"; args[2] = "-c"; strcpy(buf, "exec "); strncat(buf, proc, sizeof(buf) - strlen(buf) - 1); args[3] = buf; args[4] = ((void *)0) ; execvp(args[1], args + 1); } initlog((1|2), "cannot execute \"%s\"", args[1]); if (ch->process[0] != '+') write_utmp_wtmp("", ch->id, getpid(), 8 , ((void *)0) ); exit(1); } *res = pid; sigprocmask( 2 , &omask, ((void *)0) ); ; if (pid == -1) { initlog((1|2), "cannot fork, retry.."); do_msleep(5000); continue; } return(pid); } }
int spawn(uint *param_1,__pid_t *param_2) { int iVar1; __pid_t _Var2; char *pcVar3; int *piVar4; size_t sVar5; long in_FS_OFFSET; int local_2f0; int local_2ec; uint local_2e8; int local_2e4; __pid_t local_2e0; int local_2dc; __pid_t local_2d8; __pid_t local_2d4; long local_2d0; uint *local_2c8; uint *local_2c0; uint *local_2b8 [16]; sigset_t local_238; sigset_t local_1b8; sigaction local_138; uint local_98 [33]; undefined local_11; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_2c0 = param_1 + 0xd; *param_2 = -1; local_11 = 0; if (*(char *)local_2c0 == '+') { local_2c0 = (uint *)((long)param_1 + 0x35); } *param_1 = *param_1 | 0x80; if ((param_1[0xc] == 1) || (param_1[0xc] == 0xb)) { time(&local_2d0); if (*(long *)(param_1 + 4) + 0x77 < local_2d0) { param_1[6] = 0; *(long *)(param_1 + 4) = local_2d0; } else { param_1[6] = param_1[6] + 1; } if (9 < (int)param_1[6]) { initlog(3,"Id \"%s\" respawning too fast: disabled for %d minutes",param_1 + 7,5); *param_1 = *param_1 & 0xfffffffd; *param_1 = *param_1 | 0x10; *(long *)(param_1 + 4) = local_2d0; local_2e8 = alarm(0); if ((300 < (int)local_2e8) || ((int)local_2e8 < 1)) { local_2e8 = 300; } alarm(local_2e8); iVar1 = -1; LAB_00102aae: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar1; } __stack_chk_fail(); } } iVar1 = access("/etc/initscript",4); if ((iVar1 == 0) && (runlevel != 'S')) { local_2b8[1] = (uint *)0x1073f5; local_2b8[2] = (uint *)0x1073e5; local_2b8[3] = param_1 + 7; local_2b8[4] = param_1 + 9; local_2b8[5] = (uint *)0x1073fd; local_2ec = 0; while (*(long *)(actions + (long)local_2ec * 0x10) != 0) { if (param_1[0xc] == *(uint *)(actions + (long)local_2ec * 0x10 + 8)) { local_2b8[5] = *(uint **)(actions + (long)local_2ec * 0x10); break; } local_2ec = local_2ec + 1; } if (*(char *)local_2c0 == '@') { local_2c0 = (uint *)((long)local_2c0 + 1); } local_2b8[6] = local_2c0; local_2b8[7] = (uint *)0x0; } else { pcVar3 = strpbrk((char *)local_2c0,"~`!$^&*()=|\\{}[];\"\'<>?"); if ((pcVar3 == (char *)0x0) || (*(char *)local_2c0 == '@')) { local_98[0]._0_1_ = 0; if (*(char *)local_2c0 == '@') { local_2c0 = (uint *)((long)local_2c0 + 1); } strncat((char *)local_98,(char *)local_2c0,0x87); local_2c8 = local_98; for (local_2ec = 1; local_2ec < 0xf; local_2ec = local_2ec + 1) { for (; (*(char *)local_2c8 == ' ' || (*(char *)local_2c8 == '\t')); local_2c8 = (uint *)((long)local_2c8 + 1)) { } local_2b8[local_2ec] = local_2c8; if (*(char *)local_2c8 == '\0') break; for (; (((*(char *)local_2c8 != '\0' && (*(char *)local_2c8 != ' ')) && (*(char *)local_2c8 != '\t')) && (*(char *)local_2c8 != '#')); local_2c8 = (uint *)((long)local_2c8 + 1)) { } if ((*(char *)local_2c8 == '#') || (*(char *)local_2c8 == '\0')) { local_2ec = local_2ec + 1; *(char *)local_2c8 = '\0'; break; } *(char *)local_2c8 = '\0'; local_2c8 = (uint *)((long)local_2c8 + 1); } local_2b8[local_2ec] = (uint *)0x0; } else { local_2b8[1] = (uint *)0x1073f5; local_2b8[2] = (uint *)0x10741c; strcpy((char *)local_98,"exec "); sVar5 = strlen((char *)local_98); strncat((char *)local_98,(char *)local_2c0,0x87 - sVar5); local_2b8[3] = local_98; local_2b8[4] = (uint *)0x0; } } local_2b8[0] = local_2b8[1]; while( true ) { sigemptyset(&local_238); sigaddset(&local_238,0x11); sigprocmask(0,&local_238,&local_1b8); local_2e0 = fork(); if (local_2e0 == 0) break; *param_2 = local_2e0; sigprocmask(2,&local_1b8,(sigset_t *)0x0); iVar1 = local_2e0; if (local_2e0 != -1) goto LAB_00102aae; initlog(3,"cannot fork, retry.."); do_msleep(5000); } close(0); close(1); close(2); if (-1 < pipe_fd) { close(pipe_fd); pipe_fd = -1; } sigprocmask(2,&local_1b8,(sigset_t *)0x0); pcVar3 = strchr("*#sS",(int)runlevel); if ((pcVar3 == (char *)0x0) || ((*param_1 & 0x20) == 0)) { setsid(); local_2e4 = console_open(); if (local_2e4 < 0) { piVar4 = __errno_location(); pcVar3 = strerror(*piVar4); initlog(3,"open(%s): %s",console_dev,pcVar3); local_2e4 = open("/dev/null",2); } iVar1 = dup(local_2e4); if (iVar1 < 0) { initlog(3,"cannot duplicate /dev/null fd"); } iVar1 = dup(local_2e4); if (iVar1 < 0) { initlog(3,"cannot duplicate /dev/null fd"); } } else { setsid(); local_2dc = console_open(); if (-1 < local_2dc) { ioctl(local_2dc,0x540e,1); iVar1 = dup(local_2dc); if (iVar1 < 0) { initlog(3,"cannot duplicate console fd"); } iVar1 = dup(local_2dc); if (iVar1 < 0) { initlog(3,"cannot duplicate console fd"); } } memset(&local_138,0,0x98); local_138.__sigaction_handler = 0; local_138.sa_flags = 0x10000000; sigemptyset(&local_138.sa_mask); sigaction(0x11,&local_138,(sigaction *)0x0); local_2e0 = fork(); if (local_2e0 < 0) { piVar4 = __errno_location(); pcVar3 = strerror(*piVar4); initlog(3,"cannot fork: %s",pcVar3); exit(1); } if (0 < local_2e0) { memset(&local_138,0,0x98); local_138.__sigaction_handler = 1; local_138.sa_flags = 0x10000000; sigemptyset(&local_138.sa_mask); sigaction(2,&local_138,(sigaction *)0x0); memset(&local_138,0,0x98); local_138.__sigaction_handler = 1; local_138.sa_flags = 0x10000000; sigemptyset(&local_138.sa_mask); sigaction(0x14,&local_138,(sigaction *)0x0); memset(&local_138,0,0x98); local_138.__sigaction_handler = 1; local_138.sa_flags = 0x10000000; sigemptyset(&local_138.sa_mask); sigaction(3,&local_138,(sigaction *)0x0); do { local_2d8 = waitpid(local_2e0,&local_2f0,0); if (local_2d8 == local_2e0) break; } while ((-1 < local_2d8) || (piVar4 = __errno_location(), *piVar4 != 10)); local_2d4 = tcgetpgrp(local_2dc); _Var2 = getpid(); if (local_2d4 != _Var2) { exit(0); } local_2e0 = fork(); if (local_2e0 < 0) { piVar4 = __errno_location(); pcVar3 = strerror(*piVar4); initlog(3,"cannot fork: %s",pcVar3); exit(1); } if (local_2e0 == 0) { setsid(); ioctl(local_2dc,0x540e,1); exit(0); } do { local_2d8 = waitpid(local_2e0,&local_2f0,0); if (local_2d8 == local_2e0) break; } while ((-1 < local_2d8) || (piVar4 = __errno_location(), *piVar4 != 10)); exit(0); } console_stty(); } if (*(char *)(param_1 + 0xd) != '+') { _Var2 = getpid(); write_utmp_wtmp(&DAT_00107481,param_1 + 7,_Var2,5,&DAT_00107481); } for (local_2ec = 1; local_2ec < 0x41; local_2ec = local_2ec + 1) { memset(&local_138,0,0x98); local_138.__sigaction_handler = 0; local_138.sa_flags = 0x10000000; sigemptyset(&local_138.sa_mask); sigaction(local_2ec,&local_138,(sigaction *)0x0); } environ = init_buildenv(1); execvp((char *)local_2b8[1],(char **)(local_2b8 + 1)); piVar4 = __errno_location(); if (*piVar4 == 8) { local_2b8[1] = (uint *)0x1073f5; local_2b8[2] = (uint *)0x10741c; strcpy((char *)local_98,"exec "); sVar5 = strlen((char *)local_98); strncat((char *)local_98,(char *)local_2c0,0x87 - sVar5); local_2b8[3] = local_98; local_2b8[4] = (uint *)0x0; execvp((char *)local_2b8[1],(char **)(local_2b8 + 1)); } initlog(3,"cannot execute \"%s\"",local_2b8[1]); if (*(char *)(param_1 + 0xd) != '+') { _Var2 = getpid(); write_utmp_wtmp(&DAT_00107481,param_1 + 7,_Var2,8,0); } exit(1); }
static _Bool all_digits_p (char const *s) { size_t n = strlen (s); return ((unsigned int) (s[0]) - '0' <= 9) && n == strspn (s, "0123456789"); }
int all_digits_p(char *a0) { unsigned long v0; unsigned int v2; unsigned int v3; v0 = strlen(a0); if (*(a0) - 48 <= 9 && v0 == strspn(a0, "0123456789")) { v2 = 1; goto LABEL_40156d; } v2 = 0; LABEL_40156d: v3 = v2 & 1; return v3; }
static _Bool parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr) { options.stay_on_filesystem = 1 ; return parse_noop (entry, argv, arg_ptr); }
long long parse_xdev(unsigned long long a0, unsigned long long a1, unsigned long long a2) { g_500015 = 1; return parse_noop(a0, a1, a2); }
int rl_delete_text (int from, int to) { register char *text; register int diff, i; if (from > to) do { int t; t = from; from = to; to = t; } while (0); if (to > rl_end) { to = rl_end; if (from > to) from = to; } if (from < 0) from = 0; text = rl_copy_text (from, to); diff = to - from; for (i = from; i < rl_end - diff; i++) rl_line_buffer[i] = rl_line_buffer[i + diff]; if (_rl_doing_an_undo == 0) rl_add_undo (UNDO_DELETE, from, to, text); else xfree (text); rl_end -= diff; rl_line_buffer[rl_end] = '\0'; _rl_fix_mark (); return (diff); }
int rl_delete_text(int param_1,int param_2) { int iVar1; undefined8 uVar2; int iVar3; int local_40; int local_3c; local_40 = param_2; local_3c = param_1; if (param_2 < param_1) { local_40 = param_1; local_3c = param_2; } if ((rl_end < local_40) && (local_40 = rl_end, rl_end < local_3c)) { local_3c = rl_end; } if (local_3c < 0) { local_3c = 0; } uVar2 = rl_copy_text(local_3c,local_40); iVar1 = local_40 - local_3c; for (iVar3 = local_3c; iVar3 < rl_end - iVar1; iVar3 = iVar3 + 1) { *(undefined *)(iVar3 + rl_line_buffer) = *(undefined *)((iVar3 + iVar1) + rl_line_buffer); } if (_rl_doing_an_undo == 0) { rl_add_undo(0,local_3c,local_40,uVar2); } else { xfree(uVar2); } rl_end = rl_end - iVar1; *(undefined *)(rl_end + rl_line_buffer) = 0; _rl_fix_mark(); return iVar1; }
int main (int argc, char **argv) { ; set_program_name (argv[0]); setlocale ( 6 , ""); bindtextdomain ("coreutils", "/usr/local/share/locale"); textdomain ("coreutils"); atexit (close_stdout); parse_gnu_standard_options_only (argc, argv, "yes", "GNU coreutils", Version, 1 , usage, ("David MacKenzie"), (char const *) ((void *)0) ); char **operands = argv + optind; char **operand_lim = argv + argc; if (optind == argc) *operand_lim++ = bad_cast ("y"); size_t bufalloc = 0; _Bool reuse_operand_strings = 1 ; char **operandp = operands; do { size_t operand_len = strlen (*operandp); bufalloc += operand_len + 1; if (operandp + 1 < operand_lim && *operandp + operand_len + 1 != operandp[1]) reuse_operand_strings = 0 ; } while (++operandp < operand_lim); if (bufalloc <= 8192 / 2) { bufalloc = 8192 ; reuse_operand_strings = 0 ; } char *buf = reuse_operand_strings ? *operands : xmalloc (bufalloc); size_t bufused = 0; operandp = operands; do { size_t operand_len = strlen (*operandp); if (! reuse_operand_strings) memcpy (buf + bufused, *operandp, operand_len); bufused += operand_len; buf[bufused++] = ' '; } while (++operandp < operand_lim); buf[bufused - 1] = '\n'; size_t copysize = bufused; for (size_t copies = bufalloc / copysize; --copies; ) { memcpy (buf + bufused, buf, copysize); bufused += copysize; } while (full_write ( 1 , buf, bufused) == bufused) continue; error (0, (*__errno_location ()) , gettext ("standard output")); return 1 ; }
undefined8 main(int param_1,undefined8 *param_2) { long lVar1; bool bVar2; char **ppcVar3; char **ppcVar4; char *pcVar5; size_t sVar6; ulong uVar7; int *piVar8; undefined8 uVar9; char **local_68; ulong local_60; char **local_58; ulong local_50; ulong local_48; set_program_name(*param_2); setlocale(6,""); bindtextdomain("coreutils","/usr/local/share/locale"); textdomain("coreutils"); uVar9 = 0x1003d7; atexit(p_Ram00000000001003cf); parse_gnu_standard_options_only (param_1,param_2,&DAT_001008d1,"GNU coreutils",Version,1,usage,"David MacKenzie",0,uVar9 ); ppcVar3 = (char **)(param_2 + optind); ppcVar4 = (char **)(param_2 + param_1); local_68 = ppcVar4; if (param_1 == optind) { local_68 = ppcVar4 + 1; pcVar5 = (char *)bad_cast(&DAT_001008fd); *ppcVar4 = pcVar5; } local_60 = 0; bVar2 = true; local_58 = ppcVar3; do { sVar6 = strlen(*local_58); local_60 = local_60 + sVar6 + 1; if ((local_58 + 1 < local_68) && (*local_58 + sVar6 + 1 != local_58[1])) { bVar2 = false; } local_58 = local_58 + 1; } while (local_58 < local_68); if (local_60 < 0x1001) { local_60 = 0x2000; bVar2 = false; } if (bVar2) { pcVar5 = *ppcVar3; } else { pcVar5 = (char *)xmalloc(local_60); } local_50 = 0; local_58 = ppcVar3; do { sVar6 = strlen(*local_58); if (!bVar2) { memcpy(pcVar5 + local_50,*local_58,sVar6); } lVar1 = local_50 + sVar6; uVar7 = lVar1 + 1; pcVar5[lVar1] = ' '; local_58 = local_58 + 1; local_50 = uVar7; } while (local_58 < local_68); pcVar5[lVar1] = '\n'; local_48 = local_60 / uVar7; while (local_48 = local_48 - 1, local_48 != 0) { memcpy(pcVar5 + local_50,pcVar5,uVar7); local_50 = local_50 + uVar7; } do { uVar7 = full_write(1,pcVar5,local_50); } while (local_50 == uVar7); uVar9 = gettext("standard output"); piVar8 = __errno_location(); error(0,*piVar8,uVar9); return 1; }
static int check_selinux_attr (char const *name, struct error_context *ctx) { return strncmp (name, "" "security.selinux" "", sizeof ("security.selinux") - 1) && attr_copy_check_permissions (name, ctx); }
long long check_selinux_attr(char *a0, unsigned long long a1) { unsigned long long v1; if (!strncmp(a0, "security.selinux", 0x10)) { v1 = 0; return v1; } else if (!attr_copy_check_permissions(a0, a1, a1)) { v1 = 0; return v1; } else { v1 = 1; return v1; } }
int serial_decode(const char *input, gnutls_datum_t *output) { int i; int64_t value; char *endptr; int64_t value_limit; gnutls_datum_t input_datum; if (input[0] == '0' && input[1] == 'x') { input_datum.data = (void *) (input + 2); input_datum.size = strlen(input + 2); if (input_datum.size == 0) { return -302; } return gnutls_hex_decode2(&input_datum, output); } value = strtoll(input, &endptr, 10); value_limit = 0x7fffffffffffffffLL; if (*endptr != '\0') { fprintf( stderr , "Trailing garbage: `%s'\n", endptr); return -302; } if (value <= 0 || value >= value_limit) { fprintf( stderr , "Integer out of range: `%s' (min: 1, max: %" "l" "d" ")\n", input, value_limit-1); return -302; } output->size = sizeof(int64_t); output->data = gnutls_malloc(output->size); if (output->data == ((void *)0) ) { output->size = 0; return -25; } for (i = output->size - 1; i >= 0; i--) { output->data[i] = value & 0xff; value = value >> 8; } return 0; }
long serial_decode(long a1, long a2) { int i; long v4; char *endptr; unsigned long v7; v7 = __readfsqword(0x28u); if ( *(_BYTE *)a1 == 48 && *(_BYTE *)(a1 + 1) == 120 ) { endptr = (char *)(a1 + 2); if ( (unsigned int)strlen((const char *)(a1 + 2)) ) return gnutls_hex_decode2(&endptr, a2); else return 4294966994LL; } else { v4 = strtoll((const char *)a1, &endptr, 10); if ( *endptr ) { fprintf(stderr, "Trailing garbage: `%s'\n", endptr); return 4294966994LL; } else if ( v4 <= 0 || v4 == 0x7FFFFFFFFFFFFFFFLL ) { fprintf(stderr, "Integer out of range: `%s' (min: 1, max: %ld)\n", (const char *)a1, 0x7FFFFFFFFFFFFFFELL); return 4294966994LL; } else { *(_DWORD *)(a2 + 8) = 8; *(_QWORD *)a2 = gnutls_malloc(*(unsigned int *)(a2 + 8)); if ( *(_QWORD *)a2 ) { for ( i = *(_DWORD *)(a2 + 8) - 1; i >= 0; --i ) { *(_BYTE *)(*(_QWORD *)a2 + i) = v4; v4 >>= 8; } return 0LL; } else { *(_DWORD *)(a2 + 8) = 0; return 4294967271LL; } } } }
static _Bool parse_or (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; (void) argv; (void) arg_ptr; our_pred = get_new_pred_noarg (entry); our_pred->pred_func = pred_or; our_pred->p_type = BI_OP; our_pred->p_prec = OR_PREC; our_pred->need_stat = our_pred->need_type = 0 ; return 1 ; }
long long parse_or(unsigned long long a0, unsigned long a1, unsigned long a2) { unsigned long v0; unsigned long v1; struct_0 *v2; v1 = a1; v0 = a2; v2 = get_new_pred_noarg(a0); v2->field_0 = got.pred_or; v2->field_10 = 3; v2->field_14 = 2; v2->field_1b = 0; v2->field_1a = v2->field_1b; return 1; }
size_t strlens(const char *last, ...) { va_list ap; size_t ret = 0; const char *str; __builtin_va_start( ap , last ) ; for (str = last; str != ((void *)0) ; str = __builtin_va_arg( ap , const char * ) ) ret += strlen(str); __builtin_va_end( ap ) ; return (ret); }
long long strlens() { void* v0; char *v1; unsigned int v2; unsigned int v3; unsigned long v4; unsigned long v5; unsigned long v6; char v7; unsigned long v8; unsigned long v9; unsigned long v10; unsigned long v11; int v12; int v13; int v14; int v15; int v16; int v17; int v18; int v19; unsigned long v20; unsigned long v21; unsigned long v22; unsigned long v23; unsigned long v24; char v25; int v26; int v27; int v28; int v29; int v30; int v31; int v32; int v33; unsigned long long *v34; char *v35; char *v36; v8 = v21; v9 = v22; v10 = v23; v11 = v24; if (v25) { v12 = v26; v13 = v27; v14 = v28; v15 = v29; v16 = v30; v17 = v31; v18 = v32; v19 = v33; } v6 = v34[5]; v0 = 0; v2 = 8; v3 = 48; v4 = &v20; v5 = &v7; for (v1 = v35; v1; v1 = v36) { v0 += strlen(v1); if (v2 > 47) v4 += 8; else v2 += 8; } if ((v6 ^ v34[5])) __stack_chk_fail(); return v0; }
static int ct_conv_cbuff_resize(ct_buffer_t *conv, size_t csize) { void *p; if (csize <= conv->csize) return 0; conv->csize = csize; p = realloc(conv->cbuff, conv->csize * sizeof(*conv->cbuff)); if (p == ((void *)0) ) { conv->csize = 0; free(conv->cbuff); conv->cbuff = ((void *)0) ; return -1; } conv->cbuff = p; return 0; }
int ct_conv_cbuff_resize(unsigned long long a0[2], unsigned long a1) { unsigned long v0; unsigned int v2; if (a1 <= a0[1]) { v2 = 0; return v2; } a0[1] = a1; v0 = realloc(a0[0], a0[1]); if (v0) { a0[0] = v0; v2 = 0; return v2; } a0[1] = 0; free(a0[0]); a0[0] = 0; v2 = -1; return v2; }