mirror of
				https://github.com/ComputerScienceHouse/proxstar.git
				synced 2025-03-09 15:40:09 +00:00 
			
		
		
		
	properly validate hostname properly (hopefully for the last time)
This commit is contained in:
		
							parent
							
								
									7db17ab91d
								
							
						
					
					
						commit
						e608c0dc10
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -1,3 +1,6 @@
 | 
				
			||||||
 | 
					import psycopg2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_next_ip(starrs, range_name):
 | 
					def get_next_ip(starrs, range_name):
 | 
				
			||||||
    c = starrs.cursor()
 | 
					    c = starrs.cursor()
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
| 
						 | 
					@ -42,6 +45,10 @@ def renew_ip(starrs, addr):
 | 
				
			||||||
def check_hostname(starrs, hostname):
 | 
					def check_hostname(starrs, hostname):
 | 
				
			||||||
    c = starrs.cursor()
 | 
					    c = starrs.cursor()
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
 | 
					        c.execute("BEGIN")
 | 
				
			||||||
 | 
					        c.callproc("api.initialize", ('root', ))
 | 
				
			||||||
 | 
					        c.callproc("api.validate_name", (hostname, ))
 | 
				
			||||||
 | 
					        c.execute("COMMIT")
 | 
				
			||||||
        c.execute("BEGIN")
 | 
					        c.execute("BEGIN")
 | 
				
			||||||
        c.callproc("api.initialize", ('root', ))
 | 
					        c.callproc("api.initialize", ('root', ))
 | 
				
			||||||
        c.callproc("api.validate_domain", (hostname, 'csh.rit.edu'))
 | 
					        c.callproc("api.validate_domain", (hostname, 'csh.rit.edu'))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue