Diff

Differences From Artifact [f319eb8ec1]:

To Artifact [3ee13d5544]:


116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137



138
139
140
141
142
143
144
116
117
118
119
120
121
122



123
124
125
126

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143







-
-
-




-







+
+
+







    if (cfg.host[0] == '\0') {
	/* No settings for this host; use defaults */
	strncpy(cfg.host, host, sizeof(cfg.host)-1);
	cfg.host[sizeof(cfg.host)-1] = '\0';
	cfg.port = 22;
    }

    if (portnumber)
	cfg.port = portnumber;

    /* Set username */
    if (user != NULL && user[0] != '\0') {
	strncpy(cfg.username, user, sizeof(cfg.username)-1);
	cfg.username[sizeof(cfg.username)-1] = '\0';
	cfg.port = 22;
    } else if (cfg.username[0] == '\0') {
	bump("Empty user name");
    }

    if (cfg.protocol != PROT_SSH)
	cfg.port = 22;

    if (portnumber)
	cfg.port = portnumber;

    err = ssh_init(cfg.host, cfg.port, cmd, &realhost);
    if (err != NULL)
	bump("ssh_init: %s", err);
    if (verbose && realhost != NULL)
	fprintf(stderr, "Connected to %s\n", realhost);

    connection_open = 1;