After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 152659 - WARNING **: Owner of /tmp/orbit-<username> is not the current user
WARNING **: Owner of /tmp/orbit-<username> is not the current user
Status: RESOLVED FIXED
Product: ORBit2
Classification: Deprecated
Component: general
2.10.x
Other Linux
: Normal minor
: ---
Assigned To: ORBit maintainers
ORBit maintainers
: 137784 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-09-14 19:25 UTC by gnomejoybug7.12.joek
Modified: 2006-10-22 14:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix the bug (1.95 KB, patch)
2006-09-15 13:20 UTC, Manjunath K V
none Details | Review
Modified patch to fix the issue (2.13 KB, patch)
2006-09-27 07:08 UTC, Manjunath K V
none Details | Review

Description gnomejoybug7.12.joek 2004-09-14 19:25:51 UTC
1) Say you have a machine that runs gnome with a user named joe_user1.  There
will be a directory in /tmp called ./orbit-joe_user1.

2) If you create another account on the machine called joe_user (without the '1'
suffix),  when you start certain gtk programs (eg mozilla, grip) from the
command line as joe_user, it will say

WARNING **: Owner of /tmp/orbit-joe_user1 not the current user

The program will start and run normally.

Evidently the programs get confused when usernames have similar prefixes and
different suffixes.

Other people are apparently experiencing the same problem, see here:
https://listman.redhat.com/archives/phoebe-list/2003-February/msg00688.html

I am not 100% sure that gtk+ is the right section to post this bug in; if that
is not the case please forward it to the correct section.

Thank you.
Comment 1 Michael Meeks 2004-09-29 12:55:48 UTC
We should use the UID instead of the user name for that file I think; that would
save this problem (and some others) ever occuring.
Comment 2 Chris A 2004-12-01 23:08:02 UTC
The problem is from:

orb/GIOP/giop.c:

test_safe_socket_dir(const char *dirname)

This function is used to scan a directory (from 'scan_socket_dir' in the same
file). If there is both a 'marcus' and 'marc' (or any other combination, where
the second username is a substring of the first), then the second user will get a:

Owner of /tmp/orbit-marcus is not the current user


Comment 3 Michael Meeks 2004-12-03 04:13:36 UTC
For the next gnome release we should switch to scanning /tmp/orbit-<UID>-*
instead of the user-name; which would cause fewer problems.
Patch welcome :-)
Comment 4 Manjunath K V 2006-09-15 13:16:56 UTC
Consider we have two users user1 and user10. The ORBit directories created will be /tmp/orbit-user1 and /tmp/orbit-user10 respectively. In scan_socket_dir () we have a check as below:
     strncmp (dent, prefix, prefix_len); 

Now for user1, prefix will be 'orbit-user1'. The strncmp succeeds for 'orbit-user1' and 'orbit-user10' as well, but since user1 does not own 'orbit-user10' directory the warning message is displayed.

Solution:
Since user1 can have directories like /tmp/orbit-user1 or /tmp/orbit-user1-*, checking for /tmp/orbit-user1 first and then checking for /tmp/orbit-user1-* will fix this issue. 

Changing the strncmp () with the below will fix the issue:
    (strcmp (dent, prefix) && strncmp (dent, prefix_with_hyphen, prefix_len))
where, prefix_with_hyphen is 'orbit-user1-'

Attaching a patch using this approach.

Kindly note that if we use UIDs instead of username, we will still get the above warning due to strncmp (). Eg: We can users with UID 500 and 5000. Now for UID 500, the strncmp () will still succeed for UID 5000 and hence the bug.

=====================================
Comment 5 Manjunath K V 2006-09-15 13:20:30 UTC
Created attachment 72851 [details] [review]
Patch to fix the bug
Comment 6 Michael Meeks 2006-09-22 10:11:09 UTC
looks great to me - please do commit to HEAD.

I still think that moving to a UID based solution is prolly better.
Comment 7 Manjunath K V 2006-09-22 12:23:05 UTC
Michael: I can recreate a patch using UIDs but am not sure how UID based solution is a better approach. Even in case UIDs are used, we will still have to do both the above mentioned string comparisons (as done in the above attached patch). Kindly let me know if I am missing anything.
Comment 8 Manjunath K V 2006-09-27 07:07:23 UTC
Michael: Attaching a modified patch to retain strncmp() instead of using strcmp(). Kindly note that this patch also doesn't use the UID approach. 
Comment 9 Manjunath K V 2006-09-27 07:08:51 UTC
Created attachment 73477 [details] [review]
Modified patch to fix the issue
Comment 10 Michael Meeks 2006-09-27 08:35:15 UTC
fine - I was happy with the original patch :-) please do commit.
Brian - any chance you can deal with committing this if Manjunath has no CVS account ?
Comment 11 Manjunath K V 2006-09-27 09:31:15 UTC
Michael: So should I go ahead and commit the second patch ? Kindly confirm.
Comment 12 Michael Meeks 2006-09-27 09:39:33 UTC
go go go ! ;-)
Comment 13 Leena Gunda 2006-09-27 10:20:28 UTC
Have checked in the patch to CVS HEAD on behalf of Manjunath. Thanks.
Comment 14 Kjartan Maraas 2006-10-22 14:06:45 UTC
*** Bug 137784 has been marked as a duplicate of this bug. ***