cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Kerberos v5 FTP?

From: Thomas J. Moore <thomoore_at_iupui.edu>
Date: Fri, 06 Jul 2007 09:14:51 -0400

On 07/05/2007 03:38 PM, Daniel Johnson wrote:
> I've started getting compiler warnings in my autobuilds due to the new
> code:

Yes, I was aiming for functionality, not cleanliness. -Wall wasn't even turned
on when I built. Also, I figured someone else could clean up things if
necessary. Attached is a simple patch to clean up a bit.

  - Thomas J. Moore
    UITS/Research Technology/Research Storage
    Indiana University/IUPUI

Index: curl/lib/krb5.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/krb5.c,v
retrieving revision 1.1
diff -u -r1.1 krb5.c
--- curl/lib/krb5.c 1 Jul 2007 22:01:19 -0000 1.1
+++ curl/lib/krb5.c 6 Jul 2007 13:06:29 -0000
@@ -1,11 +1,4 @@
-/* This source code was modified by Martin Hedenfalk <mhe_at_stacken.kth.se> for
- * use in Curl. His latest changes were done 2000-09-18.
- *
- * It has since been patched away like a madman by Daniel Stenberg
- * <daniel_at_haxx.se> to make it better applied to curl conditions, and to make
- * it not use globals, pollute name space and more. This source code awaits a
- * rewrite to work around the paragraph 2 in the BSD licenses as explained
- * below.
+/* GSSAPI/krb5 support for FTP - loosely based on old krb4.c
  *
  * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden).
@@ -52,10 +45,6 @@
 #include <gssapi/gssapi_generic.h>
 #include <gssapi/gssapi_krb5.h>
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h> /* for getpid() */
-#endif
-
 #include "urldata.h"
 #include "base64.h"
 #include "ftp.h"
@@ -63,22 +52,15 @@
 #include "krb4.h"
 #include "memory.h"
 
-#if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
-#include "inet_ntoa_r.h"
-#endif
-
 /* The last #include file should be: */
 #include "memdebug.h"
 
 #define LOCAL_ADDR (&conn->local_addr)
 #define REMOTE_ADDR conn->ip_addr->ai_addr
-#define myctladdr LOCAL_ADDR
-#define hisctladdr REMOTE_ADDR
 
 static int
 krb5_check_prot(void *app_data, int level)
 {
- gss_ctx_id_t *context = app_data;
   app_data = NULL; /* prevent compiler warning */
   if(level == prot_confidential)
     return -1;
@@ -93,6 +75,10 @@
   OM_uint32 maj, min;
   gss_buffer_desc enc, dec;
 
+ /* shut gcc up */
+ level = 0;
+ conn = NULL;
+
   enc.value = buf;
   enc.length = len;
   maj = gss_unseal(&min, *context, &enc, &dec, NULL, NULL);
@@ -112,7 +98,6 @@
 static int
 krb5_overhead(void *app_data, int level, int len)
 {
- gss_ctx_id_t *context = app_data;
   /* no arguments are used, just init them to prevent compiler warnings */
   app_data = NULL;
   level = 0;
@@ -130,6 +115,9 @@
   int state;
   int len;
 
+ /* shut gcc up */
+ conn = NULL;
+
   dec.value = from;
   dec.length = length;
   maj = gss_seal(&min, *context,
@@ -155,9 +143,6 @@
 {
   int ret;
   char *p;
- unsigned char *ptr;
- size_t len;
- u_int32_t cs;
   const char *host = conn->dns_entry->addr->ai_canonname;
   ssize_t nread;
   unsigned int l = sizeof(conn->local_addr);
Index: curl/lib/security.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/security.c,v
retrieving revision 1.33
diff -u -r1.33 security.c
--- curl/lib/security.c 1 Jul 2007 22:01:19 -0000 1.33
+++ curl/lib/security.c 6 Jul 2007 13:06:29 -0000
@@ -129,9 +129,9 @@
 }
 
 static int
-block_write(int fd, void *buf, size_t len)
+block_write(int fd, const void *buf, size_t len)
 {
- unsigned char *p = buf;
+ const unsigned char *p = buf;
   int b;
   while(len) {
     b = write(fd, p, len);
Received on 2007-07-06