20397201 /usr/lib/dtrace/sftp.d should be a mediated link in OPENSSH and link to sftp64.d
authorkavya.racharla@oracle.com <kavya.racharla@oracle.com>
Tue, 17 Feb 2015 10:18:43 -0800
changeset 3820 1063fcafa7a5
parent 3817 30b42c38bbc4
child 3822 fe3bbc835041
20397201 /usr/lib/dtrace/sftp.d should be a mediated link in OPENSSH and link to sftp64.d
components/openssh/dtrace_sftp/sftp64.d
components/openssh/openssh.p5m
components/openssh/patches/013-dtrace_sftp.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openssh/dtrace_sftp/sftp64.d	Tue Feb 17 10:18:43 2015 -0800
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D depends_on library net.d
+#pragma D depends_on library io.d
+#pragma D depends_on module lofs
+
+typedef struct sftpinfo {
+	string sfi_user;		/* user name */
+	string sfi_operation;		/* SFTP Operation */
+	ssize_t sfi_nbytes;		/* bytes transferred, if any */
+	string sfi_pathname;		/* pathname of transfer */
+	string sfi_fsresource;		/* Dataset(ZFS) or resource name */
+} sftpinfo_t;
+
+/*
+ * This structure must match the definition of same in sftp_provider_impl.h.
+ */
+typedef struct sftpproto {
+	int64_t sftp_nbytes;		/* bytes written or read */
+	uint64_t sftp_user;		/* user name */
+	uint64_t sftp_operation;	/* SFTP operation */
+	uint64_t sftp_raddr;		/* remote address */
+	uint64_t sftp_pathname;		/* path with file name */
+	int32_t sftp_fd;		/* fd for transfer, if any */
+} sftpproto_t;
+
+#pragma D binding "1.6.1" translator
+translator conninfo_t <sftpproto_t *s> {
+	ci_protocol = "tcp";
+	ci_remote = copyinstr((uintptr_t)
+	    *(uint64_t *)copyin((uintptr_t)&s->sftp_raddr, sizeof (uint64_t)));
+	ci_local = "<unknown>";
+};
+
+#pragma D binding "1.6.1" translator
+translator sftpinfo_t <sftpproto_t *s> {
+	sfi_user = copyinstr((uintptr_t)
+	    *(uint64_t *)copyin((uintptr_t)&s->sftp_user, sizeof (uint64_t)));
+	sfi_operation = copyinstr((uintptr_t)
+	    *(uint64_t *)copyin((uintptr_t)&s->sftp_operation,
+	    sizeof (uint64_t)));
+	sfi_nbytes =
+	    *(uint64_t *)copyin((uintptr_t)&s->sftp_nbytes, sizeof (uint64_t));
+	sfi_fsresource = stringof(fds[*(int32_t *)copyin((uintptr_t)&s->sftp_fd,
+	    sizeof (int32_t))].fi_fs) == "lofs" ? stringof(((struct loinfo *)
+	    curthread->t_procp->p_user.u_finfo.fi_list[*(int32_t *)copyin(
+	    (uintptr_t)&s->sftp_fd, sizeof (int32_t))].uf_file->f_vnode->
+	    v_vfsp->vfs_data)->li_realvfs->vfs_resource->rs_string) :
+	    stringof(curthread->t_procp->p_user.u_finfo.fi_list[
+	    *(int32_t *)copyin((uintptr_t)&s->sftp_fd, sizeof (int32_t))].
+	    uf_file->f_vnode->v_vfsp->vfs_resource->rs_string);
+	sfi_pathname = copyinstr((uintptr_t)*(uint64_t *)copyin(
+	    (uintptr_t)&s->sftp_pathname, sizeof (uint64_t)));
+};
--- a/components/openssh/openssh.p5m	Sun Feb 15 19:02:09 2015 -0600
+++ b/components/openssh/openssh.p5m	Tue Feb 17 10:18:43 2015 -0800
@@ -48,6 +48,9 @@
     mediator-implementation=openssh
 link path=usr/bin/ssh-keyscan target=../lib/openssh/bin/ssh-keyscan \
     mediator=ssh mediator-implementation=openssh
+file usr/lib/dtrace/64/sftp64.d path=usr/lib/dtrace/64/sftp64.d mode=0555
+link path=usr/lib/dtrace/sftp.d target=./64/sftp64.d mediator=ssh \
+    mediator-implementation=openssh
 file usr/bin/scp path=usr/lib/openssh/bin/scp mode=0555
 file usr/bin/sftp path=usr/lib/openssh/bin/sftp mode=0555
 file usr/bin/ssh path=usr/lib/openssh/bin/ssh mode=0555
--- a/components/openssh/patches/013-dtrace_sftp.patch	Sun Feb 15 19:02:09 2015 -0600
+++ b/components/openssh/patches/013-dtrace_sftp.patch	Tue Feb 17 10:18:43 2015 -0800
@@ -6,6 +6,14 @@
 #
 --- orig/Makefile.in	Wed Apr 16 17:10:03 2014
 +++ new/Makefile.in	Wed Apr 23 11:00:05 2014
[email protected]@ -26,6 +26,7 @@
+ SFTP_SERVER=$(libexecdir)/sftp-server
+ SSH_KEYSIGN=$(libexecdir)/ssh-keysign
+ SSH_PKCS11_HELPER=$(libexecdir)/ssh-pkcs11-helper
++ROOTDLIBDIR64=$(DESTDIR)/usr/lib/dtrace/64
+ [email protected][email protected]
+ [email protected][email protected]
+ [email protected][email protected]
 @@ -76,7 +76,8 @@
  	jpake.o schnorr.o ssh-pkcs11.o krl.o smult_curve25519_ref.o \
  	kexc25519.o kexc25519c.o poly1305.o chacha.o cipher-chachapoly.o \
@@ -56,6 +64,14 @@
  	(cd openbsd-compat && $(MAKE) clean)
  
  distclean:	regressclean
[email protected]@ -313,6 +314,7 @@
+ 	ln -s ./ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
+ 	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
+ 	ln -s ./ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
++	mkdir -p $(ROOTDLIBDIR64) && cp $(srcdir)/sftp64.d $(ROOTDLIBDIR64)/sftp64.d
+ 
+ install-sysconf:
+ 	if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
 --- orig/sftp-server.c	Wed Apr 16 18:44:37 2014
 +++ new/sftp-server.c	Thu Apr 17 11:53:54 2014
 @@ -51,6 +51,9 @@