upstream: rename remote_glob() -> sftp_glob() to match other API

OpenBSD-Commit-ID: d9dfb3708d824ec02970a84d96cf5937e0887229
This commit is contained in:
djm@openbsd.org 2023-09-10 23:12:32 +00:00 committed by Damien Miller
parent 21b79af6c8
commit b6b49130a0
No known key found for this signature in database
3 changed files with 15 additions and 15 deletions

8
scp.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: scp.c,v 1.258 2023/09/08 05:56:13 djm Exp $ */ /* $OpenBSD: scp.c,v 1.259 2023/09/10 23:12:32 djm Exp $ */
/* /*
* scp - secure remote copy. This is basically patched BSD rcp which * scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd). * uses ssh to do the data transfer (instead of using rcmd).
@ -186,7 +186,7 @@ size_t sftp_nrequests;
/* Needed for sftp */ /* Needed for sftp */
volatile sig_atomic_t interrupted = 0; volatile sig_atomic_t interrupted = 0;
int remote_glob(struct sftp_conn *, const char *, int, int sftp_glob(struct sftp_conn *, const char *, int,
int (*)(const char *, int), glob_t *); /* proto for sftp-glob.c */ int (*)(const char *, int), glob_t *); /* proto for sftp-glob.c */
static void static void
@ -1568,7 +1568,7 @@ sink_sftp(int argc, char *dst, const char *src, struct sftp_conn *conn)
} }
debug3_f("copying remote %s to local %s", abs_src, dst); debug3_f("copying remote %s to local %s", abs_src, dst);
if ((r = remote_glob(conn, abs_src, GLOB_NOCHECK|GLOB_MARK, if ((r = sftp_glob(conn, abs_src, GLOB_NOCHECK|GLOB_MARK,
NULL, &g)) != 0) { NULL, &g)) != 0) {
if (r == GLOB_NOSPACE) if (r == GLOB_NOSPACE)
error("%s: too many glob matches", src); error("%s: too many glob matches", src);
@ -2001,7 +2001,7 @@ throughlocal_sftp(struct sftp_conn *from, struct sftp_conn *to,
} }
debug3_f("copying remote %s to remote %s", abs_src, target); debug3_f("copying remote %s to remote %s", abs_src, target);
if ((r = remote_glob(from, abs_src, GLOB_NOCHECK|GLOB_MARK, if ((r = sftp_glob(from, abs_src, GLOB_NOCHECK|GLOB_MARK,
NULL, &g)) != 0) { NULL, &g)) != 0) {
if (r == GLOB_NOSPACE) if (r == GLOB_NOSPACE)
error("%s: too many glob matches", src); error("%s: too many glob matches", src);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp-glob.c,v 1.32 2023/09/08 05:56:13 djm Exp $ */ /* $OpenBSD: sftp-glob.c,v 1.33 2023/09/10 23:12:32 djm Exp $ */
/* /*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
* *
@ -32,7 +32,7 @@
#include "sftp-common.h" #include "sftp-common.h"
#include "sftp-client.h" #include "sftp-client.h"
int remote_glob(struct sftp_conn *, const char *, int, int sftp_glob(struct sftp_conn *, const char *, int,
int (*)(const char *, int), glob_t *); int (*)(const char *, int), glob_t *);
struct SFTP_OPENDIR { struct SFTP_OPENDIR {
@ -134,7 +134,7 @@ fudge_stat(const char *path, struct stat *st)
} }
int int
remote_glob(struct sftp_conn *conn, const char *pattern, int flags, sftp_glob(struct sftp_conn *conn, const char *pattern, int flags,
int (*errfunc)(const char *, int), glob_t *pglob) int (*errfunc)(const char *, int), glob_t *pglob)
{ {
int r; int r;

16
sftp.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp.c,v 1.235 2023/09/08 05:56:13 djm Exp $ */ /* $OpenBSD: sftp.c,v 1.236 2023/09/10 23:12:32 djm Exp $ */
/* /*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
* *
@ -110,7 +110,7 @@ struct complete_ctx {
char **remote_pathp; char **remote_pathp;
}; };
int remote_glob(struct sftp_conn *, const char *, int, int sftp_glob(struct sftp_conn *, const char *, int,
int (*)(const char *, int), glob_t *); /* proto for sftp-glob.c */ int (*)(const char *, int), glob_t *); /* proto for sftp-glob.c */
extern char *__progname; extern char *__progname;
@ -655,7 +655,7 @@ process_get(struct sftp_conn *conn, const char *src, const char *dst,
memset(&g, 0, sizeof(g)); memset(&g, 0, sizeof(g));
debug3("Looking up %s", abs_src); debug3("Looking up %s", abs_src);
if ((r = remote_glob(conn, abs_src, GLOB_MARK, NULL, &g)) != 0) { if ((r = sftp_glob(conn, abs_src, GLOB_MARK, NULL, &g)) != 0) {
if (r == GLOB_NOSPACE) { if (r == GLOB_NOSPACE) {
error("Too many matches for \"%s\".", abs_src); error("Too many matches for \"%s\".", abs_src);
} else { } else {
@ -977,7 +977,7 @@ do_globbed_ls(struct sftp_conn *conn, const char *path,
memset(&g, 0, sizeof(g)); memset(&g, 0, sizeof(g));
if ((r = remote_glob(conn, path, if ((r = sftp_glob(conn, path,
GLOB_MARK|GLOB_NOCHECK|GLOB_BRACE|GLOB_KEEPSTAT|GLOB_NOSORT, GLOB_MARK|GLOB_NOCHECK|GLOB_BRACE|GLOB_KEEPSTAT|GLOB_NOSORT,
NULL, &g)) != 0 || NULL, &g)) != 0 ||
(g.gl_pathc && !g.gl_matchc)) { (g.gl_pathc && !g.gl_matchc)) {
@ -1618,7 +1618,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
break; break;
case I_RM: case I_RM:
path1 = make_absolute_pwd_glob(path1, *pwd); path1 = make_absolute_pwd_glob(path1, *pwd);
remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g); sftp_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
for (i = 0; g.gl_pathv[i] && !interrupted; i++) { for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
if (!quiet) if (!quiet)
mprintf("Removing %s\n", g.gl_pathv[i]); mprintf("Removing %s\n", g.gl_pathv[i]);
@ -1722,7 +1722,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
attrib_clear(&a); attrib_clear(&a);
a.flags |= SSH2_FILEXFER_ATTR_PERMISSIONS; a.flags |= SSH2_FILEXFER_ATTR_PERMISSIONS;
a.perm = n_arg; a.perm = n_arg;
remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g); sftp_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
for (i = 0; g.gl_pathv[i] && !interrupted; i++) { for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
if (!quiet) if (!quiet)
mprintf("Changing mode on %s\n", mprintf("Changing mode on %s\n",
@ -1736,7 +1736,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
case I_CHOWN: case I_CHOWN:
case I_CHGRP: case I_CHGRP:
path1 = make_absolute_pwd_glob(path1, *pwd); path1 = make_absolute_pwd_glob(path1, *pwd);
remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g); sftp_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
for (i = 0; g.gl_pathv[i] && !interrupted; i++) { for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
if ((hflag ? sftp_lstat : sftp_stat)(conn, if ((hflag ? sftp_lstat : sftp_stat)(conn,
g.gl_pathv[i], 0, &aa) != 0) { g.gl_pathv[i], 0, &aa) != 0) {
@ -2017,7 +2017,7 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
memset(&g, 0, sizeof(g)); memset(&g, 0, sizeof(g));
if (remote != LOCAL) { if (remote != LOCAL) {
tmp = make_absolute_pwd_glob(tmp, remote_path); tmp = make_absolute_pwd_glob(tmp, remote_path);
remote_glob(conn, tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g); sftp_glob(conn, tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);
} else } else
(void)glob(tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g); (void)glob(tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);