Commit c6d0de79 authored by Kevin Lyda's avatar Kevin Lyda
Browse files

A bunch of minor fixes

parent 8e9a7445
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ func Run(args []string) int {
			fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
			return 1
		}
		fmt.Printf("command=\"%s --user %s --fp %s\",restrict %s %s\n",
		fmt.Printf("command=\"%s --user %s --fp %s\",restrict,pty %s %s\n",
			bulletin, sshKey.Login, fp, keyType, keyBase64)
		return 0
	}
@@ -84,7 +84,7 @@ func Run(args []string) int {
		fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
		return 1
	}
	fmt.Printf("command=\"%s --onboard --fp %s --pubkey %s:%s\",restrict %s %s\n",
	fmt.Printf("command=\"%s --onboard --fp %s --pubkey %s:%s\",restrict,pty %s %s\n",
		bulletin, fp, keyType, keyBase64, keyType, keyBase64)
	return 0
}
+1 −1
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ func MigrateKeysWithQueries(q *storage.Queries) error {
		}

		// Write this entry back in the new secure format.
		newLine := fmt.Sprintf("command=\"%s --user %s\",restrict %s",
		newLine := fmt.Sprintf("command=\"%s --user %s\",restrict,pty %s",
			bulletin, login, keyLine)
		rewriteLines = append(rewriteLines, newLine)
		migrated++
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import (
	"golang.org/x/sys/unix"
)

var keytemplate = `command="%s --user %s",restrict %s`
var keytemplate = `command="%s --user %s",restrict,pty %s`

// Add adds an ssh key to the `authorized_keys` file.
func Add(login, public string) error {
+6 −2
Original line number Diff line number Diff line
@@ -1015,7 +1015,11 @@ The following actions are available:
				Action:  ActionUserNoadmin,
			},
			"LIST": {
				Description: `  Lists all the users.  Must be an admin.`,
				Description: `  Lists all the users.  Must be an admin.

  Each user is shown with flags [a, m, d, p] where:
    a = admin, m = moderator, d = disabled, p = prompt
  A value of 1 means the flag is set, 0 means it is not.`,
				Action: ActionUserList,
			},
			"NAME": {
+6 −4
Original line number Diff line number Diff line
@@ -128,13 +128,15 @@ func ActionShowUser(cmd *dclish.Command) error {
			return nil
		}
	}
	var showLogin int64
	var showDisabled int64
	if cmd.Flags["/LOGIN"].Value == "true" {
		if this.User.Admin == 0 {
			fmt.Println("ERROR: You are not an admin.")
			return nil
		}
		showLogin = 1
		showDisabled = 0
	} else {
		showDisabled = 1
	}
	folder := this.Folder
	if cmd.Flags["/FOLDER"].Set {
@@ -169,7 +171,7 @@ func ActionShowUser(cmd *dclish.Command) error {
	// Actually do the thing.
	ctx := storage.Context()
	if cmd.Flags["/LOGIN"].Set && cmd.Flags["/FOLDER"].Set {
		rows, err := this.Q.GetLastReadByEnabled(ctx, folder.Name, showLogin)
		rows, err := this.Q.GetLastReadByEnabled(ctx, folder.Name, showDisabled)
		if err != nil {
			fmt.Printf("ERROR: Failed to get list (%s).\n", err)
			return nil
@@ -197,7 +199,7 @@ func ActionShowUser(cmd *dclish.Command) error {
		fmt.Println("User          Folder                     Message #")
		fmt.Printf("%-12s  %-25s  % 4d\n", r.Author, folder.Name, r.ID)
	} else if cmd.Flags["/LOGIN"].Set {
		rows, err := this.Q.GetLastLoginByEnabled(ctx, showLogin)
		rows, err := this.Q.GetLastLoginByEnabled(ctx, showDisabled)
		if err != nil {
			fmt.Printf("ERROR: Failed to get list (%s).\n", err)
			return nil