VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp@ 28739

Last change on this file since 28739 was 28630, checked in by vboxsync, 15 years ago

VBoxServiceVMInfo: don't destroy the property handle when leaving the worker loop, do this in the term function; some cleanup

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.5 KB
Line 
1/* $Id: VBoxServiceVMInfo.cpp 28630 2010-04-23 08:54:57Z vboxsync $ */
2/** @file
3 * VBoxService - Virtual Machine Information for the Host.
4 */
5
6/*
7 * Copyright (C) 2009-2010 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22
23
24/*******************************************************************************
25* Header Files *
26*******************************************************************************/
27#ifdef RT_OS_WINDOWS
28#include <winsock2.h>
29#include <ws2tcpip.h>
30#include <windows.h>
31#include <Ntsecapi.h>
32#else
33# define __STDC_LIMIT_MACROS
34# include <arpa/inet.h>
35# include <errno.h>
36# include <netinet/in.h>
37# include <sys/ioctl.h>
38# include <sys/socket.h>
39# include <net/if.h>
40# include <unistd.h>
41# ifndef RT_OS_FREEBSD /* The header does not exist anymore since FreeBSD 9-current */
42# include <utmp.h>
43# endif
44# ifdef RT_OS_SOLARIS
45# include <sys/sockio.h>
46# endif
47#endif
48
49#include <iprt/mem.h>
50#include <iprt/thread.h>
51#include <iprt/string.h>
52#include <iprt/semaphore.h>
53#include <iprt/system.h>
54#include <iprt/time.h>
55#include <iprt/assert.h>
56#include <VBox/version.h>
57#include <VBox/VBoxGuestLib.h>
58#include "VBoxServiceInternal.h"
59#include "VBoxServiceUtils.h"
60
61
62/*******************************************************************************
63* Global Variables *
64*******************************************************************************/
65/** The vminfo interval (millseconds). */
66uint32_t g_VMInfoInterval = 0;
67/** The semaphore we're blocking on. */
68static RTSEMEVENTMULTI g_VMInfoEvent = NIL_RTSEMEVENTMULTI;
69/** The guest property service client ID. */
70static uint32_t g_VMInfoGuestPropSvcClientID = 0;
71/** Number of logged in users in OS. */
72static uint32_t g_cVMInfoLoggedInUsers = UINT32_MAX;
73
74
75/** @copydoc VBOXSERVICE::pfnPreInit */
76static DECLCALLBACK(int) VBoxServiceVMInfoPreInit(void)
77{
78 return VINF_SUCCESS;
79}
80
81
82/** @copydoc VBOXSERVICE::pfnOption */
83static DECLCALLBACK(int) VBoxServiceVMInfoOption(const char **ppszShort, int argc, char **argv, int *pi)
84{
85 int rc = -1;
86 if (ppszShort)
87 /* no short options */;
88 else if (!strcmp(argv[*pi], "--vminfo-interval"))
89 rc = VBoxServiceArgUInt32(argc, argv, "", pi,
90 &g_VMInfoInterval, 1, UINT32_MAX - 1);
91 return rc;
92}
93
94
95/** @copydoc VBOXSERVICE::pfnInit */
96static DECLCALLBACK(int) VBoxServiceVMInfoInit(void)
97{
98 /*
99 * If not specified, find the right interval default.
100 * Then create the event sem to block on.
101 */
102 if (!g_VMInfoInterval)
103 g_VMInfoInterval = g_DefaultInterval * 1000;
104 if (!g_VMInfoInterval)
105 g_VMInfoInterval = 10 * 1000;
106
107 int rc = RTSemEventMultiCreate(&g_VMInfoEvent);
108 AssertRCReturn(rc, rc);
109
110#ifdef RT_OS_WINDOWS
111 /* Get function pointers. */
112 HMODULE hKernel32 = LoadLibrary("kernel32");
113 if (hKernel32 != NULL)
114 {
115 g_pfnWTSGetActiveConsoleSessionId = (PFNWTSGETACTIVECONSOLESESSIONID)GetProcAddress(hKernel32, "WTSGetActiveConsoleSessionId");
116 FreeLibrary(hKernel32);
117 }
118#endif
119
120 rc = VbglR3GuestPropConnect(&g_VMInfoGuestPropSvcClientID);
121 if (RT_SUCCESS(rc))
122 VBoxServiceVerbose(3, "Property Service Client ID: %#x\n", g_VMInfoGuestPropSvcClientID);
123 else
124 {
125 VBoxServiceError("Failed to connect to the guest property service! Error: %Rrc\n", rc);
126 RTSemEventMultiDestroy(g_VMInfoEvent);
127 g_VMInfoEvent = NIL_RTSEMEVENTMULTI;
128 }
129
130 return rc;
131}
132
133
134/**
135 * Writes the properties that won't change while the service is running.
136 *
137 * Errors are ignored.
138 */
139static void VBoxServiceVMInfoWriteFixedProperties(void)
140{
141 /*
142 * First get OS information that won't change.
143 */
144 char szInfo[256];
145 int rc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szInfo, sizeof(szInfo));
146 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Product",
147 "%s", RT_FAILURE(rc) ? "" : szInfo);
148
149 rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szInfo, sizeof(szInfo));
150 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Release",
151 "%s", RT_FAILURE(rc) ? "" : szInfo);
152
153 rc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szInfo, sizeof(szInfo));
154 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Version",
155 "%s", RT_FAILURE(rc) ? "" : szInfo);
156
157 rc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szInfo, sizeof(szInfo));
158 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/ServicePack",
159 "%s", RT_FAILURE(rc) ? "" : szInfo);
160
161 /*
162 * Retrieve version information about Guest Additions and installed files (components).
163 */
164 char *pszAddVer;
165 char *pszAddRev;
166 rc = VbglR3GetAdditionsVersion(&pszAddVer, &pszAddRev);
167 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version",
168 "%s", RT_FAILURE(rc) ? "" : pszAddVer);
169 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision",
170 "%s", RT_FAILURE(rc) ? "" : pszAddRev);
171 if (RT_SUCCESS(rc))
172 {
173 RTStrFree(pszAddVer);
174 RTStrFree(pszAddRev);
175 }
176
177#ifdef RT_OS_WINDOWS
178 /*
179 * Do windows specific properties.
180 */
181 char *pszInstDir;
182 rc = VbglR3GetAdditionsInstallationPath(&pszInstDir);
183 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/InstallDir",
184 "%s", RT_FAILURE(rc) ? "" : pszInstDir);
185 if (RT_SUCCESS(rc))
186 RTStrFree(pszInstDir);
187
188 VBoxServiceWinGetComponentVersions(g_VMInfoGuestPropSvcClientID);
189#endif
190}
191
192
193/** @copydoc VBOXSERVICE::pfnWorker */
194DECLCALLBACK(int) VBoxServiceVMInfoWorker(bool volatile *pfShutdown)
195{
196 int rc = VINF_SUCCESS;
197
198 /*
199 * Tell the control thread that it can continue
200 * spawning services.
201 */
202 RTThreadUserSignal(RTThreadSelf());
203
204#ifdef RT_OS_WINDOWS
205 /* Required for network information (must be called per thread). */
206 WSADATA wsaData;
207 if (WSAStartup(MAKEWORD(2, 2), &wsaData))
208 VBoxServiceError("WSAStartup failed! Error: %Rrc\n", RTErrConvertFromWin32(WSAGetLastError()));
209#endif /* RT_OS_WINDOWS */
210
211 /*
212 * Write the fixed properties first.
213 */
214 VBoxServiceVMInfoWriteFixedProperties();
215
216 /*
217 * Now enter the loop retrieving runtime data continuously.
218 */
219 unsigned cErrors = 0;
220 for (;;)
221 {
222/** @todo r=bird: split this code up into functions!! */
223 /* Enumerate logged in users. */
224 uint32_t cUsersInList = 0;
225 char szUserList[4096] = {0};
226
227#ifdef RT_OS_WINDOWS
228# ifndef TARGET_NT4
229 PLUID paSessions = NULL;
230 ULONG cSession = 0;
231 NTSTATUS r = 0;
232
233 /* This function can report stale or orphaned interactive logon sessions
234 of already logged off users (especially in Windows 2000). */
235 r = ::LsaEnumerateLogonSessions(&cSession, &paSessions);
236 VBoxServiceVerbose(3, "Users: Found %ld users.\n", cSession);
237 if (r != STATUS_SUCCESS)
238 {
239 VBoxServiceError("LsaEnumerate failed %lu\n", LsaNtStatusToWinError(r));
240 return 1;
241 }
242
243 PVBOXSERVICEVMINFOPROC paProcs;
244 DWORD cProcs;
245 rc = VBoxServiceVMInfoWinProcessesEnumerate(&paProcs, &cProcs);
246 if (RT_SUCCESS(rc))
247 {
248 for (ULONG i = 0; i < cSession; i++)
249 {
250 VBOXSERVICEVMINFOUSER UserInfo;
251 if ( VBoxServiceVMInfoWinIsLoggedIn(&UserInfo, &paSessions[i])
252 && VBoxServiceVMInfoWinSessionHasProcesses(&paSessions[i], paProcs, cProcs))
253 {
254 if (cUsersInList > 0)
255 strcat(szUserList, ",");
256
257 cUsersInList++;
258
259 char *pszTemp;
260 int rc2 = RTUtf16ToUtf8(UserInfo.wszUser, &pszTemp);
261 if (RT_SUCCESS(rc2))
262 {
263 strcat(szUserList, pszTemp);
264 RTMemFree(pszTemp);
265 }
266 else
267 strcat(szUserList, "<string-convertion-error>");
268 }
269 }
270 VBoxServiceVMInfoWinProcessesFree(paProcs);
271 }
272
273 ::LsaFreeReturnBuffer(paSessions);
274# endif /* TARGET_NT4 */
275#elif defined(RT_OS_FREEBSD)
276 /** @todo FreeBSD: Port logged on user info retrival. */
277#elif defined(RT_OS_OS2)
278 /** @todo OS/2: Port logged on (LAN/local/whatever) user info retrival. */
279#else
280 rc = utmpname(UTMP_FILE);
281# ifdef RT_OS_SOLARIS
282 if (rc != 1)
283# else
284 if (rc != 0)
285# endif
286 {
287 VBoxServiceError("Could not set UTMP file! Error: %ld\n", errno);
288 }
289 setutent();
290 utmp *ut_user;
291 while ((ut_user = getutent()))
292 {
293 /* Make sure we don't add user names which are not
294 * part of type USER_PROCESS and don't add same users twice. */
295 if ( ut_user->ut_type == USER_PROCESS
296 && strstr(szUserList, ut_user->ut_user) == NULL)
297 {
298 /** @todo Do we really want to filter out double user names? (Same user logged in twice)
299 * bird: If we do, then we must add checks for buffer overflows here! */
300 /** @todo r=bird: strstr will filtering out users with similar names. For
301 * example: smith, smithson, joesmith and bobsmith */
302 if (cUsersInList > 0)
303 strcat(szUserList, ",");
304 strcat(szUserList, ut_user->ut_user);
305 cUsersInList++;
306 }
307 }
308 endutent();
309#endif /* !RT_OS_WINDOWS */
310
311 if (cUsersInList > 0)
312 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", "%s", szUserList);
313 else
314 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", NULL);
315 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsers", "%u", cUsersInList);
316 if ( g_cVMInfoLoggedInUsers != cUsersInList
317 || g_cVMInfoLoggedInUsers == UINT32_MAX)
318 {
319 /* Update this property ONLY if there is a real change from no users to
320 * users or vice versa. The only exception is that the initialization
321 * forces an update, but only once. This ensures consistent property
322 * settings even if the VM aborted previously. */
323 if (cUsersInList == 0)
324 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/NoLoggedInUsers", "true");
325 else if (g_cVMInfoLoggedInUsers == 0)
326 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/NoLoggedInUsers", "false");
327 }
328 g_cVMInfoLoggedInUsers = cUsersInList;
329
330 /*
331 * Get network configuration.
332 */
333 /** @todo Throw this code into a separate function/module? */
334 int nNumInterfaces = 0;
335#ifdef RT_OS_WINDOWS
336 SOCKET sd = WSASocket(AF_INET, SOCK_DGRAM, 0, 0, 0, 0);
337 if (sd == SOCKET_ERROR) /* Socket invalid. */
338 {
339 VBoxServiceError("Failed to get a socket: Error %d\n", WSAGetLastError());
340 return -1;
341 }
342
343 INTERFACE_INFO InterfaceList[20] = {0};
344 unsigned long nBytesReturned = 0;
345 if (WSAIoctl(sd,
346 SIO_GET_INTERFACE_LIST,
347 0,
348 0,
349 &InterfaceList,
350 sizeof(InterfaceList),
351 &nBytesReturned,
352 0,
353 0) == SOCKET_ERROR)
354 {
355 VBoxServiceError("Failed to WSAIoctl() on socket: Error: %d\n", WSAGetLastError());
356 return -1;
357 }
358 nNumInterfaces = nBytesReturned / sizeof(INTERFACE_INFO);
359#else
360 int sd = socket(AF_INET, SOCK_DGRAM, 0);
361 if (sd < 0) /* Socket invalid. */
362 {
363 VBoxServiceError("Failed to get a socket: Error %d\n", errno);
364 return -1;
365 }
366
367 ifconf ifcfg;
368 char buffer[1024] = {0};
369 ifcfg.ifc_len = sizeof(buffer);
370 ifcfg.ifc_buf = buffer;
371 if (ioctl(sd, SIOCGIFCONF, &ifcfg) < 0)
372 {
373 VBoxServiceError("Failed to ioctl(SIOCGIFCONF) on socket: Error %d\n", errno);
374 return -1;
375 }
376
377 ifreq* ifrequest = ifcfg.ifc_req;
378 ifreq *ifreqitem = NULL;
379 nNumInterfaces = ifcfg.ifc_len / sizeof(ifreq);
380#endif
381 char szPropPath [FILENAME_MAX];
382 int iCurIface = 0;
383
384 /*
385 * This property is a beacon which is _always_ written, even if the network configuration
386 * does not change. If this property is missing, the host assumes that all other GuestInfo
387 * properties are no longer valid.
388 */
389 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/Net/Count", "%d",
390 nNumInterfaces > 1 ? nNumInterfaces-1 : 0);
391
392 /** @todo Use GetAdaptersInfo() and GetAdapterAddresses (IPv4 + IPv6) for more information. */
393 for (int i = 0; i < nNumInterfaces; ++i)
394 {
395 sockaddr_in *pAddress;
396 u_long nFlags = 0;
397#ifdef RT_OS_WINDOWS
398 if (InterfaceList[i].iiFlags & IFF_LOOPBACK) /* Skip loopback device. */
399 continue;
400 nFlags = InterfaceList[i].iiFlags;
401 pAddress = (sockaddr_in *)&(InterfaceList[i].iiAddress);
402#else
403 if (ioctl(sd, SIOCGIFFLAGS, &ifrequest[i]) < 0)
404 {
405 VBoxServiceError("Failed to ioctl(SIOCGIFFLAGS) on socket: Error %d\n", errno);
406 return -1;
407 }
408 if (ifrequest[i].ifr_flags & IFF_LOOPBACK) /* Skip loopback device. */
409 continue;
410 nFlags = ifrequest[i].ifr_flags;
411 pAddress = ((sockaddr_in *)&ifrequest[i].ifr_addr);
412#endif
413 Assert(pAddress);
414 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%d/V4/IP", iCurIface);
415 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
416
417#ifdef RT_OS_WINDOWS
418 pAddress = (sockaddr_in *) & (InterfaceList[i].iiBroadcastAddress);
419#else
420 if (ioctl(sd, SIOCGIFBRDADDR, &ifrequest[i]) < 0)
421 {
422 VBoxServiceError("Failed to ioctl(SIOCGIFBRDADDR) on socket: Error %d\n", errno);
423 return -1;
424 }
425 pAddress = (sockaddr_in *)&ifrequest[i].ifr_broadaddr;
426#endif
427 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%d/V4/Broadcast", iCurIface);
428 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
429
430#ifdef RT_OS_WINDOWS
431 pAddress = (sockaddr_in *)&(InterfaceList[i].iiNetmask);
432#else
433 if (ioctl(sd, SIOCGIFNETMASK, &ifrequest[i]) < 0)
434 {
435 VBoxServiceError("Failed to ioctl(SIOCGIFBRDADDR) on socket: Error %d\n", errno);
436 return -1;
437 }
438 #if defined(RT_OS_FREEBSD) || defined(RT_OS_OS2) || defined(RT_OS_SOLARIS)
439 pAddress = (sockaddr_in *)&ifrequest[i].ifr_addr;
440 #else
441 pAddress = (sockaddr_in *)&ifrequest[i].ifr_netmask;
442 #endif
443
444#endif
445 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%d/V4/Netmask", iCurIface);
446 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
447
448 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%d/Status", iCurIface);
449 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, szPropPath,
450 nFlags & IFF_UP ? "Up" : "Down");
451
452 iCurIface++;
453 }
454 if (sd >= 0)
455#ifdef RT_OS_WINDOWS
456 closesocket(sd);
457#else
458 close(sd);
459#endif
460
461 /*
462 * Block for a while.
463 *
464 * The event semaphore takes care of ignoring interruptions and it
465 * allows us to implement service wakeup later.
466 */
467 if (*pfShutdown)
468 break;
469 int rc2 = RTSemEventMultiWait(g_VMInfoEvent, g_VMInfoInterval);
470 if (*pfShutdown)
471 break;
472 if (rc2 != VERR_TIMEOUT && RT_FAILURE(rc2))
473 {
474 VBoxServiceError("RTSemEventMultiWait failed; rc2=%Rrc\n", rc2);
475 rc = rc2;
476 break;
477 }
478 }
479
480#ifdef RT_OS_WINDOWS
481 WSACleanup();
482#endif
483
484 return rc;
485}
486
487
488/** @copydoc VBOXSERVICE::pfnStop */
489static DECLCALLBACK(void) VBoxServiceVMInfoStop(void)
490{
491 RTSemEventMultiSignal(g_VMInfoEvent);
492}
493
494
495/** @copydoc VBOXSERVICE::pfnTerm */
496static DECLCALLBACK(void) VBoxServiceVMInfoTerm(void)
497{
498 int rc;
499
500 if (g_VMInfoEvent != NIL_RTSEMEVENTMULTI)
501 {
502 /** @todo temporary solution: Zap all values which are not valid
503 * anymore when VM goes down (reboot/shutdown ). Needs to
504 * be replaced with "temporary properties" later.
505 *
506 * One idea is to introduce a (HGCM-)session guest property
507 * flag meaning that a guest property is only valid as long
508 * as the HGCM session isn't closed (e.g. guest application
509 * terminates).
510 */
511 rc = VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", NULL);
512 rc = VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsers", "%d", 0);
513 if (g_cVMInfoLoggedInUsers > 0)
514 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/NoLoggedInUsers", "true");
515
516 const char *apszPat[1] = { "/VirtualBox/GuestInfo/Net/*" };
517 rc = VbglR3GuestPropDelSet(g_VMInfoGuestPropSvcClientID, &apszPat[0], RT_ELEMENTS(apszPat));
518 rc = VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/Net/Count", "%d", 0);
519
520 /* Disconnect from guest properties service. */
521 rc = VbglR3GuestPropDisconnect(g_VMInfoGuestPropSvcClientID);
522 if (RT_FAILURE(rc))
523 VBoxServiceError("Failed to disconnect from guest property service! Error: %Rrc\n", rc);
524 g_VMInfoGuestPropSvcClientID = 0;
525
526
527 RTSemEventMultiDestroy(g_VMInfoEvent);
528 g_VMInfoEvent = NIL_RTSEMEVENTMULTI;
529 }
530}
531
532
533/**
534 * The 'vminfo' service description.
535 */
536VBOXSERVICE g_VMInfo =
537{
538 /* pszName. */
539 "vminfo",
540 /* pszDescription. */
541 "Virtual Machine Information",
542 /* pszUsage. */
543 "[--vminfo-interval <ms>]"
544 ,
545 /* pszOptions. */
546 " --vminfo-interval Specifies the interval at which to retrieve the\n"
547 " VM information. The default is 10000 ms.\n"
548 ,
549 /* methods */
550 VBoxServiceVMInfoPreInit,
551 VBoxServiceVMInfoOption,
552 VBoxServiceVMInfoInit,
553 VBoxServiceVMInfoWorker,
554 VBoxServiceVMInfoStop,
555 VBoxServiceVMInfoTerm
556};
557
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette