D-Bus 1.4.6
dbus-sysdeps-util-win.c
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
00002 /* dbus-sysdeps-util.c Would be in dbus-sysdeps.c, but not used in libdbus
00003  * 
00004  * Copyright (C) 2002, 2003, 2004, 2005  Red Hat, Inc.
00005  * Copyright (C) 2003 CodeFactory AB
00006  *
00007  * Licensed under the Academic Free License version 2.1
00008  * 
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022  *
00023  */
00024 
00025 #include <config.h>
00026 
00027 #define STRSAFE_NO_DEPRECATE
00028 
00029 #include "dbus-sysdeps.h"
00030 #include "dbus-internals.h"
00031 #include "dbus-protocol.h"
00032 #include "dbus-string.h"
00033 #include "dbus-sysdeps.h"
00034 #include "dbus-sysdeps-win.h"
00035 #include "dbus-sockets-win.h"
00036 #include "dbus-memory.h"
00037 #include "dbus-pipe.h"
00038 
00039 #include <stdio.h>
00040 #include <stdlib.h>
00041 #if HAVE_ERRNO_H
00042 #include <errno.h>
00043 #endif
00044 #include <winsock2.h>   // WSA error codes
00045 
00046 #ifndef DBUS_WINCE
00047 #include <io.h>
00048 #include <lm.h>
00049 #include <sys/stat.h>
00050 #endif
00051 
00052 
00062 dbus_bool_t
00063 _dbus_become_daemon (const DBusString *pidfile,
00064                      DBusPipe         *print_pid_pipe,
00065                      DBusError        *error,
00066                      dbus_bool_t       keep_umask)
00067 {
00068   return TRUE;
00069 }
00070 
00079 static dbus_bool_t
00080 _dbus_write_pid_file (const DBusString *filename,
00081                       unsigned long     pid,
00082                       DBusError        *error)
00083 {
00084   const char *cfilename;
00085   HANDLE hnd;
00086   char pidstr[20];
00087   int total;
00088   int bytes_to_write;
00089 
00090   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00091 
00092   cfilename = _dbus_string_get_const_data (filename);
00093 
00094   hnd = CreateFileA (cfilename, GENERIC_WRITE,
00095                      FILE_SHARE_READ | FILE_SHARE_WRITE,
00096                      NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL,
00097                      INVALID_HANDLE_VALUE);
00098   if (hnd == INVALID_HANDLE_VALUE)
00099     {
00100       char *emsg = _dbus_win_error_string (GetLastError ());
00101       dbus_set_error (error, _dbus_win_error_from_last_error (),
00102                       "Could not create PID file %s: %s",
00103                       cfilename, emsg);
00104       _dbus_win_free_error_string (emsg);
00105       return FALSE;
00106     }
00107 
00108   if (snprintf (pidstr, sizeof (pidstr), "%lu\n", pid) < 0)
00109     {
00110       dbus_set_error (error, _dbus_error_from_system_errno (),
00111                       "Failed to format PID for \"%s\": %s", cfilename,
00112                       _dbus_strerror_from_errno ());
00113       CloseHandle (hnd);
00114       return FALSE;
00115     }
00116 
00117   total = 0;
00118   bytes_to_write = strlen (pidstr);;
00119 
00120   while (total < bytes_to_write)
00121     {
00122       DWORD bytes_written;
00123       BOOL res;
00124 
00125       res = WriteFile (hnd, pidstr + total, bytes_to_write - total,
00126                        &bytes_written, NULL);
00127 
00128       if (res == 0 || bytes_written <= 0)
00129         {
00130           char *emsg = _dbus_win_error_string (GetLastError ());
00131           dbus_set_error (error, _dbus_win_error_from_last_error (),
00132                            "Could not write to %s: %s", cfilename, emsg);
00133           _dbus_win_free_error_string (emsg);
00134           CloseHandle (hnd);
00135           return FALSE;
00136         }
00137 
00138       total += bytes_written;
00139     }
00140 
00141   if (CloseHandle (hnd) == 0)
00142     {
00143       char *emsg = _dbus_win_error_string (GetLastError ());
00144       dbus_set_error (error, _dbus_win_error_from_last_error (),
00145                        "Could not close file %s: %s",
00146                       cfilename, emsg);
00147       _dbus_win_free_error_string (emsg);
00148 
00149       return FALSE;
00150     }
00151 
00152   return TRUE;
00153 }
00154 
00166 dbus_bool_t
00167 _dbus_write_pid_to_file_and_pipe (const DBusString *pidfile,
00168                                   DBusPipe         *print_pid_pipe,
00169                                   dbus_pid_t        pid_to_write,
00170                                   DBusError        *error)
00171 {
00172   if (pidfile)
00173     {
00174       _dbus_verbose ("writing pid file %s\n", _dbus_string_get_const_data (pidfile));
00175       if (!_dbus_write_pid_file (pidfile,
00176                                  pid_to_write,
00177                                  error))
00178         {
00179           _dbus_verbose ("pid file write failed\n");
00180           _DBUS_ASSERT_ERROR_IS_SET(error);
00181           return FALSE;
00182         }
00183     }
00184   else
00185     {
00186       _dbus_verbose ("No pid file requested\n");
00187     }
00188 
00189   if (print_pid_pipe != NULL && _dbus_pipe_is_valid (print_pid_pipe))
00190     {
00191       DBusString pid;
00192       int bytes;
00193 
00194       _dbus_verbose ("writing our pid to pipe %d\n", print_pid_pipe->fd_or_handle);
00195 
00196       if (!_dbus_string_init (&pid))
00197         {
00198           _DBUS_SET_OOM (error);
00199           return FALSE;
00200         }
00201 
00202       if (!_dbus_string_append_int (&pid, pid_to_write) ||
00203           !_dbus_string_append (&pid, "\n"))
00204         {
00205           _dbus_string_free (&pid);
00206           _DBUS_SET_OOM (error);
00207           return FALSE;
00208         }
00209 
00210       bytes = _dbus_string_get_length (&pid);
00211       if (_dbus_pipe_write (print_pid_pipe, &pid, 0, bytes, error) != bytes)
00212         {
00213           /* _dbus_pipe_write sets error only on failure, not short write */
00214           if (error != NULL && !dbus_error_is_set(error))
00215             {
00216               dbus_set_error (error, DBUS_ERROR_FAILED,
00217                               "Printing message bus PID: did not write enough bytes\n");
00218             }
00219           _dbus_string_free (&pid);
00220           return FALSE;
00221         }
00222 
00223       _dbus_string_free (&pid);
00224     }
00225   else
00226     {
00227       _dbus_verbose ("No pid pipe to write to\n");
00228     }
00229 
00230   return TRUE;
00231 }
00232 
00239 dbus_bool_t
00240 _dbus_verify_daemon_user (const char *user)
00241 {
00242   return TRUE;
00243 }
00244 
00252 dbus_bool_t
00253 _dbus_change_to_daemon_user  (const char    *user,
00254                               DBusError     *error)
00255 {
00256   return TRUE;
00257 }
00258 
00259 void
00260 _dbus_request_file_descriptor_limit (unsigned int limit)
00261 {
00262 }
00263 
00264 void
00265 _dbus_init_system_log (void)
00266 {
00267     // FIXME!
00268 }
00269 
00278 void
00279 _dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...)
00280 {
00281   va_list args;
00282 
00283   va_start (args, msg);
00284 
00285   _dbus_system_logv (severity, msg, args);
00286 
00287   va_end (args);
00288 }
00289 
00300 void
00301 _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args)
00302 {
00303   char *s = "";
00304   char buf[1024];
00305   
00306   switch(severity) 
00307    {
00308      case DBUS_SYSTEM_LOG_INFO: s = "info"; break;
00309      case DBUS_SYSTEM_LOG_SECURITY: s = "security"; break;
00310      case DBUS_SYSTEM_LOG_FATAL: s = "fatal"; break;
00311    }
00312    
00313   sprintf(buf,"%s%s",s,msg);
00314   vsprintf(buf,buf,args);
00315   OutputDebugStringA(buf);
00316   
00317   if (severity == DBUS_SYSTEM_LOG_FATAL)
00318     exit (1);
00319 }
00320 
00326 void
00327 _dbus_set_signal_handler (int               sig,
00328                           DBusSignalHandler handler)
00329 {
00330   _dbus_verbose ("_dbus_set_signal_handler() has to be implemented\n");
00331 }
00332 
00341 dbus_bool_t
00342 _dbus_stat(const DBusString *filename,
00343            DBusStat         *statbuf,
00344            DBusError        *error)
00345 {
00346   const char *filename_c;
00347   WIN32_FILE_ATTRIBUTE_DATA wfad;
00348   char *lastdot;
00349   DWORD rc;
00350 
00351   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00352 
00353   filename_c = _dbus_string_get_const_data (filename);
00354 
00355   if (!GetFileAttributesExA (filename_c, GetFileExInfoStandard, &wfad))
00356     {
00357       _dbus_win_set_error_from_win_error (error, GetLastError ());
00358       return FALSE;
00359     }
00360 
00361   if (wfad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
00362     statbuf->mode = _S_IFDIR;
00363   else
00364     statbuf->mode = _S_IFREG;
00365 
00366   statbuf->mode |= _S_IREAD;
00367   if (wfad.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
00368     statbuf->mode |= _S_IWRITE;
00369 
00370   lastdot = strrchr (filename_c, '.');
00371   if (lastdot && stricmp (lastdot, ".exe") == 0)
00372     statbuf->mode |= _S_IEXEC;
00373 
00374   statbuf->mode |= (statbuf->mode & 0700) >> 3;
00375   statbuf->mode |= (statbuf->mode & 0700) >> 6;
00376 
00377   statbuf->nlink = 1;
00378 
00379 #ifdef ENABLE_UID_TO_SID
00380   {
00381     PSID owner_sid, group_sid;
00382     PSECURITY_DESCRIPTOR sd;
00383 
00384     sd = NULL;
00385     rc = GetNamedSecurityInfo ((char *) filename_c, SE_FILE_OBJECT,
00386                                OWNER_SECURITY_INFORMATION |
00387                                GROUP_SECURITY_INFORMATION,
00388                                &owner_sid, &group_sid,
00389                                NULL, NULL,
00390                                &sd);
00391     if (rc != ERROR_SUCCESS)
00392       {
00393         _dbus_win_set_error_from_win_error (error, rc);
00394         if (sd != NULL)
00395           LocalFree (sd);
00396         return FALSE;
00397       }
00398     
00399     /* FIXME */
00400     statbuf->uid = _dbus_win_sid_to_uid_t (owner_sid);
00401     statbuf->gid = _dbus_win_sid_to_uid_t (group_sid);
00402 
00403     LocalFree (sd);
00404   }
00405 #else
00406   statbuf->uid = DBUS_UID_UNSET;
00407   statbuf->gid = DBUS_GID_UNSET;
00408 #endif
00409 
00410   statbuf->size = ((dbus_int64_t) wfad.nFileSizeHigh << 32) + wfad.nFileSizeLow;
00411 
00412   statbuf->atime =
00413     (((dbus_int64_t) wfad.ftLastAccessTime.dwHighDateTime << 32) +
00414      wfad.ftLastAccessTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
00415 
00416   statbuf->mtime =
00417     (((dbus_int64_t) wfad.ftLastWriteTime.dwHighDateTime << 32) +
00418      wfad.ftLastWriteTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
00419 
00420   statbuf->ctime =
00421     (((dbus_int64_t) wfad.ftCreationTime.dwHighDateTime << 32) +
00422      wfad.ftCreationTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
00423 
00424   return TRUE;
00425 }
00426 
00427 
00428 /* This file is part of the KDE project
00429 Copyright (C) 2000 Werner Almesberger
00430 
00431 libc/sys/linux/sys/dirent.h - Directory entry as returned by readdir
00432 
00433 This program is free software; you can redistribute it and/or
00434 modify it under the terms of the GNU Library General Public
00435 License as published by the Free Software Foundation; either
00436 version 2 of the License, or (at your option) any later version.
00437 
00438 This program is distributed in the hope that it will be useful,
00439 but WITHOUT ANY WARRANTY; without even the implied warranty of
00440 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00441 Library General Public License for more details.
00442 
00443 You should have received a copy of the GNU Library General Public License
00444 along with this program; see the file COPYING.  If not, write to
00445 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00446 Boston, MA 02110-1301, USA.
00447 */
00448 #define HAVE_NO_D_NAMLEN        /* no struct dirent->d_namlen */
00449 #define HAVE_DD_LOCK            /* have locking mechanism */
00450 
00451 #define MAXNAMLEN 255           /* sizeof(struct dirent.d_name)-1 */
00452 
00453 #define __dirfd(dir) (dir)->dd_fd
00454 
00455 /* struct dirent - same as Unix */
00456 struct dirent
00457   {
00458     long d_ino;                    /* inode (always 1 in WIN32) */
00459     off_t d_off;                /* offset to this dirent */
00460     unsigned short d_reclen;    /* length of d_name */
00461     char d_name[_MAX_FNAME+1];    /* filename (null terminated) */
00462   };
00463 
00464 /* typedef DIR - not the same as Unix */
00465 typedef struct
00466   {
00467     HANDLE handle;              /* FindFirst/FindNext handle */
00468     short offset;               /* offset into directory */
00469     short finished;             /* 1 if there are not more files */
00470     WIN32_FIND_DATAA fileinfo;  /* from FindFirst/FindNext */
00471     char *dir;                  /* the dir we are reading */
00472     struct dirent dent;         /* the dirent to return */
00473   }
00474 DIR;
00475 
00476 /**********************************************************************
00477 * Implement dirent-style opendir/readdir/closedir on Window 95/NT
00478 *
00479 * Functions defined are opendir(), readdir() and closedir() with the
00480 * same prototypes as the normal dirent.h implementation.
00481 *
00482 * Does not implement telldir(), seekdir(), rewinddir() or scandir().
00483 * The dirent struct is compatible with Unix, except that d_ino is
00484 * always 1 and d_off is made up as we go along.
00485 *
00486 * Error codes are not available with errno but GetLastError.
00487 *
00488 * The DIR typedef is not compatible with Unix.
00489 **********************************************************************/
00490 
00491 static DIR * _dbus_opendir(const char *dir)
00492 {
00493   DIR *dp;
00494   char *filespec;
00495   HANDLE handle;
00496   int index;
00497 
00498   filespec = malloc(strlen(dir) + 2 + 1);
00499   strcpy(filespec, dir);
00500   index = strlen(filespec) - 1;
00501   if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
00502     filespec[index] = '\0';
00503   strcat(filespec, "\\*");
00504 
00505   dp = (DIR *)malloc(sizeof(DIR));
00506   dp->offset = 0;
00507   dp->finished = 0;
00508   dp->dir = strdup(dir);
00509 
00510   handle = FindFirstFileA(filespec, &(dp->fileinfo));
00511   if (handle == INVALID_HANDLE_VALUE)
00512     {
00513       if (GetLastError() == ERROR_NO_MORE_FILES)
00514         dp->finished = 1;
00515       else
00516         return NULL;
00517     }
00518 
00519   dp->handle = handle;
00520   free(filespec);
00521 
00522   return dp;
00523 }
00524 
00525 static struct dirent * _dbus_readdir(DIR *dp)
00526 {
00527   int saved_err = GetLastError();
00528 
00529   if (!dp || dp->finished)
00530     return NULL;
00531 
00532   if (dp->offset != 0)
00533     {
00534       if (FindNextFileA(dp->handle, &(dp->fileinfo)) == 0)
00535         {
00536           if (GetLastError() == ERROR_NO_MORE_FILES)
00537             {
00538               SetLastError(saved_err);
00539               dp->finished = 1;
00540             }
00541           return NULL;
00542         }
00543     }
00544   dp->offset++;
00545   
00546   strncpy(dp->dent.d_name, dp->fileinfo.cFileName, _MAX_FNAME);
00547   dp->dent.d_ino = 1;
00548   dp->dent.d_reclen = strlen(dp->dent.d_name);
00549   dp->dent.d_off = dp->offset;
00550   
00551   return &(dp->dent);
00552 }
00553 
00554 
00555 static int _dbus_closedir(DIR *dp)
00556 {
00557   if (!dp)
00558     return 0;
00559   FindClose(dp->handle);
00560   if (dp->dir)
00561     free(dp->dir);
00562   if (dp)
00563     free(dp);
00564 
00565   return 0;
00566 }
00567 
00568 
00572 struct DBusDirIter
00573   {
00574     DIR *d; 
00576   };
00577 
00585 DBusDirIter*
00586 _dbus_directory_open (const DBusString *filename,
00587                       DBusError        *error)
00588 {
00589   DIR *d;
00590   DBusDirIter *iter;
00591   const char *filename_c;
00592 
00593   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00594 
00595   filename_c = _dbus_string_get_const_data (filename);
00596 
00597   d = _dbus_opendir (filename_c);
00598   if (d == NULL)
00599     {
00600       char *emsg = _dbus_win_error_string (GetLastError ());
00601       dbus_set_error (error, _dbus_win_error_from_last_error (),
00602                       "Failed to read directory \"%s\": %s",
00603                       filename_c, emsg);
00604       _dbus_win_free_error_string (emsg);
00605       return NULL;
00606     }
00607   iter = dbus_new0 (DBusDirIter, 1);
00608   if (iter == NULL)
00609     {
00610       _dbus_closedir (d);
00611       dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
00612                       "Could not allocate memory for directory iterator");
00613       return NULL;
00614     }
00615 
00616   iter->d = d;
00617 
00618   return iter;
00619 }
00620 
00634 dbus_bool_t
00635 _dbus_directory_get_next_file (DBusDirIter      *iter,
00636                                DBusString       *filename,
00637                                DBusError        *error)
00638 {
00639   struct dirent *ent;
00640 
00641   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00642 
00643 again:
00644   SetLastError (0);
00645   ent = _dbus_readdir (iter->d);
00646   if (ent == NULL)
00647     {
00648       if (GetLastError() != 0)
00649         {
00650           char *emsg = _dbus_win_error_string (GetLastError ());
00651           dbus_set_error (error, _dbus_win_error_from_last_error (),
00652                           "Failed to get next in directory: %s", emsg);
00653           _dbus_win_free_error_string (emsg);
00654         }
00655       return FALSE;
00656     }
00657   else if (ent->d_name[0] == '.' &&
00658            (ent->d_name[1] == '\0' ||
00659             (ent->d_name[1] == '.' && ent->d_name[2] == '\0')))
00660     goto again;
00661   else
00662     {
00663       _dbus_string_set_length (filename, 0);
00664       if (!_dbus_string_append (filename, ent->d_name))
00665         {
00666           dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
00667                           "No memory to read directory entry");
00668           return FALSE;
00669         }
00670       else
00671         return TRUE;
00672     }
00673 }
00674 
00678 void
00679 _dbus_directory_close (DBusDirIter *iter)
00680 {
00681   _dbus_closedir (iter->d);
00682   dbus_free (iter);
00683 }
00684 
00691 dbus_bool_t
00692 _dbus_path_is_absolute (const DBusString *filename)
00693 {
00694   if (_dbus_string_get_length (filename) > 0)
00695     return _dbus_string_get_byte (filename, 1) == ':'
00696            || _dbus_string_get_byte (filename, 0) == '\\'
00697            || _dbus_string_get_byte (filename, 0) == '/';
00698   else
00699     return FALSE;
00700 }
00701  /* End of DBusInternalsUtils functions */
00703 
00715 dbus_bool_t
00716 _dbus_string_get_dirname(const DBusString *filename,
00717                          DBusString       *dirname)
00718 {
00719   int sep;
00720 
00721   _dbus_assert (filename != dirname);
00722   _dbus_assert (filename != NULL);
00723   _dbus_assert (dirname != NULL);
00724 
00725   /* Ignore any separators on the end */
00726   sep = _dbus_string_get_length (filename);
00727   if (sep == 0)
00728     return _dbus_string_append (dirname, "."); /* empty string passed in */
00729 
00730   while (sep > 0 &&
00731          (_dbus_string_get_byte (filename, sep - 1) == '/' ||
00732           _dbus_string_get_byte (filename, sep - 1) == '\\'))
00733     --sep;
00734 
00735   _dbus_assert (sep >= 0);
00736 
00737   if (sep == 0 ||
00738       (sep == 2 &&
00739        _dbus_string_get_byte (filename, 1) == ':' &&
00740        isalpha (_dbus_string_get_byte (filename, 0))))
00741     return _dbus_string_copy_len (filename, 0, sep + 1,
00742                                   dirname, _dbus_string_get_length (dirname));
00743 
00744   {
00745     int sep1, sep2;
00746     _dbus_string_find_byte_backward (filename, sep, '/', &sep1);
00747     _dbus_string_find_byte_backward (filename, sep, '\\', &sep2);
00748 
00749     sep = MAX (sep1, sep2);
00750   }
00751   if (sep < 0)
00752     return _dbus_string_append (dirname, ".");
00753 
00754   while (sep > 0 &&
00755          (_dbus_string_get_byte (filename, sep - 1) == '/' ||
00756           _dbus_string_get_byte (filename, sep - 1) == '\\'))
00757     --sep;
00758 
00759   _dbus_assert (sep >= 0);
00760 
00761   if ((sep == 0 ||
00762        (sep == 2 &&
00763         _dbus_string_get_byte (filename, 1) == ':' &&
00764         isalpha (_dbus_string_get_byte (filename, 0))))
00765       &&
00766       (_dbus_string_get_byte (filename, sep) == '/' ||
00767        _dbus_string_get_byte (filename, sep) == '\\'))
00768     return _dbus_string_copy_len (filename, 0, sep + 1,
00769                                   dirname, _dbus_string_get_length (dirname));
00770   else
00771     return _dbus_string_copy_len (filename, 0, sep - 0,
00772                                   dirname, _dbus_string_get_length (dirname));
00773 }
00774 
00775 
00783 dbus_bool_t
00784 _dbus_unix_user_is_process_owner (dbus_uid_t uid)
00785 {
00786   return FALSE;
00787 }
00788 
00789 dbus_bool_t _dbus_windows_user_is_process_owner (const char *windows_sid)
00790 {
00791   return TRUE;
00792 }
00793 
00794 /*=====================================================================
00795   unix emulation functions - should be removed sometime in the future
00796  =====================================================================*/
00797 
00807 dbus_bool_t
00808 _dbus_unix_user_is_at_console (dbus_uid_t         uid,
00809                                DBusError         *error)
00810 {
00811   dbus_set_error (error, DBUS_ERROR_NOT_SUPPORTED,
00812                   "UNIX user IDs not supported on Windows\n");
00813   return FALSE;
00814 }
00815 
00816 
00825 dbus_bool_t
00826 _dbus_parse_unix_group_from_config (const DBusString  *groupname,
00827                                     dbus_gid_t        *gid_p)
00828 {
00829   return FALSE;
00830 }
00831 
00840 dbus_bool_t
00841 _dbus_parse_unix_user_from_config (const DBusString  *username,
00842                                    dbus_uid_t        *uid_p)
00843 {
00844   return FALSE;
00845 }
00846 
00847 
00858 dbus_bool_t
00859 _dbus_unix_groups_from_uid (dbus_uid_t            uid,
00860                             dbus_gid_t          **group_ids,
00861                             int                  *n_group_ids)
00862 {
00863   return FALSE;
00864 }
00865 
00866 
00867  /* DBusString stuff */
00869 
00870 /************************************************************************
00871  
00872  error handling
00873  
00874  ************************************************************************/
00875 
00876 
00877 
00878 
00879 
00880 /* lan manager error codes */
00881 const char*
00882 _dbus_lm_strerror(int error_number)
00883 {
00884 #ifdef DBUS_WINCE
00885   // TODO
00886   return "unknown";
00887 #else
00888   const char *msg;
00889   switch (error_number)
00890     {
00891     case NERR_NetNotStarted:
00892       return "The workstation driver is not installed.";
00893     case NERR_UnknownServer:
00894       return "The server could not be located.";
00895     case NERR_ShareMem:
00896       return "An internal error occurred. The network cannot access a shared memory segment.";
00897     case NERR_NoNetworkResource:
00898       return "A network resource shortage occurred.";
00899     case NERR_RemoteOnly:
00900       return "This operation is not supported on workstations.";
00901     case NERR_DevNotRedirected:
00902       return "The device is not connected.";
00903     case NERR_ServerNotStarted:
00904       return "The Server service is not started.";
00905     case NERR_ItemNotFound:
00906       return "The queue is empty.";
00907     case NERR_UnknownDevDir:
00908       return "The device or directory does not exist.";
00909     case NERR_RedirectedPath:
00910       return "The operation is invalid on a redirected resource.";
00911     case NERR_DuplicateShare:
00912       return "The name has already been shared.";
00913     case NERR_NoRoom:
00914       return "The server is currently out of the requested resource.";
00915     case NERR_TooManyItems:
00916       return "Requested addition of items exceeds the maximum allowed.";
00917     case NERR_InvalidMaxUsers:
00918       return "The Peer service supports only two simultaneous users.";
00919     case NERR_BufTooSmall:
00920       return "The API return buffer is too small.";
00921     case NERR_RemoteErr:
00922       return "A remote API error occurred.";
00923     case NERR_LanmanIniError:
00924       return "An error occurred when opening or reading the configuration file.";
00925     case NERR_NetworkError:
00926       return "A general network error occurred.";
00927     case NERR_WkstaInconsistentState:
00928       return "The Workstation service is in an inconsistent state. Restart the computer before restarting the Workstation service.";
00929     case NERR_WkstaNotStarted:
00930       return "The Workstation service has not been started.";
00931     case NERR_BrowserNotStarted:
00932       return "The requested information is not available.";
00933     case NERR_InternalError:
00934       return "An internal error occurred.";
00935     case NERR_BadTransactConfig:
00936       return "The server is not configured for transactions.";
00937     case NERR_InvalidAPI:
00938       return "The requested API is not supported on the remote server.";
00939     case NERR_BadEventName:
00940       return "The event name is invalid.";
00941     case NERR_DupNameReboot:
00942       return "The computer name already exists on the network. Change it and restart the computer.";
00943     case NERR_CfgCompNotFound:
00944       return "The specified component could not be found in the configuration information.";
00945     case NERR_CfgParamNotFound:
00946       return "The specified parameter could not be found in the configuration information.";
00947     case NERR_LineTooLong:
00948       return "A line in the configuration file is too long.";
00949     case NERR_QNotFound:
00950       return "The printer does not exist.";
00951     case NERR_JobNotFound:
00952       return "The print job does not exist.";
00953     case NERR_DestNotFound:
00954       return "The printer destination cannot be found.";
00955     case NERR_DestExists:
00956       return "The printer destination already exists.";
00957     case NERR_QExists:
00958       return "The printer queue already exists.";
00959     case NERR_QNoRoom:
00960       return "No more printers can be added.";
00961     case NERR_JobNoRoom:
00962       return "No more print jobs can be added.";
00963     case NERR_DestNoRoom:
00964       return "No more printer destinations can be added.";
00965     case NERR_DestIdle:
00966       return "This printer destination is idle and cannot accept control operations.";
00967     case NERR_DestInvalidOp:
00968       return "This printer destination request contains an invalid control function.";
00969     case NERR_ProcNoRespond:
00970       return "The print processor is not responding.";
00971     case NERR_SpoolerNotLoaded:
00972       return "The spooler is not running.";
00973     case NERR_DestInvalidState:
00974       return "This operation cannot be performed on the print destination in its current state.";
00975     case NERR_QInvalidState:
00976       return "This operation cannot be performed on the printer queue in its current state.";
00977     case NERR_JobInvalidState:
00978       return "This operation cannot be performed on the print job in its current state.";
00979     case NERR_SpoolNoMemory:
00980       return "A spooler memory allocation failure occurred.";
00981     case NERR_DriverNotFound:
00982       return "The device driver does not exist.";
00983     case NERR_DataTypeInvalid:
00984       return "The data type is not supported by the print processor.";
00985     case NERR_ProcNotFound:
00986       return "The print processor is not installed.";
00987     case NERR_ServiceTableLocked:
00988       return "The service database is locked.";
00989     case NERR_ServiceTableFull:
00990       return "The service table is full.";
00991     case NERR_ServiceInstalled:
00992       return "The requested service has already been started.";
00993     case NERR_ServiceEntryLocked:
00994       return "The service does not respond to control actions.";
00995     case NERR_ServiceNotInstalled:
00996       return "The service has not been started.";
00997     case NERR_BadServiceName:
00998       return "The service name is invalid.";
00999     case NERR_ServiceCtlTimeout:
01000       return "The service is not responding to the control function.";
01001     case NERR_ServiceCtlBusy:
01002       return "The service control is busy.";
01003     case NERR_BadServiceProgName:
01004       return "The configuration file contains an invalid service program name.";
01005     case NERR_ServiceNotCtrl:
01006       return "The service could not be controlled in its present state.";
01007     case NERR_ServiceKillProc:
01008       return "The service ended abnormally.";
01009     case NERR_ServiceCtlNotValid:
01010       return "The requested pause or stop is not valid for this service.";
01011     case NERR_NotInDispatchTbl:
01012       return "The service control dispatcher could not find the service name in the dispatch table.";
01013     case NERR_BadControlRecv:
01014       return "The service control dispatcher pipe read failed.";
01015     case NERR_ServiceNotStarting:
01016       return "A thread for the new service could not be created.";
01017     case NERR_AlreadyLoggedOn:
01018       return "This workstation is already logged on to the local-area network.";
01019     case NERR_NotLoggedOn:
01020       return "The workstation is not logged on to the local-area network.";
01021     case NERR_BadUsername:
01022       return "The user name or group name parameter is invalid.";
01023     case NERR_BadPassword:
01024       return "The password parameter is invalid.";
01025     case NERR_UnableToAddName_W:
01026       return "@W The logon processor did not add the message alias.";
01027     case NERR_UnableToAddName_F:
01028       return "The logon processor did not add the message alias.";
01029     case NERR_UnableToDelName_W:
01030       return "@W The logoff processor did not delete the message alias.";
01031     case NERR_UnableToDelName_F:
01032       return "The logoff processor did not delete the message alias.";
01033     case NERR_LogonsPaused:
01034       return "Network logons are paused.";
01035     case NERR_LogonServerConflict:
01036       return "A centralized logon-server conflict occurred.";
01037     case NERR_LogonNoUserPath:
01038       return "The server is configured without a valid user path.";
01039     case NERR_LogonScriptError:
01040       return "An error occurred while loading or running the logon script.";
01041     case NERR_StandaloneLogon:
01042       return "The logon server was not specified. Your computer will be logged on as STANDALONE.";
01043     case NERR_LogonServerNotFound:
01044       return "The logon server could not be found.";
01045     case NERR_LogonDomainExists:
01046       return "There is already a logon domain for this computer.";
01047     case NERR_NonValidatedLogon:
01048       return "The logon server could not validate the logon.";
01049     case NERR_ACFNotFound:
01050       return "The security database could not be found.";
01051     case NERR_GroupNotFound:
01052       return "The group name could not be found.";
01053     case NERR_UserNotFound:
01054       return "The user name could not be found.";
01055     case NERR_ResourceNotFound:
01056       return "The resource name could not be found.";
01057     case NERR_GroupExists:
01058       return "The group already exists.";
01059     case NERR_UserExists:
01060       return "The user account already exists.";
01061     case NERR_ResourceExists:
01062       return "The resource permission list already exists.";
01063     case NERR_NotPrimary:
01064       return "This operation is only allowed on the primary domain controller of the domain.";
01065     case NERR_ACFNotLoaded:
01066       return "The security database has not been started.";
01067     case NERR_ACFNoRoom:
01068       return "There are too many names in the user accounts database.";
01069     case NERR_ACFFileIOFail:
01070       return "A disk I/O failure occurred.";
01071     case NERR_ACFTooManyLists:
01072       return "The limit of 64 entries per resource was exceeded.";
01073     case NERR_UserLogon:
01074       return "Deleting a user with a session is not allowed.";
01075     case NERR_ACFNoParent:
01076       return "The parent directory could not be located.";
01077     case NERR_CanNotGrowSegment:
01078       return "Unable to add to the security database session cache segment.";
01079     case NERR_SpeGroupOp:
01080       return "This operation is not allowed on this special group.";
01081     case NERR_NotInCache:
01082       return "This user is not cached in user accounts database session cache.";
01083     case NERR_UserInGroup:
01084       return "The user already belongs to this group.";
01085     case NERR_UserNotInGroup:
01086       return "The user does not belong to this group.";
01087     case NERR_AccountUndefined:
01088       return "This user account is undefined.";
01089     case NERR_AccountExpired:
01090       return "This user account has expired.";
01091     case NERR_InvalidWorkstation:
01092       return "The user is not allowed to log on from this workstation.";
01093     case NERR_InvalidLogonHours:
01094       return "The user is not allowed to log on at this time.";
01095     case NERR_PasswordExpired:
01096       return "The password of this user has expired.";
01097     case NERR_PasswordCantChange:
01098       return "The password of this user cannot change.";
01099     case NERR_PasswordHistConflict:
01100       return "This password cannot be used now.";
01101     case NERR_PasswordTooShort:
01102       return "The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.";
01103     case NERR_PasswordTooRecent:
01104       return "The password of this user is too recent to change.";
01105     case NERR_InvalidDatabase:
01106       return "The security database is corrupted.";
01107     case NERR_DatabaseUpToDate:
01108       return "No updates are necessary to this replicant network/local security database.";
01109     case NERR_SyncRequired:
01110       return "This replicant database is outdated; synchronization is required.";
01111     case NERR_UseNotFound:
01112       return "The network connection could not be found.";
01113     case NERR_BadAsgType:
01114       return "This asg_type is invalid.";
01115     case NERR_DeviceIsShared:
01116       return "This device is currently being shared.";
01117     case NERR_NoComputerName:
01118       return "The computer name could not be added as a message alias. The name may already exist on the network.";
01119     case NERR_MsgAlreadyStarted:
01120       return "The Messenger service is already started.";
01121     case NERR_MsgInitFailed:
01122       return "The Messenger service failed to start.";
01123     case NERR_NameNotFound:
01124       return "The message alias could not be found on the network.";
01125     case NERR_AlreadyForwarded:
01126       return "This message alias has already been forwarded.";
01127     case NERR_AddForwarded:
01128       return "This message alias has been added but is still forwarded.";
01129     case NERR_AlreadyExists:
01130       return "This message alias already exists locally.";
01131     case NERR_TooManyNames:
01132       return "The maximum number of added message aliases has been exceeded.";
01133     case NERR_DelComputerName:
01134       return "The computer name could not be deleted.";
01135     case NERR_LocalForward:
01136       return "Messages cannot be forwarded back to the same workstation.";
01137     case NERR_GrpMsgProcessor:
01138       return "An error occurred in the domain message processor.";
01139     case NERR_PausedRemote:
01140       return "The message was sent, but the recipient has paused the Messenger service.";
01141     case NERR_BadReceive:
01142       return "The message was sent but not received.";
01143     case NERR_NameInUse:
01144       return "The message alias is currently in use. Try again later.";
01145     case NERR_MsgNotStarted:
01146       return "The Messenger service has not been started.";
01147     case NERR_NotLocalName:
01148       return "The name is not on the local computer.";
01149     case NERR_NoForwardName:
01150       return "The forwarded message alias could not be found on the network.";
01151     case NERR_RemoteFull:
01152       return "The message alias table on the remote station is full.";
01153     case NERR_NameNotForwarded:
01154       return "Messages for this alias are not currently being forwarded.";
01155     case NERR_TruncatedBroadcast:
01156       return "The broadcast message was truncated.";
01157     case NERR_InvalidDevice:
01158       return "This is an invalid device name.";
01159     case NERR_WriteFault:
01160       return "A write fault occurred.";
01161     case NERR_DuplicateName:
01162       return "A duplicate message alias exists on the network.";
01163     case NERR_DeleteLater:
01164       return "@W This message alias will be deleted later.";
01165     case NERR_IncompleteDel:
01166       return "The message alias was not successfully deleted from all networks.";
01167     case NERR_MultipleNets:
01168       return "This operation is not supported on computers with multiple networks.";
01169     case NERR_NetNameNotFound:
01170       return "This shared resource does not exist.";
01171     case NERR_DeviceNotShared:
01172       return "This device is not shared.";
01173     case NERR_ClientNameNotFound:
01174       return "A session does not exist with that computer name.";
01175     case NERR_FileIdNotFound:
01176       return "There is not an open file with that identification number.";
01177     case NERR_ExecFailure:
01178       return "A failure occurred when executing a remote administration command.";
01179     case NERR_TmpFile:
01180       return "A failure occurred when opening a remote temporary file.";
01181     case NERR_TooMuchData:
01182       return "The data returned from a remote administration command has been truncated to 64K.";
01183     case NERR_DeviceShareConflict:
01184       return "This device cannot be shared as both a spooled and a non-spooled resource.";
01185     case NERR_BrowserTableIncomplete:
01186       return "The information in the list of servers may be incorrect.";
01187     case NERR_NotLocalDomain:
01188       return "The computer is not active in this domain.";
01189 #ifdef NERR_IsDfsShare
01190 
01191     case NERR_IsDfsShare:
01192       return "The share must be removed from the Distributed File System before it can be deleted.";
01193 #endif
01194 
01195     case NERR_DevInvalidOpCode:
01196       return "The operation is invalid for this device.";
01197     case NERR_DevNotFound:
01198       return "This device cannot be shared.";
01199     case NERR_DevNotOpen:
01200       return "This device was not open.";
01201     case NERR_BadQueueDevString:
01202       return "This device name list is invalid.";
01203     case NERR_BadQueuePriority:
01204       return "The queue priority is invalid.";
01205     case NERR_NoCommDevs:
01206       return "There are no shared communication devices.";
01207     case NERR_QueueNotFound:
01208       return "The queue you specified does not exist.";
01209     case NERR_BadDevString:
01210       return "This list of devices is invalid.";
01211     case NERR_BadDev:
01212       return "The requested device is invalid.";
01213     case NERR_InUseBySpooler:
01214       return "This device is already in use by the spooler.";
01215     case NERR_CommDevInUse:
01216       return "This device is already in use as a communication device.";
01217     case NERR_InvalidComputer:
01218       return "This computer name is invalid.";
01219     case NERR_MaxLenExceeded:
01220       return "The string and prefix specified are too long.";
01221     case NERR_BadComponent:
01222       return "This path component is invalid.";
01223     case NERR_CantType:
01224       return "Could not determine the type of input.";
01225     case NERR_TooManyEntries:
01226       return "The buffer for types is not big enough.";
01227     case NERR_ProfileFileTooBig:
01228       return "Profile files cannot exceed 64K.";
01229     case NERR_ProfileOffset:
01230       return "The start offset is out of range.";
01231     case NERR_ProfileCleanup:
01232       return "The system cannot delete current connections to network resources.";
01233     case NERR_ProfileUnknownCmd:
01234       return "The system was unable to parse the command line in this file.";
01235     case NERR_ProfileLoadErr:
01236       return "An error occurred while loading the profile file.";
01237     case NERR_ProfileSaveErr:
01238       return "@W Errors occurred while saving the profile file. The profile was partially saved.";
01239     case NERR_LogOverflow:
01240       return "Log file %1 is full.";
01241     case NERR_LogFileChanged:
01242       return "This log file has changed between reads.";
01243     case NERR_LogFileCorrupt:
01244       return "Log file %1 is corrupt.";
01245     case NERR_SourceIsDir:
01246       return "The source path cannot be a directory.";
01247     case NERR_BadSource:
01248       return "The source path is illegal.";
01249     case NERR_BadDest:
01250       return "The destination path is illegal.";
01251     case NERR_DifferentServers:
01252       return "The source and destination paths are on different servers.";
01253     case NERR_RunSrvPaused:
01254       return "The Run server you requested is paused.";
01255     case NERR_ErrCommRunSrv:
01256       return "An error occurred when communicating with a Run server.";
01257     case NERR_ErrorExecingGhost:
01258       return "An error occurred when starting a background process.";
01259     case NERR_ShareNotFound:
01260       return "The shared resource you are connected to could not be found.";
01261     case NERR_InvalidLana:
01262       return "The LAN adapter number is invalid.";
01263     case NERR_OpenFiles:
01264       return "There are open files on the connection.";
01265     case NERR_ActiveConns:
01266       return "Active connections still exist.";
01267     case NERR_BadPasswordCore:
01268       return "This share name or password is invalid.";
01269     case NERR_DevInUse:
01270       return "The device is being accessed by an active process.";
01271     case NERR_LocalDrive:
01272       return "The drive letter is in use locally.";
01273     case NERR_AlertExists:
01274       return "The specified client is already registered for the specified event.";
01275     case NERR_TooManyAlerts:
01276       return "The alert table is full.";
01277     case NERR_NoSuchAlert:
01278       return "An invalid or nonexistent alert name was raised.";
01279     case NERR_BadRecipient:
01280       return "The alert recipient is invalid.";
01281     case NERR_AcctLimitExceeded:
01282       return "A user's session with this server has been deleted.";
01283     case NERR_InvalidLogSeek:
01284       return "The log file does not contain the requested record number.";
01285     case NERR_BadUasConfig:
01286       return "The user accounts database is not configured correctly.";
01287     case NERR_InvalidUASOp:
01288       return "This operation is not permitted when the Netlogon service is running.";
01289     case NERR_LastAdmin:
01290       return "This operation is not allowed on the last administrative account.";
01291     case NERR_DCNotFound:
01292       return "Could not find domain controller for this domain.";
01293     case NERR_LogonTrackingError:
01294       return "Could not set logon information for this user.";
01295     case NERR_NetlogonNotStarted:
01296       return "The Netlogon service has not been started.";
01297     case NERR_CanNotGrowUASFile:
01298       return "Unable to add to the user accounts database.";
01299     case NERR_TimeDiffAtDC:
01300       return "This server's clock is not synchronized with the primary domain controller's clock.";
01301     case NERR_PasswordMismatch:
01302       return "A password mismatch has been detected.";
01303     case NERR_NoSuchServer:
01304       return "The server identification does not specify a valid server.";
01305     case NERR_NoSuchSession:
01306       return "The session identification does not specify a valid session.";
01307     case NERR_NoSuchConnection:
01308       return "The connection identification does not specify a valid connection.";
01309     case NERR_TooManyServers:
01310       return "There is no space for another entry in the table of available servers.";
01311     case NERR_TooManySessions:
01312       return "The server has reached the maximum number of sessions it supports.";
01313     case NERR_TooManyConnections:
01314       return "The server has reached the maximum number of connections it supports.";
01315     case NERR_TooManyFiles:
01316       return "The server cannot open more files because it has reached its maximum number.";
01317     case NERR_NoAlternateServers:
01318       return "There are no alternate servers registered on this server.";
01319     case NERR_TryDownLevel:
01320       return "Try down-level (remote admin protocol) version of API instead.";
01321     case NERR_UPSDriverNotStarted:
01322       return "The UPS driver could not be accessed by the UPS service.";
01323     case NERR_UPSInvalidConfig:
01324       return "The UPS service is not configured correctly.";
01325     case NERR_UPSInvalidCommPort:
01326       return "The UPS service could not access the specified Comm Port.";
01327     case NERR_UPSSignalAsserted:
01328       return "The UPS indicated a line fail or low battery situation. Service not started.";
01329     case NERR_UPSShutdownFailed:
01330       return "The UPS service failed to perform a system shut down.";
01331     case NERR_BadDosRetCode:
01332       return "The program below returned an MS-DOS error code:";
01333     case NERR_ProgNeedsExtraMem:
01334       return "The program below needs more memory:";
01335     case NERR_BadDosFunction:
01336       return "The program below called an unsupported MS-DOS function:";
01337     case NERR_RemoteBootFailed:
01338       return "The workstation failed to boot.";
01339     case NERR_BadFileCheckSum:
01340       return "The file below is corrupt.";
01341     case NERR_NoRplBootSystem:
01342       return "No loader is specified in the boot-block definition file.";
01343     case NERR_RplLoadrNetBiosErr:
01344       return "NetBIOS returned an error:      The NCB and SMB are dumped above.";
01345     case NERR_RplLoadrDiskErr:
01346       return "A disk I/O error occurred.";
01347     case NERR_ImageParamErr:
01348       return "Image parameter substitution failed.";
01349     case NERR_TooManyImageParams:
01350       return "Too many image parameters cross disk sector boundaries.";
01351     case NERR_NonDosFloppyUsed:
01352       return "The image was not generated from an MS-DOS diskette formatted with /S.";
01353     case NERR_RplBootRestart:
01354       return "Remote boot will be restarted later.";
01355     case NERR_RplSrvrCallFailed:
01356       return "The call to the Remoteboot server failed.";
01357     case NERR_CantConnectRplSrvr:
01358       return "Cannot connect to the Remoteboot server.";
01359     case NERR_CantOpenImageFile:
01360       return "Cannot open image file on the Remoteboot server.";
01361     case NERR_CallingRplSrvr:
01362       return "Connecting to the Remoteboot server...";
01363     case NERR_StartingRplBoot:
01364       return "Connecting to the Remoteboot server...";
01365     case NERR_RplBootServiceTerm:
01366       return "Remote boot service was stopped; check the error log for the cause of the problem.";
01367     case NERR_RplBootStartFailed:
01368       return "Remote boot startup failed; check the error log for the cause of the problem.";
01369     case NERR_RPL_CONNECTED:
01370       return "A second connection to a Remoteboot resource is not allowed.";
01371     case NERR_BrowserConfiguredToNotRun:
01372       return "The browser service was configured with MaintainServerList=No.";
01373     case NERR_RplNoAdaptersStarted:
01374       return "Service failed to start since none of the network adapters started with this service.";
01375     case NERR_RplBadRegistry:
01376       return "Service failed to start due to bad startup information in the registry.";
01377     case NERR_RplBadDatabase:
01378       return "Service failed to start because its database is absent or corrupt.";
01379     case NERR_RplRplfilesShare:
01380       return "Service failed to start because RPLFILES share is absent.";
01381     case NERR_RplNotRplServer:
01382       return "Service failed to start because RPLUSER group is absent.";
01383     case NERR_RplCannotEnum:
01384       return "Cannot enumerate service records.";
01385     case NERR_RplWkstaInfoCorrupted:
01386       return "Workstation record information has been corrupted.";
01387     case NERR_RplWkstaNotFound:
01388       return "Workstation record was not found.";
01389     case NERR_RplWkstaNameUnavailable:
01390       return "Workstation name is in use by some other workstation.";
01391     case NERR_RplProfileInfoCorrupted:
01392       return "Profile record information has been corrupted.";
01393     case NERR_RplProfileNotFound:
01394       return "Profile record was not found.";
01395     case NERR_RplProfileNameUnavailable:
01396       return "Profile name is in use by some other profile.";
01397     case NERR_RplProfileNotEmpty:
01398       return "There are workstations using this profile.";
01399     case NERR_RplConfigInfoCorrupted:
01400       return "Configuration record information has been corrupted.";
01401     case NERR_RplConfigNotFound:
01402       return "Configuration record was not found.";
01403     case NERR_RplAdapterInfoCorrupted:
01404       return "Adapter ID record information has been corrupted.";
01405     case NERR_RplInternal:
01406       return "An internal service error has occurred.";
01407     case NERR_RplVendorInfoCorrupted:
01408       return "Vendor ID record information has been corrupted.";
01409     case NERR_RplBootInfoCorrupted:
01410       return "Boot block record information has been corrupted.";
01411     case NERR_RplWkstaNeedsUserAcct:
01412       return "The user account for this workstation record is missing.";
01413     case NERR_RplNeedsRPLUSERAcct:
01414       return "The RPLUSER local group could not be found.";
01415     case NERR_RplBootNotFound:
01416       return "Boot block record was not found.";
01417     case NERR_RplIncompatibleProfile:
01418       return "Chosen profile is incompatible with this workstation.";
01419     case NERR_RplAdapterNameUnavailable:
01420       return "Chosen network adapter ID is in use by some other workstation.";
01421     case NERR_RplConfigNotEmpty:
01422       return "There are profiles using this configuration.";
01423     case NERR_RplBootInUse:
01424       return "There are workstations, profiles, or configurations using this boot block.";
01425     case NERR_RplBackupDatabase:
01426       return "Service failed to backup Remoteboot database.";
01427     case NERR_RplAdapterNotFound:
01428       return "Adapter record was not found.";
01429     case NERR_RplVendorNotFound:
01430       return "Vendor record was not found.";
01431     case NERR_RplVendorNameUnavailable:
01432       return "Vendor name is in use by some other vendor record.";
01433     case NERR_RplBootNameUnavailable:
01434       return "(boot name, vendor ID) is in use by some other boot block record.";
01435     case NERR_RplConfigNameUnavailable:
01436       return "Configuration name is in use by some other configuration.";
01437     case NERR_DfsInternalCorruption:
01438       return "The internal database maintained by the Dfs service is corrupt.";
01439     case NERR_DfsVolumeDataCorrupt:
01440       return "One of the records in the internal Dfs database is corrupt.";
01441     case NERR_DfsNoSuchVolume:
01442       return "There is no DFS name whose entry path matches the input Entry Path.";
01443     case NERR_DfsVolumeAlreadyExists:
01444       return "A root or link with the given name already exists.";
01445     case NERR_DfsAlreadyShared:
01446       return "The server share specified is already shared in the Dfs.";
01447     case NERR_DfsNoSuchShare:
01448       return "The indicated server share does not support the indicated DFS namespace.";
01449     case NERR_DfsNotALeafVolume:
01450       return "The operation is not valid on this portion of the namespace.";
01451     case NERR_DfsLeafVolume:
01452       return "The operation is not valid on this portion of the namespace.";
01453     case NERR_DfsVolumeHasMultipleServers:
01454       return "The operation is ambiguous because the link has multiple servers.";
01455     case NERR_DfsCantCreateJunctionPoint:
01456       return "Unable to create a link.";
01457     case NERR_DfsServerNotDfsAware:
01458       return "The server is not Dfs Aware.";
01459     case NERR_DfsBadRenamePath:
01460       return "The specified rename target path is invalid.";
01461     case NERR_DfsVolumeIsOffline:
01462       return "The specified DFS link is offline.";
01463     case NERR_DfsNoSuchServer:
01464       return "The specified server is not a server for this link.";
01465     case NERR_DfsCyclicalName:
01466       return "A cycle in the Dfs name was detected.";
01467     case NERR_DfsNotSupportedInServerDfs:
01468       return "The operation is not supported on a server-based Dfs.";
01469     case NERR_DfsDuplicateService:
01470       return "This link is already supported by the specified server-share.";
01471     case NERR_DfsCantRemoveLastServerShare:
01472       return "Can't remove the last server-share supporting this root or link.";
01473     case NERR_DfsVolumeIsInterDfs:
01474       return "The operation is not supported for an Inter-DFS link.";
01475     case NERR_DfsInconsistent:
01476       return "The internal state of the Dfs Service has become inconsistent.";
01477     case NERR_DfsServerUpgraded:
01478       return "The Dfs Service has been installed on the specified server.";
01479     case NERR_DfsDataIsIdentical:
01480       return "The Dfs data being reconciled is identical.";
01481     case NERR_DfsCantRemoveDfsRoot:
01482       return "The DFS root cannot be deleted. Uninstall DFS if required.";
01483     case NERR_DfsChildOrParentInDfs:
01484       return "A child or parent directory of the share is already in a Dfs.";
01485     case NERR_DfsInternalError:
01486       return "Dfs internal error.";
01487       /* the following are not defined in mingw */
01488 #if 0
01489 
01490     case NERR_SetupAlreadyJoined:
01491       return "This machine is already joined to a domain.";
01492     case NERR_SetupNotJoined:
01493       return "This machine is not currently joined to a domain.";
01494     case NERR_SetupDomainController:
01495       return "This machine is a domain controller and cannot be unjoined from a domain.";
01496     case NERR_DefaultJoinRequired:
01497       return "The destination domain controller does not support creating machine accounts in OUs.";
01498     case NERR_InvalidWorkgroupName:
01499       return "The specified workgroup name is invalid.";
01500     case NERR_NameUsesIncompatibleCodePage:
01501       return "The specified computer name is incompatible with the default language used on the domain controller.";
01502     case NERR_ComputerAccountNotFound:
01503       return "The specified computer account could not be found.";
01504     case NERR_PersonalSku:
01505       return "This version of Windows cannot be joined to a domain.";
01506     case NERR_PasswordMustChange:
01507       return "The password must change at the next logon.";
01508     case NERR_AccountLockedOut:
01509       return "The account is locked out.";
01510     case NERR_PasswordTooLong:
01511       return "The password is too long.";
01512     case NERR_PasswordNotComplexEnough:
01513       return "The password does not meet the complexity policy.";
01514     case NERR_PasswordFilterError:
01515       return "The password does not meet the requirements of the password filter DLLs.";
01516 #endif
01517 
01518     }
01519   msg = strerror (error_number);
01520   if (msg == NULL)
01521     msg = "unknown";
01522 
01523   return msg;
01524 #endif //DBUS_WINCE
01525 }
01526 
01541 dbus_bool_t
01542 _dbus_command_for_pid (unsigned long  pid,
01543                        DBusString    *str,
01544                        int            max_len,
01545                        DBusError     *error)
01546 {
01547   // FIXME
01548   return FALSE;
01549 }