Merge branch 'master' into 1.1
Conflicts: lib/utils.c src/net_setup.c src/process.c src/protocol_auth.c src/protocol_key.c src/utils.h
This commit is contained in:
commit
6dfdb32361
9 changed files with 69 additions and 7 deletions
|
|
@ -229,7 +229,7 @@ static bool read_rsa_private_key(void) {
|
|||
result = rsa_set_hex_private_key(&myself->connection->rsa, n, "FFFF", d);
|
||||
free(n);
|
||||
free(d);
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Else, check for PrivateKeyFile statement and read it */
|
||||
|
|
|
|||
|
|
@ -29,16 +29,21 @@
|
|||
|
||||
bool rsa_set_hex_public_key(rsa_t *rsa, char *n, char *e) {
|
||||
*rsa = RSA_new();
|
||||
BN_hex2bn(&(*rsa)->n, n);
|
||||
BN_hex2bn(&(*rsa)->e, e);
|
||||
if(BN_hex2bn(&(*rsa)->n, n) != strlen(n))
|
||||
return false;
|
||||
if(BN_hex2bn(&(*rsa)->e, e) != strlen(e))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rsa_set_hex_private_key(rsa_t *rsa, char *n, char *e, char *d) {
|
||||
*rsa = RSA_new();
|
||||
BN_hex2bn(&(*rsa)->n, n);
|
||||
BN_hex2bn(&(*rsa)->e, e);
|
||||
BN_hex2bn(&(*rsa)->d, d);
|
||||
if(BN_hex2bn(&(*rsa)->n, n) != strlen(n))
|
||||
return false;
|
||||
if(BN_hex2bn(&(*rsa)->e, e) != strlen(e))
|
||||
return false;
|
||||
if(BN_hex2bn(&(*rsa)->d, d) != strlen(d))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ bool execute_script(const char *name, char **envp) {
|
|||
int status, len;
|
||||
char *scriptname;
|
||||
int i;
|
||||
char *interpreter = NULL;
|
||||
|
||||
#ifndef HAVE_MINGW
|
||||
len = xasprintf(&scriptname, "\"%s" SLASH "%s\"", confbase, name);
|
||||
|
|
@ -249,8 +250,19 @@ bool execute_script(const char *name, char **envp) {
|
|||
}
|
||||
#endif
|
||||
|
||||
// Custom scripts interpreter
|
||||
if(get_config_string(lookup_config(config_tree, "ScriptsInterpreter"), &interpreter)) {
|
||||
// Force custom scripts interpreter allowing execution of scripts on android without execution flag (such as on /sdcard)
|
||||
free(scriptname);
|
||||
len = xasprintf(&scriptname, "%s \"%s/%s\"", interpreter, confbase, name);
|
||||
free(interpreter);
|
||||
if(len < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
logger(DEBUG_STATUS, LOG_INFO, "Executing script %s", name);
|
||||
|
||||
|
||||
#ifdef HAVE_PUTENV
|
||||
/* Set environment */
|
||||
|
||||
|
|
|
|||
|
|
@ -334,6 +334,9 @@ bool ans_key_h(connection_t *c, const char *request) {
|
|||
return send_request(to->nexthop->connection, "%s", request);
|
||||
}
|
||||
|
||||
/* Don't use key material until every check has passed. */
|
||||
from->status.validkey = false;
|
||||
|
||||
if(compression < 0 || compression > 11) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses bogus compression level!", from->name, from->hostname);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -329,8 +329,11 @@ static bool drop_privs(void) {
|
|||
"initgroups", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
#ifndef __ANDROID__
|
||||
// Not supported in android NDK
|
||||
endgrent();
|
||||
endpwent();
|
||||
#endif
|
||||
}
|
||||
if (do_chroot) {
|
||||
tzset(); /* for proper timestamps in logs */
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static int charb64decode(char c) {
|
|||
|
||||
int hex2bin(const char *src, char *dst, int length) {
|
||||
int i;
|
||||
for(i = 0; i < length && src[i * 2] && src[i * 2 + 1]; i++)
|
||||
for(i = 0; i < length && isxdigit(src[i * 2]) && isxdigit(src[i * 2 + 1]); i++)
|
||||
dst[i] = charhex2bin(src[i * 2]) * 16 + charhex2bin(src[i * 2 + 1]);
|
||||
return i;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue