author | Tomas Kuthan <tomas.kuthan@oracle.com> |
Fri, 27 Jan 2017 14:23:05 -0800 | |
branch | s11u3-sru |
changeset 7621 | c11a68c3a63d |
parent 7619 | 4e1d20a92c16 |
permissions | -rw-r--r-- |
7619
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
1 |
# |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
2 |
# This patch is to provide a SFTP DTrace provider which offers an administrator |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
3 |
# some observability of SFTP data transfer. This was developed in-house. |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
4 |
# Because this is Solaris-specific and not suitable for upstream, we will not |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
5 |
# contribute the changes to the upstream community. |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
6 |
# |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
7 |
diff -pur old/Makefile.in new/Makefile.in |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
8 |
--- old/Makefile.in |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
9 |
+++ new/Makefile.in |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
10 |
@@ -85,6 +85,7 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
11 |
atomicio.o key.o dispatch.o mac.o uidswap.o uuencode.o misc.o utf8.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
12 |
monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
13 |
msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o umac128.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
14 |
+ sftp_provider.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
15 |
ssh-pkcs11.o smult_curve25519_ref.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
16 |
poly1305.o chacha.o cipher-chachapoly.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
17 |
ssh-ed25519.o digest-openssl.o digest-libc.o hmac.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
18 |
@@ -107,7 +108,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passw |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
19 |
monitor_mm.o monitor.o monitor_wrap.o auth-krb5.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
20 |
auth2-gss.o gss-serv.o gss-serv-krb5.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
21 |
loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
22 |
- sftp-server.o sftp-common.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
23 |
+ sftp-server.o sftp-common.o sftp_provider.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
24 |
sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
25 |
sandbox-seccomp-filter.o sandbox-capsicum.o sandbox-pledge.o \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
26 |
sandbox-solaris.o |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
27 |
@@ -187,8 +188,8 @@ ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
28 |
ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
29 |
$(LD) -o [email protected] ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
30 |
|
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
31 |
-sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
32 |
- $(LD) -o [email protected] sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
33 |
+sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o sftp_provider.o |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
34 |
+ $(LD) -o [email protected] sftp-server.o sftp-common.o sftp-server-main.o sftp_provider.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
35 |
|
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
36 |
sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glob.o progressmeter.o |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
37 |
$(LD) -o [email protected] progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
38 |
@@ -225,9 +226,18 @@ umac128.o: umac.c |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
39 |
-Dumac_update=umac128_update -Dumac_final=umac128_final \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
40 |
-Dumac_delete=umac128_delete -Dumac_ctx=umac128_ctx |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
41 |
|
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
42 |
+# dtrace sftp |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
43 |
+sftp_provider.h: $(srcdir)/sftp_provider.d |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
44 |
+ /usr/sbin/dtrace -xnolibs -h -s $(srcdir)/sftp_provider.d \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
45 |
+ -o $(srcdir)/sftp_provider.h |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
46 |
+ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
47 |
+sftp_provider.o: sftp_provider.d sftp_provider.h sftp-server.o |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
48 |
+ /usr/sbin/dtrace -G -32 -xnolibs -s $(srcdir)/sftp_provider.d \ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
49 |
+ sftp-server.o -o sftp_provider.o |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
50 |
+ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
51 |
clean: regressclean |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
52 |
rm -f *.o *.a $(TARGETS) logintest config.cache config.log |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
53 |
- rm -f *.out core survey |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
54 |
+ rm -f *.out core survey sftp_provider.h |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
55 |
rm -f regress/unittests/test_helper/*.a |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
56 |
rm -f regress/unittests/test_helper/*.o |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
57 |
rm -f regress/unittests/sshbuf/*.o |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
58 |
diff -pur old/sftp-server.c new/sftp-server.c |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
59 |
--- old/sftp-server.c |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
60 |
+++ new/sftp-server.c |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
61 |
@@ -51,6 +51,9 @@ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
62 |
|
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
63 |
#include "sftp.h" |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
64 |
#include "sftp-common.h" |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
65 |
+#ifdef DTRACE_SFTP |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
66 |
+#include "sftp_provider_impl.h" |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
67 |
+#endif |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
68 |
|
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
69 |
/* Our verbosity */ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
70 |
static LogLevel log_level = SYSLOG_LEVEL_ERROR; |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
71 |
@@ -737,14 +740,17 @@ process_read(u_int32_t id) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
72 |
u_int32_t len; |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
73 |
int r, handle, fd, ret, status = SSH2_FX_FAILURE; |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
74 |
u_int64_t off; |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
75 |
+ char *fpath; |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
76 |
|
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
77 |
if ((r = get_handle(iqueue, &handle)) != 0 || |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
78 |
(r = sshbuf_get_u64(iqueue, &off)) != 0 || |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
79 |
(r = sshbuf_get_u32(iqueue, &len)) != 0) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
80 |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
81 |
|
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
82 |
- debug("request %u: read \"%s\" (handle %d) off %llu len %d", |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
83 |
- id, handle_to_name(handle), handle, (unsigned long long)off, len); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
84 |
+ fpath = handle_to_name(handle); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
85 |
+ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
86 |
+ debug("request %u: read \"%s\" (handle %d) off %llu len %d", |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
87 |
+ id, fpath, handle, (unsigned long long)off, len); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
88 |
if (len > sizeof buf) { |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
89 |
len = sizeof buf; |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
90 |
debug2("read change len %d", len); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
91 |
@@ -755,7 +761,13 @@ process_read(u_int32_t id) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
92 |
error("process_read: seek failed"); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
93 |
status = errno_to_portable(errno); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
94 |
} else { |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
95 |
+#ifdef DTRACE_SFTP |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
96 |
+ SFTP_TRANSFER_START_OP("read", fd, fpath, len); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
97 |
+#endif |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
98 |
ret = read(fd, buf, len); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
99 |
+#ifdef DTRACE_SFTP |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
100 |
+ SFTP_TRANSFER_DONE_OP("read", fd, fpath, ret); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
101 |
+#endif |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
102 |
if (ret < 0) { |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
103 |
status = errno_to_portable(errno); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
104 |
} else if (ret == 0) { |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
105 |
@@ -778,14 +790,16 @@ process_write(u_int32_t id) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
106 |
size_t len; |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
107 |
int r, handle, fd, ret, status; |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
108 |
u_char *data; |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
109 |
+ char *fpath; |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
110 |
|
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
111 |
if ((r = get_handle(iqueue, &handle)) != 0 || |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
112 |
(r = sshbuf_get_u64(iqueue, &off)) != 0 || |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
113 |
(r = sshbuf_get_string(iqueue, &data, &len)) != 0) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
114 |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
115 |
|
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
116 |
+ fpath = handle_to_name(handle); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
117 |
debug("request %u: write \"%s\" (handle %d) off %llu len %zu", |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
118 |
- id, handle_to_name(handle), handle, (unsigned long long)off, len); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
119 |
+ id, fpath, handle, (unsigned long long)off, len); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
120 |
fd = handle_to_fd(handle); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
121 |
|
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
122 |
if (fd < 0) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
123 |
@@ -797,7 +811,14 @@ process_write(u_int32_t id) |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
124 |
error("process_write: seek failed"); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
125 |
} else { |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
126 |
/* XXX ATOMICIO ? */ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
127 |
+#ifdef DTRACE_SFTP |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
128 |
+ SFTP_TRANSFER_START_OP("write", fd, fpath, len); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
129 |
+#endif |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
130 |
ret = write(fd, data, len); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
131 |
+#ifdef DTRACE_SFTP |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
132 |
+ SFTP_TRANSFER_DONE_OP("write", fd, fpath, ret); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
133 |
+#endif |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
134 |
+ |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
135 |
if (ret < 0) { |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
136 |
error("process_write: write failed"); |
4e1d20a92c16
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
137 |
status = errno_to_portable(errno); |