* limitations under the License
*/
+#include <dlfcn.h>
#include <syslog.h>
#include <security/pam_ext.h>
#include <security/pam_modules.h>
#include <klay/xml/parser.h>
#include <klay/xml/document.h>
+#define KRATE_UID_MIN 60001
+#define KRATE_UID_MAX 60100
+
#define LAZYMOUNT_EXTERN extern
+#define LAZYMOUNT_LIB "/usr/lib/liblazymount.so.0"
std::string buildKrateManifestPath(const std::string& name)
{
return static_cast<const char*>(retItem);
}
+static int wait_condition(void)
+{
+ int r;
+ void *h;
+
+ int (*wait_mount_user)(void);
+
+ r = access(LAZYMOUNT_LIB,F_OK);
+ if (r < 0){
+ fprintf(stderr, "cannot find lazymount module - No support lazymount\n");
+ return 0;
+ }
+
+ h = dlopen(LAZYMOUNT_LIB, RTLD_LAZY);
+ if (!h) {
+ fprintf(stderr, "lazymount module dlopen error\n");
+ return -1;
+ }
+
+ do{
+ wait_mount_user = (int (*)())dlsym(h,"wait_mount_user");
+ if (!wait_mount_user) {
+ fprintf(stderr, "dlsym wait_mount_user error\n");
+ dlclose(h);
+ return -1;
+ }
+ } while (0);
+
+ r = wait_mount_user();
+ if (r < 0) {
+ fprintf(stderr, "wait_mout_user failed\n");
+ dlclose(h);
+ return r;
+ }
+
+ dlclose(h);
+ return 0;
+}
+
extern "C" {
LAZYMOUNT_EXTERN __attribute__((visibility("default")))
int container_preprocess(char* id) {
builder.unshareNamespace();
};
createSession(user, sessionBuilder);
+
+ if (user.getUid() >= KRATE_UID_MIN && user.getUid() <= KRATE_UID_MAX ) {
+ wait_condition();
+ }
} catch (runtime::Exception& e) {
std::cerr << "krate error : " << e.what() <<std::endl << std::flush;
return -1;