[Kde-kiosk] KDesktopFile::isAuthorizedDesktopFile

Russell Brown russell at lls.lls.com
Fri May 9 15:07:17 CEST 2003


Very sorry to bug the list on this but can anyone help???

I still can't get run_desktop_files to work as described in
README.kiosk...  Waldo said 'works for me' so I've been putting in debug
and trying to see what happens.

Brief recap: Desktop/xxx.desktop entries from $HOME/Desktop
always appear on the desktop as icons no matter what the setting of
run_desktop_files. This might not be related to the actual execution of
the desktop files but seems out of line for the kiosk process - why show
a users things he can't run?

Anyway, with run_desktop_files set true, my test user can run .desktop
files from $KDEDIRS/share/apps/kdesktop/Desktop and from $HOME/Desktop
(my test .desktop files just fire up an xterm).

With run_desktop_files set to false, my test user cannot excute the
.desktop files in EITHER $KDEDIRS/share/apps/kdesktop/Desktop OR
$HOME/Desktop - An error popup appears saying "You are not authorised
to execute this service". URL link type desktop entries do work though.

Looking into the code in kdesktopfile.cpp
KDesktopFile::isAuthorizedDesktopFile and adding some debug I get
the following when the test user clicks on the .desktop file from
/usr/share/apps/kdesktop/Desktop/foo.desktop

I've included the code and added my comments to show what's being processed.

bool KDesktopFile::isAuthorizedDesktopFile(const QString& path)
{
/* 
    This function is called with path set to:
    /usr/share/apps/kdesktop/Desktop/foo
    kapp does have a value
*/
  if (!kapp || kapp->authorize("run_desktop_files"))
     return true;

  if (path.isEmpty())
     return false; // Empty paths are not ok.
 
  if (path[0] != '/')
     return true; // Relative paths are ok.
    
  KStandardDirs *dirs = KGlobal::dirs();
/*
  The function makes it here...
  dirs->relativeLocation("applnk", path) returns
        /usr/share/apps/kdesktop/Desktop/foo
  as does dirs->relativeLocation("services", path)
*/
  if (dirs->relativeLocation("applnk", path)[0] != '/')
     return true;
  if (dirs->relativeLocation("services", path)[0] != '/')
     return true;
/*
  So, we get to here and dirs->relativeLocation("appdata", path) returns
  'Desktop/foo'
  which obviously does not begin with "kdesktop/Desktop"
*/
  if (dirs->relativeLocation("appdata", path).startsWith("kdesktop/Desktop"))
     return true;
/*
  So the function gets here and returns false
*/
  return false;
}

So kdesktop is always getting a false from this function.

Is the code broken and Waldo's version working by magic? or is there some
blindingly obvious thing I'm missing that someone can point out to me?

Thanks in advance

-- 
 Regards,
     Russell
 --------------------------------------------------------------------
| Russell Brown          | MAIL: russell at lls.com PHONE: 01780 471800 |
| Lady Lodge Systems     | WWW Work: http://www.lls.com              |
| Peterborough, England  | WWW Play: http://www.ruffle.me.uk         |
 --------------------------------------------------------------------


More information about the kde-kiosk mailing list