summaryrefslogtreecommitdiffstats
path: root/plugin/eurephiadb_session.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2009-10-05 00:01:18 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2009-10-05 00:01:18 +0200
commit164032f3fcf86d4f08244764aab1b68a0fb6c71e (patch)
tree1541aa0612f9acc782d25d2170f2bdcd6ac2bdff /plugin/eurephiadb_session.c
parent8f8632ef5f8e63cc9495550c09605d4cc9c58de8 (diff)
downloadeurephia-164032f3fcf86d4f08244764aab1b68a0fb6c71e.tar.gz
eurephia-164032f3fcf86d4f08244764aab1b68a0fb6c71e.tar.xz
eurephia-164032f3fcf86d4f08244764aab1b68a0fb6c71e.zip
Use macros to extract values via get_env()
This has two purposes. To make the code more readable and to use the same maximum length of the data being retrieved from the environment table.
Diffstat (limited to 'plugin/eurephiadb_session.c')
-rw-r--r--plugin/eurephiadb_session.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugin/eurephiadb_session.c b/plugin/eurephiadb_session.c
index f717fd8..14370f2 100644
--- a/plugin/eurephiadb_session.c
+++ b/plugin/eurephiadb_session.c
@@ -41,8 +41,9 @@
#include "eurephia_log.h"
#include "eurephiadb_session.h"
#include <eurephiadb_session_common.h>
+#include <environment.h>
#include <randstr.h>
-#include "sha512.h"
+#include <sha512.h>
// Also defined in the eurephiadb_driver.h, but not as extern.
@@ -93,9 +94,10 @@ eurephiaSESSION *eDBopen_session_seed(eurephiaCTX *ctx, const char *digest,
new_session->type = ((vpnipaddr == NULL) && (vpnipmask == NULL) ? stAUTHENTICATION : stSESSION);
// Build up a string containing all elements for the session seed
- totlen = 60 + 64 + 34 + 34 + 34 + 34 + 6 + 5 + 15;
- // max length of: digest + cname + username + vpnipaddr + vpnipmask + remipaddr + remport + pid
- // + extra buffer
+ totlen = MAXLEN_TLSDIGEST + MAXLEN_CNAME + MAXLEN_USERNAME + MAXLEN_POOLIPADDR + MAXLEN_POOLNETMASK
+ + MAXLEN_TRUSTEDIP + MAXLEN_TRUSTEDPORT + 5 + 15;
+ // max length of: digest + cname + username + vpnipaddr + vpnipmask
+ // + remipaddr + remport + pid + extra buffer
seeddata = (char *) malloc_nullsafe(ctx, totlen);
if( seeddata == NULL ) {