diff --git a/ChangeLog b/ChangeLog index 9c421a2..15e0b27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,47 @@ + +Sun Apr 13 2008 Valient Gough + * switch to V6 XML config format using boost serialization module + * add better boost autoconf detection + +Fri Apr 11 2008 Valient Gough + * bump version to 1.4.2 + * add zero-block pass-through option, enabling allow-holes code + * add error checking to setfsuid/setfsgid calls + +Tue Mar 25 2008 Valient Gough + * check for additional arguments to xattr functions + +Sat Mar 22 2008 Valient Gough + * remove ulockmgr support, since it isn't needed + +Sun Jan 27 2008 Valient Gough + * fix compile problem if ulockmgr isn't available + +Tue Jan 22 2008 Valient Gough + * ensure paths end in '/'. fixes launchpad bug 184905 + +Wed Jan 16 2008 Valient Gough + * no arg required for stdinpass, reported by Scott Hendrickson + +Tue Jan 15 2008 Valient Gough + * bump version to 1.4.1.1 + * dump shared library version + * fix directory rename issue (launchpad bug #183358) + +Sat Jan 12 2008 Valient Gough + * more minor changes to password lengths. Accept up to 512 bytes for + text password + * update man docs + +Fri Jan 11 2008 Valient Gough + * bump version to 1.4.1 + * make max-password lengths consistent. Fix newline quashing, bug + report by mpb + +Tue Jan 8 2008 Valient Gough + * determine symbolic link size in getAttr call + * remove old HAVE_SSL wrappers on MemoryPool + Sun Jan 6 22:26:25 PST 2008 Valient Gough * fix SSL test to keep -lssl at end of compile line, found by Kenny Simpson diff --git a/encfs/encfs.cpp b/encfs/encfs.cpp index bd16f6f..20c2b55 100644 --- a/encfs/encfs.cpp +++ b/encfs/encfs.cpp @@ -167,13 +167,17 @@ int _do_getattr(FileNode *fnode, struct stat *stbuf) scoped_array buf(new char[stbuf->st_size+1]); res = ::readlink( fnode->cipherName(), buf.get(), stbuf->st_size ); - // other functions expect c-strings to be null-terminated, which - // readlink doesn't provide - buf[res] = '\0'; + if(res >= 0) + { + // other functions expect c-strings to be null-terminated, which + // readlink doesn't provide + buf[res] = '\0'; - stbuf->st_size = FSRoot->plainPath( buf.get() ).length(); + stbuf->st_size = FSRoot->plainPath( buf.get() ).length(); - res = ESUCCESS; + res = ESUCCESS; + } else + res = -errno; } } diff --git a/encfs/encfsctl.cpp b/encfs/encfsctl.cpp index 8dba8c3..fe83e2b 100644 --- a/encfs/encfsctl.cpp +++ b/encfs/encfsctl.cpp @@ -42,6 +42,8 @@ #include "i18n.h" +#include + #ifdef HAVE_SSL #define NO_DES #include @@ -50,6 +52,7 @@ using namespace rlog; using namespace std; using namespace gnu; +using namespace boost; static int showInfo( int argc, char **argv ); @@ -333,7 +336,7 @@ int processContents( const shared_ptr &rootInfo, O_RDONLY, &errCode ); if(!node) { - cerr << "unable to open " << path << endl; + cerr << "unable to open " << path << "\n"; return errCode; } else { @@ -379,6 +382,31 @@ static int cmd_cat( int argc, char **argv ) return errCode; } +static int copyLink(const struct stat &stBuf, + const shared_ptr &rootInfo, + const string &cpath, const string &destName ) +{ + scoped_array buf(new char[stBuf.st_size+1]); + int res = ::readlink( cpath.c_str(), buf.get(), stBuf.st_size ); + if(res == -1) + { + cerr << "unable to readlink of " << cpath << "\n"; + return EXIT_FAILURE; + } + + buf[res] = '\0'; + string decodedLink = rootInfo->root->plainPath(buf.get()); + + res = ::symlink( decodedLink.c_str(), destName.c_str() ); + if(res == -1) + { + cerr << "unable to create symlink for " << cpath + << " to " << decodedLink << "\n"; + } + + return EXIT_SUCCESS; +} + static int copyContents(const shared_ptr &rootInfo, const char* encfsName, const char* targetName) { @@ -387,7 +415,7 @@ static int copyContents(const shared_ptr &rootInfo, if(!node) { - cerr << "unable to open " << encfsName << endl; + cerr << "unable to open " << encfsName << "\n"; return EXIT_FAILURE; } else { @@ -403,7 +431,7 @@ static int copyContents(const shared_ptr &rootInfo, if(readlink (d.c_str(), linkContents, PATH_MAX + 1) <= 0) { - cerr << "unable to read link " << encfsName << endl; + cerr << "unable to read link " << encfsName << "\n"; return EXIT_FAILURE; } symlink(rootInfo->root->plainPath(linkContents).c_str(), @@ -461,17 +489,29 @@ static int traverseDirs(const shared_ptr &rootInfo, string cpath = rootInfo->root->cipherPath(plainPath.c_str()); string destName = destDir + name; - if(isDirectory(cpath.c_str())) - traverseDirs(rootInfo, (plainPath + '/').c_str(), - destName + '/'); - else + int r = EXIT_SUCCESS; + struct stat stBuf; + if( !lstat( cpath.c_str(), &stBuf )) { - int r = copyContents(rootInfo, plainPath.c_str(), - destName.c_str()); - - if(r != EXIT_SUCCESS) - return r; + if( S_ISDIR( stBuf.st_mode ) ) + { + traverseDirs(rootInfo, (plainPath + '/').c_str(), + destName + '/'); + } else if( S_ISLNK( stBuf.st_mode )) + { + r = copyLink( stBuf, rootInfo, cpath, destName ); + } else + { + r = copyContents(rootInfo, plainPath.c_str(), + destName.c_str()); + } + } else + { + r = EXIT_FAILURE; } + + if(r != EXIT_SUCCESS) + return r; } } } @@ -707,7 +747,7 @@ int main(int argc, char **argv) if(commands[offset].name == 0) { - cerr << autosprintf(_("invalid command: \"%s\""), argv[1]) << endl; + cerr << autosprintf(_("invalid command: \"%s\""), argv[1]) << "\n"; } else { if((argc-2 < commands[offset].minOptions) || @@ -715,7 +755,7 @@ int main(int argc, char **argv) { cerr << autosprintf( _("Incorrect number of arguments for command \"%s\""), - argv[1]) << endl; + argv[1]) << "\n"; } else return (*commands[offset].func)( argc-1, argv+1 ); }