Escape ssh key before storing
This commit is contained in:
		
					parent
					
						
							
								c2e2e1828f
							
						
					
				
			
			
				commit
				
					
						79cbfac092
					
				
			
		
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -2,6 +2,7 @@ import datetime
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
import subprocess
 | 
					import subprocess
 | 
				
			||||||
import tempfile
 | 
					import tempfile
 | 
				
			||||||
 | 
					import xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from django import forms
 | 
					from django import forms
 | 
				
			||||||
from django.conf import settings
 | 
					from django.conf import settings
 | 
				
			||||||
| 
						 | 
					@ -207,7 +208,7 @@ class UserHostingKeyForm(forms.ModelForm):
 | 
				
			||||||
                logger.debug(
 | 
					                logger.debug(
 | 
				
			||||||
                    "Not a correct ssh format {error}".format(error=str(cpe)))
 | 
					                    "Not a correct ssh format {error}".format(error=str(cpe)))
 | 
				
			||||||
                raise forms.ValidationError(KEY_ERROR_MESSAGE)
 | 
					                raise forms.ValidationError(KEY_ERROR_MESSAGE)
 | 
				
			||||||
        return openssh_pubkey_str
 | 
					        return xml.sax.saxutils.escape(openssh_pubkey_str)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def clean_name(self):
 | 
					    def clean_name(self):
 | 
				
			||||||
        INVALID_NAME_MESSAGE = _("Comma not accepted in the name of the key")
 | 
					        INVALID_NAME_MESSAGE = _("Comma not accepted in the name of the key")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue