Fix another #642 thingie : listen disabled in sandbox
- Fix a bug in RSocket API
This commit is contained in:
parent
0a6f820489
commit
f5b14d2616
|
@ -574,15 +574,16 @@ int main(int argc, char **argv, char **envp) {
|
|||
r_list_free (cmds);
|
||||
/////
|
||||
if (r_config_get_i (r.config, "scr.prompt"))
|
||||
if (run_rc && r_config_get_i (r.config, "cfg.fortunes")) {
|
||||
r_core_cmd (&r, "fo", 0);
|
||||
r_cons_flush ();
|
||||
}
|
||||
if (run_rc && r_config_get_i (r.config, "cfg.fortunes")) {
|
||||
r_core_cmd (&r, "fo", 0);
|
||||
r_cons_flush ();
|
||||
}
|
||||
if (do_analysis) {
|
||||
r_core_cmd0 (&r, "aa");
|
||||
r_cons_flush ();
|
||||
}
|
||||
if (sandbox)r_config_set (r.config, "cfg.sandbox", "true");
|
||||
if (sandbox)
|
||||
r_config_set (r.config, "cfg.sandbox", "true");
|
||||
|
||||
r.num->value = 0;
|
||||
if (patchfile) {
|
||||
|
@ -591,10 +592,14 @@ int main(int argc, char **argv, char **envp) {
|
|||
for (;;) {
|
||||
#if USE_THREADS
|
||||
do {
|
||||
if (r_core_prompt (&r, R_FALSE)<1)
|
||||
int err = r_core_prompt (&r, R_FALSE);
|
||||
if (err<1) {
|
||||
// handle ^D
|
||||
break;
|
||||
}
|
||||
if (lock) r_th_lock_enter (lock);
|
||||
if ((ret = r_core_prompt_exec (&r))==-1) {
|
||||
break;
|
||||
// eprintf ("Invalid command\n");
|
||||
}
|
||||
if (lock) r_th_lock_leave (lock);
|
||||
|
|
|
@ -403,7 +403,9 @@ R_API char *r_line_readline_cb(RLineReadCallback cb, void *user) {
|
|||
#if USE_UTF8
|
||||
utflen = r_line_readchar_utf8 (
|
||||
(ut8*)buf, sizeof (buf));
|
||||
if (utflen <1) return NULL;
|
||||
if (utflen <1) {
|
||||
return NULL;
|
||||
}
|
||||
buf[utflen] = 0;
|
||||
#else
|
||||
ch = r_line_readchar ();
|
||||
|
|
|
@ -148,8 +148,9 @@ R_API int r_cons_fgets(char *buf, int len, int argc, const char **argv) {
|
|||
int mouse = r_cons_enable_mouse (R_FALSE);
|
||||
r_cons_enable_mouse (R_FALSE);
|
||||
r_cons_flush ();
|
||||
if (cons->user_fgets)
|
||||
if (cons->user_fgets) {
|
||||
RETURN (cons->user_fgets (buf, len));
|
||||
}
|
||||
*buf = '\0';
|
||||
fflush (cons->fdin);
|
||||
if (color) {
|
||||
|
|
|
@ -426,7 +426,7 @@ R_API int r_core_fgets(char *buf, int len) {
|
|||
rli->completion.run = autocomplete;
|
||||
ptr = r_line_readline (); //CMDS, radare_argv);
|
||||
if (ptr == NULL)
|
||||
return -2;
|
||||
return -1;
|
||||
strncpy (buf, ptr, len);
|
||||
//free(ptr); // XXX leak
|
||||
return strlen (buf)+1;
|
||||
|
@ -699,10 +699,12 @@ R_API int r_core_prompt(RCore *r, int sync) {
|
|||
}
|
||||
r_line_set_prompt (prompt);
|
||||
ret = r_cons_fgets (line, sizeof (line), 0, NULL);
|
||||
if (ret == -2) return R_CORE_CMD_EXIT;
|
||||
if (ret == -1) return R_FALSE;
|
||||
if (ret == -2) return R_CORE_CMD_EXIT; // ^D
|
||||
if (ret == -1) return R_FALSE; // FD READ ERROR
|
||||
r->num->value = rnv;
|
||||
if (sync) return r_core_prompt_exec (r);
|
||||
if (sync) {
|
||||
return r_core_prompt_exec (r);
|
||||
}
|
||||
free (r->cmdqueue);
|
||||
r->cmdqueue = strdup (line);
|
||||
return R_TRUE;
|
||||
|
|
|
@ -363,7 +363,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
|
|||
timeout = r_config_get_i (core->config, "http.timeout");
|
||||
strncpy (input, _input, sizeof (input)-4);
|
||||
/* Parse uri */
|
||||
if ((ptr = strstr(input, "tcp://"))) {
|
||||
if ((ptr = strstr (input, "tcp://"))) {
|
||||
proto = RTR_PROT_TCP;
|
||||
host = ptr+6;
|
||||
} else if ((ptr = strstr(input, "http://"))) {
|
||||
|
|
|
@ -102,12 +102,12 @@ R_API RSocket *r_socket_new (int is_ssl) {
|
|||
signal (SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
s->local = 0;
|
||||
s->fd = -1;
|
||||
#if HAVE_LIB_SSL
|
||||
if (is_ssl) {
|
||||
s->sfd = NULL;
|
||||
s->ctx = NULL;
|
||||
s->bio = NULL;
|
||||
s->fd = -1;
|
||||
if (!SSL_library_init ()) {
|
||||
r_socket_free (s);
|
||||
return NULL;
|
||||
|
@ -287,7 +287,8 @@ R_API int r_socket_port_by_name(const char *name) {
|
|||
R_API int r_socket_listen (RSocket *s, const char *port, const char *certfile) {
|
||||
int optval = 1;
|
||||
struct linger linger = { 0 };
|
||||
|
||||
if (r_sandbox_enable (0))
|
||||
return R_FALSE;
|
||||
#if __WINDOWS__
|
||||
WSADATA wsadata;
|
||||
if (WSAStartup (MAKEWORD (1, 1), &wsadata) == SOCKET_ERROR) {
|
||||
|
|
Loading…
Reference in New Issue