ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 8th, 2004, 11:32 AM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
Question Java and CF

hi, i cannot quite figure this one out. i have a small java program that returns a user's windows login. i use the following code to get the result out of that java program.

<cfobject action="create" type="java" class="GetUser1" name="emp">
<cfset emp.init()>
<cfset user = emp.gUser()>
<cfoutput>#user#</cfoutput>

and here is the small java program called GetUser1.java

public class GetUser1
{
public String uName;

public String gUser()
{
uName = System.getProperty("user.name");
return uName;
}
}


When i run the CF code on the server, it displays 'SYSTEM' instead of my windows user name. does anyone know why it displays 'SYSTEM'?

Reply With Quote
  #2  
Old November 8th, 2004, 12:15 PM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 23
Send a message via AIM to bocmaxima
What happens when you run the code through JVM and not just through CF?

Reply With Quote
  #3  
Old November 8th, 2004, 01:05 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
since there is no main method it won't run thru JVM. but that is not the problem, i can modify it to display something else such as

uName = "crap"; and it will write crap on the screen.

eventually, the application will have to run on the client side to get the client's username. then, i take that username and use CF to insert into a DB table on the server side. it kind of sounds like hacking. i am not sure if this will work out, but if anyone has any idea please shoot...
thanks

Reply With Quote
  #4  
Old January 11th, 2005, 07:10 AM
prs_kishore prs_kishore is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 23 prs_kishore User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 5 m 5 sec
Reputation Power: 0
hai FalconsEye,
I think this is a real bug in CFML.I am also working on similar cfml application.
I tested your code differently,

<cfset myobject = createobject("java","getuser1")>
<cfset user = myobject.gUser()>
<cfoutput>#user#</cfoutput>

but still "SYSTEM" is the output....

If you execute the same code in java we are getting the correct answer,

class getuser
{
public String uName;

public String gUser()
{
uName = System.getProperty("user.name");
return uName;
}
}
public class getuser1
{
public static void main(String args[])
{
getuser g = new getuser();
String p = g.gUser();
System.out.println(p);
}
}

output:

C:\jdk1.3\bin>javac getuser1.java

C:\jdk1.3\bin>java getuser1
administrator

C:\jdk1.3\bin>

So, i think it is a real problem in CFML which should be corrected.
If any body has valuable suggestions ,please suggest..

bye
Kishore prs

Reply With Quote
  #5  
Old January 11th, 2005, 07:57 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 14 h 23 m 22 sec
Reputation Power: 53
This isn't a bug at all; it's doing exactly what it is supposed to do. The user account that is executing the code is the user account that *ColdFusion* is running under. Obviously the CF service is using the SYSTEM account so that is what you see.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #6  
Old January 18th, 2005, 01:16 AM
prs_kishore prs_kishore is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 23 prs_kishore User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 5 m 5 sec
Reputation Power: 0
hai kiteless,
Its a great work.
I agree with you.
So, can you tell us how we can get the exact result(user account) but not the cold fusion account.

thank you,
with regards,

Kishore PRS

Reply With Quote
  #7  
Old January 18th, 2005, 08:27 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 14 h 23 m 22 sec
Reputation Power: 53
Not that I know of, except to have a login system, or to inspect the cgi scope if the user has logged into a site using OS level security. I believe there is a variable called auth_user once the user has logged into the site, but again this is only if you are using OS/Web server permissions on the directories of your web site.

But no, as far as I know there is no way for the CF server (or any other application server for that matter) to know anything about which user account the user is using on their local machine.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Java and CF


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway