commit 2afde960164d9b7c1c8e660fa08f99299d7bd5f3 from: Omar Polo date: Wed Nov 23 11:33:22 2022 UTC kamiftp: use the [user@]host[:port][/path] syntax instead of taking the path as a separate argument. For some time the old style will be supported. commit - 315668d47de15aca3c4f52136a3e55cd2adc04dd commit + 2afde960164d9b7c1c8e660fa08f99299d7bd5f3 blob - 2d4b1af1e1145afbda93fa3e94522a2bd456f5a6 blob + 5a9dae586122e17eae9a994be61d85ed7a989f62 --- kamiftp/ftp.c +++ kamiftp/ftp.c @@ -218,7 +218,7 @@ static void __dead usage(int ret) { fprintf(stderr, "usage: %s [-c] [-C cert] [-K key] " - "host[:port] [path]\n", getprogname()); + "[user@]host[:port][/path]\n", getprogname()); fprintf(stderr, "kamid suite version " KAMID_VERSION "\n"); exit(ret); } @@ -916,10 +916,21 @@ dial(const char *host, const char *port) static void do_connect(const char *connspec, const char *path) { + char pathbuf[PATH_MAX]; char *t; const char *port; host = xstrdup(connspec); + + if ((t = strchr(host, '/')) != NULL) { + if (t == host) + errx(1, "invalid connection string: %s", connspec); + if (strlcpy(pathbuf, t, sizeof(pathbuf)) >= sizeof(pathbuf)) + errx(1, "path too long: %s", t); + path = pathbuf; + *t = '\0'; + } + if ((t = strchr(host, '@')) != NULL) { if (t == host) errx(1, "invalid connection string: %s", connspec); blob - ff8d39705cd346b238db02b5017d1025d4854e5a blob + 6c0dd553a4d6a5635b14d94f7ed23becf8912790 --- kamiftp/kamiftp.1 +++ kamiftp/kamiftp.1 @@ -12,7 +12,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 7 2022 $ +.Dd $Mdocdate: November 23 2022 $ .Dt KAMIFTP 1 .Os .Sh NAME @@ -23,8 +23,7 @@ .Op Fl c .Op Fl C Ar cert .Op Fl K Ar key -.Oo Ar user Ns @ Oc Ns Ar host Ns Op : Ns Ar port -.Op Ar path +.Oo Ar user Ns @ Oc Ns Ar host Ns Oo : Ns Ar port Oc Ns Op / Ns Ar path .Sh DESCRIPTION .Nm is a