[prev in list] [next in list] [prev in thread] [next in thread] 

List:       proftpd-committers
Subject:    [ProFTPD-committers] CVS: proftpd/src fsio.c,1.45,1.46
From:       TJ Saunders <castaglia () users ! sourceforge ! net>
Date:       2005-10-26 16:19:18
Message-ID: E1EUnzi-0007Ru-Up () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/proftp/proftpd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28325/src

Modified Files:
	fsio.c 
Log Message:

Patrick McHardy pointed out that in a couple of places, the FSIO API
uses the readlink function pointer, registered for an fs_t, directly.
However, it is not required for registered fs_ts to provide any
particular FSIO function.  Thus pr_fsio_readlink(), which iterates through
the fs layers in order to find the first that does provide a readlink
function, should be used.


Index: fsio.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/src/fsio.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- fsio.c	28 Aug 2005 18:01:51 -0000	1.45
+++ fsio.c	26 Oct 2005 16:19:16 -0000	1.46
@@ -2,7 +2,7 @@
  * ProFTPD - FTP server daemon
  * Copyright (c) 1997, 1998 Public Flood Software
  * Copyright (C) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver@tos.net>
- * Copyright (C) 2001, 2002, 2003, 2004, 2005 The ProFTPD Project
+ * Copyright (C) 2001-2005 The ProFTPD Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -511,11 +511,10 @@
       /* Three characters are reserved at the end of linkbuf for some path
        * characters (and a trailing NUL).
        */
-      if (fs_cwd->readlink &&
-          (i = fs_cwd->readlink(fs_cwd, path, &linkbuf[2],
-           sizeof(linkbuf)-3)) != -1) {
+      i = fs_cwd->readlink(fs_cwd, path, &linkbuf[2], sizeof(linkbuf)-3);
+      if (i != -1) {
         linkbuf[i] = '\0';
-        if (!strchr(linkbuf, '/')) {
+        if (strchr(linkbuf, '/') == NULL) {
           if (i + 3 > PR_TUNABLE_PATH_MAX)
             i = PR_TUNABLE_PATH_MAX - 3;
 
@@ -795,7 +794,8 @@
 
     /* Cleaning the path may have removed a trailing slash, which the
      * caller may actually have wanted.  Make sure one is present in
-     * the cleaned version, if it was present in the original version.
+     * the cleaned version, if it was present in the original version and
+     * is not present in the cleaned version.
      */
     if (path[strlen(path)-1] == '/') {
       size_t len = strlen(cleaned_path);
@@ -1550,9 +1550,8 @@
           return -1;
         }
 	
-        if (fs->readlink &&
-            (len = fs->readlink(fs, namebuf, linkpath,
-             sizeof(linkpath)-1)) <= 0) {
+        len = pr_fsio_readlink(fs, namebuf, linkpath, sizeof(linkpath)-1);
+        if (len <= 0) {
           errno = ENOENT;
           return -1;
         }
@@ -1706,9 +1705,8 @@
           return -1;
         }
 
-        if (fs->readlink &&
-            (len = fs->readlink(fs, namebuf, linkpath,
-             sizeof(linkpath)-1)) <= 0) {
+        len = fs->readlink(fs, namebuf, linkpath, sizeof(linkpath)-1);
+        if (len <= 0) {
           errno = ENOENT;
           return -1;
         }



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
ProFTPD Committers Mailing List
proftpd-committers@proftpd.org
https://lists.sourceforge.net/lists/listinfo/proftp-committers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic