|
|
@@ -261,9 +261,9 @@ static int l_iotauth_onenet(lua_State *L) {
|
|
|
|
|
|
static void iotda_token(const char* device_id,const char* device_secret,long long cur_timestamp,int ins_timestamp,char* client_id,const char* password){
|
|
|
char hmac[65] = {0};
|
|
|
- char timestamp[13] = {0};
|
|
|
+ char timestamp[11] = {0};
|
|
|
struct tm *timeinfo = localtime( &cur_timestamp );
|
|
|
- if(snprintf_(timestamp, 12, "%04d%02d%02d%02d", (timeinfo->tm_year)+1900,timeinfo->tm_mon+1,timeinfo->tm_mday,timeinfo->tm_hour)<0){
|
|
|
+ if(snprintf_(timestamp, 11, "%04d%02d%02d%02d", (timeinfo->tm_year)+1900,timeinfo->tm_mon+1,timeinfo->tm_mday,timeinfo->tm_hour)<0){
|
|
|
return;
|
|
|
}
|
|
|
snprintf_(client_id, CLIENT_ID_LEN, "%s_0_%d_%s", device_id,ins_timestamp,timestamp);
|
|
|
@@ -288,7 +288,7 @@ static int l_iotauth_iotda(lua_State *L) {
|
|
|
char client_id[CLIENT_ID_LEN] = {0};
|
|
|
char password[PASSWORD_LEN] = {0};
|
|
|
size_t len = 0;
|
|
|
- long long cur_timestamp = 0;
|
|
|
+ long long cur_timestamp = 32472115200;
|
|
|
int ins_timestamp = 0;
|
|
|
const char* device_id = luaL_checklstring(L, 1, &len);
|
|
|
const char* device_secret = luaL_checklstring(L, 2, &len);
|