[Pkg-nagios-changes] [SCM] Debian packaging for mod gearman. branch, upstream, updated. e9a5a6997d9dd8b31b433b5bcbad495448db0131
Sven Nierlein
sven at nierlein.org
Thu Apr 7 08:06:29 UTC 2011
The following commit has been merged in the upstream branch:
commit d55dfe0c2e99460ecbb3ccf2e2e988f616a932b1
Author: Sven Nierlein <sven at nierlein.org>
Date: Fri Mar 11 10:35:14 2011 +0100
fixed reading keys
diff --git a/Changes b/Changes
index 275eded..98bfa3e 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
This file documents the revision history for mod_gearman.
+1.0.2 Fri Mar 11 10:30:21 CET 2011
+ - fixed reading keyfiles
+
1.0.1 Sat Mar 5 15:47:22 CET 2011
- added spawn-rate option for worker
- added perfdata_mode option to prevent perfdata queue getting to big
diff --git a/README.asciidoc b/README.asciidoc
index 3cb5cb8..d8f47f0 100644
--- a/README.asciidoc
+++ b/README.asciidoc
@@ -352,8 +352,9 @@ least 8 bytes long. Maximum length is 32 characters.
====
keyfile::
-The shared password will be read from this file. Use either key or keyfile.
-Only the first 32 characters will be used.
+The shared password will be read from this file. Use either key or keyfile.
+Only the first 32 characters from the first line will be used.
+Whitespace to the right will be trimmed.
+
====
keyfile=/path/to/secret.file
diff --git a/common/utils.c b/common/utils.c
index 77fcf9e..42a8d9e 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -769,7 +769,7 @@ int read_keyfile(mod_gm_opt_t *opt) {
free(opt->crypt_key);
opt->crypt_key = malloc(GM_BUFFERSIZE);
- fgets(opt->crypt_key, 32, fp);
+ fgets(opt->crypt_key, 33, fp);
fclose(fp);
rtrim(opt->crypt_key);
diff --git a/configure.ac b/configure.ac
index fea2d63..e8cf660 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
##############################################
AC_PREREQ([2.59])
-AC_INIT([mod_gearman], [1.0.1], [sven.nierlein at consol.de])
+AC_INIT([mod_gearman], [1.0.2], [sven.nierlein at consol.de])
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
AC_CONFIG_SRCDIR([neb_module/mod_gearman.c],[worker/worker.c],[tools/send_gearman.c],[tools/check_gearman.c],[tools/gearman_top.c])
AC_CONFIG_HEADER([config.h])
diff --git a/include/common.h b/include/common.h
index 8efcab0..097cbb3 100644
--- a/include/common.h
+++ b/include/common.h
@@ -52,7 +52,7 @@
#define MOD_GM_COMMON_H
/* constants */
-#define GM_VERSION "1.0.1"
+#define GM_VERSION "1.0.2"
#define GM_ENABLED 1
#define GM_DISABLED 0
#define GM_BUFFERSIZE 98304
diff --git a/support/mod_gearman.spec b/support/mod_gearman.spec
index 99e6042..f2f91cf 100644
--- a/support/mod_gearman.spec
+++ b/support/mod_gearman.spec
@@ -1,5 +1,5 @@
Name: mod_gearman
-Version: 1.0
+Version: 1.0.2
Release: 3
License: GNU Public License version 2
Packager: Olivier Raginel <babar at cern.ch>
diff --git a/t/01-utils.c b/t/01-utils.c
index 66cc01c..a1bf65e 100644
--- a/t/01-utils.c
+++ b/t/01-utils.c
@@ -19,7 +19,7 @@ void printf_hex(char* text, int length) {
}
int main(void) {
- plan(40);
+ plan(42);
/* lowercase */
char test[100];
@@ -54,7 +54,7 @@ int main(void) {
mod_gm_opt = malloc(sizeof(mod_gm_opt_t));
int rc = set_default_options(mod_gm_opt);
ok(rc == 0, "setting default options");
- mod_gm_opt->keyfile = "t/test1.key";
+ mod_gm_opt->keyfile = "t/data/test1.key";
read_keyfile(mod_gm_opt);
//printf_hex(mod_gm_opt->crypt_key, 32);
test[0]='\x0';
@@ -65,15 +65,23 @@ int main(void) {
snprintf(hex, 4, "%02x", mod_gm_opt->crypt_key[i]);
strncat(test, hex, 4);
}
- if(!ok(strcmp(test, "3131313131313131313131313131313131313131313131313131313131310000") == 0, "read keyfile t/test1.key"))
+ if(!ok(strcmp(test, "3131313131313131313131313131313131313131313131313131313131310000") == 0, "read keyfile t/data/test1.key"))
diag("expected: '3131313131313131313131313131313131313131313131313131313131310000'\n but got: '%s'", test );
- mod_gm_opt->keyfile = "t/test2.key";
+ mod_gm_opt->keyfile = "t/data/test2.key";
read_keyfile(mod_gm_opt);
//printf_hex(mod_gm_opt->crypt_key, 32);
- if(!ok(strcmp(mod_gm_opt->crypt_key, "abcdef") == 0, "reading keyfile t/test2.key"))
+ if(!ok(strcmp(mod_gm_opt->crypt_key, "abcdef") == 0, "reading keyfile t/data/test2.key"))
diag("expected: 'abcdef'\n but got: '%s'", mod_gm_opt->crypt_key );
+ mod_gm_opt->keyfile = "t/data/test3.key";
+ read_keyfile(mod_gm_opt);
+ //printf_hex(mod_gm_opt->crypt_key, 32);
+ if(!ok(strcmp(mod_gm_opt->crypt_key, "11111111111111111111111111111111") == 0, "reading keyfile t/data/test3.key"))
+ diag("expected: '11111111111111111111111111111111'\n but got: '%s'", mod_gm_opt->crypt_key );
+ ok(strlen(mod_gm_opt->crypt_key) == 32, "key size for t/data/test3.key");
+
+
/* encrypt */
char * key = "test1234";
char * encrypted = malloc(GM_BUFFERSIZE);
diff --git a/t/test1.key b/t/data/test1.key
similarity index 100%
rename from t/test1.key
rename to t/data/test1.key
diff --git a/t/test2.key b/t/data/test2.key
similarity index 100%
rename from t/test2.key
rename to t/data/test2.key
diff --git a/t/data/test3.key b/t/data/test3.key
new file mode 100644
index 0000000..75c6f63
--- /dev/null
+++ b/t/data/test3.key
@@ -0,0 +1 @@
+1111111111111111111111111111111111111111
--
Debian packaging for mod gearman.
More information about the Pkg-nagios-changes
mailing list