CZPOSTPR Incorrect directory type

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
dm9724
Posts: 4
Joined: Sun May 19, 2013 12:07 pm

CZPOSTPR Incorrect directory type

Post by dm9724 »

CZPOSTPR exit has been implemented which generates a WTO to MVS SYSLOG which includes the following information:
userid
current FTP command
reason code
confidence level
directory type (MVS or HFS)
file name

The directory type field incorrectly has value of HFS when the transfer is an MVS dataset.

The following is the WTO for a unix file transfer which correctly indicates directory type of HFS
SFTP001I user=userid cmd=STOR rea=00 confidence=unknown HFS file=/SYSTEM/tmp/sftp-xxxx-syslog_130924_222702

The following is the WTO for an MVS dataset transfer which incorrectly indicates directory type of HFS
SFTP001I user=userid cmd=STOR rea=00 confidence=unknown HFS file=USERID.SYSLOG.COZSFTP

Do you have any idea why directory type is HFS for an MVS dataset transfer?

thank you
dovetail
Site Admin
Posts: 2025
Joined: Thu Jul 29, 2004 12:12 pm

Re: CZPOSTPR Incorrect directory type

Post by dovetail »

Please capture a trace of this and email to us at info@dovetail.com so that we can review.

To turn on the trace, add the following to the user's $HOME/.ssh/sftp-server.rc script:

Code: Select all

# The user's $HOME/.ssh/sftp-server.rc
export COZ_LOG=T,ZosExitInterface=F
export SFTP_SERVER_OPTIONS="-e -l debug3"
dovetail
Site Admin
Posts: 2025
Joined: Thu Jul 29, 2004 12:12 pm

Re: CZPOSTPR Incorrect directory type

Post by dovetail »

Thanks for sending the trace.
It confirms what I expected was happening -

the "directory type" in the CZCHKCMD or CZPOSTPR (like their FTCHKCMD and FTPOSTPR) actually refers to the type of the current working directory and NOT to the type of the file.

The current working directory can be one thing and the file can be an absolute reference to a file in a different directory or to a completely different type of file (a data set).
In SFTP, there is really no such thing as a "current working directory", so what we do is simulate the "current working directory" based on whether we see a at "FXP_STAT" request for a directory. While most clients use FXP_STAT packets for "cd" commands, others like PuTTY don't.

It really doesn't matter - to be safe and correct you can't use the "current working directory" or the "directory type" (of the current working directory) as the only indication of the type of file.

Here is a forum post that outlines the correct way (for BOTH IBM FTP and Co:Z SFTP) for an exit to figure out the real file or data set name:

http://dovetail.com/forum/viewtopic.php?t=963
(see the last post, from 08 Jul 2010 07:56 am)
Post Reply