Changeset 6790

Show
Ignore:
Timestamp:
01/25/11 13:52:35 (2 years ago)
Author:
jow
Message:

luci-0.10: merge r6789

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/branches/luci-0.10/libs/sys/luasrc/sys.lua

    r6758 r6790  
    605605function user.setpasswd(username, password) 
    606606    if password then 
    607         password = password:gsub("'", "") 
     607        password = password:gsub("'", [['"'"']]) 
    608608    end 
    609609 
    610610    if username then 
    611         username = username:gsub("'", "") 
    612     end 
    613  
    614     local cmd = "(echo '"..password.."';sleep 1;echo '"..password.."')|" 
    615     cmd = cmd .. "passwd '"..username.."' >/dev/null 2>&1" 
    616     return os.execute(cmd) 
     611        username = username:gsub("'", [['"'"']]) 
     612    end 
     613 
     614    return os.execute( 
     615        "(echo '" .. password .. "'; sleep 1; echo '" .. password .. "') | " .. 
     616        "passwd '" .. username .. "' >/dev/null 2>&1" 
     617    ) 
    617618end 
    618619