mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	For anonymous ftp, make sure local hostname is fully qualified.
This commit is contained in:
		
							parent
							
								
									009e79bf02
								
							
						
					
					
						commit
						2db6bfcd1d
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -221,6 +221,10 @@ def login(self, user = '', passwd = '', acct = ''):
 | 
				
			||||||
		if not user: user = 'anonymous'
 | 
							if not user: user = 'anonymous'
 | 
				
			||||||
		if user == 'anonymous' and passwd in ('', '-'):
 | 
							if user == 'anonymous' and passwd in ('', '-'):
 | 
				
			||||||
			thishost = socket.gethostname()
 | 
								thishost = socket.gethostname()
 | 
				
			||||||
 | 
								# Make sure it is fully qualified
 | 
				
			||||||
 | 
								if not '.' in thishost:
 | 
				
			||||||
 | 
								    thisaddr = socket.gethostbyname(thishost)
 | 
				
			||||||
 | 
								    thishost = socket.gethostbyaddr(thisaddr)[0]
 | 
				
			||||||
			try:
 | 
								try:
 | 
				
			||||||
				if os.environ.has_key('LOGNAME'):
 | 
									if os.environ.has_key('LOGNAME'):
 | 
				
			||||||
					realuser = os.environ['LOGNAME']
 | 
										realuser = os.environ['LOGNAME']
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue