ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Spectre2/Share.cpp
(Generate patch)

Comparing Spectre2/Share.cpp (file contents):
Revision 431 by douglas, 2005-03-26T22:35:26-08:00 vs.
Revision 441 by douglas, 2005-04-12T15:42:24-07:00

# Line 77 | Line 77 | bool Share::mountable() const
77          {
78                  struct stat share;
79  
80 <                // XXX: _unsynchronized
81 < //              _synchronized (Daemon::smbcLock)
82 <                        CheckError(::smbc_stat(getUri().NullTerminate(), &share));
80 >                CheckError(::smbc_stat(getUri().NullTerminate(), &share));
81  
82                  return true;
83          }
# Line 94 | Line 92 | extern "C"
92          void authenticate(const char* host, const char* name, char* work, int workSize, char* owner, int ownerSize, char* password, int passwordSize)
93          {
94                  const Share& share(*Daemon::shares.Find(Share(host, name)));
95 +                const ext::Buffer& owner_(share.getOwner().GetData());
96  
97 <                if (!share.getOwner().IsEmpty())
98 <                        ::snprintf(owner, ownerSize, "%s", share.getOwner().NullTerminate());
97 >                if (!owner_.IsEmpty())
98 >                {
99 >                        _foreach (const ext::Buffer, atom, owner_)
100 >                                owner[_index] = *atom;
101 >
102 >                        owner[owner_.GetSize() < size_t(ownerSize) ? owner_.GetSize() : ownerSize - 1] = '\0';
103 >                }
104                  
105 <                ::snprintf(password, passwordSize, "%s", share.getPassword().NullTerminate());
105 >                ext::Buffer password_(share.getPassword().GetData());
106 >
107 >                _foreach (ext::Buffer, atom, password_)
108 >                        password[_index] = *atom;
109 >
110 >                password[password_.GetSize() < size_t(passwordSize) ? password_.GetSize() : passwordSize - 1] = '\0';
111          }
112   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines