sanderv32 / ngx_http_auth_yubikey_module

Yubikey basic authentication for NGINX
Other
36 stars 2 forks source link

[FIXED] Fail To Compile on latest nginx stable #2

Closed teward closed 10 years ago

teward commented 10 years ago

Hi, I'm getting "Fail to Build" errors on the latest nginx stable. Attached is the output from make and where it fails:

make -f objs/Makefile
make[1]: Entering directory `/home/teward/Desktop/nginx_yubi_testbuild/nginx-1.6.2'
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security  -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/libxml2 -I objs -I src/http -I src/http/modules -I src/mail \
        -o objs/addon/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.o \
        debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c: In function ‘ngx_http_auth_yubikey_otp_handler’:
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:306:3: error: pointer targets in passing argument 1 of ‘sprintf’ differ in signedness [-Werror=pointer-sign]
   sprintf(tmpbuf,"%s%2.2x",tmpbuf,alcf->cached_cred[j].md5[i]);
   ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:25,
                 from src/os/unix/ngx_linux_config.h:18,
                 from src/core/ngx_config.h:26,
                 from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:34:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:31:1: note: expected ‘char * __restrict__’ but argument is of type ‘u_char *’
 __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
 ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:319:2: error: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Werror=pointer-sign]
  declen=base64_decode_block(alcf->secret_key.data, strlen(alcf->secret_key.data), key, &state);
  ^
In file included from src/os/unix/ngx_linux_config.h:27:0,
                 from src/core/ngx_config.h:26,
                 from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:34:
/usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘u_char *’
 extern size_t strlen (const char *__s)
               ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:319:2: error: pointer targets in passing argument 1 of ‘base64_decode_block’ differ in signedness [-Werror=pointer-sign]
  declen=base64_decode_block(alcf->secret_key.data, strlen(alcf->secret_key.data), key, &state);
  ^
In file included from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:41:0:
debian/modules/ngx_http_auth_yubikey_module/b64/cdecode.h:26:5: note: expected ‘const char *’ but argument is of type ‘u_char *’
 int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in);
     ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:319:2: error: pointer targets in passing argument 3 of ‘base64_decode_block’ differ in signedness [-Werror=pointer-sign]
  declen=base64_decode_block(alcf->secret_key.data, strlen(alcf->secret_key.data), key, &state);
  ^
In file included from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:41:0:
debian/modules/ngx_http_auth_yubikey_module/b64/cdecode.h:26:5: note: expected ‘char *’ but argument is of type ‘u_char *’
 int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in);
     ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:330:5: error: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Werror=pointer-sign]
     if (strlen(r->headers_in.passwd.data) < 32)
     ^
In file included from src/os/unix/ngx_linux_config.h:27:0,
                 from src/core/ngx_config.h:26,
                 from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:34:
/usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘u_char *’
 extern size_t strlen (const char *__s)
               ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:346:5: error: pointer targets in passing argument 1 of ‘atoi’ differ in signedness [-Werror=pointer-sign]
     ykclient_set_client (ykc, atoi(alcf->client_id.data), declen, key);
     ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:25,
                 from src/os/unix/ngx_linux_config.h:18,
                 from src/core/ngx_config.h:26,
                 from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:34:
/usr/include/stdlib.h:278:1: note: expected ‘const char *’ but argument is of type ‘u_char *’
 __NTH (atoi (const char *__nptr))
 ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:346:5: error: pointer targets in passing argument 4 of ‘ykclient_set_client’ differ in signedness [-Werror=pointer-sign]
     ykclient_set_client (ykc, atoi(alcf->client_id.data), declen, key);
     ^
In file included from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:39:0:
/usr/include/ykclient.h:72:15: note: expected ‘const char *’ but argument is of type ‘u_char *’
   extern void ykclient_set_client (ykclient_t * ykc,
               ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:350:3: error: pointer targets in passing argument 1 of ‘strstr’ differ in signedness [-Werror=pointer-sign]
   if ( strstr(buf, user.data) ) {
   ^
In file included from src/os/unix/ngx_linux_config.h:27:0,
                 from src/core/ngx_config.h:26,
                 from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:34:
/usr/include/string.h:342:14: note: expected ‘const char *’ but argument is of type ‘u_char *’
 extern char *strstr (const char *__haystack, const char *__needle)
              ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:350:3: error: pointer targets in passing argument 2 of ‘strstr’ differ in signedness [-Werror=pointer-sign]
   if ( strstr(buf, user.data) ) {
   ^
In file included from src/os/unix/ngx_linux_config.h:27:0,
                 from src/core/ngx_config.h:26,
                 from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:34:
/usr/include/string.h:342:14: note: expected ‘const char *’ but argument is of type ‘u_char *’
 extern char *strstr (const char *__haystack, const char *__needle)
              ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:352:4: error: pointer targets in passing argument 1 of ‘strstr’ differ in signedness [-Werror=pointer-sign]
    p = strstr(buf, user.data);
    ^
In file included from src/os/unix/ngx_linux_config.h:27:0,
                 from src/core/ngx_config.h:26,
                 from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:34:
/usr/include/string.h:342:14: note: expected ‘const char *’ but argument is of type ‘u_char *’
 extern char *strstr (const char *__haystack, const char *__needle)
              ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:352:4: error: pointer targets in passing argument 2 of ‘strstr’ differ in signedness [-Werror=pointer-sign]
    p = strstr(buf, user.data);
    ^
In file included from src/os/unix/ngx_linux_config.h:27:0,
                 from src/core/ngx_config.h:26,
                 from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:34:
/usr/include/string.h:342:14: note: expected ‘const char *’ but argument is of type ‘u_char *’
 extern char *strstr (const char *__haystack, const char *__needle)
              ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:352:6: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign]
    p = strstr(buf, user.data);
      ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:353:4: error: pointer targets in passing argument 1 of ‘strstr’ differ in signedness [-Werror=pointer-sign]
    ykey = strstr(p, ":")+1;
    ^
In file included from src/os/unix/ngx_linux_config.h:27:0,
                 from src/core/ngx_config.h:26,
                 from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:34:
/usr/include/string.h:342:14: note: expected ‘const char *’ but argument is of type ‘u_char *’
 extern char *strstr (const char *__haystack, const char *__needle)
              ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:353:9: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign]
    ykey = strstr(p, ":")+1;
         ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:354:4: error: pointer targets in passing argument 1 of ‘strstr’ differ in signedness [-Werror=pointer-sign]
    *strstr(ykey, "\n") = '\0';
    ^
In file included from src/os/unix/ngx_linux_config.h:27:0,
                 from src/core/ngx_config.h:26,
                 from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:34:
/usr/include/string.h:342:14: note: expected ‘const char *’ but argument is of type ‘u_char *’
 extern char *strstr (const char *__haystack, const char *__needle)
              ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:357:5: error: pointer targets in passing argument 2 of ‘ykclient_request’ differ in signedness [-Werror=pointer-sign]
     rc = ykclient_request (ykc, r->headers_in.passwd.data);
     ^
In file included from debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:39:0:
/usr/include/ykclient.h:115:22: note: expected ‘const char *’ but argument is of type ‘u_char *’
   extern ykclient_rc ykclient_request (ykclient_t * ykc,
                      ^
debian/modules/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.c:359:5: error: implicit declaration of function ‘ykclient_check_signature’ [-Werror=implicit-function-declaration]
     if ((rc=ykclient_check_signature(ykc))!=YKCLIENT_OK) {
     ^
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/ngx_http_auth_yubikey_module/ngx_http_auth_yubikey_module.o] Error 1
make[1]: Leaving directory `/home/teward/Desktop/nginx_yubi_testbuild/nginx-1.6.2'
make: *** [build] Error 2
sanderv32 commented 10 years ago

Hi, I created a new branch "compile-fix". This compiles on Ubuntu 14.04 but didn't have the time to test it yet.

teward commented 10 years ago

fail to compile is resolved, but now I get this error when using the module (in an Ubuntu 14.04 VM)"

2014/09/30 23:52:54 [error] 31027#0: *1 ykclient error: HMAC signature validation/generation error, client: 127.0.0.1, server: localhost, request: "GET /yubi/ HTTP/1.1", host: "localhost"
teward commented 10 years ago

Interesting discovery: It now doesn't generate those errors. It does, however, return "401 Authorization Required" after the window goes away. A refresh seems to recognize the authentication, but it's odd it wouldn't do that the first time.

I'll open a new issue for that.