backup
[lcr.git] / crypt.cpp
index 65890c3..7868ceb 100644 (file)
--- a/crypt.cpp
+++ b/crypt.cpp
@@ -293,10 +293,7 @@ unsigned long crc32(unsigned char *data, int len)
        unsigned long crc = 0xffffffff;
 
        if (!crc_initialized)
-       {
-               PERROR("crc not initialized, exitting...");
-               exit(-1);
-       }
+               FATAL("crc not initialized, exitting...");
 
        while (len--)
                crc = (crc >> 8) ^ crc32_table[(crc & 0xFF) ^ *data++];
@@ -577,8 +574,7 @@ static void *keyengine_child(void *arg)
 
        /* exit process */
        apppbx->ea_endpoint->ep_use--;
-       memset(args, 0, sizeof(struct auth_args));
-       free(args);
+       FREE(args, sizeof(struct auth_args));
        amemuse--;
        return(NULL);
 }
@@ -595,14 +591,7 @@ void EndpointAppPBX::cryptman_keyengine(int job)
                return;
        }
 
-       arg = (struct auth_args *)calloc(1, sizeof(struct auth_args));
-       if (!arg)
-       {
-               PERROR("failed to alloc memory.\n");
-               e_crypt_keyengine_return = -1;
-               return;
-       }
-
+       arg = (struct auth_args *)MALLOC(sizeof(struct auth_args));
        arg->apppbx = this;
        arg->job = job;
        e_crypt_keyengine_return = 0;
@@ -1832,8 +1821,8 @@ void EndpointAppPBX::encrypt_shared(void)
        }
 
        /* check the key for the call */
-       if (port->p_type==PORT_TYPE_DSS1_TE_OUT || port->p_type==PORT_TYPE_DSS1_NT_OUT || port->p_type==PORT_TYPE_SIP_OUT)
-               ret = parse_secrets((char *)e_ext.number, (char *)port->p_dialinginfo.number, &auth_pointer, &crypt_pointer, &key_pointer);
+       if (port->p_type==PORT_TYPE_DSS1_TE_OUT || port->p_type==PORT_TYPE_DSS1_NT_OUT)
+               ret = parse_secrets((char *)e_ext.number, (char *)port->p_dialinginfo.id, &auth_pointer, &crypt_pointer, &key_pointer);
        else
        {
                if (!port->p_callerinfo.id[0])
@@ -2044,3 +2033,4 @@ void EndpointAppPBX::encrypt_result(int msg, char *text)
        }
 }
 
+