wpa_supplicant.conf permission

2,976 views
Skip to first unread message

Richard Zhao

unread,
Feb 23, 2010, 10:22:01 PM2/23/10
to android-platform
Hi group,

I'm working on wifi on eclair.
I found functions in libhardware_legacy/wifi/wifi.c is called in user
system. It tries to copy conf template to /data/misc/wifi/
wap_supplicant.conf, and chown to use wifi group system. but system
can not chown to wifi use, right?
And in init.rc, /data/misc/wifi is set to owner wifi group wifi.
wpa_supplicant uses setuid to switch to use wifi, but it always report
it don't have permission to read wpa_supplicant.conf.

Thanks
Richard

Richard Zhao

unread,
Feb 24, 2010, 4:27:12 AM2/24/10
to android-platform, lock...@android.com
Hi Mike,

Currently, my /data/misc/wifi is 0770 wifi:wifi, is it correct?
"cat /proc/pid/status" shows system_server is in 1010(wifi) group.
But it always fails at
libhardware_legacy/wifi.c:
int ensure_config_file_exists()
{
char buf[2048];
int srcfd, destfd;
int nread;

if (access(SUPP_CONFIG_FILE, R_OK|W_OK) == 0) {
return 0;
} else if (errno != ENOENT) {
LOGE("Cannot access \"%s\": %s", SUPP_CONFIG_FILE,
strerror(errno)); //fail here
return -1;
}

Do you have any clue?

Thanks
Richard

Mike Lockwood

unread,
Feb 24, 2010, 8:09:52 AM2/24/10
to Richard Zhao, android-platform
Hi Richard,

That sounds right to me. On my Nexus One I have:

/data/misc/wifi:
drwxrwx--- wifi wifi 2010-02-19 19:29 wifi

/data/misc/wifi/wpa_supplicant.conf:
-rw-rw---- system wifi 254 2010-02-21 09:13 wpa_supplicant.conf

So both the system server and wpa_supplicant can read and write the
wpa_supplicant.conf file, and create the file if it does not exist.

When the system starts for the first time, a default
wpa_supplicant.conf file is copied from
/system/etc/wifi/wpa_supplicant.conf. Maybe you are seeing an error
message when the phone starts for the first time and the file has not
been copied yet?

Mike

--
Mike Lockwood
Google android team

Richard Zhao

unread,
Feb 24, 2010, 8:56:11 AM2/24/10
to Mike Lockwood, android-platform
Yes, it's strange. It's the first time boot. access(SUPP_CONFIG_FILE,
R_OK|W_OK) always failes, errno returns permission denied.
The /data/misc/wifi permission is just like yours. But I'm using nfs.
It may not matter much.

Is Nexus using hardware/libhardware_legacy/wifi/wifi.c?

Thanks
Richard

Mike Lockwood

unread,
Feb 24, 2010, 11:44:01 AM2/24/10
to Richard Zhao, android-platform
Yes, Nexus One is using the same
hardware/libhardware_legacy/wifi/wifi.c code that is in the eclair
branch on kernel.org.

Mike

Richard Zhao

unread,
Feb 25, 2010, 7:08:04 AM2/25/10
to Mike Lockwood, android-platform
Hi Mike,

It's caused by nfs. If I use a sd card with ext3 fs, it won't have the problem.

Thanks
Richard

Reply all
Reply to author
Forward
0 new messages