forked from tildetown/town
		
	add newline to keyfile if needed
This commit is contained in:
		
							parent
							
								
									69ad6a384a
								
							
						
					
					
						commit
						9bb456bc17
					
				
							
								
								
									
										7
									
								
								external/cmd/helpers/createkeyfile/main.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								external/cmd/helpers/createkeyfile/main.go
									
									
									
									
										vendored
									
									
								
							| @ -76,12 +76,13 @@ func main() { | ||||
| 		quit(fmt.Sprintf("file contents look wrong: %s", string(stdin)), 8) | ||||
| 	} | ||||
| 
 | ||||
| 	n, err = f.Write(stdin) | ||||
| 	_, err = f.Write(stdin) | ||||
| 	if err != nil { | ||||
| 		quit(err.Error(), 9) | ||||
| 	} else if n == 0 { | ||||
| 		quit("wrote nothing to keyfile", 10) | ||||
| 	} | ||||
| 
 | ||||
| 	_, err = f.WriteString("\n") | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| /* | ||||
|  | ||||
							
								
								
									
										7
									
								
								external/cmd/welcome/main.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								external/cmd/welcome/main.go
									
									
									
									
										vendored
									
									
								
							| @ -7,6 +7,7 @@ import ( | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| 	"os/exec" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| 
 | ||||
| 	"git.tilde.town/tildetown/town/invites" | ||||
| @ -205,12 +206,16 @@ func createUser(data newUserData) (err error) { | ||||
| } | ||||
| 
 | ||||
| func keyfileText(data newUserData) string { | ||||
| 	pkey := data.PubKey | ||||
| 	if !strings.HasSuffix(pkey, "\n") { | ||||
| 		pkey += "\n" | ||||
| 	} | ||||
| 	header := `########## GREETINGS! ########## | ||||
| # This file was automatically generated by tilde.town when | ||||
| # your account was created. You can edit it if you want, but we | ||||
| # recommend adding stuff to ~/.ssh/authorized_keys instead.` | ||||
| 
 | ||||
| 	return fmt.Sprintf("%s\n%s", header, data.PubKey) | ||||
| 	return fmt.Sprintf("%s\n%s", header, pkey) | ||||
| } | ||||
| 
 | ||||
| func main() { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user