From: Yang Tse <yangsita@gmail.com>
Date: Wed, 27 Jul 2011 18:10:02 +0000 (+0200)
Subject: NTLM single-sign on adjustments (IV)
X-Git-Tag: curl-7_22_0~202
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dddf9aa610b32a6b7aa304826dbf962c951e2203;p=curl

NTLM single-sign on adjustments (IV)

Fix compiler warning
---

diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c
index 77f678630..5e164f2b7 100644
--- a/lib/http_ntlm.c
+++ b/lib/http_ntlm.c
@@ -834,7 +834,7 @@ static CURLcode sso_ntlm_response(struct connectdata *conn,
   size_t len_in = strlen(input), len_out = sizeof(buf);
 
   while(len_in > 0) {
-    int written = write(conn->fd_helper, input, len_in);
+    ssize_t written = write(conn->fd_helper, input, len_in);
     if(written == -1) {
       /* Interrupted by a signal, retry it */
       if(errno == EINTR)
diff --git a/tests/server/fake_ntlm.c b/tests/server/fake_ntlm.c
index 9ce8436ef..686264b1e 100644
--- a/tests/server/fake_ntlm.c
+++ b/tests/server/fake_ntlm.c
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
   char *type1_input = NULL, *type3_input = NULL;
   char *type1_output = NULL, *type3_output = NULL;
   size_t size = 0;
-  int testnum;
+  long testnum;
   const char *env;
   int arg = 1;
   char *helper_user = (char *)"unknown";
@@ -98,7 +98,13 @@ int main(int argc, char *argv[])
 
   env = getenv("NTLM_AUTH_TESTNUM");
   if (env) {
-    testnum = strtoul(env, NULL, 10);
+    char *endptr;
+    long lnum = strtol(env, &endptr, 10);
+    if((endptr != env + strlen(env)) || (lnum < 1L)) {
+      logmsg("Test number not valid in NTLM_AUTH_TESTNUM");
+      exit(1);
+    }
+    testnum = lnum;
   } else {
     logmsg("Test number not specified in NTLM_AUTH_TESTNUM");
     exit(1);