Hello everyone:
I have big problem with ForceCommand in openssh5.1

I want to configure login account to have shell access with
ForceCommand option enabled and also sftp access without Chroot
Environment

I configured ssh with following lines:

Subsystem sftp internal-sftp
##because there is no Match User section everyone have sftp access
Match User test ## test user
ForceCommand /home/forcetest


And wrote /home/forcetest:


if [[ $SSH_TTY ]]; then
if [[ ! $SSH_ORIGINAL_COMMAND ]] ; then
/home/${LOGNAME}/.profileactive ;
else
DATE=`date`
echo "$DATE $LOGNAME - $SSH_CONNECTION - proba
naduzycia" >> /var/log/shell
fi
else

{
DATE=`date`
echo "$DATE $LOGNAME - $SSH_CONNECTION sftp - proba
naduzycia" >> /var/log/shell
}
fi


When I disable ForceCommand option everything works. But when I
enable, users from Match User list for ForceCommand cannot get via
sftp.....

Is there any option for detect type of ssh service: shell or
sftp ?????
Or have somebody any idea for this problem...

In my opinion ForceCommand crosses out sftp access.

Thanks for help

Regards
Janusz