On Mar 24, 2013, at 4:29 PM, Harris, Jeffrey E. wrote:
-----Original Message-----
From: Patrick Flaherty [mailto:pflah...@rampageinc.com]
Sent: Sunday, March 24, 2013 4:15 PM
To: Tomcat Users List
Subject: Re: runtime.exec "cmd.exe /C net use"
Within your application, do you actually access the mappings by
letter, or by UNC?
The problem is after I'm up and running, I try to run "cmd.exe /C
net
use" from within the app it does not return any mapped drives. it
returns:
net use
New connections will be remembered.
There are no entries in the list.
We understand that. What we are trying to tell you if you want
those
mappings to appear (regardless of whether they are already mapped or
not), we think you need to dynamically map them within your
application. Otherwise, we think you will continue to experience
the
situation you describe above.
Again, the return above happen only when running as a service but
works fine when tomcat starts from startup.bat in a console. Works
fine means it returns drive letter, unc equivalent etc ...
basically
what you normally see when you have mapped network drives and run
"net use"
from cmd.exe.
It make no sense I know but I'm at a loss.
I think it makes sense (pending further information on how you
actually access the shares from within your application) because the
application is not actually using a mapped drive, but using its
access
rights from a UNC.
Hi Jeffrey,
I think I'm getting what you might be saying. Because "net use"
returns a drive letter in its return
then the service cannot deal with it? To answer your question about
how
we access shares from within our app, we *have to* use UNC paths that
already have the proper credentials provided by a common username &
password that the service uses to login (local account with same
username and password as an account already on the file server) So
when
the app accesses the UNC path for the first time it tries to use it's
service login credentials which we require to exist on the file
server
with the shares. Therefore when we do our first network access the
service login account is used to authenticate with the file server
and
because we create an account on the file server with the same
username
and password we get clean access to the shares.
I never liked having this
rule (service login name and password must exist on the file server
matching exactly) but it has work for us for years. But getting
back to
net use, because drive letters are not usable by code running in the
service, we don't get anything back from "net use"
because part of its return is
a drive letter? I hope I'm making sense, but is that the gist of what
you are saying? If it is then it starts to make a lot more sense now.
Thanks for hanging in there with me.
Pat
Mappings are strictly a convention for using UNCs with drive letters
(a fall back
to the days of Windows 3.1 and 95/98 which did not understand UNCs,
and neither
did applications). Based on your description, you are using
passthrough authentication because you
are operating in a workgroup environment (if you were in a domain
environment,
you would simply assign a domain account, and give that account the
right
permissions to the share). Your description above about
authentication is
exactly right - matching accounts and passwords means transparent
access to the
share.
Andre discussed this point in his last post - a service account
logging in interactively
has a different environment than a service account logging in as a
service. Windows is
basically ignoring any drive mappings that you specify because they
were specified outside
of the service session. You are gaining access because of the UNCs
and the passthrough
authentication.
If you want to use drive mappings, you need to map them WITHIN your
application (or service
session) to appear. See the link in Serge's post for some ideas how
to do this. I think
the best method is to actually map the drives yourself within your
application, if you can;
otherwise, set up a service that does the drive mappings, and then
calls your Tomcat service.
If all you want to do is make the list of mappings appear in an HTML
page (without actually using
them in your application), you can just fake the list as I discussed
previously.
The key point is because the mappings are not set within the service
session itself, you are NOT
using the mappings, only the UNCs, and they will not appear using
the net use command within
the service.
Jeffrey Harris
Hi Jeffrey,
Yes, I now get it. Thanks for the lesson on Windows Networking (I
thought I knew well) and thanks to Andre as well.
You also said that if all I wanted to do was make a list of mapping
appear in an html page (without actually using them
in your application), you can just fake it as previously discussed. I
think I missed that part.
Thanks
Pat
This e-mail and any attachments are intended only for the use of the
addressee(s) named herein and may contain proprietary information.
If you are not the intended recipient of this e-mail or believe that
you received this email in error, please take immediate action to
notify the sender of the apparent error by reply e-mail; permanently
delete the e-mail and any attachments from your computer; and do not
disseminate, distribute, use, or copy this message and any
attachments.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org