--- ./old/src/ftpd.c	2011-09-15 14:15:50.028000047 +0530
+++ src/ftpd.c	2011-09-22 10:24:28.749000012 +0530
@@ -1674,9 +1674,15 @@ void dopass(char *password)
     {
         /* Clear password from memory, paranoia */        
         register volatile char *password_ = (volatile char *) password;
+	
 		if(remote_server == 1 )
 		{
-			edir_login(account,password,authresult.uid);
+		if (edir_login (account, password, authresult.uid) < 0)
+		{
+			addreply_noformat(530, MSG_AUTH_FAILED);
+			logfile (LOG_WARNING, MSG_AUTH_FAILED_LOG, account);
+			return;
+		}
 		}
 
 	if(default_home_dir != NULL)
@@ -6326,6 +6332,7 @@ int edir_login(const char* user,const ch
 			get_server_list_from_edir();
 		}	
 	}
+
 	return 0;
 }
 
@@ -6355,13 +6362,13 @@ int mount_remote_server(const char* wher
 		if( no_of_server <= 0) 
 			get_server_list_from_file(); 
 
+		/*  Get the remote server path excluding server name  */
+		snprintf (path, sizeof (path), index ((char *) (where + 2), '/'));		
+
 		/*  Get the server name from remote server path  */
 		if ((server = strtok ((char *) (where + 2), "/")) == NULL)
 			return -1;
 
-		/*  Get the remote server path excluding server name  */
-		snprintf (path, sizeof (path), index (server, '/'));		
-
 		/*  FTP request is with IP address  */
 		if(inet_pton(AF_INET, server, &ipv4addr) > 0)
 		{	
@@ -6660,37 +6667,23 @@ int get_remote_server_path(char* path)
 }	
 
 
-/**
- * Description: This function is used to extract E-directory IP address
- * and Port number.
- *
- * Input: Charcter string which have IP address & port number.
+/*********************************************************
+ * Description: 
+ * 	This function is used to extract LDAP port number
  *
+ * Input: Charcter string which contains port number.
  * Output: None.
- */
+ *********************************************************/
 void extractEdir_IP_Port(char *optarg)
 {
-	char *ip_address;
-        char *port;
-
-	/* extract ip address */
-        ip_address=strtok(optarg,":");
+	/*  Assign default IP address  */
+	edir_ip_address = "127.0.0.1";
 
-	/* extract port and validate the port */
-        if ( (NULL != ip_address) && (NULL != (port= strtok(NULL,":"))))
-        {
-        	edir_ip_address = strdup(ip_address);
-                edir_ldap_port = atoi(port);
+	/*  Extract configured port number  */
+	edir_ldap_port = atoi (optarg);
                 
 		if((edir_ldap_port <= 0) || (edir_ldap_port > 65535))
                 	edir_ldap_port = 389;
-        }
-        else
-        {
-		/* Assign default IP address & port number */
-                edir_ip_address = "127.0.0.1";
-                edir_ldap_port = 389;
-        }
 
 	return;
 }
@@ -6863,7 +6856,7 @@ int get_server_list_from_edir()
 	} 
 	else
 	{	
-		logfile (LOG_ERR, "LDAP search search failed. Error: %s <%d>", ldap_err2string (rc), rc);		
+		logfile (LOG_ERR, "Failed to perform LDAP search to get the list of remote servers accessible. Error: %s <%d>", ldap_err2string (rc), rc);		
 	}	
 	
 	if (file != NULL) 
--- ./old/src/ftp_parser.c	2011-09-15 14:15:49.520000042 +0530
+++ src/ftp_parser.c	2011-09-22 10:11:43.013000013 +0530
@@ -231,6 +231,8 @@ void parser(void)
 #endif
     size_t n;
 
+    char nss_loc[MAX_PATH_SIZE] = {0};	//  Buffer to hold remote server path
+    
     for (;;) {
         xferfd = -1;
         if (state_needs_update != 0) {
@@ -485,7 +487,6 @@ void parser(void)
                 docwd("..");
             } else if (!strcmp(cmd, "retr")) {
     		// support full remote server path
-    		char nss_loc[MAX_PATH_SIZE];
     		if ( (remote_server == 1) && (mount_remote_server(arg,nss_loc,NULL) ==0))
 	    		arg = nss_loc;
                 if (*arg != 0) {
@@ -513,7 +514,6 @@ void parser(void)
                 goto wayout;
             } else if (!strcmp(cmd, "dele")) {
     		// support full remote server path
-    		char nss_loc[MAX_PATH_SIZE];
     		if ( (remote_server == 1) && (mount_remote_server(arg,nss_loc,NULL) ==0))
 	    		arg = nss_loc;
                 if (*arg != 0) {
@@ -523,7 +523,6 @@ void parser(void)
                 }
             } else if (!strcmp(cmd, "stor")) {
     		// support full remote server path
-    		char nss_loc[MAX_PATH_SIZE];
     		if ( (remote_server == 1) && (mount_remote_server(arg,nss_loc,NULL) ==0))
 		{
 	    		arg = nss_loc;
@@ -546,7 +545,6 @@ void parser(void)
                 }
             } else if (!strcmp(cmd, "appe")) {
     		// support full remote server path
-    		char nss_loc[MAX_PATH_SIZE];
     		if ((remote_server == 1) && (mount_remote_server(arg,nss_loc,NULL) ==0))
 	    		arg = nss_loc;
                 arg = revealextraspc(arg);
@@ -578,7 +576,6 @@ void parser(void)
 #ifndef DISABLE_MKD_RMD
             } else if (!strcmp(cmd, "mkd") || !strcmp(cmd, "xmkd")) {
     		// support full remote server path
-    		char nss_loc[MAX_PATH_SIZE];
     		if ((remote_server == 1) && (mount_remote_server(arg,nss_loc,NULL) ==0))
 	    		arg = nss_loc;
                 arg = revealextraspc(arg);
@@ -589,7 +586,6 @@ void parser(void)
                 }
             } else if (!strcmp(cmd, "rmd") || !strcmp(cmd, "xrmd")) {
     		// support full remote server path
-    		char nss_loc[MAX_PATH_SIZE];
     		if ( (remote_server == 1) && (mount_remote_server(arg,nss_loc,NULL) ==0))
 	    		arg = nss_loc;
                 if (*arg != 0) {
@@ -638,6 +634,9 @@ void parser(void)
                 } else
 #endif
                 {
+		    // support full remote server path
+		    if ((remote_server == 1) && (mount_remote_server (arg, nss_loc, NULL) == 0))
+			    arg = nss_loc;
                     donlist(arg, 0, 0, broken_client_compat);
                 }
 #ifndef MINIMAL
@@ -649,6 +648,9 @@ void parser(void)
                 } else
 #endif
                 {
+		    // support full remote server path
+		    if ((remote_server == 1) && (mount_remote_server (arg, nss_loc, NULL) == 0))
+			    arg = nss_loc;
                     domlst(*arg != 0 ? arg : ".");
                 }
             } else if (!strcmp(cmd, "mlsd")) {
@@ -794,13 +796,14 @@ void parser(void)
                 }
 #endif
             } else if (!strcmp(cmd, "mdtm")) {
+		    // support full remote server path
+		    if ((remote_server == 1) && (mount_remote_server (arg, nss_loc, NULL) == 0))
+			    arg = nss_loc;
                 domdtm(arg);
             } else if (!strcmp(cmd, "size")) {
-	    		char nss_loc[MAX_PATH_SIZE] = {0};
+		    	// support full remote server path
     			if ( (remote_server == 1) && (mount_remote_server(arg,nss_loc,NULL) ==0))
-			{
 	    			arg = nss_loc;
-			}
                 dosize(arg);
 #ifndef MINIMAL
             } else if (!strcmp(cmd, "chmod")) {
@@ -808,12 +811,18 @@ void parser(void)
                 goto parsechmod;
 #endif
             } else if (!strcmp(cmd, "rnfr")) {
+		// support full remote server path
+		if ((remote_server == 1) && (mount_remote_server (arg, nss_loc, NULL) == 0))
+		    arg = nss_loc;
                 if (*arg != 0) {
                     dornfr(arg);
                 } else {
                     addreply_noformat(550, MSG_NO_FILE_NAME);
                 }
             } else if (!strcmp(cmd, "rnto")) {
+		// support full remote server path
+		if ((remote_server == 1) && (mount_remote_server (arg, nss_loc, NULL) == 0))
+		    arg = nss_loc;
                 arg = revealextraspc(arg);
                 if (*arg != 0) {
                     dornto(arg);
