force core dumps to be disabled

This commit is contained in:
xfnw 2021-11-08 17:30:01 -05:00
parent dcf227b95a
commit 6339649983

View file

@ -32,6 +32,15 @@
#include <openssl/pem.h> #include <openssl/pem.h>
#include <openssl/sha.h> #include <openssl/sha.h>
#include <unistd.h> #include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
void nodumps()
{
struct rlimit r;
r.rlim_cur = r.rlim_max = 0;
setrlimit(RLIMIT_CORE, &r);
}
static int called_passcb = 0; static int called_passcb = 0;
static int pass_cb(char *buf, int size, int rwflag, void *u) static int pass_cb(char *buf, int size, int rwflag, void *u)
@ -215,6 +224,8 @@ read_challenge(FILE *f)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
nodumps();
FILE *kfile; FILE *kfile;
RSA *rsa = NULL; RSA *rsa = NULL;
SHA_CTX ctx; SHA_CTX ctx;
@ -236,7 +247,7 @@ main(int argc, char **argv)
} }
OpenSSL_add_all_ciphers(); OpenSSL_add_all_ciphers();
rsa = PEM_read_RSAPrivateKey(kfile, NULL,pass_cb, NULL); rsa = PEM_read_RSAPrivateKey(kfile, NULL, pass_cb, NULL);
if(!rsa) if(!rsa)
{ {