mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	
							parent
							
								
									7adf5f18b7
								
							
						
					
					
						commit
						657f7e0db3
					
				
					 2 changed files with 14 additions and 8 deletions
				
			
		| 
						 | 
					@ -14,6 +14,12 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func chuser(input string) error {
 | 
					func chuser(input string) error {
 | 
				
			||||||
	givenUser, givenGroup, _ := strings.Cut(input, ":")
 | 
						givenUser, givenGroup, _ := strings.Cut(input, ":")
 | 
				
			||||||
 | 
						if givenUser == "" {
 | 
				
			||||||
 | 
							return fmt.Errorf("user is empty")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if strings.Index(input, ":") > -1 && givenGroup == "" {
 | 
				
			||||||
 | 
							return fmt.Errorf("group is empty")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		err      error
 | 
							err      error
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,8 +4,8 @@
 | 
				
			||||||
package main
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"testing"
 | 
					 | 
				
			||||||
	"os/user"
 | 
						"os/user"
 | 
				
			||||||
 | 
						"testing"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Usernames must not contain a number sign.
 | 
					// Usernames must not contain a number sign.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue