static std::string lpath;
 static struct stat pathstat;
 int level;
+char buffer[PATH_MAX];
+char *lnk;
 
 
 static void wrapCall(int retval, std::string msg) throw(dmlite::DmException) {
                        catalog->utime(nsPrefix + path, &utimbuf);
                        catalog->setMode(nsPrefix + path, dirmode);
                }
+       } else if (S_ISLNK(pathstat.st_mode)) {
+               memset(buffer, 0, sizeof buffer);
+               wrapCall(readlink(lpath.c_str(), buffer, sizeof(buffer) - 1), "could not read symlink '" + lpath + "'");
+               if (strncmp(buffer, localPrefix.c_str(), localPrefix.size()) == 0) {
+                       lnk = buffer + localPrefix.size();
+                       catalog->symlink(nsPrefix + lnk, nsPrefix + path);
+               } else {
+                       lnk = buffer;
+                       catalog->symlink(lnk, nsPrefix + path);
+               }
+               // XXX: plugin shouldn't follow symlinks probably???
+               //utimbuf.actime = pathstat.st_atime;
+               //utimbuf.modtime = pathstat.st_mtime;
+               //catalog->utime(nsPrefix + path, &utimbuf);
+               //catalog->setMode(nsPrefix + path, pathstat.st_mode);
        }
 }