Changeset: 983c22fa2bf9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=983c22fa2bf9
Modified Files:
        monetdb5/mal/mal_authorize.c
        monetdb5/mal/mal_authorize.h
Branch: remote_auth
Log Message:

Initial implementation of delete remote table credentials function


diffs (48 lines):

diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c
--- a/monetdb5/mal/mal_authorize.c
+++ b/monetdb5/mal/mal_authorize.c
@@ -1084,3 +1084,33 @@ AUTHaddRemoteTableCredentials(const char
        }
        return MAL_SUCCEED;
 }
+
+str
+AUTHdeleteRemoteTableCredentials(const char *local_table)
+{
+       BUN p;
+       oid id;
+
+       assert(rt_key);
+       assert(rt_uri);
+       assert(rt_remoteuser);
+       assert(rt_hashedpwd);
+
+       /* pre-condition check */
+       if (local_table == NULL || strNil(local_table))
+               throw(ILLARG, "deleteRemoteTableCredentials", "local table 
cannot be nil");
+
+       /* ensure that the username exists */
+       p = lookupRemoteTableKey(local_table);
+       if (p == BUN_NONE)
+               throw(MAL, "deleteRemoteTableCredentials", "no such table: 
'%s'", local_table);
+       id = p;
+
+       /* now, we got the oid, start removing the related tuples */
+       if (BUNappend(rt_deleted, &id, TRUE) != GDK_SUCCEED)
+               throw(MAL, "deleteRemoteTableCredentials", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+
+       /* make the stuff persistent */
+       AUTHcommit();
+       return(MAL_SUCCEED);
+}
diff --git a/monetdb5/mal/mal_authorize.h b/monetdb5/mal/mal_authorize.h
--- a/monetdb5/mal/mal_authorize.h
+++ b/monetdb5/mal/mal_authorize.h
@@ -29,6 +29,7 @@ mal_export str AUTHinitTables(const char
 
 mal_export str AUTHaddRemoteTableCredentials(const char *local_table, const 
char *localuser, const char *uri, const char *remoteuser, const char *pass, 
bool pw_encrypted);
 mal_export str AUTHgetRemoteTableCredentials(const char *local_table, str 
*uri, str *username, str *password);
+mal_export str AUTHdeleteRemoteTableCredentials(const char *local_table);
 
 /*
  * Authorisation is based on a password.  The passwords are stored hashed
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to