~zulcss/ubuntu/lucid/likewise-open/likewise-open-sru

« back to all changes in this revision

Viewing changes to samba/source/lib/util_nscd.c

  • Committer: Bazaar Package Importer
  • Author(s): Rick Clark
  • Date: 2008-08-27 08:56:20 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080827085620-5q0f58b9qtog9myq
Tags: 4.1.0.2956-0ubuntu1
* missing-likewise-logo.diff: removed
* fixed copyright notice
* updated Standards-Version to 3.8.0
* removed path from command in prerm
* removed stop in S runlevel

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
static void smb_nscd_flush_cache(const char *service)
23
23
{
24
 
#ifdef HAVE_NSCD_FLUSH_CACHE
 
24
#if defined(HAVE_NSCD_FLUSH_CACHE)
25
25
        if (!nscd_flush_cache(service)) {
26
26
                DEBUG(10,("failed to flush nscd cache for '%s' service: %s. "
27
27
                          "Is nscd running?\n",
28
28
                          service, strerror(errno)));
29
29
        }
 
30
#elif defined(DARWINOS)
 
31
        /* Darwin has a simple way to purge the Directory Service
 
32
           cache, but no API for it.  So we have to run "dscacheutil 
 
33
           -flushcache" */
 
34
        {
 
35
                int ret;
 
36
                SMB_STRUCT_STAT sbuf;
 
37
 
 
38
                if (sys_stat("/usr/sbin/lookupd", &sbuf) == 0) {
 
39
                  ret = smbrun("/usr/sbin/lookupd -flushcache", NULL);
 
40
                  if (ret != 0 ) {
 
41
                    DEBUG(2,("smb_nscd_flush_cache: Failed to flush "
 
42
                             "Apple Directory Service cache (%s)\n",
 
43
                             strerror(errno)));                 
 
44
                  }
 
45
                } else if (sys_stat("/usr/bin/dscacheutil", &sbuf) == 0) {
 
46
                  ret = smbrun("/usr/bin/dscacheutil -flushcache", NULL);
 
47
                  if (ret != 0 ) {
 
48
                    DEBUG(2,("smb_nscd_flush_cache: Failed to flush "
 
49
                             "Apple Directory Service cache (%s)\n",
 
50
                             strerror(errno)));                 
 
51
                  }
 
52
                } else {
 
53
                  DEBUG(1,("smb_nscd_flush_cache: Failed to find lookupd or dscacheutil tools.\n"));
 
54
                }
 
55
 
 
56
                return;         
 
57
        }       
 
58
        
30
59
#endif
31
60
}
32
61